/usr/src/gcc-4.9/debian/patches/testsuite-hardening-updates.diff is in gcc-4.9-source 4.9.3-13ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | # DP: Fix some gcc and g++ testcases to pass with hardening defaults
---
src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c | 2 +-
src/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c | 2 +-
src/gcc/testsuite/g++.dg/asan/asan_test.C | 2 +-
src/gcc/testsuite/g++.dg/asan/interception-malloc-test-1.C | 2 +-
src/gcc/testsuite/g++.dg/fstack-protector-strong.C | 2 +-
src/gcc/testsuite/gcc.c-torture/execute/memset-1.c | 1 -
src/gcc/testsuite/gcc.c-torture/execute/memset-1.x | 5 +++++
src/gcc/testsuite/gcc.dg/fstack-protector-strong.c | 2 +-
src/gcc/testsuite/gcc.dg/stack-usage-1.c | 2 +-
src/gcc/testsuite/gcc.dg/superblock.c | 2 +-
src/gcc/testsuite/gcc.target/i386/sw-1.c | 2 +-
11 files changed, 14 insertions(+), 10 deletions(-)
Index: b/src/gcc/testsuite/g++.dg/asan/asan_test.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/asan/asan_test.C
+++ b/src/gcc/testsuite/g++.dg/asan/asan_test.C
@@ -2,7 +2,7 @@
// { dg-skip-if "" { *-*-* } { "*" } { "-O2" } }
// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
// { dg-additional-sources "asan_globals_test-wrapper.cc" }
-// { dg-options "-fsanitize=address -fno-builtin -Wall -Wno-format -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DASAN_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
+// { dg-options "-fsanitize=address -fno-builtin -Wall -Wno-format -Wno-unused-result -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DASAN_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
// { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } }
// { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } }
// { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } }
Index: b/src/gcc/testsuite/g++.dg/asan/interception-malloc-test-1.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/asan/interception-malloc-test-1.C
+++ b/src/gcc/testsuite/g++.dg/asan/interception-malloc-test-1.C
@@ -1,7 +1,7 @@
// ASan interceptor can be accessed with __interceptor_ prefix.
// { dg-do run { target *-*-linux* } }
-// { dg-options "-fno-builtin-free" }
+// { dg-options "-fno-builtin-free -Wno-unused-result" }
// { dg-additional-options "-D__NO_INLINE__" { target { *-*-linux-gnu } } }
// { dg-shouldfail "asan" }
Index: b/src/gcc/testsuite/gcc.c-torture/execute/memset-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.c-torture/execute/memset-1.c
+++ b/src/gcc/testsuite/gcc.c-torture/execute/memset-1.c
@@ -1,3 +1,5 @@
+/* { dg-prune-output ".*warning: memset used with constant zero length parameter.*" } */
+
/* Copyright (C) 2002 Free Software Foundation.
Test memset with various combinations of pointer alignments and lengths to
Index: b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
===================================================================
--- a/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
+++ b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fno-builtin-malloc -fno-builtin-strncpy" } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-strncpy -U_FORTIFY_SOURCE" } */
/* { dg-shouldfail "asan" } */
#include <string.h>
Index: b/src/gcc/testsuite/gcc.dg/superblock.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/superblock.c
+++ b/src/gcc/testsuite/gcc.dg/superblock.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro" } */
+/* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro -fno-stack-protector" } */
/* { dg-require-effective-target scheduling } */
typedef int aligned __attribute__ ((aligned (64)));
Index: b/src/gcc/testsuite/gcc.dg/stack-usage-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ b/src/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fstack-usage" } */
+/* { dg-options "-fstack-usage -fno-stack-protector" } */
/* This is aimed at testing basic support for -fstack-usage in the back-ends.
See the SPARC back-end for example (grep flag_stack_usage_info in sparc.c).
Index: b/src/gcc/testsuite/gcc.target/i386/sw-1.c
===================================================================
--- a/src/gcc/testsuite/gcc.target/i386/sw-1.c
+++ b/src/gcc/testsuite/gcc.target/i386/sw-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mtune=generic -fshrink-wrap -fdump-rtl-pro_and_epilogue" } */
+/* { dg-options "-O2 -mtune=generic -fshrink-wrap -fdump-rtl-pro_and_epilogue -fno-stack-protector" } */
/* { dg-skip-if "No shrink-wrapping preformed" { x86_64-*-mingw* } { "*" } { "" } } */
#include <string.h>
Index: b/src/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
===================================================================
--- a/src/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
+++ b/src/gcc/testsuite/c-c++-common/cilk-plus/CK/spawnee_inline.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */
-/* { dg-options "-fcilkplus -w" } */
+/* { dg-options "-fcilkplus -w -U_FORTIFY_SOURCE" } */
/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
#include <stdio.h>
Index: b/src/gcc/testsuite/gcc.dg/fstack-protector-strong.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/fstack-protector-strong.c
+++ b/src/gcc/testsuite/gcc.dg/fstack-protector-strong.c
@@ -1,7 +1,7 @@
/* Test that stack protection is done on chosen functions. */
/* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */
-/* { dg-options "-O2 -fstack-protector-strong" } */
+/* { dg-options "-O2 -fstack-protector-strong -U_FORTIFY_SOURCE" } */
#include<string.h>
Index: b/src/gcc/testsuite/g++.dg/fstack-protector-strong.C
===================================================================
--- a/src/gcc/testsuite/g++.dg/fstack-protector-strong.C
+++ b/src/gcc/testsuite/g++.dg/fstack-protector-strong.C
@@ -1,7 +1,7 @@
/* Test that stack protection is done on chosen functions. */
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O2 -fstack-protector-strong" } */
+/* { dg-options "-O2 -fstack-protector-strong -U_FORTIFY_SOURCE" } */
class A
{
Index: b/src/gcc/testsuite/gcc.c-torture/execute/memset-1.x
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/gcc.c-torture/execute/memset-1.x
@@ -0,0 +1,5 @@
+# Implement "/* { dg-options "-U_FORITFY_SOURCE" } */", due to
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20567
+
+set additional_flags "-U_FORTIFY_SOURCE"
+return 0
|