public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
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 ` duz at sol-3 dot de
2004-04-30 16:17 ` duz at sol-3 dot de
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 16:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From duz at sol-3 dot de 2004-04-30 15:56 -------
Created an attachment (id=6198)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6198&action=view)
The specs file from the compiler I've built here on Linux.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229
^ permalink raw reply [flat|nested] 7+ messages in thread
* [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
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 16:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From duz at sol-3 dot de 2004-04-30 15:57 -------
Created an attachment (id=6199)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6199&action=view)
How I compiled the preprocessed source file plus compiler messages.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 16:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From duz at sol-3 dot de 2004-04-30 16:00 -------
Created an attachment (id=6200)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6200&action=view)
The preprocessed source file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
2004-04-30 16:00 [Bug c++/15229] New: Omits constructor calls for variables not used otherwise duz at sol-3 dot de
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 16:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From duz at sol-3 dot de 2004-04-30 16:00 -------
Created an attachment (id=6201)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6201&action=view)
The resulting assembler source, which hopefully shows the problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
2004-04-30 16:00 [Bug c++/15229] New: Omits constructor calls for variables not used otherwise duz at sol-3 dot de
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: duz at sol-3 dot de @ 2004-04-30 17:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From duz at sol-3 dot de 2004-04-30 16:43 -------
I just tried it on solaris-8 for sparc, with the compiler prebuilt from
sunfreeware.com:
$ /usr/local/bin/g++ -v -help
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.0/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.4.0
$
Same problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15229
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15229] Omits constructor calls for variables not used otherwise.
2004-04-30 16:00 [Bug c++/15229] New: Omits constructor calls for variables not used otherwise duz at sol-3 dot de
` (4 preceding siblings ...)
2004-04-30 17:01 ` duz at sol-3 dot de
@ 2004-04-30 18:14 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-30 18:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-30 17:22 -------
Invalid, this code is equivent to this simplifed case:
struct Lingo
{
Lingo ();
};
struct ALingo : Lingo
{
ALingo();
};
int main()
{
ALingo a;
Lingo b(a); // <-- calls the copy constrctor
}
Since there is no user defined copy constructor, the compiler creates one for you (by the rules of C++).
So this is invalid, to solve this you need to define a copy constructor.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
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).