aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/noncompile
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/noncompile
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/noncompile')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20000901-1.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20001228-1.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010425-1.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010524-1.c2
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20011025-1.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020130-1.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020207-1.c32
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020213-1.c34
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020220-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20030818-1.c3
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-1.c15
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-2.c15
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-3.c16
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040629-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20041207.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20050120-1.c19
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920507-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920616-2.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920721-2.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920824-1.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920923-1.c127
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921102-1.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921116-1.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930301-1.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-1.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-2.c6
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930714-1.c25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/931203-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940112-1.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940227-1.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950825-1.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950921-1.c10
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/951123-1.c2
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/971104-1.c29
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/990416-1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/const-ll-1.c24
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-1.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-4.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-1.c17
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-2.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-3.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-4.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-5.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c5
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-1.c175
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c14
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/noncompile.exp25
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c11
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr23576.c1
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c3
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c4
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c7
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr44517.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr52290.c3
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/redecl-1.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/scope.c19
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c3
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/va-arg-1.c8
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/noncompile/voidparam-1.c17
65 files changed, 897 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20000901-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20000901-1.c
new file mode 100644
index 000000000..ef5c3cbca
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20000901-1.c
@@ -0,0 +1 @@
+struct foo bar[] = { {"baz"} }; /* { dg-error "array type has incomplete element type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20001228-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20001228-1.c
new file mode 100644
index 000000000..73a44a859
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20001228-1.c
@@ -0,0 +1,6 @@
+void rof(void)
+{
+ union { int a; } u;
+ for (u.a = 0; u; u.a++) /* { dg-error "used union" } */
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010425-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010425-1.c
new file mode 100644
index 000000000..e36269e8d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010425-1.c
@@ -0,0 +1,9 @@
+__inline__ void bar(int x)
+{
+ (void)x;
+}
+
+void foo(void)
+{
+ bar(baz); /* { dg-error "undeclared|for each function" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010524-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010524-1.c
new file mode 100644
index 000000000..95c5db15d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20010524-1.c
@@ -0,0 +1,2 @@
+int i = 7 / 0; /* { dg-error "not constant" } */
+ /* { dg-warning "division by zero" "div by zero" { target *-*-* } 1 } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20011025-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20011025-1.c
new file mode 100644
index 000000000..51e60e5cb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20011025-1.c
@@ -0,0 +1,5 @@
+double foo [] =
+{ &bar, /* { dg-error "undeclared|is not constant|near init" } */
+ (void *) 0 }; /* { dg-error "incompatible types|is not constant|near init" } */
+double baz [] =
+{ (void *) 0 }; /* { dg-error "incompatible types|is not constant|near init" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020130-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020130-1.c
new file mode 100644
index 000000000..d820e062e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020130-1.c
@@ -0,0 +1,9 @@
+/* Test for ICE when using typedef for bad type. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */
+
+void
+foo (void)
+{
+ typedef int t[x]; /* { dg-error "undeclared|function" "x undeclared" } */
+ t bar;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020207-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020207-1.c
new file mode 100644
index 000000000..945eb1b1b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020207-1.c
@@ -0,0 +1,32 @@
+/* This testcase ICEd because statement expression type was set, but was not
+ as used. */
+
+struct A {
+ unsigned int a, b, c;
+};
+
+extern void abort (void);
+extern void exit (int);
+
+struct A bar (void)
+{
+ return (struct A) { 176, 52, 31 };
+}
+
+void baz (struct A *a)
+{
+ if (a->a != 176 || a->b != 52 || a->c != 31)
+ abort ();
+}
+
+int main ()
+{
+ struct A d;
+
+ d = ({ { bar (); } }); /* { dg-error "void value" } */
+ d = ({ if (1) { bar (); } }); /* { dg-error "void value" } */
+ d = ({ while (0) { bar (); } }); /* { dg-error "void value" } */
+ d = ({ do { bar (); } while (0); }); /* { dg-error "void value" } */
+ baz (&d);
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020213-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020213-1.c
new file mode 100644
index 000000000..41480f079
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020213-1.c
@@ -0,0 +1,34 @@
+/* PR c/5503
+ Test whether argument checking is done for fputs, bzero and bcmp. */
+typedef struct { int i; } FILE;
+typedef __SIZE_TYPE__ size_t;
+int fputs (const char *, FILE *);
+void bzero (void *, size_t);
+int bcmp (const void *, const void *, size_t);
+
+char buf[32];
+FILE *f;
+
+int main ()
+{
+ fputs ("foo"); /* { dg-error "too few" } */
+ fputs ("foo", "bar", "baz"); /* { dg-error "too many" } */
+ fputs (21, 43);
+ bzero (buf); /* { dg-error "too few" } */
+ bzero (21); /* { dg-error "too few" } */
+ bcmp (buf, buf + 16); /* { dg-error "too few" } */
+ bcmp (21); /* { dg-error "too few" } */
+ fputs ("foo", f);
+ bzero (buf, 32);
+ bcmp (buf, buf + 16, 16);
+ return 0;
+}
+
+/* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 15 } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 5 } */
+/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 16 } */
+/* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 16 } */
+/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 18 } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 6 } */
+/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 20 } */
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 7 } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020220-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
new file mode 100644
index 000000000..3063f422c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
@@ -0,0 +1,12 @@
+/* PR c++/5713
+ Test that there are no ICEs after redeclaration error. */
+
+int foo (const char*, const char*);
+
+void bar (void)
+{
+ const char *s = "bar";
+ int i; /* { dg-message "note: previous declaration" } */
+ int size = 2;
+ int i = foo (s, s + size); /* { dg-error "redeclaration of" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20030818-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20030818-1.c
new file mode 100644
index 000000000..71b89ec6f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20030818-1.c
@@ -0,0 +1,3 @@
+/* PR 11207. */
+
+char font8x8[256][8] = { [-1] = { 0 } }; /* { dg-error "array index|near init" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-1.c
new file mode 100644
index 000000000..dc5ab7a7c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-1.c
@@ -0,0 +1,15 @@
+/* PR/11658 The error message was quite mysterious for gcc up to 3.4.x */
+
+struct a {
+ int x;
+};
+
+int bug_if(struct a a) { if (a) return 1; else return 0; } /* { dg-error "struct type" } */
+int bug_while(struct a a) { while (a); } /* { dg-error "struct type" } */
+int bug_do_while(struct a a) { do ; while (a); } /* { dg-error "struct type" } */
+int bug_for(struct a a) { for ( ; a; ) ; } /* { dg-error "struct type" } */
+int bug_or(struct a a) { return (a || 1); } /* { dg-error "struct type" } */
+int bug_and(struct a a) { return (a && 1); } /* { dg-error "struct type" } */
+int bug_cond(struct a a) { return (a ? 1 : 0); } /* { dg-error "struct type" } */
+int bug_cond2(struct a a) { return (a ? : 0); } /* { dg-error "struct type" } */
+int bug_bool(struct a a) { return (_Bool) a; } /* { dg-error "struct type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-2.c
new file mode 100644
index 000000000..5c8b22f02
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-2.c
@@ -0,0 +1,15 @@
+/* PR/11658 The error message was quite mysterious for gcc up to 3.4.x */
+
+union a {
+ int x;
+};
+
+int bug_if(union a a) { if (a) return 1; else return 0; } /* { dg-error "union type" } */
+int bug_while(union a a) { while (a); } /* { dg-error "union type" } */
+int bug_do_while(union a a) { do ; while (a); } /* { dg-error "union type" } */
+int bug_for(union a a) { for ( ; a; ) ; } /* { dg-error "union type" } */
+int bug_or(union a a) { return (a || 1); } /* { dg-error "union type" } */
+int bug_and(union a a) { return (a && 1); } /* { dg-error "union type" } */
+int bug_cond(union a a) { return (a ? 1 : 0); } /* { dg-error "union type" } */
+int bug_cond2(union a a) { return (a ? : 0); } /* { dg-error "union type" } */
+int bug_bool(union a a) { return (_Bool) a; } /* { dg-error "union type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-3.c
new file mode 100644
index 000000000..5b90c3ee8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040203-3.c
@@ -0,0 +1,16 @@
+/* PR/11658 The error message was quite mysterious for gcc up to 3.4.x */
+/* { dg-options "-std=gnu89" } */
+
+struct s { char c[1]; };
+struct s f(void);
+
+int bug_if(void) { if (f().c) return 1; else return 0; } /* { dg-error "array that cannot be converted" } */
+int bug_while(void) { while (f().c); } /* { dg-error "array that cannot be converted" } */
+int bug_do_while(void) { do ; while (f().c); } /* { dg-error "array that cannot be converted" } */
+int bug_for(void) { for ( ; f().c; ) ; } /* { dg-error "array that cannot be converted" } */
+int bug_or(void) { return (f().c || 1); } /* { dg-error "array that cannot be converted" } */
+int bug_and(void) { return (f().c && 1); } /* { dg-error "array that cannot be converted" } */
+int bug_cond(void) { return (f().c ? 1 : 0); } /* { dg-error "array that cannot be converted" } */
+int bug_cond2(void) { return (f().c ? : 0); } /* { dg-error "array that cannot be converted" } */
+int bug_not(void) { return !f().c; } /* { dg-error "wrong type argument to unary exclamation mark" } */
+int bug_bool(void) { return (_Bool) f().c; } /* { dg-error "array that cannot be converted" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040629-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040629-1.c
new file mode 100644
index 000000000..ff00260a7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20040629-1.c
@@ -0,0 +1,8 @@
+/* PR 16216 */
+
+void func()
+{
+ const char *pek; int i;
+ pek=__builtin_va_arg(ap,const char*); /* { dg-error "" } */
+}
+/* { dg-message "undeclared identifier is reported only once" "reminder" { target *-*-* } 0 } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20041207.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20041207.c
new file mode 100644
index 000000000..0d02da909
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20041207.c
@@ -0,0 +1,8 @@
+/* PR18867 - ICE on a switch controlling expressions with an
+ invalid type. Origin: Serge Belyshev <belyshev@lubercy.com> */
+
+void f()
+{
+ float x;
+ switch (x) {case 0: break;}; /* { dg-error "not an integer" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20050120-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20050120-1.c
new file mode 100644
index 000000000..4af84b6f2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/20050120-1.c
@@ -0,0 +1,19 @@
+/* PR c/18946 */
+/* { dg-do compile } */
+/* { dg-options "-Wshadow" } */
+
+void bar (void)
+{
+ {
+ if (foo) /* { dg-error "undeclared|for each" } */
+ foo (); /* { dg-warning "shadows previous" } */
+ }
+}
+
+void baz (void)
+{
+ if (foo) /* { dg-error "undeclared" } */
+ {
+ int foo; /* { dg-warning "shadows previous" } */
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920507-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920507-1.c
new file mode 100644
index 000000000..22b7b0a8b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920507-1.c
@@ -0,0 +1,8 @@
+/* { dg-options "-ffat-lto-objects" } */
+int *
+x(void)
+{
+ register int *a asm("unknown_register"); /* { dg-error "invalid register" } */
+ int *v[1] = {a};
+ return v[0];
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920616-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920616-2.c
new file mode 100644
index 000000000..25f59434f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920616-2.c
@@ -0,0 +1 @@
+f(void a,...){} /* { dg-error "has incomplete type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920721-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920721-2.c
new file mode 100644
index 000000000..b21ff994e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920721-2.c
@@ -0,0 +1,6 @@
+void f(int n)
+{
+int s;
+for(s=0;s<n;s++)
+ s==5?1 n=1; /* { dg-error "parse error|syntax error|expected" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920824-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920824-1.c
new file mode 100644
index 000000000..bc8b19c3c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920824-1.c
@@ -0,0 +1 @@
+struct s{struct s{int i;}x;}; /* { dg-error "nested redefinition" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920923-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920923-1.c
new file mode 100644
index 000000000..ccd1dc3a7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/920923-1.c
@@ -0,0 +1,127 @@
+/* { dg-message "undeclared identifier is reported only once" "reminder for mmu_base" { target *-*-* } 0 } */
+typedef BYTE unsigned char; /* { dg-error "expected" } */
+typedef int item_n;
+typedef int perm_set;
+struct PENT { caddr_t v_addr; };/* { dg-error "unknown type name" } */
+typedef struct PENT prec;
+typedef struct PENT *prec_t;
+prec_t mem_hash;
+BYTE *mem_base; /* { dg-error "unknown type name" } */
+struct PTE {
+ BYTE *p_page; /* { dg-error "unknown type name" } */
+ perm_set p_perms;
+};
+typedef struct PTE pte;
+struct PTP {
+ union {
+ struct *PTP p_tablep; /* { dg-error "expected" } */
+ struct *PTE p_entry;
+ } u;
+ int valid;
+};
+typedef struct PTP (u.p_tablep);/* { dg-error "expected" } */
+int pfree=0;
+int pcount=0;
+
+void
+mmu_walk_find(va)
+caddr_t va; /* { dg-error "unknown type name" } */
+{
+ BYTE *page_addr; /* { dg-error "unknown type name" } */
+ if (mmu_base[Level1(va)]->valid==0x0) { /* { dg-error "undeclared" } */
+ l1_base = mmu_base[Level1(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
+ mmu_base[Level1(va)]->valid = 0x3;
+ for (idx=0; idx<LEVEL1_ENTRIES; idx++) /* { dg-error "undeclared" } */
+ l1_base[idx]->valid = 0x0;
+ goto build_level2;
+ } else
+ l1_base = mmu_base[Level1(va)]->(u.p_tablep); /* { dg-error "expected" } */
+
+ if (l1_base[Level2(va)]->valid==0x0) {
+ build_level2:
+ l2_base = l1_base[Level2(va)]->(u.p_tablep) = p_alloc(); /* { dg-error "expected|undeclared" } */
+ l1_base[Level2(va)]->valid = 0x3;
+ for (idx=0; idx<LEVEL2_ENTRIES; idx++) /* { dg-error "undeclared" } */
+ l2_base[idx]->valid=0x0;
+ goto build_page; /* { dg-error "used but not defined" } */
+ } else
+ l2_base = mmu_base[Level2(va)]->(u.p_tablep); /* { dg-error "expected" } */
+
+ page_addr = l2_base[Level2(va)]->valid;
+}
+
+void *
+a_translate(va_op, v_addr)
+int va_op;
+caddr_t v_addr; /* { dg-error "unknown type name" } */
+{
+ register prec_t bucket;
+ register caddr_t p_addr; /* { dg-error "unknown type name" } */
+ bucket = mem_hash+((((v_addr)>>ITEMBITS))&hash_mask); /* { dg-error "undeclared" } */
+ do {
+ if (bucket->v_addr == ((v_addr)>>ITEMBITS) { /* { dg-error "expected|undeclared|no member" } */
+ if(!(bucket->perm_set&va_op))
+ goto prot_fault;
+ return mem_base + v_addr;
+ }
+ } while((bucket++)->v_addr != ((caddr_t)0)); /* { dg-error "expected|undeclared|no member" } */
+
+ page_miss:
+ p_addr = (--bucket)->p_addr; /* { dg-error "no member" } */
+ page_type:
+ switch (p_addr) {
+ case BUCKET_FULL: /* { dg-error "undeclared" } */
+ enlarge_hash_table(mem_hash);
+ case((caddr_t)0): /* { dg-error "expected" } */
+ p_addr = fill_item_entry(va_op, v_addr);
+ goto page_type;
+ case((caddr_t)1): /* { dg-error "expected" } */
+ default:
+ ((void)(((0))?0:(__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
+ "FALSE", 327, "b.c"), 0)));
+ }
+}
+
+void
+flush_hash(hasht, hash_size)
+prec_t hasht;
+int hash_size;
+{
+ register prec_t bucket;
+ register int idx;
+ bucket = hasht;
+ for(idx=(hash_size*3)-1; idx>=0; idx--) {
+ bucket->v_addr = ((caddr_t)0);/* { dg-error "undeclared|expected|no member" } */
+ bucket->p_addr = ((caddr_t)0);/* { dg-error "no member|expected" } */
+ bucket->perm_set = VA_EMPTY; /* { dg-error "undeclared|no member" } */
+ }
+}
+
+extern void *calloc(__SIZE_TYPE__, __SIZE_TYPE__);
+
+void
+init_mem()
+{
+ mem_base = (BYTE *) calloc(1024, (1<<13)); /* { dg-error "undeclared|expected" } */
+ ((void)((mem_base != (BYTE *)0) /* { dg-error "expected" } */
+ ? 0
+ : (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
+ "mem_base != (BYTE *)0", 366, "b.c"),
+ 0)));
+ hash_num = INIT_NUM_ENTRIES * 3; /* { dg-error "undeclared" } */
+ mem_hash = (prec_t) calloc(hash_num, sizeof(prec));
+ ((void)((mem_hash != (prec_t)0)
+ ? 0
+ : (__eprintf("Failed assertion`%s'at line%d of`%s'.\n",
+ "mem_hash != (prec_t)0", 370, "b.c"),
+ 0)));
+ flush_hash(mem_hash, 32);
+ build_ptables(mem_base, 1024*(1<<13)); /* { dg-bogus "integer overflow" "int smaller than 32 bits" { xfail int16 } } */
+}
+
+struct tm {
+ int tm_sec; int tm_min; int tm_hour;
+ int tm_mday;int tm_mon; int tm_year;
+ int tm_wday;int tm_yday;int tm_isdst;
+ char*tm_zone; long tm_gmtoff;
+};
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921102-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921102-1.c
new file mode 100644
index 000000000..ef04b1b2a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921102-1.c
@@ -0,0 +1 @@
+int x[]={[0.3 ... 4.6]9}; /* { dg-error "not of integer type|near init" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921116-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921116-1.c
new file mode 100644
index 000000000..890bbb634
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/921116-1.c
@@ -0,0 +1 @@
+void a (void x) {} /* { dg-error "has incomplete type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930301-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930301-1.c
new file mode 100644
index 000000000..afabd1513
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930301-1.c
@@ -0,0 +1,5 @@
+struct a *q;
+f()
+{
+ q++; /* { dg-error "pointer to" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-1.c
new file mode 100644
index 000000000..835e072c6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-1.c
@@ -0,0 +1,6 @@
+f ()
+{
+ double b;
+ b = b * 10;
+ goto c; /* { dg-error "used but not defined" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-2.c
new file mode 100644
index 000000000..5e02d8951
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930622-2.c
@@ -0,0 +1,6 @@
+f ()
+{
+ int i;
+ for (i--) /* { dg-error "parse|syntax|expected" } */
+ ;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930714-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930714-1.c
new file mode 100644
index 000000000..bdbc13394
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/930714-1.c
@@ -0,0 +1,25 @@
+typedef union _yystype
+{
+ int i;
+ int *iptr;
+ int (*ifunc)(int);
+ void (*vfunc)(int);
+}
+YYSTYPE;
+
+extern int f1(int k);
+
+void test()
+{
+ YYSTYPE a;
+ int (*iptr)(int);
+ int foo[5];
+
+ a = f1; /* { dg-error "incompatible types" } */
+ a = (YYSTYPE)f1;
+ a = (YYSTYPE)foo;
+ a = (YYSTYPE)(int *)foo;
+ iptr = f1;
+ a = iptr; /* { dg-error "incompatible types" } */
+ a = (YYSTYPE)iptr;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/931203-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/931203-1.c
new file mode 100644
index 000000000..0c6a9f2d3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/931203-1.c
@@ -0,0 +1,11 @@
+typedef struct
+{
+ int x, y;
+} point_t;
+
+
+point_t
+f ()
+{
+ return 0; /* { dg-error "incompatible types" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940112-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940112-1.c
new file mode 100644
index 000000000..bb5e0f66c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940112-1.c
@@ -0,0 +1,7 @@
+double
+f (int x)
+{
+ double e = 1;
+ e = 1;
+ return (e)
+} /* { dg-error "parse error|syntax error|expected" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940227-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940227-1.c
new file mode 100644
index 000000000..2e6d91393
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/940227-1.c
@@ -0,0 +1,5 @@
+struct font {
+ struct {
+ char *line,*ulmask;
+ } c[2];
+} character[1] = { { {"", ""}, {"", ""} } }; /* { dg-error "extra|near|excess" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950825-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950825-1.c
new file mode 100644
index 000000000..43dca2f10
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950825-1.c
@@ -0,0 +1,4 @@
+main()
+{
+return (struct x) {{y: 0}}; /* { dg-error "extra|near|excess|incompatible|invalid" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950921-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950921-1.c
new file mode 100644
index 000000000..f141d510b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/950921-1.c
@@ -0,0 +1,10 @@
+typedef enum
+{
+ a = (X) 0, /* { dg-error "undeclared|not integer|parse error|syntax error|expected" } */
+ b
+} c;
+
+typedef enum
+{
+ d = (X) 0 /* { dg-error "undeclared|not integer|parse error|syntax error|expected" } */
+} e;
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/951123-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/951123-1.c
new file mode 100644
index 000000000..009d02b8f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/951123-1.c
@@ -0,0 +1,2 @@
+struct S { int a; int b[2]; };
+struct S x = { 0, [0]; }; /* { dg-error "array index|near|parse|syntax|expected" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/971104-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/971104-1.c
new file mode 100644
index 000000000..722b71c78
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/971104-1.c
@@ -0,0 +1,29 @@
+extern int printf(const char *, ...);
+typedef unsigned short ushort;
+struct sembuf {
+ ushort sem_num;
+ short sem_op;
+ short sem_flg;
+};
+union semun {
+ int val;
+ struct semid_ds *buf;
+ ushort *array;
+ struct seminfo *__buf;
+ void *__pad;
+};
+static union semun semctl_arg;
+static int semid;
+static void up(int sem){
+ struct sembuf sb;
+ sb.sem_num = (unsigned short) sem;
+ sb.sem_op = 1;
+ sb.sem_flg = 0x1000 ;
+ if(semop(semid, &sb, 1) == -1) error("up failure");
+ if(semctl(semid, sb.sem_num, 12 , semctl_arg) == 0)
+ printf("%s had processes sleeping on it!\n",
+ ({ "MUTEX ", "BARB_SEM 1", "BARB_SEM 2", "CUST_SEM 1",
+ "CUST_SEM 2", "WAIT_SEM 1", "WAIT_SEM 2", "WAIT_SEM 3",
+ "WAIT_SEM 4"} /* { dg-error "parse error|syntax error|expected" } */
+ [( sb.sem_num )]) ); /* { dg-error "expected" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/990416-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/990416-1.c
new file mode 100644
index 000000000..91801910b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/990416-1.c
@@ -0,0 +1,12 @@
+extern void *memcpy (void *, const void *, __SIZE_TYPE__);
+typedef int word_type;
+
+static void
+copy_reg (unsigned int reg, frame_state *udata, /* { dg-error "unknown type name" } */
+ frame_state *target_udata) /* { dg-error "unknown type name" } */
+{
+ word_type *preg = ge_reg_addr (reg, udata, 0);
+ word_type *ptreg = ge_reg_addr (reg, target_udata, 0);
+
+ memcpy (ptreg, preg, __builtin_dwarf_reg_size (reg));
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/const-ll-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/const-ll-1.c
new file mode 100644
index 000000000..cac3af6aa
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/const-ll-1.c
@@ -0,0 +1,24 @@
+/* Test for broken long long suffixes. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+
+/* The following are valid integer suffixes, according to C99:
+
+ no suffix
+ u or U
+ ul, uL, Ul or UL
+ ull, uLL, Ull or ULL
+ l or L
+ lu, lU, Lu or LU
+ llu, llU, LLu or LLU
+
+ The following are not but have been accepted by GCC in the past:
+
+ lul and case variants (the 'l's being separated by a 'u')
+ lL, Ll and variants with a 'u' (mixed case pair of 'l's)
+
+ (cpplib gets this right when processing #if expressions.)
+
+*/
+
+unsigned long long a = 1LUL; /* { dg-error "lul|LUL" "error for LUL suffix" } */
+long long b = 1Ll; /* { dg-error "Ll" "error for Ll suffix" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-1.c
new file mode 100644
index 000000000..773643b3f
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-1.c
@@ -0,0 +1,4 @@
+struct a
+{
+ struct b t; /* { dg-error "has incomplete type" } */
+};
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c
new file mode 100644
index 000000000..0c707e372
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-2.c
@@ -0,0 +1,12 @@
+/* Origin: <steven@gcc.gnu.org>
+ Make sure we do not ICE when the type in the function
+ argument list is incomplete (Bug 10602). */
+/* { dg-options "-w" } */
+
+int g95_type_for_mode (enum machine_mode);
+
+int
+g95_type_for_mode (enum machine_mode mode) /* { dg-error "incomplete type" } */
+{
+ return 0;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c
new file mode 100644
index 000000000..735ef465b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-3.c
@@ -0,0 +1,9 @@
+/* Both occurrences of "c" should get diagnostics. PR 12391. */
+typedef struct { int a; } b_t;
+
+int foo (void)
+{
+ b_t d;
+ struct b_t *c = &d; /* { dg-warning "incompatible pointer type" } */
+ c->a; /* { dg-error "incomplete type" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-4.c
new file mode 100644
index 000000000..a4f47694d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-4.c
@@ -0,0 +1,4 @@
+void foo()
+{
+ enum E e; /* { dg-error "storage size" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c
new file mode 100644
index 000000000..049c34a20
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c
@@ -0,0 +1,8 @@
+/* ICE on unnamed field with incomplete enum type: PR 40032. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+struct A
+{
+ enum E : 8; /* { dg-warning "narrower than values of its type" } */
+ /* { dg-error "has incomplete type" "incomplete" { target *-*-* } 6 } */
+};
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-1.c
new file mode 100644
index 000000000..007991b6a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-1.c
@@ -0,0 +1,17 @@
+struct a
+{ double a, b, c; };
+
+struct b
+{
+ struct a arr[6];
+};
+
+static struct b a_b =
+{
+ {0,0,0},
+ {0,0,0}, /* { dg-error "extra brace|excess elements|near" } */
+ {0,0,0}, /* { dg-error "extra brace|excess elements|near" } */
+ {0,0,0}, /* { dg-error "extra brace|excess elements|near" } */
+ {0,0,0}, /* { dg-error "extra brace|excess elements|near" } */
+ {0,0,0}, /* { dg-error "extra brace|excess elements|near" } */
+};
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-2.c
new file mode 100644
index 000000000..b0699023a
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-2.c
@@ -0,0 +1 @@
+int d[][] = { {1}, {2}, {3} }; /* { dg-error "incomplete element type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-3.c
new file mode 100644
index 000000000..fe9543522
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-3.c
@@ -0,0 +1,4 @@
+void die(void)
+{
+ char foo[BAR] = "1234"; /* { dg-error "undeclared|function|incomplete type" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-4.c
new file mode 100644
index 000000000..782251fa3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-4.c
@@ -0,0 +1 @@
+struct a { char *b; } c[D]; /* { dg-error "undeclared" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-5.c
new file mode 100644
index 000000000..366397aef
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/init-5.c
@@ -0,0 +1,4 @@
+/* Test for ICE after syntax error in initializer with range
+ designator: PR 35446. */
+
+int a[2][2] = { [0 ... 1] = { ; } }; /* { dg-error "expected expression" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c
new file mode 100644
index 000000000..d1d4b364b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/invalid_asm.c
@@ -0,0 +1,5 @@
+/* { dg-options "-ffat-lto-objects" } */
+asm_invalid_register_name()
+{
+ asm("":::"this_is_an_invalid_register_name"); /* { dg-error "unknown register" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-1.c
new file mode 100644
index 000000000..58d212f96
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-1.c
@@ -0,0 +1,175 @@
+/* Test various diagnostics of ill-formed constructs involving labels. */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+extern void dummy(void);
+
+/* labels must be defined */
+void a(void)
+{
+ goto l; /* { dg-error "used but not defined" "no label" } */
+}
+
+/* warnings for labels defined but not used, or declared but not defined */
+void b(void)
+{
+ __label__ l;
+ l: /* { dg-warning "defined but not used" "no goto 1" } */
+ m: /* { dg-warning "defined but not used" "no goto 2" } */
+ dummy();
+}
+
+void c(void)
+{
+ __label__ l; /* { dg-warning "declared but not defined" "only __label__" } */
+ dummy();
+}
+
+/* can't have two labels with the same name in the same function */
+void d(void)
+{
+ l: dummy(); /* { dg-message "note: previous definition" "prev def same scope" } */
+ l: dummy(); /* { dg-error "duplicate label" "dup label same scope" } */
+ goto l;
+}
+
+/* even at different scopes */
+void e(void)
+{
+ l: dummy(); /* { dg-message "note: previous definition" "prev def diff scope" } */
+ {
+ l: dummy(); /* { dg-error "duplicate label" "dup label diff scope" } */
+ }
+ goto l;
+}
+
+/* but, with __label__, you can */
+void f(void)
+{
+ l: dummy();
+ {
+ __label__ l;
+ l: dummy(); /* { dg-warning "defined but not used" "unused shadow 1" } */
+ };
+ goto l; /* this reaches the outer l */
+}
+
+/* a __label__ is not visible outside its scope */
+void g(void)
+{
+ dummy();
+ {
+ __label__ l;
+ l: dummy();
+ goto l;
+ }
+ goto l; /* { dg-error "used but not defined" "label ref out of scope" } */
+}
+
+/* __label__ can appear at top level of a function, too...
+ ... but doesn't provide a definition of the label */
+void h(void)
+{
+ __label__ l;
+ dummy ();
+
+ goto l; /* { dg-error "used but not defined" "used, only __label__" } */
+}
+
+/* A nested function may not goto a label outside itself */
+void i(void)
+{
+ auto void nest(void);
+
+ l: nest();
+
+ void nest(void)
+ {
+ goto l; /* { dg-error "used but not defined" "nest use outer label" } */
+ }
+
+ goto l; /* reaches the outer l */
+}
+
+/* which means that a nested function may have its own label with the
+ same name as the outer function */
+void j(void)
+{
+ auto void nest(void);
+
+ l: nest();
+
+ void nest(void)
+ {
+ l: dummy(); /* { dg-warning "defined but not used" "nest label same name" } */
+ }
+
+ goto l; /* reaches the outer l */
+}
+
+/* and, turnabout, an outer function may not goto a label in a nested
+ function */
+void k(void)
+{
+ void nest(void)
+ {
+ l: dummy(); /* { dg-warning "defined but not used" "outer use nest label" } */
+ }
+
+ goto l; /* { dg-error "used but not defined" "outer use nest label" } */
+ nest();
+}
+
+/* not even with __label__ */
+void l(void)
+{
+ void nest(void)
+ {
+ __label__ l;
+ l: dummy(); /* { dg-warning "defined but not used" "outer use nest __label__" } */
+ }
+
+ goto l; /* { dg-error "used but not defined" "outer use nest __label__" } */
+ nest();
+}
+
+
+/* but if the outer label is declared with __label__, then a nested
+ function can goto that label (accomplishing a longjmp) */
+void m(void)
+{
+ __label__ l;
+ void nest(void) { goto l; }
+ nest();
+ dummy();
+ l:;
+}
+
+/* and that means the nested function cannot have its own label with
+ the same name as an outer label declared with __label__ */
+
+void n(void)
+{
+ __label__ l; /* { dg-message "note: previous declaration" "outer label decl" } */
+ void nest(void)
+ {
+ l: goto l; /* { dg-error "duplicate label" "inner label defn" } */
+ }
+
+ l:
+ nest();
+}
+
+/* unless the nested function uses __label__ too! */
+void o(void)
+{
+ __label__ l;
+ void nest(void)
+ {
+ __label__ l;
+ l: goto l;
+ }
+
+ l: goto l;
+ nest();
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
new file mode 100644
index 000000000..6d4def7ea
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
@@ -0,0 +1,14 @@
+/* Ensure that diagnostics for labels appear on the correct lineno.
+ by Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/23/2000. */
+
+void
+foo(int i)
+{
+ my_label: /* { dg-message "note: previous definition" "prev label" } */
+
+ i++;
+
+ my_label: /* { dg-error "duplicate label" "label lineno" } */
+
+ i++;
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/noncompile.exp b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/noncompile.exp
new file mode 100644
index 000000000..15460ef2b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/noncompile.exp
@@ -0,0 +1,25 @@
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Test error reporting.
+# Don't run this directory with any default CFLAGS, but do cycle through
+# torture options.
+
+load_lib gcc-dg.exp
+
+dg-init
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
+dg-finish
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c
new file mode 100644
index 000000000..5f879c3f0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-1.c
@@ -0,0 +1,11 @@
+/* Test that stray semicolon in old-style parameters is not
+ accepted. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+f(a)
+ int a;; /* { dg-error "parse error|syntax error|expected declaration specifiers" } */
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c
new file mode 100644
index 000000000..1b156b770
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/old-style-parm-2.c
@@ -0,0 +1,11 @@
+/* Test that parameter without declaration specifiers in old-style
+ parameters is not accepted. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+f(a)
+ a; /* { dg-error "parse error|syntax error|no type or storage class|expected declaration specifiers" } */
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr23576.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr23576.c
new file mode 100644
index 000000000..384b0f68c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr23576.c
@@ -0,0 +1 @@
+struct ipr_path_entry path[0]; /* { dg-error "array type has incomplete element type" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c
new file mode 100644
index 000000000..f85588786
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-1.c
@@ -0,0 +1,3 @@
+/* PR 35444: ICE from pending VLA sizes in invalid parameter list. */
+void foo(int n, int a[n], int 0); /* { dg-error "expected" } */
+void bar() {}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c
new file mode 100644
index 000000000..43817b90d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35444-2.c
@@ -0,0 +1,4 @@
+/* PR 35444: ICE from pending VLA sizes in invalid parameter list.
+ Similar case to the PR, but with "..." before the syntax error. */
+void foo(int n, int a[n], ... 0); /* { dg-error "expected" } */
+void bar() {}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c
new file mode 100644
index 000000000..9c31e9bb6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr35447-1.c
@@ -0,0 +1,7 @@
+/* ICE arising from preparing to enter a scope for a nested function
+ but never doing so. PR 35447. */
+
+void foo()
+{
+ ({ int i().; }); /* { dg-error "expected" } */
+} /* { dg-error "expected" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
new file mode 100644
index 000000000..4f0744207
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr40033-1.c
@@ -0,0 +1,7 @@
+/* ICE from error_mark_node being wrapped in a C_MAYBE_CONST_EXPR. PR
+ 40033. */
+
+void foo()
+{
+ ({ 0,; }); /* { dg-error "expected" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr44517.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr44517.c
new file mode 100644
index 000000000..fa9a9df2d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr44517.c
@@ -0,0 +1,18 @@
+/* PR c/44517: Improve diagnostic for misspelled typename in function declaration. */
+int f1(int x, pid_t y, long z, in t) {
+/* { dg-error "unknown type name 'pid_t'" "pid_t" { target *-*-* } 2 } */
+/* { dg-error "unknown type name 'in'" "in" { target *-*-* } 2 } */
+ return x + y + z + t;
+}
+
+int f2(int x, lon y, long z, ...){ /* { dg-error "unknown type name 'lon'" } */
+ return;
+}
+
+void f3(int n, int a[n], pid_t x); /* { dg-error "unknown type name 'pid_t'" } */
+void f4() {}
+void f5(int a, *b); /* { dg-error "expected declaration specifiers or" } */
+void f6(int a, b); /* { dg-error "unknown type name 'b'" } */
+void f7(int a, goto b); /* { dg-error "expected declaration specifiers or" } */
+void f8(int a, in goto); /* { dg-error "unknown type name 'in'" } */
+void f9(int a, in 1); /* { dg-error "unknown type name 'in'" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr52290.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr52290.c
new file mode 100644
index 000000000..ac408fbd1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/pr52290.c
@@ -0,0 +1,3 @@
+/* { dg-error "undeclared here" "undeclared" { target *-*-* } 3 } */
+/* { dg-error "expected" "expected" { target *-*-* } 3 } */
+int f()[j]
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/redecl-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
new file mode 100644
index 000000000..732db0098
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
@@ -0,0 +1,9 @@
+/* Copyright 2000 Free Software Foundation */
+/* by Alexandre Oliva <aoliva@redhat.com> */
+
+int
+foo ()
+{
+ int bar; /* { dg-message "note: previous.*decl" "previous.*decl" } */
+ volatile int bar; /* { dg-error "conflicting type qualifiers" "conflicting type qualifiers" } */
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/scope.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/scope.c
new file mode 100644
index 000000000..7f09c27cf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/scope.c
@@ -0,0 +1,19 @@
+extern void abort (void);
+extern void exit (int);
+static int v = 3;
+
+f ()
+{
+ int v = 4;
+ {
+ extern int v; /* { dg-error "static" } */
+ if (v != 3)
+ abort ();
+ }
+}
+
+main ()
+{
+ f ();
+ exit (0);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c
new file mode 100644
index 000000000..5bb7c2a4d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-1.c
@@ -0,0 +1,8 @@
+/* Test for no ICE with an undeclared identifier in an enum in old-style
+ parameter decls. PR 12560. */
+/* { dg-options "-w" } */
+
+foo(c)
+ enum { a = b } c; /* { dg-error "undeclared|for each" } */
+{
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c
new file mode 100644
index 000000000..36cd0eaf1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/undeclared-2.c
@@ -0,0 +1,3 @@
+/* Invalid, but should not ICE. PRs 11944, 14734. */
+
+void foo(const int[i]); /* { dg-error "undeclared|for each" } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/va-arg-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/va-arg-1.c
new file mode 100644
index 000000000..b8b7d3c31
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/va-arg-1.c
@@ -0,0 +1,8 @@
+#include <stdarg.h>
+
+f (int x, ...)
+{
+ va_list args;
+ va_start (args, bogus_variable); /* { dg-error "undeclared|for each function|not last named" } */
+ va_end (args);
+}
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/voidparam-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/voidparam-1.c
new file mode 100644
index 000000000..3378adddf
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/noncompile/voidparam-1.c
@@ -0,0 +1,17 @@
+/* Test for bad uses of 'void' in parameter lists. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+
+typedef const void cv;
+typedef volatile void vv;
+
+void foo0 (const void); /* { dg-error "parameter" "const void decl" } */
+void foo0a (cv); /* { dg-error "parameter" "const void decl" } */
+void foo1 (volatile void); /* { dg-error "parameter" "volatile void decl" } */
+void foo1a (vv); /* { dg-error "parameter" "volatile void decl" } */
+void foo2 (register void); /* { dg-error "parameter" "register void decl" } */
+
+void bar0 (const void) { } /* { dg-error "parameter" "const void defn" } */
+void bar0a (cv) { } /* { dg-error "parameter" "const void defn" } */
+void bar1 (volatile void) { } /* { dg-error "parameter" "volatile void defn" } */
+void bar1a (vv) { } /* { dg-error "parameter" "volatile void defn" } */
+void bar2 (register void) { } /* { dg-error "parameter" "register void defn" } */