diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/uninit-38.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/uninit-38.c | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-38.c b/gcc/testsuite/gcc.dg/uninit-38.c index 8dacc8c..0d70bcd 100644 --- a/gcc/testsuite/gcc.dg/uninit-38.c +++ b/gcc/testsuite/gcc.dg/uninit-38.c @@ -1,5 +1,5 @@ -/* Verify that dereferencing uninitialized allocated objects and VLAs - correctly reflects offsets into the objects. +/* Verify that dereferencing uninitialized VLAs correctly reflects + offsets into the objects. The test's main purpose is to exercise the formatting of MEM_REFs. If -Wuninitialized gets smarter and detects uninitialized accesses before they're turned into MEM_REFs the test will likely need to @@ -18,41 +18,6 @@ extern void* malloc (size_t); void sink (void*, ...); -#undef T -#define T(Type, idx, off) \ - __attribute__ ((noipa)) \ - void UNIQ (test_)(int n) \ - { \ - void *p = malloc (n); \ - Type *q = (Type*)((char*)p + off); \ - sink (p, q[idx]); \ - } \ - typedef void dummy_type - -T (int, 0, 0); // { dg-warning "'\\*\\(int \\*\\)p' is used uninitialized" } -T (int, 0, 1); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)'" } -T (int, 0, 2); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)'" } -T (int, 0, 3); // { dg-warning "'\\*\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)'" } -T (int, 0, 4); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[1]'" } -T (int, 0, 5); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[1]'" } -T (int, 0, 6); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[1]'" } -T (int, 0, 7); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[1]'" } -T (int, 0, 8); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[2]'" } -T (int, 0, 9); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[2]'" } - - -T (int, 1, 0); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[1]' is used uninitialized" } -T (int, 1, 1); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[1]'" } -T (int, 1, 2); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[1]'" } -T (int, 1, 3); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[1]'" } -T (int, 1, 4); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[2]'" } -T (int, 1, 5); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[2]'" } -T (int, 1, 6); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 2\\)\\)\\\[2]'" } -T (int, 1, 7); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 3\\)\\)\\\[2]'" } -T (int, 1, 8); // { dg-warning "'\\(\\(int \\*\\)p\\)\\\[3]'" } -T (int, 1, 9); // { dg-warning "'\\(\\(int \\*\\)\\(\\(char \\*\\)p \\+ 1\\)\\)\\\[3]'" } - -#undef T #define T(Type, idx, off) \ __attribute__ ((noipa)) \ void UNIQ (test_)(int n) \ |