public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56712] New: constuctor function is called twice
@ 2013-03-24 15:55 bernd.edlinger at hotmail dot de
2013-03-24 17:02 ` [Bug middle-end/56712] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-03-24 15:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
Bug #: 56712
Summary: constuctor function is called twice
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bernd.edlinger@hotmail.de
Created attachment 29713
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29713
cnt++ is accidentally called twice at -O2 or higher
The attached test program has a constructor function
with the __attribute__((constructor)) that is split
up into two parts construct.part.0 and construct
construct.part.0 is the part after "if (xx != 0) return;"
The problem is that both are put into the .ctors section
first the construct.part.0 and then construct.
Unfortunately the construct function is called before
construct.part.0 which has the check removed.
Therefore basically the constuctor is called twice:
cnt=2 at -O2 or -O3, but cnt=1 at -O1 or less.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] constuctor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
@ 2013-03-24 17:02 ` pinskia at gcc dot gnu.org
2013-03-24 22:21 ` [Bug middle-end/56712] constructor " mikpe at it dot uu.se
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-24 17:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-24 17:02:38 UTC ---
I think this has been fixed already.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
2013-03-24 17:02 ` [Bug middle-end/56712] " pinskia at gcc dot gnu.org
@ 2013-03-24 22:21 ` mikpe at it dot uu.se
2013-03-25 10:14 ` [Bug middle-end/56712] [4.6 Regression] " rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2013-03-24 22:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-24 22:21:28 UTC ---
Works for me with 4.7/4.8/4.9, and 4.5 and older, but fails with 4.6.
The bug was fixed for 4.7.0 by r180700; that change has no BZ PR entry, but the
patch submission (http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02486.html)
described a scenario involving cloned constructor functions much like this one.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
2013-03-24 17:02 ` [Bug middle-end/56712] " pinskia at gcc dot gnu.org
2013-03-24 22:21 ` [Bug middle-end/56712] constructor " mikpe at it dot uu.se
@ 2013-03-25 10:14 ` rguenth at gcc dot gnu.org
2013-03-26 6:14 ` bernd.edlinger at hotmail dot de
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-25 10:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Status|UNCONFIRMED |NEW
Known to work| |4.5.3, 4.7.0
Keywords| |wrong-code
Last reconfirmed| |2013-03-25
CC| |pbrook at gcc dot gnu.org
Ever Confirmed|0 |1
Summary|constructor function is |[4.6 Regression]
|called twice |constructor function is
| |called twice
Target Milestone|--- |4.6.4
Known to fail| |4.6.3
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-25 10:14:40 UTC ---
Thus confirmed. Can eventually be backported to the next 4.6 release.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
` (2 preceding siblings ...)
2013-03-25 10:14 ` [Bug middle-end/56712] [4.6 Regression] " rguenth at gcc dot gnu.org
@ 2013-03-26 6:14 ` bernd.edlinger at hotmail dot de
2013-03-26 6:16 ` bernd.edlinger at hotmail dot de
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-03-26 6:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> 2013-03-26 06:13:55 UTC ---
(In reply to comment #2)
> Works for me with 4.7/4.8/4.9, and 4.5 and older, but fails with 4.6.
> The bug was fixed for 4.7.0 by r180700; that change has no BZ PR entry, but the
> patch submission (http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02486.html)
> described a scenario involving cloned constructor functions much like this one.
OK, confirmed.
with this fix the bug went away in the test example and in the original
more complex context.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
` (3 preceding siblings ...)
2013-03-26 6:14 ` bernd.edlinger at hotmail dot de
@ 2013-03-26 6:16 ` bernd.edlinger at hotmail dot de
2013-03-26 10:24 ` mikpe at it dot uu.se
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-03-26 6:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
--- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> 2013-03-26 06:15:52 UTC ---
Created attachment 29724
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29724
backport of the above mentioned fix
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
` (4 preceding siblings ...)
2013-03-26 6:16 ` bernd.edlinger at hotmail dot de
@ 2013-03-26 10:24 ` mikpe at it dot uu.se
2013-03-26 19:19 ` bernd.edlinger at hotmail dot de
2013-04-12 16:17 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu.se @ 2013-03-26 10:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> 2013-03-26 10:24:08 UTC ---
(In reply to comment #5)
> Created attachment 29724 [details]
> backport of the above mentioned fix
Don't base your backport on the original patch submission, base it on the
actual commit, r180700. There are differences between the two.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
` (5 preceding siblings ...)
2013-03-26 10:24 ` mikpe at it dot uu.se
@ 2013-03-26 19:19 ` bernd.edlinger at hotmail dot de
2013-04-12 16:17 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-03-26 19:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #29724|0 |1
is obsolete| |
--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> 2013-03-26 19:18:59 UTC ---
Created attachment 29735
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29735
backport of commit r180700 in gcc-4.7 branch
OK, now I see...
I tested the new patch again. Everything looks good.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug middle-end/56712] [4.6 Regression] constructor function is called twice
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
` (6 preceding siblings ...)
2013-03-26 19:19 ` bernd.edlinger at hotmail dot de
@ 2013-04-12 16:17 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-12 16:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56712
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|4.6.4 |4.7.0
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-12 16:17:21 UTC ---
The 4.6 branch has been closed, fixed in GCC 4.7.0.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-04-12 16:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-24 15:55 [Bug c/56712] New: constuctor function is called twice bernd.edlinger at hotmail dot de
2013-03-24 17:02 ` [Bug middle-end/56712] " pinskia at gcc dot gnu.org
2013-03-24 22:21 ` [Bug middle-end/56712] constructor " mikpe at it dot uu.se
2013-03-25 10:14 ` [Bug middle-end/56712] [4.6 Regression] " rguenth at gcc dot gnu.org
2013-03-26 6:14 ` bernd.edlinger at hotmail dot de
2013-03-26 6:16 ` bernd.edlinger at hotmail dot de
2013-03-26 10:24 ` mikpe at it dot uu.se
2013-03-26 19:19 ` bernd.edlinger at hotmail dot de
2013-04-12 16:17 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).