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

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).