aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-06-16 05:12:15 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-06-16 05:12:15 +0000
commite1b7793c8ebdc72bd3d7283d70a29444da614c13 (patch)
tree8497f69348fcfb23ffa019c746e037539cb42cc0 /gcc/testsuite
parentdee6f5752949e9c53e1706925ad934760bcab775 (diff)
downloadgcc-e1b7793c8ebdc72bd3d7283d70a29444da614c13.zip
gcc-e1b7793c8ebdc72bd3d7283d70a29444da614c13.tar.gz
gcc-e1b7793c8ebdc72bd3d7283d70a29444da614c13.tar.bz2
df-problems.c (df_simulate_one_insn_forwards): Fix braces in switch.
./: * df-problems.c (df_simulate_one_insn_forwards): Fix braces in switch. * gcov.c (read_count_file): Add braces around variables declared before label. * c.opt (Wjump-misses-init): New warning. * c-opts.c (c_common_handle_option): Set warn_jump_misses_init for -Wall and -Wc++-compat if not already set. (c_common_post_options): Clear warn_jump_misses_init if it was not set. * c-decl.c (struct c_binding): Change type field to a union with new label field. Make it the first field in the struct. Update references to type to use u.type instead. (struct c_spot_bindings): Define. (struct c_goto_bindings): Define. (c_goto_bindings_p): Define, along with VECs. (struct c_label_vars): Define. (struct c_scope): Add has_label_bindings field. (bind_label, set_spot_bindings): New static functions. (decl_jump_unsafe, update_spot_bindings): New static functions. (update_label_decls): New static function. (pop_scope): Call update_label_decls. Don't call c_end_vm_scope. Update binding u.label field to shadowed field. (c_binding_start_stmt_expr): New function. (c_binding_end_stmt_expr): New function. (pushdecl): Don't call c_begin_vm_scope. (make_label): Add defining and p_label_vars parameters. Change all callers. (lookup_label): Correct test for whether a label has not yet been defined. Call bind_label rather than bind. (warn_about_goto): New static function. (lookup_label_for_goto): New function. (declare_label): Call bind_label rather than bind. (check_earlier_gotos): New static function. (define_label): Don't give errors about jumping into statement expressions or scopes of variably modified types. Call set_spot_bindings and check_earlier_gotos. Call bind_label instead of bind. Don't set label_context_stack_se or label_context_stack_vm. (c_get_switch_bindings): New function. (c_release_switch_bindings): New function. (c_check_switch_jump_warnings): New function. (start_function): Don't set label_context_stack_se or label_context_stack_vm. (finish_function): Likewise. * c-typeck.c (label_context_stack_se): Don't define. (label_context_stack_vm): Don't define. (c_finish_goto_label): Call lookup_label_for_goto rather than lookup_label. Don't give errors about jumping into a statement expression or the scope of a variably modified type. Don't set label_context_stack_se or label_context_stack_vm. (struct c_switch): Remove blocked_stmt_expr and blocked_vm fields. Add bindings field. (c_start_case): Don't set deleted fields. Set bindings field. (do_case): Rework order of tests. Don't check blocked_stmt_expr or blocked_vm. Call c_check_switch_jump_warnings. (c_finish_case): Don't test blocked_stmt_expr field. Call c_release_switch_bindings. (c_begin_stmt_expr): Don't increment blocked_stmt_expr in c_switch_stack. Don't walk label_context_stack_se labels. Don't set label_context_stack_se. Call c_bindings_start_stmt_expr. (c_finish_stmt_expr): Don't decrement blocked_stmt_expr in c_switch_stack. Don't walk label_context_stack_se labels. Don't set label_context_stack_se. Call c_bindings_end_stmt_expr. (c_begin_vm_scope, c_end_vm_scope): Don't define. * c-tree.h (C_DECL_UNJUMPABLE_STMT_EXPR): Don't define. (C_DECL_UNDEFINABLE_STMT_EXPR): Don't define. (C_DECL_UNJUMPABLE_VM): Don't define. (C_DECL_UNDEFINABLE_VM): Don't define. (struct c_label_list): Don't define. (struct c_label_context_se): Don't define. (struct c_label_context_vm): Don't define. (struct c_spot_bindings): Declare. (c_bindings_start_stmt_expr): Declare. (c_bindings_end_stmt_expr): Declare. (lookup_label_for_goto): Declare. (c_get_switch_bindings, c_release_switch_bindings): Declare. (c_check_switch_jump_warnings): Declare. (label_context_stack_se, label_context_stack_vm): Don't declare. (c_finish_goto_label): Update declaration. (c_begin_vm_scope, c_end_vm_scope): Don't declare. * doc/invoke.texi (Option Summary): Mention -Wjump-misses-init. (Warning Options): Document -Wjump-misses-init. cp/: * parser.c (cp_parser_direct_declarator): Add braces around variables declared before label. objc/: * objc-act.c (objc_start_function): Don't set label_context_stack_se or label_context_stack_vm. testsuite/: * gcc.dg/Wjump-misses-init-1.c: New testcase. * gcc.dg/Wjump-misses-init-2.c: New testcase. * gcc.dg/c99-vla-jump-5.c: Adjust expected error messages. Recognize new notes. * gcc.dg/stmt-expr-label-2.c: Likewise. * gcc.dg/c99-vla-jump-1.c: Recognize new notes. Fix column numbers. * gcc.dg/c99-vla-jump-2.c: Recognize new notes. * gcc.dg/c99-vla-jump-3.c: Recognize new notes. * gcc.dg/c99-vla-jump-4.c: Likewise. * gcc.dg/stmt-expr-label-1.c: Likewise. * gcc.dg/stmt-expr-label-3.c: Likewise. * gcc.dg/vla-8.c: Likewise. Move error message to different line. From-SVN: r148512
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog17
-rw-r--r--gcc/testsuite/gcc.dg/Wjump-misses-init-1.c156
-rw-r--r--gcc/testsuite/gcc.dg/Wjump-misses-init-2.c52
-rw-r--r--gcc/testsuite/gcc.dg/c99-vla-jump-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/c99-vla-jump-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-vla-jump-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-vla-jump-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-vla-jump-5.c8
-rw-r--r--gcc/testsuite/gcc.dg/stmt-expr-label-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/stmt-expr-label-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/stmt-expr-label-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/vla-8.c8
12 files changed, 267 insertions, 12 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 62874a7..c961525 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,20 @@
+2009-06-15 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/Wjump-misses-init-1.c: New testcase.
+ * gcc.dg/Wjump-misses-init-2.c: New testcase.
+ * gcc.dg/c99-vla-jump-5.c: Adjust expected error messages.
+ Recognize new notes.
+ * gcc.dg/stmt-expr-label-2.c: Likewise.
+ * gcc.dg/c99-vla-jump-1.c: Recognize new notes. Fix column
+ numbers.
+ * gcc.dg/c99-vla-jump-2.c: Recognize new notes.
+ * gcc.dg/c99-vla-jump-3.c: Recognize new notes.
+ * gcc.dg/c99-vla-jump-4.c: Likewise.
+ * gcc.dg/stmt-expr-label-1.c: Likewise.
+ * gcc.dg/stmt-expr-label-3.c: Likewise.
+ * gcc.dg/vla-8.c: Likewise. Move error message to different
+ line.
+
2009-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-math-6.c: Robustify and fix clog cases.
diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c b/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c
new file mode 100644
index 0000000..86117f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-1.c
@@ -0,0 +1,156 @@
+/* { dg-do compile } */
+/* { dg-options "-Wjump-misses-init" } */
+int
+f1 (int a)
+{
+ if (a > 0)
+ {
+ int i = 7; /* { dg-message "here" } */
+ lab: /* { dg-message "here" } */
+ return a;
+ }
+ else
+ {
+ if (a < 0)
+ goto lab; /* { dg-warning "jump" } */
+ return 1;
+ }
+}
+
+int
+f2 (int a)
+{
+ if (a > 0)
+ {
+ if (a < 0)
+ goto lab; /* { dg-warning "jump" } */
+ return 1;
+ }
+ else
+ {
+ int i = 7; /* { dg-message "here" } */
+ lab: /* { dg-message "here" } */
+ return a;
+ }
+}
+
+int
+f3 (int a)
+{
+ if (a > 0)
+ {
+ static int i = 7;
+ lab:
+ return a;
+ }
+ else
+ {
+ if (a < 0)
+ goto lab;
+ return 1;
+ }
+}
+
+int
+f4 (int a)
+{
+ if (a > 0)
+ {
+ if (a < 0)
+ goto lab;
+ return 1;
+ }
+ else
+ {
+ static int i = 7;
+ lab:
+ return a;
+ }
+}
+
+int
+f5 (int a)
+{
+ if (a > 0)
+ {
+ int b = 1;
+ if (a < 0)
+ goto lab;
+ }
+ lab:
+ return a;
+}
+
+int
+f6 (int a)
+{
+ if (a > 0)
+ {
+ lab:
+ return a;
+ }
+ else
+ {
+ int b = 1;
+ goto lab;
+ }
+}
+
+int
+f7 (int a)
+{
+ switch (a) /* { dg-message "switch" } */
+ {
+ int b = 1; /* { dg-message "here" } */
+
+ case 1: /* { dg-warning "jump" } */
+ return a;
+ }
+}
+
+int
+f8 (int a)
+{
+ switch (a) /* { dg-message "switch" } */
+ {
+ int b = 1; /* { dg-message "here" } */
+
+ case 1: /* { dg-warning "jump" } */
+ goto lab;
+ }
+ lab:
+ return a;
+}
+
+int
+f9 (int a)
+{
+ switch (a)
+ {
+ case 0:
+ {
+ int b = 1;
+ return b;
+ }
+ case 1:
+ return a;
+ }
+}
+
+int
+f10 (int a)
+{
+ switch (a)
+ {
+ case 0:
+ {
+ int b = 1;
+ goto lab;
+ }
+
+ case 1:
+ goto lab;
+ }
+ lab:
+ return a;
+}
diff --git a/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c b/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c
new file mode 100644
index 0000000..042c02a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wjump-misses-init-2.c
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-Wjump-misses-init -std=c99" } */
+extern void f1 ();
+int
+f2 (int a)
+{
+ switch (a) /* { dg-message "switch" } */
+ {
+ case 1:
+ f1 ();
+ int v2 = 3; /* { dg-message "here" } */
+ case 2: /* { dg-warning "jump" } */
+ if (v2 == 7)
+ f1 ();
+ }
+ return 0;
+}
+
+int
+f3 (int i)
+{
+ if (i)
+ goto bad; /* { dg-warning "jump" } */
+ int a = f2 (i); /* { dg-message "here" } */
+ bad: /* { dg-message "here" } */
+ return a;
+}
+
+int
+f4 (int a)
+{
+ switch (a)
+ {
+ case 1:
+ f1 ();
+ static int v2 = 3;
+ case 2:
+ if (v2 == 7)
+ f1 ();
+ }
+ return 0;
+}
+
+int
+f5 (int i)
+{
+ if (i)
+ goto bad;
+ static int a = 6;
+ bad:
+ return a;
+}
diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-1.c b/gcc/testsuite/gcc.dg/c99-vla-jump-1.c
index 3cfa384..8e34b10 100644
--- a/gcc/testsuite/gcc.dg/c99-vla-jump-1.c
+++ b/gcc/testsuite/gcc.dg/c99-vla-jump-1.c
@@ -15,11 +15,11 @@
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
void fa0 (int n) { goto a; a:{ int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; }
-void fa1 (int n) { goto a; { int b[n]; a:{ int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "41:jump into scope of identifier with variably modified type" } */
-void fa2 (int n) { goto a; { int b[n]; { int c[n]; a:0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "53:jump into scope of identifier with variably modified type" } */
-void fa3 (int n) { goto a; { int b[n]; { int c[n]; 0;} a:{ int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "57:jump into scope of identifier with variably modified type" } */
-void fa4 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; a:0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "69:jump into scope of identifier with variably modified type" } */
-void fa5 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} a:; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "73:jump into scope of identifier with variably modified type" } */
+void fa1 (int n) { goto a; { int b[n]; a:{ int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */
+void fa2 (int n) { goto a; { int b[n]; { int c[n]; a:0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */
+void fa3 (int n) { goto a; { int b[n]; { int c[n]; 0;} a:{ int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */
+void fa4 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; a:0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */
+void fa5 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} a:; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "21:jump into scope of identifier with variably modified type" } */
void fa6 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; a:0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */
void fa7 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; a:{ int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; }
void fa8 (int n) { goto a; { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; a:{ int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0; } /* { dg-error "jump into scope of identifier with variably modified type" } */
@@ -303,3 +303,7 @@ void fa285 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}
void fa286 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; a:; int j[n]; 0; goto a; }
void fa287 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; a:0; goto a; }
void fa288 (int n) { { int b[n]; { int c[n]; 0;} { int d[n]; 0;} ; int e[n]; 0;}; { int f[n]; { int g[n]; 0;}; { int h[n]; 0;}; ; int i[n]; 0;}; ; int j[n]; 0;a: goto a; }
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-2.c b/gcc/testsuite/gcc.dg/c99-vla-jump-2.c
index 27cecaa..2b4d4d5 100644
--- a/gcc/testsuite/gcc.dg/c99-vla-jump-2.c
+++ b/gcc/testsuite/gcc.dg/c99-vla-jump-2.c
@@ -303,3 +303,7 @@ void fb285 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:g
void fb286 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; a:; int j[n]; P03A:goto P03A;0;p03B:goto p03B; goto a; P03B:goto P03B; }
void fb287 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; P0C:goto P0C;; int j[n]; a:0;p03B:goto p03B; goto a; P03B:goto P03B; }
void fb288 (int n) { P0A:goto P0A;{ int b[n]; P01A:goto P01A;{ int c[n]; P012A:goto P012A;0;} P01B:goto P01B;{ int d[n]; P013A:goto P013A;0;} P01C:goto P01C;; int e[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ int f[n]; P02A:goto P02A;{ int g[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ int h[n]; P025A:goto P025A;0;}; P02C:goto P02C;; int i[n]; P026A:goto P026A;0;}; P0C:goto P0C;; int j[n]; P03A:goto P03A;0;a: goto a; P03B:goto P03B; }
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-3.c b/gcc/testsuite/gcc.dg/c99-vla-jump-3.c
index 0aff362..ac1ae96 100644
--- a/gcc/testsuite/gcc.dg/c99-vla-jump-3.c
+++ b/gcc/testsuite/gcc.dg/c99-vla-jump-3.c
@@ -303,3 +303,7 @@ void fc285 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef
void fc286 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; a:; typedef int (*j)[n]; 0; goto a; }
void fc287 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; ; typedef int (*j)[n]; a:0; goto a; }
void fc288 (int n) { { typedef int (*b)[n]; { typedef int (*c)[n]; 0;} { typedef int (*d)[n]; 0;} ; typedef int (*e)[n]; 0;}; { typedef int (*f)[n]; { typedef int (*g)[n]; 0;}; { typedef int (*h)[n]; 0;}; ; typedef int (*i)[n]; 0;}; ; typedef int (*j)[n]; 0;a: goto a; }
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-4.c b/gcc/testsuite/gcc.dg/c99-vla-jump-4.c
index e77a142..848dfba 100644
--- a/gcc/testsuite/gcc.dg/c99-vla-jump-4.c
+++ b/gcc/testsuite/gcc.dg/c99-vla-jump-4.c
@@ -303,3 +303,7 @@ void fd285 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typede
void fd286 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; a:; typedef int (*j)[n]; P03A:goto P03A;0;p03B:goto p03B; goto a; P03B:goto P03B; }
void fd287 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; P0C:goto P0C;; typedef int (*j)[n]; a:0;p03B:goto p03B; goto a; P03B:goto P03B; }
void fd288 (int n) { P0A:goto P0A;{ typedef int (*b)[n]; P01A:goto P01A;{ typedef int (*c)[n]; P012A:goto P012A;0;} P01B:goto P01B;{ typedef int (*d)[n]; P013A:goto P013A;0;} P01C:goto P01C;; typedef int (*e)[n]; P014A:goto P014A;0;}; P0B:goto P0B;{ typedef int (*f)[n]; P02A:goto P02A;{ typedef int (*g)[n]; P024A:goto P024A;0;}; P02B:goto P02B;{ typedef int (*h)[n]; P025A:goto P025A;0;}; P02C:goto P02C;; typedef int (*i)[n]; P026A:goto P026A;0;}; P0C:goto P0C;; typedef int (*j)[n]; P03A:goto P03A;0;a: goto a; P03B:goto P03B; }
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/c99-vla-jump-5.c b/gcc/testsuite/gcc.dg/c99-vla-jump-5.c
index ca3f85f..683bcf2 100644
--- a/gcc/testsuite/gcc.dg/c99-vla-jump-5.c
+++ b/gcc/testsuite/gcc.dg/c99-vla-jump-5.c
@@ -16,8 +16,8 @@ f (int a, int b)
{
switch (a) {
int v[b];
- case 2: /* { dg-error "case label in scope of identifier with variably modified type not containing enclosing switch statement" } */
- default: /* { dg-error "'default' label in scope of identifier with variably modified type not containing enclosing switch statement" } */
+ case 2: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */
+ default: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */
switch (a)
{
case 4:
@@ -28,3 +28,7 @@ f (int a, int b)
}
}
}
+
+/* Match extra informative notes. */
+/* { dg-message "note: switch starts here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-1.c b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c
index 57ab34e..a9dd466 100644
--- a/gcc/testsuite/gcc.dg/stmt-expr-label-1.c
+++ b/gcc/testsuite/gcc.dg/stmt-expr-label-1.c
@@ -402,3 +402,6 @@ void f194 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); a:0; goto a
void fa194 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); a:0;p0D:goto p0D; goto a; P0D:goto P0D; }
void f195 (void) { ({ ({0;}); ({0;}); 0;}); ({ ({0;}); ({0;}); 0;}); 0;a: goto a; }
void fa195 (void) { P0A:goto P0A;({ P01A:goto P01A;({P012A:goto P012A;0;}); P01B:goto P01B;({P013A:goto P013A;0;}); P01C:goto P01C;0;}); P0B:goto P0B;({ P02A:goto P02A;({P024A:goto P024A;0;}); P02B:goto P02B;({P025A:goto P025A;0;}); P02C:goto P02C;0;}); P0C:goto P0C;0;a: goto a; P0D:goto P0D; }
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-2.c b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c
index 35b96e8..be7aa52 100644
--- a/gcc/testsuite/gcc.dg/stmt-expr-label-2.c
+++ b/gcc/testsuite/gcc.dg/stmt-expr-label-2.c
@@ -8,13 +8,13 @@
void
f (int a)
{
- switch (a)
+ switch (a) /* { dg-message "here" } */
{
case 0:
case 1:
({
- case 2: /* { dg-error "case label in statement expression not containing enclosing switch statement" } */
- default: /* { dg-error "'default' label in statement expression not containing enclosing switch statement" } */
+ case 2: /* { dg-error "switch jumps into statement expression" } */
+ default: /* { dg-error "switch jumps into statement expression" } */
switch (a)
{
case 3:
diff --git a/gcc/testsuite/gcc.dg/stmt-expr-label-3.c b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c
index 7b1515f..0a67222 100644
--- a/gcc/testsuite/gcc.dg/stmt-expr-label-3.c
+++ b/gcc/testsuite/gcc.dg/stmt-expr-label-3.c
@@ -6,3 +6,6 @@
/* { dg-options "-O2" } */
void f(void) { 1 ? 1 : ({ a : 1; 1; }); goto a; } /* { dg-error "jump into statement expression" } */
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/vla-8.c b/gcc/testsuite/gcc.dg/vla-8.c
index 1d31876..6e14a06 100644
--- a/gcc/testsuite/gcc.dg/vla-8.c
+++ b/gcc/testsuite/gcc.dg/vla-8.c
@@ -23,8 +23,12 @@ void foo1(int n) {
}
void foo2(int n) {
- goto A;
+ goto A; /* { dg-error "jump into scope of identifier with variably modified type" } */
int (*(*bar2)(void))[n];
- A: /* { dg-error "jump into scope of identifier with variably modified type" } */
+ A:
;
}
+
+/* Match extra informative notes. */
+/* { dg-message "note: label '\[^\n'\]*' defined here" "note: expected" { target *-*-* } 0 } */
+/* { dg-message "note: '\[^\n'\]*' declared here" "note: expected" { target *-*-* } 0 } */