Summary: | [4.0 Regression] pragma interface/implementation still break synthesized methods | ||
---|---|---|---|
Product: | gcc | Reporter: | Michael Matz <matz> |
Component: | c++ | Assignee: | Mark Mitchell <mark> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | belyshev, das, gcc-bugs, mark, pinskia, schwab, zak.kipling |
Priority: | P2 | Keywords: | diagnostic, ice-on-valid-code, link-failure |
Version: | 4.0.1 | ||
Target Milestone: | 4.1.1 | ||
See Also: | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33925 | ||
Host: | Target: | ||
Build: | Known to work: | 3.4.0 4.1.0 4.1.1 4.1.2 | |
Known to fail: | 4.0.0 | Last reconfirmed: | 2005-06-30 15:10:43 |
Bug Depends on: | |||
Bug Blocks: | 24248 | ||
Attachments: | preprocessed output that causes ICE |
Description
Michael Matz
2005-06-30 14:55:09 UTC
Andrew: that's not a diagnostic issue. While the diagnostic (the warning) indeed is wrong and misleading (and probably points to the underlying cause of this issue), the actual error I'm complaining about is the link error, due to not emitting an out-of-line copy of A::A() in a.cc as it would be required. (In reply to comment #1) Yes which is why I did not confirm it yet because I did not look at fully. I just added the diagnostic keyword because it is still a wrong warning. I am adding wrong-code also. Reduced testcase: ---- a.ii ---- # 1 "a.cc" # 0 "<built-in>" # 1 "<command line>" # 1 "a.cc" #pragma implementation # 1 "a.h" 1 struct B { B(){}; ~B(){} }; #pragma interface struct A { B a; }; # 3 "a.cc" 2 ---- use.ii ---- # 1 "use.cc" # 0 "<built-in>" # 1 "<command line>" # 1 "use.cc" # 1 "a.h" 1 struct B { B(){}; ~B(){} }; #pragma interface struct A { B a; }; # 2 "use.cc" 2 A a; int main() {} Ah, I see. Note that you must compile the reduced testcase (thanks for that) with -O0, or with -fno-inline, otherwise the A::A ctor will be inlined in use.cc (making the warning about the non-availability of it even more funny ;-) ), and not lead to the link error. Fixed in 4.1. Subject: Bug 22252 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2005-09-09 18:56:16 Modified files: gcc/testsuite : ChangeLog gcc/cp : ChangeLog decl.c decl2.c pt.c semantics.c Added files: gcc/testsuite/g++.dg/ext: interface1.C interface1.h interface1a.cc Log message: PR c++/22252 * decl.c (start_preparsed_function): Do not pay attention to #pragma interface for implicitly-defined methods. * decl2.c (cp_finish_file): Do not complain about uses of inline functions that have bodies, even if we decided not to emit the body in this translation unit. * semantics.c (note_decl_for_pch): Do not mess with linkage. (expand_or_defer_fn): Make inline, non-template functions COMDAT at this point. PR c++/22252 * g++.dg/ext/interface1.C: New test. * g++.dg/ext/interface1.h: Likewise. * g++.dg/ext/interface1a.cc: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6041&r2=1.6042 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4880&r2=1.4881 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1424&r2=1.1425 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.799&r2=1.800 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1029&r2=1.1030 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.487&r2=1.488 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1.h.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/interface1a.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 *** Bug 24421 has been marked as a duplicate of this bug. *** *** Bug 24248 has been marked as a duplicate of this bug. *** *** Bug 24852 has been marked as a duplicate of this bug. *** Created attachment 10401 [details]
preprocessed output that causes ICE
This patch seems to cause another ICE. I applied the patch on gcc-4.0 to fix this bug, and now the attached output causes an ICE with >= -O1 (the same seems to be true on gcc-4.1 as well). Reverting the patch seems to stop the new ICE.
The claim in Comment #9 is that this is a 4.1 regression as well as a 4.0 regression, so I've udpated the subject line. It would be interesting to know if this affects mainline as well. (In reply to comment #10) > The claim in Comment #9 is that this is a 4.1 regression as well as a 4.0 > regression, so I've udpated the subject line. It would be interesting to know > if this affects mainline as well. Actually that was a different bug. That was PR 25010 so this was fixed also in 4.1 fully. Tested on the mainline and the 4.1 branch to confirm that. not release critical for GCC-4.0.x |