diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2018-08-15 11:45:44 +0000 |
---|---|---|
committer | Iain Sandoe <iains@gcc.gnu.org> | 2018-08-15 11:45:44 +0000 |
commit | 7273331429916a0c203b1064e0414c741c06a78f (patch) | |
tree | 85d44fb86970e37b0e74a8cfc826e11d25919208 /gcc/c | |
parent | 05c1e87adbc09a2c90155d5d5d05cf866d39c9e2 (diff) | |
download | gcc-7273331429916a0c203b1064e0414c741c06a78f.zip gcc-7273331429916a0c203b1064e0414c741c06a78f.tar.gz gcc-7273331429916a0c203b1064e0414c741c06a78f.tar.bz2 |
Don't make unsized objects into extern.
2018-08-15 Iain Sandoe <iain@sandoe.co.uk>
gcc/c:
PR c/19315
* c-decl.c (finish_decl): Don't add the 'extern' storage class to
objects of unknown size.
gcc/testsuite:
PR c/19315
gcc.dg/graphite/pr82451.c: Make array 'a' an extern.
gcc.dg/redecl-10.c: Expect warnings for the static vars with unknown
size.
From-SVN: r263556
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index be2ffbd..5931206 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2018-08-15 Iain Sandoe <iain@sandoe.co.uk> + + PR c/19315 + * c-decl.c (finish_decl): Don't add the 'extern' storage class to + objects of unknown size. + 2018-08-13 Martin Sebor <msebor@redhat.com> PR tree-optimization/71625 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index ed1dd28..da42add 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4969,14 +4969,6 @@ finish_decl (tree decl, location_t init_loc, tree init, case 2: if (do_default) error ("array size missing in %q+D", decl); - /* If a `static' var's size isn't known, - make it extern as well as static, so it does not get - allocated. - If it is not `static', then do not mark extern; - finish_incomplete_decl will give it a default size - and it will get allocated. */ - else if (!pedantic && TREE_STATIC (decl) && !TREE_PUBLIC (decl)) - DECL_EXTERNAL (decl) = 1; break; case 3: |