aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-02-12 11:38:19 -0800
committerIan Lance Taylor <iant@golang.org>2021-02-12 11:38:19 -0800
commit89d7be42db00cd0953e7d4584877cf50a56ed046 (patch)
tree3a471e8ee60b7be687ab7501f70379618adcf174 /gcc/testsuite/gcc.dg
parent305e9d2c7815e90a29bbde1e3a7cd776861f4d7c (diff)
parent9769564e7456453e2273071d0faa5aab2554ff78 (diff)
downloadgcc-89d7be42db00cd0953e7d4584877cf50a56ed046.zip
gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.gz
gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.bz2
Merge from trunk revision 9769564e7456453e2273071d0faa5aab2554ff78.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/explode-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/file-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/file-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr94851-2.c54
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr98575-1.c46
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr98969.c18
-rw-r--r--gcc/testsuite/gcc.dg/array-quals-1.c30
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pr98882.c6
-rw-r--r--gcc/testsuite/gcc.dg/decl-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr99007-1.c13
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr99007-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr99007-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/label-decl-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/mismatch-decl-1.c10
-rw-r--r--gcc/testsuite/gcc.dg/old-style-then-proto-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/parm-mismatch-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr35445.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr97882.c144
-rw-r--r--gcc/testsuite/gcc.dg/pr97932.c125
-rw-r--r--gcc/testsuite/gcc.dg/qual-return-7.c18
-rw-r--r--gcc/testsuite/gcc.dg/qual-return-8.c28
-rw-r--r--gcc/testsuite/gcc.dg/redecl-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/tls/thr-init-1.c2
27 files changed, 571 insertions, 44 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-1.c b/gcc/testsuite/gcc.dg/analyzer/explode-1.c
index 9b95afd..6b62e8e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/explode-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/explode-1.c
@@ -47,7 +47,7 @@ void test (void)
{
default:
case 0:
- *pp = malloc (16); /* { dg-warning "leak" } */
+ *pp = malloc (16);
break;
case 1:
free (*pp);
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-1.c b/gcc/testsuite/gcc.dg/analyzer/file-1.c
index f2b77b9d..f9afa88 100644
--- a/gcc/testsuite/gcc.dg/analyzer/file-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/file-1.c
@@ -47,3 +47,10 @@ test_4 (const char *path)
return; /* { dg-warning "leak of FILE 'f'" } */
}
+
+void
+test_5 (const char *path)
+{
+ FILE *f = fopen (path, "r"); /* { dg-message "opened here" } */
+ return; /* { dg-warning "leak of FILE 'f'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-3.c b/gcc/testsuite/gcc.dg/analyzer/file-3.c
new file mode 100644
index 0000000..8f93a98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/file-3.c
@@ -0,0 +1,18 @@
+typedef struct _IO_FILE FILE;
+extern struct _IO_FILE *stderr;
+
+extern FILE *fopen (const char *__restrict __filename,
+ const char *__restrict __modes);
+extern int _IO_getc (FILE *stream);
+
+void
+test_1 (const char *path)
+{
+ FILE *f = fopen (path, "r"); /* { dg-message "opened here" } */
+
+ /* Implementation of getc in glibc < 2.28.
+ Verify that we know that this doesn't close the file. */
+ _IO_getc (f);
+
+ return; /* { dg-warning "leak of FILE 'f'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
new file mode 100644
index 0000000..6094721
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr94851-2.c
@@ -0,0 +1,54 @@
+/* As pr94851-1.c, but verify that we don't get confused by a call to
+ an unknown function (PR analyzer/98575). */
+
+/* { dg-additional-options "-O2" } */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef struct AMARK {
+ struct AMARK *m_next;
+ char m_name;
+} AMARK;
+
+struct buf {
+ AMARK *b_amark;
+};
+
+struct buf *curbp;
+
+extern void unknown_fn (void);
+
+int pamark(void) {
+ int c;
+
+ AMARK *p = curbp->b_amark;
+ AMARK *last = curbp->b_amark;
+
+ unknown_fn ();
+
+ c = getchar ();
+
+ while (p != (AMARK *)NULL && p->m_name != (char)c) {
+ last = p;
+ p = p->m_next;
+ }
+
+ if (p != (AMARK *)NULL) {
+ printf("over writing mark %c\n", c);
+ } else {
+ if ((p = (AMARK *)malloc(sizeof(AMARK))) == (AMARK *)NULL)
+ return 0;
+
+ p->m_next = (AMARK *)NULL;
+
+ if (curbp->b_amark == (AMARK *)NULL)
+ curbp->b_amark = p;
+ else
+ last->m_next = p;
+ }
+
+ p->m_name = (char)c; /* { dg-bogus "leak of 'p'" "bogus leak" } */
+
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c b/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c
new file mode 100644
index 0000000..6472e76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr98575-1.c
@@ -0,0 +1,46 @@
+/* A malloced pointer that's written to a global pointer shouldn't be
+ reported as leaking, even if an unknown function has been called
+ (PR analyzer/98575). */
+
+void **g;
+
+extern void unknown_fn (void);
+
+/* Without a call to unknown_fn. */
+
+int test_1 (void)
+{
+ void *p;
+ p = __builtin_malloc(1024);
+ *g = p;
+ return 0;
+}
+
+/* With a call to unknown_fn in various places. */
+
+int test_2 (void)
+{
+ void *p;
+ unknown_fn ();
+ p = __builtin_malloc(1024);
+ *g = p;
+ return 0;
+}
+
+int test_3 (void)
+{
+ void *p;
+ p = __builtin_malloc(1024);
+ unknown_fn ();
+ *g = p;
+ return 0;
+}
+
+int test_4 (void)
+{
+ void *p;
+ p = __builtin_malloc(1024);
+ *g = p;
+ unknown_fn ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr98969.c b/gcc/testsuite/gcc.dg/analyzer/pr98969.c
new file mode 100644
index 0000000..8298f26
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr98969.c
@@ -0,0 +1,18 @@
+struct foo
+{
+ char *expr;
+};
+
+void
+test_1 (long int i)
+{
+ struct foo *f = (struct foo *)i;
+ f->expr = __builtin_malloc (1024);
+} /* { dg-bogus "leak" "PR analyzer/98969" { xfail *-*-* } } */
+
+void
+test_2 (long int i)
+{
+ __builtin_free (((struct foo *)i)->expr);
+ __builtin_free (((struct foo *)i)->expr); /* { dg-warning "double-'free' of '\\*\\(\\(struct foo \\*\\)i\\)\\.expr'" } */
+}
diff --git a/gcc/testsuite/gcc.dg/array-quals-1.c b/gcc/testsuite/gcc.dg/array-quals-1.c
index c8d3629..5d9170e 100644
--- a/gcc/testsuite/gcc.dg/array-quals-1.c
+++ b/gcc/testsuite/gcc.dg/array-quals-1.c
@@ -8,44 +8,44 @@
/* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* } } } */
/* { dg-final { scan-assembler-symbol-section {^_?a$} {^\.(const|rodata|srodata)|\[RO\]} } } */
static const int a[2] = { 1, 2 };
-/* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?a1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
const int a1[2] = { 1, 2 };
typedef const int ci;
/* { dg-final { scan-assembler-symbol-section {^_?b$} {^\.(const|rodata|srodata)|\[RO\]} } } */
static ci b[2] = { 3, 4 };
-/* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?b1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
ci b1[2] = { 3, 4 };
typedef int ia[2];
/* { dg-final { scan-assembler-symbol-section {^_?c$} {^\.(const|rodata|srodata)|\[RO\]} } } */
static const ia c = { 5, 6 };
-/* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?c1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
const ia c1 = { 5, 6 };
typedef const int cia[2];
/* { dg-final { scan-assembler-symbol-section {^_?d$} {^\.(const|rodata|srodata)|\[RO\]} } } */
static cia d = { 7, 8 };
-/* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?d1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
cia d1 = { 7, 8 };
/* { dg-final { scan-assembler-symbol-section {^_?e$} {^\.(const|rodata|srodata)|\[RO\]} } } */
static cia e[2] = { { 1, 2 }, { 3, 4 } };
-/* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata)|\[RO\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?e1$} {^\.(const|rodata|srodata|sdata)|\[RO\]} } } */
cia e1[2] = { { 1, 2 }, { 3, 4 } };
-/* { dg-final { scan-assembler-symbol-section {^_?p$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?p$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const p = &a;
-/* { dg-final { scan-assembler-symbol-section {^_?q$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?q$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const q = &b;
-/* { dg-final { scan-assembler-symbol-section {^_?r$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?r$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const r = &c;
-/* { dg-final { scan-assembler-symbol-section {^_?s$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?s$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const s = &d;
-/* { dg-final { scan-assembler-symbol-section {^_?t$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?t$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const t = &e;
-/* { dg-final { scan-assembler-symbol-section {^_?p1$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?p1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const p1 = &a1;
-/* { dg-final { scan-assembler-symbol-section {^_?q1$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?q1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const q1 = &b1;
-/* { dg-final { scan-assembler-symbol-section {^_?r1$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?r1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const r1 = &c1;
-/* { dg-final { scan-assembler-symbol-section {^_?s1$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?s1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const s1 = &d1;
-/* { dg-final { scan-assembler-symbol-section {^_?t1$} {^\.(const|rodata|srodata)|\[RW\]} } } */
+/* { dg-final { scan-assembler-symbol-section {^_?t1$} {^\.(const|rodata|srodata|sdata)|\[RW\]} } } */
void *const t1 = &e1;
diff --git a/gcc/testsuite/gcc.dg/cpp/pr98882.c b/gcc/testsuite/gcc.dg/cpp/pr98882.c
new file mode 100644
index 0000000..e831df0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pr98882.c
@@ -0,0 +1,6 @@
+/* PR preprocessor/98882 */
+/* { dg-do preprocess } */
+/* { dg-options "-fdirectives-only" } */
+
+/* Last line does not end with a newline. */
+ /*Here*/ \ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/decl-8.c b/gcc/testsuite/gcc.dg/decl-8.c
index 485065b..608ff97 100644
--- a/gcc/testsuite/gcc.dg/decl-8.c
+++ b/gcc/testsuite/gcc.dg/decl-8.c
@@ -3,8 +3,8 @@
/* { dg-do compile } */
/* { dg-options "-std=gnu89 -pedantic-errors" } */
-typedef int I; /* { dg-message "note: previous declaration of 'I' was here" } */
+typedef int I; /* { dg-message "note: previous declaration of 'I'" "note" } */
typedef int I; /* { dg-error "redefinition of typedef 'I'" } */
-typedef int I1; /* { dg-message "note: previous declaration of 'I1' was here" } */
+typedef int I1; /* { dg-message "note: previous declaration of 'I1'" "note" } */
typedef long I1; /* { dg-error "conflicting types for 'I1'" } */
diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-1.c b/gcc/testsuite/gcc.dg/gomp/pr99007-1.c
new file mode 100644
index 0000000..d46957b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr99007-1.c
@@ -0,0 +1,13 @@
+/* PR middle-end/99007 */
+
+void
+bar (int n)
+{
+ int i;
+ long s[n];
+ for (i = 0; i < n; i++)
+ s[i] = 0;
+ #pragma omp teams distribute parallel for reduction(+:s) allocate(s)
+ for (i = 0; i < 8; i++)
+ s[3]++;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-2.c b/gcc/testsuite/gcc.dg/gomp/pr99007-2.c
new file mode 100644
index 0000000..3909931
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr99007-2.c
@@ -0,0 +1,15 @@
+/* PR middle-end/99007 */
+
+int
+bar (int n)
+{
+ int s[n];
+ int i, j;
+ for (i = 0; i < n; i++)
+ s[i] = 0;
+ #pragma omp teams distribute parallel for reduction(+:s) private (j)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < n; j++)
+ s[j] += i;
+ return s[0] + s[n - 1];
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr99007-3.c b/gcc/testsuite/gcc.dg/gomp/pr99007-3.c
new file mode 100644
index 0000000..c6db941
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr99007-3.c
@@ -0,0 +1,16 @@
+/* PR middle-end/99007 */
+
+int
+bar (int n)
+{
+ int s[n];
+ int i, j;
+ for (i = 0; i < n; i++)
+ s[i] = 0;
+ #pragma omp parallel reduction(+:s) num_threads(2)
+ #pragma omp parallel for reduction(+:s) private (j)
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < n; j++)
+ s[j] += i;
+ return s[0] + s[n - 1];
+}
diff --git a/gcc/testsuite/gcc.dg/label-decl-4.c b/gcc/testsuite/gcc.dg/label-decl-4.c
index 5661e01..82f1af0 100644
--- a/gcc/testsuite/gcc.dg/label-decl-4.c
+++ b/gcc/testsuite/gcc.dg/label-decl-4.c
@@ -7,8 +7,8 @@ void
f (void)
{
__label__ a, b, a; /* { dg-error "duplicate label declaration 'a'" } */
- /* { dg-message "note: previous declaration of 'a' was here" "previous" { target *-*-* } .-1 } */
- __label__ c; /* { dg-message "note: previous declaration of 'c' was here" } */
+ /* { dg-message "note: previous declaration of 'a'" "previous" { target *-*-* } .-1 } */
+ __label__ c; /* { dg-message "note: previous declaration of 'c'" "note" } */
__label__ c; /* { dg-error "duplicate label declaration 'c'" } */
return;
}
diff --git a/gcc/testsuite/gcc.dg/mismatch-decl-1.c b/gcc/testsuite/gcc.dg/mismatch-decl-1.c
index da4db0a..b6dd543 100644
--- a/gcc/testsuite/gcc.dg/mismatch-decl-1.c
+++ b/gcc/testsuite/gcc.dg/mismatch-decl-1.c
@@ -4,12 +4,12 @@
/* The bug this is testing is that if a new decl conflicts with an
explicit decl, you don't get the "changes type of builtin" message,
- but if there was *also* a builtin, you *also* don't get the
- "previous declaration was here" message, leaving you with no clue
- where the previous declaration came from. */
+ but if there was *also* a builtin, you *also* don't get the "previous
+ declaration" message, leaving you with no clue where the previous
+ declaration came from. */
-extern char foo(int,int); /* { dg-message "previous declaration of 'foo' was here" } */
-extern char *index(const char *,int); /* { dg-message "previous declaration of 'index' was here" } */
+extern char foo(int,int); /* { dg-message "previous declaration of 'foo'" "note" } */
+extern char *index(const char *,int); /* { dg-message "previous declaration of 'index'" "note" } */
/* This changes the type of "index", which is both a builtin and an
explicit decl. */
diff --git a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
index 7d76287..e3e6186 100644
--- a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
+++ b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
@@ -7,38 +7,38 @@
void f1() {}
void f1(void); /* { dg-warning "prototype for 'f1' follows non-prototype definition" } */
-void f2() {} /* { dg-message "note: previous definition of 'f2' was here" } */
+void f2() {} /* { dg-message "note: previous definition of 'f2'" "note" } */
void f2(int); /* { dg-error "prototype for 'f2' declares more arguments than previous old-style definition" } */
-void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3' was here" } */
+void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3'" "note" } */
void f3(void); /* { dg-error "prototype for 'f3' declares fewer arguments than previous old-style definition" } */
void f4(a) int a; {}
void f4(int); /* { dg-warning "prototype for 'f4' follows non-prototype definition" } */
-void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5' was here" } */
+void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5'" "note" } */
void f5(int, int); /* { dg-error "prototype for 'f5' declares more arguments than previous old-style definition" } */
-void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6' was here" } */
+void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6'" "note" } */
void f6(int, ...); /* { dg-error "conflicting types for 'f6'" } */
-void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7' was here" } */
+void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7'" "note" } */
void f7(int); /* { dg-error "prototype for 'f7' declares fewer arguments than previous old-style definition" } */
-void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8' was here" } */
+void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8'" "note" } */
void f8(int, ...); /* { dg-error "conflicting types for 'f8'" } */
void f9(a, b) int a, b; {}
void f9(int, int); /* { dg-warning "prototype for 'f9' follows non-prototype definition" } */
-void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10' was here" } */
+void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10'" "note" } */
void f10(int, long); /* { dg-error "prototype for 'f10' declares argument 2 with incompatible type" } */
-void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11' was here" } */
+void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11'" "note" } */
void f11(long, int); /* { dg-error "prototype for 'f11' declares argument 1 with incompatible type" } */
void f12(a, b) const int a; volatile int b; {}
void f12(volatile int, const int); /* { dg-warning "prototype for 'f12' follows non-prototype definition" } */
-void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13' was here" } */
+void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13'" "note" } */
void f13(volatile int [2][2]); /* { dg-error "prototype for 'f13' declares argument 1 with incompatible type" } */
diff --git a/gcc/testsuite/gcc.dg/parm-mismatch-1.c b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
index 058f2e8..d7621bc 100644
--- a/gcc/testsuite/gcc.dg/parm-mismatch-1.c
+++ b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
@@ -4,15 +4,15 @@
/* { dg-do compile } */
/* { dg-options "" } */
-void f0(); /* { dg-message "note: previous declaration of 'f0' was here" } */
+void f0(); /* { dg-message "note: previous declaration of 'f0'" "note" } */
void f0(int, ...); /* { dg-error "conflicting types for 'f0'" } */
/* { dg-message "note: a parameter list with an ellipsis cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */
-void f1(int, ...); /* { dg-message "note: previous declaration of 'f1' was here" } */
+void f1(int, ...); /* { dg-message "note: previous declaration of 'f1'" "note" } */
void f1(); /* { dg-error "conflicting types for 'f1'" } */
/* { dg-message "note: a parameter list with an ellipsis cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */
-void f2(); /* { dg-message "note: previous declaration of 'f2' was here" } */
+void f2(); /* { dg-message "note: previous declaration of 'f2'" "note" } */
void f2(char); /* { dg-error "conflicting types for 'f2'" } */
/* { dg-message "note: an argument type that has a default promotion cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */
-void f3(char); /* { dg-message "note: previous declaration of 'f3' was here" } */
+void f3(char); /* { dg-message "note: previous declaration of 'f3'" "note" } */
void f3(); /* { dg-error "conflicting types for 'f3'" } */
/* { dg-message "note: an argument type that has a default promotion cannot match an empty parameter name list declaration" "note" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/pr35445.c b/gcc/testsuite/gcc.dg/pr35445.c
index 56ca6e2..30c29f4 100644
--- a/gcc/testsuite/gcc.dg/pr35445.c
+++ b/gcc/testsuite/gcc.dg/pr35445.c
@@ -2,5 +2,5 @@
/* { dg-do compile } */
extern int i;
-extern int i; /* { dg-message "was here" } */
+extern int i; /* { dg-message "previous declaration of 'i'" } */
int i[] = { 0 }; /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/pr97882.c b/gcc/testsuite/gcc.dg/pr97882.c
new file mode 100644
index 0000000..48ea93d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97882.c
@@ -0,0 +1,144 @@
+/* PR c/97882 - Segmentation Fault on improper redeclaration of function
+ { dg-do compile }
+ { dg-options "" } */
+
+// Check pointer declaration incompatibiliies.
+
+extern enum E e_u; // { dg-message "note: previous declaration of 'e_u' with type 'enum E'" "note" }
+unsigned e_u; // { dg-error "conflicting types for 'e_u'; have 'unsigned int'" }
+
+
+extern enum E *p; // { dg-message "note: previous declaration of 'p' with type 'enum E \\*'" "note" }
+unsigned *p; // { dg-error "conflicting types for 'p'; have 'unsigned int \\*'" }
+
+extern enum E **p2; // { dg-message "note: previous declaration of 'p2' with type 'enum E \\*\\*'" "note" }
+unsigned **p2; // { dg-error "conflicting types for 'p2'; have 'unsigned int \\*\\*'" }
+
+extern enum E ***p3; // { dg-message "note: previous declaration of 'p3' with type 'enum E \\*\\*\\*'" "note" }
+unsigned ***p3; // { dg-error "conflicting types for 'p3'; have 'unsigned int \\*\\*\\*'" }
+
+extern enum F *q; // { dg-message "note: previous declaration of 'q' with type 'enum F \\*'" "note" }
+int *q; // { dg-error "conflicting types for 'q'; have 'int \\*'" }
+
+extern enum E* r[]; // { dg-message "note: previous declaration of 'r' with type 'enum E \\*\\\[]'" "note" }
+extern unsigned *r[1]; // { dg-error "conflicting types for 'r'; have 'unsigned int \\*\\\[1]'" }
+
+extern enum E **r2[]; // { dg-message "note: previous declaration of 'r2' with type 'enum E \\*\\*\\\[]'" "note" }
+extern unsigned **r2[2];// { dg-error "conflicting types for 'r2'; have 'unsigned int \\*\\*\\\[2]'" }
+
+
+typedef enum E* EPAx[];
+typedef unsigned* UPAx[];
+
+extern EPAx* peax; // { dg-message "note: previous declaration of 'peax' with type 'enum E \\* \\(\\*\\)\\\[]'" "note" }
+extern UPAx* peax; // { dg-error "conflicting types for 'peax'; have 'unsigned int \\* \\(\\*\\)\\\[]'" }
+
+
+/* Check incompatibilities in the return type in a redeclaration
+ of a function without a prototye. */
+
+/* Verify the following isn't rejected. */
+void f_v ();
+void f_v (void);
+
+enum E fE_u (); // { dg-message "previous declaration of 'fE_u' with type 'enum E\\(\\)'" "note" }
+unsigned fE_u (); // { dg-error "conflicting types for 'fE_u'; have 'unsigned int\\(\\)'" }
+
+enum E* fpE_u (); // { dg-message "previous declaration of 'fpE_u' with type 'enum E \\*\\(\\)'" "note" }
+unsigned* fpE_u (); // { dg-error "conflicting types for 'fpE_u'; have 'unsigned int \\*\\(\\)'" }
+
+enum E** fppE_u (); // { dg-message "previous declaration of 'fppE_u' with type 'enum E \\*\\*\\(\\)'" "note" }
+unsigned** fppE_u (); // { dg-error "conflicting types for 'fppE_u'; have 'unsigned int \\*\\*\\(\\)'" }
+
+enum E** fppE_u (); // { dg-message "previous declaration of 'fppE_u' with type 'enum E \\*\\*\\(\\)'" "note" }
+unsigned** fppE_u (); // { dg-error "conflicting types for 'fppE_u'; have 'unsigned int \\*\\*\\(\\)'" }
+
+enum E gE_u (); // { dg-message "previous declaration of 'gE_u' with type 'enum E\\(\\)'" "note" }
+unsigned gE_u () // { dg-error "conflicting types for 'gE_u'; have 'unsigned int\\(\\)'" }
+{ return 0; }
+
+enum E** gppE_u (); // { dg-message "previous declaration of 'gppE_u' with type 'enum E \\*\\*\\(\\)'" "note" }
+unsigned** gppE_u () // { dg-error "conflicting types for 'gppE_u'; have 'unsigned int \\*\\*\\(\\)'" }
+{ return 0; }
+
+unsigned fu_E (); // { dg-message "previous declaration of 'fu_E' with type 'unsigned int\\(\\)'" "note" }
+enum E fu_E (); // { dg-error "conflicting types for 'fu_E'; have 'enum E\\(\\)'" }
+
+unsigned gu_E (); // { dg-message "previous declaration of 'gu_E' with type 'unsigned int\\(\\)'" "note" }
+enum E gu_E () { } // { dg-error "conflicting types for 'gu_E'" }
+ // { dg-error "incomplete type" "return type" { target *-*-* } .-1 }
+
+typedef enum E FE_ ();
+typedef unsigned Fuv (void);
+
+FE_* fpF_u (); // // { dg-message "previous declaration of 'fpF_u' with type 'enum E \\(\\*\\(\\)\\)\\(\\)'" "note" }
+Fuv* fpF_u (); // { dg-error "conflicting types for 'fpF_u'; have 'unsigned int \\(\\*\\(\\)\\)\\(void\\)'" }
+
+
+typedef void Fv_ ();
+typedef void Fvv (void);
+
+/* Verify the following isn't rejected. */
+Fv_* f ();
+Fvv* f ();
+
+
+/* Check incompatibilities in argument types of a function redeclaration. */
+
+void fvE_u (enum E); // { dg-message "note: previous declaration of 'fvE_u' with type 'void\\(enum E\\)'" "note" }
+void fvE_u (unsigned); // { dg-error "conflicting types for 'fvE_u'; have 'void\\(unsigned int\\)'" }
+
+void fviE_u (int, enum E); // { dg-message "note: previous declaration of 'fviE_u' with type 'void\\(int, *enum E\\)'" "note" }
+void fviE_u (int, unsigned); // { dg-error "conflicting types for 'fviE_u'; have 'void\\(int, *unsigned int\\)'" }
+
+void fvE_el (enum E, ...); // { dg-message "note: previous declaration of 'fvE_el' with type 'void\\(enum E, \\.\\.\\.\\)'" "note" }
+void fvE_el (unsigned, ...); // { dg-error "conflicting types for 'fvE_el'; have 'void\\(unsigned int, \\.\\.\\.\\)'" }
+
+
+/* Check incompatibilities in the return type in a redeclaration
+ of a nested function without a prototye. */
+
+void f1 (void)
+{
+ enum G f11 (); // { dg-message "note: previous declaration of 'f11' with type 'enum G\\(\\)'" "note" }
+ unsigned f11 () { } // { dg-error "conflicting types for 'f11'; have 'unsigned int\\(\\)'" }
+}
+
+
+void f2 (void)
+{
+ const enum G f21 (); // { dg-message "note: previous declaration of 'f21' with type 'enum G\\(\\)'" "note" }
+ unsigned f21 () { } // { dg-error "conflicting types for 'f21'; have 'unsigned int\\(\\)'" }
+}
+
+
+void f3 (void)
+{
+ enum G f31 (); // { dg-message "note: previous declaration of 'f31' with type 'enum G\\(\\)'" "note" }
+ const unsigned f31 () { } // { dg-error "conflicting types for 'f31'; have 'unsigned int\\(\\)'" }
+}
+
+
+void f4 (void)
+{
+ auto enum G f31 (); // { dg-message "note: previous declaration of 'f31' with type 'enum G\\(\\)'" "note" }
+ const unsigned f31 () { } // { dg-error "conflicting types for 'f31'; have 'unsigned int\\(\\)'" }
+}
+
+
+void f5 (void)
+{
+ enum G* f51 (); // { dg-message "note: previous declaration of 'f51' with type 'enum G \\*\\(\\)'" "note" }
+ int* f51 () { } // { dg-error "conflicting types for 'f51'; have 'int \\*\\(\\)'" }
+}
+
+
+void f6 (void)
+{
+ enum G;
+ void f61 (enum G); // { dg-message "note: previous declaration of 'f61' with type 'void\\(enum G\\)'" "note" }
+ void f61 (unsigned) // { dg-error "conflicting types for 'f61'; have 'void\\(unsigned int\\)'" }
+ { }
+}
+
+// { dg-prune-output "nested function '\[^\n\r ]+' declared but never defined" }
diff --git a/gcc/testsuite/gcc.dg/pr97932.c b/gcc/testsuite/gcc.dg/pr97932.c
new file mode 100644
index 0000000..4a0b304
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97932.c
@@ -0,0 +1,125 @@
+/* Verify that we don't emit ranges that span both
+ a macro definition location and a macro expansion location. */
+
+/* { dg-options "-fdiagnostics-show-caret" } */
+
+/* Various cases involving the ranges of the LHS and RHS operands to "-". */
+
+/* Case 1
+ start token is in macro definition ("&"),
+ end token is in macro invocation ("a" and "b"). */
+
+#define M1(A, B) &A - &B /* { dg-error "invalid operands" } */
+
+/* Intervening
+ material
+ that
+ ought
+ not
+ to
+ be
+ printed. */
+
+int test_1 (float a, int b)
+{
+ return M1(a, b); /* { dg-message "in expansion of macro 'M1'" } */
+}
+
+/* { dg-begin-multiline-output "" }
+ #define M1(A, B) &A - &B
+ ^
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ return M1(a, b);
+ ^~
+ { dg-end-multiline-output "" } */
+
+/* Case 2:
+ start and end tokens are both in macro invocation ("&", and "a"/"b"). */
+
+#define M2(A, B) A - B /* { dg-error "invalid operands" } */
+
+/* Intervening
+ material
+ that
+ ought
+ not
+ to
+ be
+ printed. */
+
+int test_2 (float a, int b)
+{
+ return M2(&a, &b); /* { dg-message "in expansion of macro 'M2'" } */
+}
+
+/* { dg-begin-multiline-output "" }
+ #define M2(A, B) A - B
+ ^
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ return M2(&a, &b);
+ ^~
+ { dg-end-multiline-output "" } */
+
+/* Case 3:
+ start token is in macro invocation ("&"),
+ end token is in macro definition ("a"). */
+
+#define M3(OP) OP a - OP b /* { dg-error "invalid operands" } */
+
+/* Intervening
+ material
+ that
+ ought
+ not
+ to
+ be
+ printed. */
+
+int test_3 (float a, int b)
+{
+ return M3(&); /* { dg-message "in expansion of macro 'M3'" } */
+}
+
+/* { dg-begin-multiline-output "" }
+ #define M3(OP) OP a - OP b
+ ^
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ return M3(&);
+ ^~
+ { dg-end-multiline-output "" } */
+
+
+/* Case 4:
+ start and end tokens are both in macro definition ("&a"). */
+
+#define M4 &a - &b /* { dg-error "invalid operands" } */
+
+/* Intervening
+ material
+ that
+ ought
+ not
+ to
+ be
+ printed. */
+
+int test_4 (float a, int b)
+{
+ return M4; /* { dg-message "in expansion of macro 'M4'" } */
+}
+
+/* { dg-begin-multiline-output "" }
+ #define M4 &a - &b
+ ~~ ^ ~~
+ | |
+ | int *
+ float *
+ { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
+ return M4;
+ ^~
+ { dg-end-multiline-output "" } */
+
diff --git a/gcc/testsuite/gcc.dg/qual-return-7.c b/gcc/testsuite/gcc.dg/qual-return-7.c
new file mode 100644
index 0000000..96f7f16
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/qual-return-7.c
@@ -0,0 +1,18 @@
+/* Same as qual-return-3.c but with nested functions.
+ { dg-do compile }
+ { dg-options "-std=gnu99" } */
+
+void test_local (void)
+{
+ auto int foo (); /* { dg-message "note: previous declaration" "different qualifiers" } */
+
+ const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */
+
+ auto void bar (void);
+ volatile void bar () { } /* { dg-warning "qualified|volatile" "different qualifiers" } */
+
+ auto volatile void baz (void);
+ void baz () { } /* { dg-warning "not compatible" "different qualifiers" } */
+}
+
+/* { dg-prune-output "nested function 'foo' declared but never defined" } */
diff --git a/gcc/testsuite/gcc.dg/qual-return-8.c b/gcc/testsuite/gcc.dg/qual-return-8.c
new file mode 100644
index 0000000..de1e7cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/qual-return-8.c
@@ -0,0 +1,28 @@
+/* Same as qual-return-7.c but in C11 mode.
+ { dg-do compile }
+ { dg-options "-std=gnu11" } */
+
+void test_local (void)
+{
+#if 0
+ /* _Atomic is not considered a qualifier and so is not ignored
+ on a return type. As a result, the redeclaration below isn't
+ valid. See also qual-return-5.c. */
+ auto int fi_ai ();
+ _Atomic int fi_ai () { return 0; }
+#endif
+
+ auto int fi_ci ();
+ const int fi_ci () { return 0; }
+
+ auto enum E fe_ce ();
+
+ enum E { e };
+ const enum E fe_ce () { return 0; }
+
+ auto void fv_vv (void);
+ volatile void fv_vv () { }
+
+ auto volatile void fvv_v (void);
+ void fvv_v () { }
+}
diff --git a/gcc/testsuite/gcc.dg/redecl-11.c b/gcc/testsuite/gcc.dg/redecl-11.c
index 5540e40..3c6f64f 100644
--- a/gcc/testsuite/gcc.dg/redecl-11.c
+++ b/gcc/testsuite/gcc.dg/redecl-11.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
int f(int (*)[]);
-void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f' was here" } */
+void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f'" "note" } */
int f(int (*)[3]); /* { dg-error "conflicting types for 'f'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-12.c b/gcc/testsuite/gcc.dg/redecl-12.c
index 711b8a3..9922cf4 100644
--- a/gcc/testsuite/gcc.dg/redecl-12.c
+++ b/gcc/testsuite/gcc.dg/redecl-12.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
+void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a'" "note" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-13.c b/gcc/testsuite/gcc.dg/redecl-13.c
index 3f05d0f..556a3cd 100644
--- a/gcc/testsuite/gcc.dg/redecl-13.c
+++ b/gcc/testsuite/gcc.dg/redecl-13.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
+void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a'" "note" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-15.c b/gcc/testsuite/gcc.dg/redecl-15.c
index ff484c9..06d6523 100644
--- a/gcc/testsuite/gcc.dg/redecl-15.c
+++ b/gcc/testsuite/gcc.dg/redecl-15.c
@@ -7,7 +7,7 @@
void
f (void)
{
- g(); /* { dg-message "note: previous implicit declaration of 'g' was here" } */
+ g(); /* { dg-message "note: previous implicit declaration of 'g'" } */
{
void g(); /* { dg-warning "conflicting types for 'g'" } */
}
diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c b/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c
new file mode 100644
index 0000000..d7be559
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/rtl/aarch64/multi-subreg-1.c
@@ -0,0 +1,19 @@
+/* { dg-additional-options "-O -fdump-rtl-cse1-all" } */
+
+__int128 __RTL (startwith ("vregs")) foo (void)
+{
+(function "foo"
+ (insn-chain
+ (block 2
+ (edge-from entry (flags "FALLTHRU"))
+ (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK)
+ (cnote 2 NOTE_INSN_FUNCTION_BEG)
+ (cinsn 3 (set (subreg:TI (reg:V8HI x0) 0) (const_int -1)))
+ (edge-to exit (flags "FALLTHRU"))
+ )
+ )
+ (crtl (return_rtx (reg/i:TI x0)))
+)
+}
+
+/* { dg-final { scan-rtl-dump {(?n)lr *def.*\[x0\].*\[x1\]} cse1 } } */
diff --git a/gcc/testsuite/gcc.dg/tls/thr-init-1.c b/gcc/testsuite/gcc.dg/tls/thr-init-1.c
index a9b6061..af51484 100644
--- a/gcc/testsuite/gcc.dg/tls/thr-init-1.c
+++ b/gcc/testsuite/gcc.dg/tls/thr-init-1.c
@@ -6,4 +6,4 @@ static __thread int fstat = 1 ; /* { dg-line fstat_prev } */
static __thread int fstat ;
static __thread int fstat = 2;
/* { dg-error "redefinition of 'fstat'" "" { target *-*-* } .-1 } */
-/* { dg-message "note: previous definition of 'fstat' was here" "" { target *-*-* } fstat_prev } */
+/* { dg-message "note: previous definition of 'fstat'" "note" { target *-*-* } fstat_prev } */