public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15229] New: Omits constructor calls for variables not used otherwise.
@ 2004-04-30 16:00 duz at sol-3 dot de
  2004-04-30 16:00 ` [Bug c++/15229] " duz at sol-3 dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 16:00 UTC (permalink / raw)
  To: gcc-bugs

I have a variable of a class type. The side-effect of the constructor is
registering and ordering some stuff in a table. The variable is declared in
main. It is not used otherwise in main. Thus I want to achieve that the table's
contents is set up properly while main is running, i.e. after global constructor
runtime but before anything else interesting happens.

I tried to find a trivial test case, but trivial cases work fine. So here comes
the big one. Attached is preprocessed C++-file

    trader-main.ii

I compiled with the command

    g++-3.4 -v -S -O -fno-exceptions trader-main.ii

(The bug also happens when I replace -O by -g. Then I see when stepping
through the program, how the debugger omits the lines instantiating the
variables in question.)

The variables are of class "Lingo", constructor declared in line

    trader-main.ii:13863

The variable instantiations inside main is in lines

    trader-main.ii:46019 through 46021

You see clearly in the resulting assembly code, that these constructor
calls are missing at the beginning of main. There should be three
calls to "Lingo::Lingo" around line

    trader-main.s:310

The corresponding destructor calls are generated in lines

    trader-main.s:396 ff.

Thank you for your time.

Ups, where do I attach the files to this form?
I'll submit it now and try to add them later.

-- 
           Summary: Omits constructor calls for variables not used
                    otherwise.
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: duz at sol-3 dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-04-30 17:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-30 16:00 [Bug c++/15229] New: Omits constructor calls for variables not used otherwise duz at sol-3 dot de
2004-04-30 16:00 ` [Bug c++/15229] " duz at sol-3 dot de
2004-04-30 16:17 ` duz at sol-3 dot de
2004-04-30 16:18 ` duz at sol-3 dot de
2004-04-30 16:19 ` duz at sol-3 dot de
2004-04-30 17:01 ` duz at sol-3 dot de
2004-04-30 18:14 ` pinskia at gcc dot gnu dot 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).