aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/label-scope1.c
diff options
context:
space:
mode:
Diffstat (limited to 'validation/label-scope1.c')
-rw-r--r--validation/label-scope1.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/validation/label-scope1.c b/validation/label-scope1.c
new file mode 100644
index 00000000..f2b1ae9b
--- /dev/null
+++ b/validation/label-scope1.c
@@ -0,0 +1,42 @@
+static void ok_top(void)
+{
+ __label__ l;
+l:
+ goto l;
+}
+
+static void ko_undecl(void)
+{
+ __label__ l;
+ goto l; // KO: undeclared
+}
+
+static void ok_local(void)
+{
+l:
+ {
+ __label__ l;
+l:
+ goto l;
+ }
+goto l;
+}
+
+static void ko_scope(void)
+{
+ {
+ __label__ l;
+l:
+ goto l;
+ }
+goto l; // KO: undeclared
+}
+
+/*
+ * check-name: label-scope1
+ *
+ * check-error-start
+label-scope1.c:11:9: error: label 'l' was not declared
+label-scope1.c:32:1: error: label 'l' was not declared
+ * check-error-end
+ */