From: Marek Polacek Date: Sat, 9 Jan 2016 11:15:26 +0000 (+0000) Subject: re PR c++/69113 (ICE: in vague_linkage_p, at cp/decl2.c:1875 with -fno-weak) X-Git-Tag: basepoints/gcc-7~1755 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73f0dae2a4e1dc4fcfebc9f47f34381dff64f3c3;p=thirdparty%2Fgcc.git re PR c++/69113 (ICE: in vague_linkage_p, at cp/decl2.c:1875 with -fno-weak) PR c++/69113 * decl2.c (comdat_linkage): Only set DECL_COMDAT if TREE_PUBLIC is set. * g++.dg/pr69113.C: New test. From-SVN: r232189 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3ec2e1c5bf9d..9aedf005547c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-01-09 Marek Polacek + + PR c++/69113 + * decl2.c (comdat_linkage): Only set DECL_COMDAT if TREE_PUBLIC is set. + 2016-01-09 Jakub Jelinek PR c++/69164 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9a07e1e006f5..a7212ca05bb6 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1820,7 +1820,8 @@ comdat_linkage (tree decl) } } - DECL_COMDAT (decl) = 1; + if (TREE_PUBLIC (decl)) + DECL_COMDAT (decl) = 1; } /* For win32 we also want to put explicit instantiations in diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 107ea24f396e..4af4374cea6b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-09 Marek Polacek + + PR c++/69113 + * g++.dg/pr69113.C: New test. + 2016-01-09 Jakub Jelinek PR middle-end/50865 diff --git a/gcc/testsuite/g++.dg/pr69113.C b/gcc/testsuite/g++.dg/pr69113.C new file mode 100644 index 000000000000..2f8331e3f2bd --- /dev/null +++ b/gcc/testsuite/g++.dg/pr69113.C @@ -0,0 +1,17 @@ +// PR c++/69113 +// { dg-do compile } +// { dg-options "-fno-weak" } + +struct foo +{ + static void bar () + { + struct baz + { + static void m () + { + static int n; + } + }; + } +};