aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-01-25 06:36:24 +0000
committerRichard Stallman <rms@gnu.org>1993-01-25 06:36:24 +0000
commit7d9795e55251f0bbd8ae853c2aca0f35dba431e3 (patch)
tree6f953746f7c7586bd9dbcc4b686ca51efd99e91e /gcc
parent3f7531dbac9de32a7297f07f3a3aa6136cc72c48 (diff)
downloadgcc-7d9795e55251f0bbd8ae853c2aca0f35dba431e3.zip
gcc-7d9795e55251f0bbd8ae853c2aca0f35dba431e3.tar.gz
gcc-7d9795e55251f0bbd8ae853c2aca0f35dba431e3.tar.bz2
(lookup_label): Return 0 if not within a function.
From-SVN: r3324
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 3222fd0..cc5e011 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2226,6 +2226,13 @@ lookup_label (id)
{
register tree decl = IDENTIFIER_LABEL_VALUE (id);
+ if (current_function_decl == 0)
+ {
+ error ("label %s referenced outside of any function",
+ IDENTIFIER_POINTER (id));
+ return 0;
+ }
+
/* Use a label already defined or ref'd with this name. */
if (decl != 0)
{