[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #34 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Wed Sep 10 14:27:40 2014
New Revision: 215131

URL: https://gcc.gnu.org/viewcvs?rev=215131root=gccview=rev
Log:
PR lto/53808
PR c++/61659
* decl2.c (note_comdat_fn): New.
(set_comdat): New.
(cp_write_global_declarations): Call set_comdat.
* method.c (implicitly_declare_fn): Call note_comdat_fn.
* pt.c (tsubst_decl) [FUNCTION_DECL]: Likewise.
* decl2.c (mark_needed): Mark clones.
(import_export_decl): Not here.

Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/abi/no-weak1.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/abi/spec1.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/opt/devirt5.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/template/friend56.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/template/spec38.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/cp-tree.h
branches/gcc-4_9-branch/gcc/cp/decl2.c
branches/gcc-4_9-branch/gcc/cp/method.c
branches/gcc-4_9-branch/gcc/cp/pt.c
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/opt/devirt4.C


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-10 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #35 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Fixed.


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #36 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Wed Sep 10 17:28:59 2014
New Revision: 215134

URL: https://gcc.gnu.org/viewcvs?rev=215134root=gccview=rev
Log:
PR c++/61659
* decl.c (grokfndecl): Don't set DECL_COMDAT on static inlines.
(duplicate_decls, start_decl): Likewise.
* pt.c (check_explicit_specialization): Likewise.
(push_template_decl_real): Or static templates.

Added:
trunk/gcc/testsuite/g++.dg/abi/no-weak1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/cp/pt.c


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-09 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #33 from John David Anglin danglin at gcc dot gnu.org ---
The issue in comment 32 was introduced in revision 214177
.


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-04 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #29 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
(In reply to Jason Merrill from comment #28)
 (In reply to Markus Trippelsdorf from comment #27)
  Possible fix:
 
 Applied to trunk, thanks.

The fix isn't in trunk yet. Forgot to push?


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #30 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Thu Sep  4 12:37:05 2014
New Revision: 214900

URL: https://gcc.gnu.org/viewcvs?rev=214900root=gccview=rev
Log:
PR ipa/61659
* decl.c (duplicate_decls): Check DECL_DECLARED_INLINE_P on
newdecl, not olddecl.

Added:
trunk/gcc/testsuite/g++.dg/template/spec38.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 CC|jason at redhat dot com|

--- Comment #31 from Jason Merrill jason at gcc dot gnu.org ---
Apparently so.  Really applied now. :)


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-04 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

John David Anglin danglin at gcc dot gnu.org changed:

   What|Removed |Added

 CC||danglin at gcc dot gnu.org

--- Comment #32 from John David Anglin danglin at gcc dot gnu.org ---
At r214748, GCC build fails on hppa1.1-hp-hpux10.20:

/xxx/gnu/gcc/objdir/./prev-gcc/xg++ -B/xxx/gnu/gcc/objdir/./prev-gcc/
-B/opt/gnu/gcc/gcc-5.0/hppa1.1-hp-hpux10.20/bin/ -nostdinc++
-B/xxx/gnu/gcc/objdir/prev-hp
pa1.1-hp-hpux10.20/libstdc++-v3/src/.libs
-B/xxx/gnu/gcc/objdir/prev-hppa1.1-hp-hpux10.20/libstdc++-v3/libsupc++/.libs 
-isystem /xxx/gnu/gcc/objdir/prev-hppa1.
1-hp-hpux10.20/libstdc++-v3/include/hppa1.1-hp-hpux10.20  -isystem
/xxx/gnu/gcc/objdir/prev-hppa1.1-hp-hpux10.20/libstdc++-v3/include  -isystem
/xxx/gnu/gcc/gcc
/libstdc++-v3/libsupc++
-L/xxx/gnu/gcc/objdir/prev-hppa1.1-hp-hpux10.20/libstdc++-v3/src/.libs
-L/xxx/gnu/gcc/objdir/prev-hppa1.1-hp-hpux10.20/libstdc++-v3/libs
upc++/.libs   -g -O2 -DIN_GCC-fno-exceptions -fno-rtti
-fasynchronous-unwind
-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wmissing-format-att
ribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-o
verlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -static-libstdc++
-static
-libgcc  -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o
c/c-decl.
o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o
c/c-a
rray-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o
c-
family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o
c-fami
ly/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o
c-family/
c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o
c-family/c-cilkplu
s.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o
default-c.o \
  cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a
libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a
../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   
-L/opt/gnu/gcc/gmp/lib -lmpc -lmpfr -lgmp   -L../zlib -lz
/usr/ccs/bin/ld: Duplicate symbol sd_iterator_start(rtx_def*, int)::null_link
in files libbackend.a(sched-rgn.o) and libbackend.a(ddg.o)
/usr/ccs/bin/ld: Duplicate symbol sd_iterator_start(rtx_def*, int)::null_link
in files libbackend.a(sched-rgn.o) and libbackend.a(haifa-sched.o)
/usr/ccs/bin/ld: Duplicate symbol sd_iterator_start(rtx_def*, int)::null_link
in files libbackend.a(sched-rgn.o) and libbackend.a(sched-deps.o)
/usr/ccs/bin/ld: Duplicate symbol sd_iterator_start(rtx_def*, int)::null_link
in files libbackend.a(sched-rgn.o) and libbackend.a(sched-ebb.o)
/usr/ccs/bin/ld: Found 4 duplicate symbol(s)


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-02 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #28 from Jason Merrill jason at gcc dot gnu.org ---
(In reply to Markus Trippelsdorf from comment #27)
 Possible fix:

Applied to trunk, thanks.


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-01 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #25 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
(In reply to Jason Merrill from comment #24)
 Created attachment 33407 [details]
 Patch for 4.9
 
 Here's a patch for the 4.9 branch.  I'm nervous about applying it because I
 suspect that we haven't yet found all the effects of setting DECL_COMDAT.

I've tested your patch and it causes a qt-5.4 build failure
(also happens on trunk):

markus@x4 WebCore % cat Font.ii
namespace WTF
{
template typename T inline void deleteOwnedPtr (T *);
}
namespace WebCore
{
class TextLayout;
}
namespace WTF
{
template 
void
deleteOwnedPtr (WebCore::TextLayout *)
{
}
}

(Without your patch:)
markus@x4 WebCore % g++ -c -O2 Font.ii
markus@x4 WebCore % nm Font.o
 T _ZN3WTF14deleteOwnedPtrIN7WebCore10TextLayoutEEEvPT_

(with patch applied)
markus@x4 WebCore % g++ -c -O2 Font.ii
markus@x4 WebCore % nm Font.o
markus@x4 WebCore %


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-01 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #26 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
ยง14.7.3/12 says:
An explicit specialization of a function template is inline only if it is
declared with the inline specifier or defined as deleted, and independently of
whether its function template is inline.

[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-09-01 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #27 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
Possible fix:

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d03f8a4707e5..d8fb35e21237 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2215,7 +2215,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool
newdecl_is_friend)
  olddecl);

  SET_DECL_TEMPLATE_SPECIALIZATION (olddecl);
- DECL_COMDAT (newdecl) = DECL_DECLARED_INLINE_P (olddecl);
+ DECL_COMDAT (newdecl) = DECL_DECLARED_INLINE_P (newdecl);

  /* Don't propagate visibility from the template to the
 specialization here.  We'll do that in determine_visibility if


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-08-27 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

Markus Trippelsdorf trippels at gcc dot gnu.org changed:

   What|Removed |Added

  Known to work||5.0
Summary|[4.9/5 Regression] Extra|[4.9 Regression] Extra
   |undefined symbol because of |undefined symbol because of
   |devirtualization|devirtualization
  Known to fail|4.10.0  |

--- Comment #23 from Markus Trippelsdorf trippels at gcc dot gnu.org ---
gcc-4.9 branch is still affected. Do you plan a backport, Jason?


[Bug ipa/61659] [4.9 Regression] Extra undefined symbol because of devirtualization

2014-08-27 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659

--- Comment #24 from Jason Merrill jason at gcc dot gnu.org ---
Created attachment 33407
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33407action=edit
Patch for 4.9

Here's a patch for the 4.9 branch.  I'm nervous about applying it because I
suspect that we haven't yet found all the effects of setting DECL_COMDAT.