diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-11-03 00:00:01 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-11-03 00:00:01 +0000 |
commit | 234f46aead2f46eff4184a37d34a2e5032d83550 (patch) | |
tree | c8da6e748a16b85ed36daaf4bb7209f4529cdd55 /gcc | |
parent | 1b5e9d7e1bd9a954485d45171ffc19e66bcb4edb (diff) | |
download | gcc-234f46aead2f46eff4184a37d34a2e5032d83550.zip gcc-234f46aead2f46eff4184a37d34a2e5032d83550.tar.gz gcc-234f46aead2f46eff4184a37d34a2e5032d83550.tar.bz2 |
c-decl.c (pushdecl): Move block inside if conditional to remove possibility of a segfault.
* c-decl.c (pushdecl): Move block inside if conditional to remove
possibility of a segfault. Lookup block-level extern
variables in enclosing scopes correctly.
* testsuite/gcc.c-torture/compile/20001018-1.x: Remove XFAIL.
From-SVN: r46726
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-decl.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20001018-1.x | 2 |
3 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ba1dd7..195406f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-11-02 Neil Booth <neil@daikokuya.demon.co.uk> + + * c-decl.c (pushdecl): Move block inside if conditional to remove + possibility of a segfault. Lookup block-level extern + variables in enclosing scopes correctly. + + * testsuite/gcc.c-torture/compile/20001018-1.x: Remove XFAIL. + 2001-11-02 Aldy Hernandez <aldyh@redhat.com> * expmed.c (store_bit_field): Use simplify_gen_subreg to make diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c840057..a907770 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2115,25 +2115,28 @@ pushdecl (x) && DECL_INITIAL (x) == 0 && DECL_EXTERNAL (x)) DECL_CONTEXT (x) = 0; - if (warn_nested_externs && DECL_EXTERNAL (x) && b != global_binding_level - && x != IDENTIFIER_IMPLICIT_DECL (name) - /* Don't print error messages for __FUNCTION__ and __PRETTY_FUNCTION__ */ - && !DECL_IN_SYSTEM_HEADER (x)) - warning ("nested extern declaration of `%s'", IDENTIFIER_POINTER (name)); - if (name) { const char *file; int line; int different_binding_level = 0; + if (warn_nested_externs + && DECL_EXTERNAL (x) + && b != global_binding_level + && x != IDENTIFIER_IMPLICIT_DECL (name) + /* No error messages for __FUNCTION__ and __PRETTY_FUNCTION__. */ + && !DECL_IN_SYSTEM_HEADER (x)) + warning ("nested extern declaration of `%s'", + IDENTIFIER_POINTER (name)); + t = lookup_name_current_level (name); /* Don't type check externs here when -traditional. This is so that code with conflicting declarations inside blocks will get warnings not errors. X11 for instance depends on this. */ if (! t && DECL_EXTERNAL (x) && TREE_PUBLIC (x) && ! flag_traditional) { - t = IDENTIFIER_GLOBAL_VALUE (name); + t = lookup_name (name); /* Type decls at global scope don't conflict with externs declared inside lexical blocks. */ if (t && TREE_CODE (t) == TYPE_DECL) diff --git a/gcc/testsuite/gcc.c-torture/compile/20001018-1.x b/gcc/testsuite/gcc.c-torture/compile/20001018-1.x deleted file mode 100644 index f41cdc2..0000000 --- a/gcc/testsuite/gcc.c-torture/compile/20001018-1.x +++ /dev/null @@ -1,2 +0,0 @@ -set torture_compile_xfail "*-*-*" -return 0 |