aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-01-28 15:28:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-01-28 15:28:16 +0100
commite63f158158a16d77dd34492534e13c1a5ca27943 (patch)
treec660b79e14ed44cde2fb526db9c98b7851ccd431 /gcc
parentaa710d25957e36a089a03929d6f82fa88371e32d (diff)
downloadgcc-e63f158158a16d77dd34492534e13c1a5ca27943.zip
gcc-e63f158158a16d77dd34492534e13c1a5ca27943.tar.gz
gcc-e63f158158a16d77dd34492534e13c1a5ca27943.tar.bz2
re PR testsuite/56053 (FAIL: c-c++-common/asan/(global|stack)-overflow-1.c)
PR testsuite/56053 * c-c++-common/asan/heap-overflow-1.c: Don't include stdlib.h and string.h. Provide memset, malloc and free prototypes, adjust line numbers in dg-output. * c-c++-common/asan/stack-overflow-1.c: Don't include string.h. Provide memset prototype and adjust line numbers in dg-output. * c-c++-common/asan/global-overflow-1.c: Likewise. From-SVN: r195505
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/c-c++-common/asan/global-overflow-1.c9
-rw-r--r--gcc/testsuite/c-c++-common/asan/heap-overflow-1.c18
-rw-r--r--gcc/testsuite/c-c++-common/asan/stack-overflow-1.c10
4 files changed, 36 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a40759c..b9d16f23 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2013-01-28 Jakub Jelinek <jakub@redhat.com>
+ PR testsuite/56053
+ * c-c++-common/asan/heap-overflow-1.c: Don't include stdlib.h and
+ string.h. Provide memset, malloc and free prototypes, adjust line
+ numbers in dg-output.
+ * c-c++-common/asan/stack-overflow-1.c: Don't include string.h.
+ Provide memset prototype and adjust line numbers in dg-output.
+ * c-c++-common/asan/global-overflow-1.c: Likewise.
+
PR tree-optimization/56094
* gcc.dg/pr56094.c: New test.
diff --git a/gcc/testsuite/c-c++-common/asan/global-overflow-1.c b/gcc/testsuite/c-c++-common/asan/global-overflow-1.c
index b70c300..66e9147 100644
--- a/gcc/testsuite/c-c++-common/asan/global-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/asan/global-overflow-1.c
@@ -2,7 +2,12 @@
/* { dg-options "-fno-builtin-memset" } */
/* { dg-shouldfail "asan" } */
-#include <string.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, __SIZE_TYPE__);
+
volatile int ten = 10;
int main() {
@@ -18,6 +23,6 @@ int main() {
}
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
-/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*global-overflow-1.c:15|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r).*" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*global-overflow-1.c:20|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r).*" } */
/* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of global variable" } */
/* { dg-output ".*YYY\[^\n\r]* of size 10\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c b/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
index 7e9f54b..43d47a3 100644
--- a/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
@@ -2,8 +2,18 @@
/* { dg-options "-fno-builtin-malloc -fno-builtin-free -fno-builtin-memset" } */
/* { dg-shouldfail "asan" } */
-#include <stdlib.h>
-#include <string.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *memset (void *, int, __SIZE_TYPE__);
+void *malloc (__SIZE_TYPE__);
+void free (void *);
+
+#ifdef __cplusplus
+}
+#endif
+
volatile int ten = 10;
int main(int argc, char **argv) {
char *x = (char*)malloc(10);
@@ -14,8 +24,8 @@ int main(int argc, char **argv) {
}
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
-/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
/* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of 10-byte region\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:9|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:19|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c b/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
index c44370f..790aa5e 100644
--- a/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
+++ b/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
@@ -2,9 +2,13 @@
/* { dg-options "-fno-builtin-memset" } */
/* { dg-shouldfail "asan" } */
-volatile int ten = 10;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, __SIZE_TYPE__);
-#include <string.h>
+volatile int ten = 10;
int main() {
char x[10];
@@ -14,5 +18,5 @@ int main() {
}
/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
-/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*stack-overflow-1.c:12|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*stack-overflow-1.c:16|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
/* { dg-output "Address 0x\[0-9a-f\]+ is\[^\n\r]*frame <main>" } */