From c1bbfd3cf8376f1a145632e57f07b77a06926c1b Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 14 Sep 2004 00:35:02 +0000 Subject: [PATCH] Fix PR 17408 and PR 17409. From-SVN: r87468 --- gcc/ChangeLog | 7 +++++++ gcc/c-decl.c | 7 +++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/pr17408.c | 5 +++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr17408.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 839e78ba902..905684cd26e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-13 Dale Johannesen + + PR 17408 + PR 17409 + * c-decl.c (start_decl): Repair TREE_STATIC for initialized + objects declared extern. + 2004-09-14 Paul Brook * config/arm/arm.c (arm_expand_prologue): Make args_to_push a diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1d6c40dd0b0..efed682dd84 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3012,8 +3012,11 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, TEM may equal DECL or it may be a previous decl of the same name. */ tem = pushdecl (decl); - if (initialized) - DECL_EXTERNAL (tem) = 0; + if (initialized && DECL_EXTERNAL (tem)) + { + DECL_EXTERNAL (tem) = 0; + TREE_STATIC (tem) = 1; + } return tem; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f81a893348c..b43b4881956 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-13 Dale Johannesen + + * gcc.c-torture/compile/pr17408.c: New test case. + 2004-09-13 Mark Mitchell PR c++/16716 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17408.c b/gcc/testsuite/gcc.c-torture/compile/pr17408.c new file mode 100644 index 00000000000..4819673f284 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17408.c @@ -0,0 +1,5 @@ +/* PRs 17408 and 17409, with different options. */ +extern int t; +extern int t = 0; +void f(){t =0;} +void g(){h(&t);} -- 2.30.2