public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors @ 2005-10-11 17:14 sabre at nondot dot org 2005-10-11 17:15 ` [Bug c++/24312] " sabre at nondot dot org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: sabre at nondot dot org @ 2005-10-11 17:14 UTC (permalink / raw) To: gcc-bugs The following testcase is miscompiled: #include <stdio.h> double foo() { return 1.0; } static struct S { S(); } s; static const double Y = foo()+2.0; S::S() { printf("%f\n", Y); } int main() { printf("%f\n", Y); } Both printfs should print 3 based on Mark's insight in Comment #22 of bug 21089. -Chris -- Summary: C++ front-end doesn't correctly handle distinction between global initializers and ctors Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sabre at nondot dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/24312] C++ front-end doesn't correctly handle distinction between global initializers and ctors 2005-10-11 17:14 [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors sabre at nondot dot org @ 2005-10-11 17:15 ` sabre at nondot dot org 2005-10-11 17:18 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: sabre at nondot dot org @ 2005-10-11 17:15 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from sabre at nondot dot org 2005-10-11 17:15 ------- Note that this could be handled in a straight-forward way with init priorities. -- sabre at nondot dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|C++ front-end doesn't |C++ front-end doesn't |correctly handle distinction|correctly handle distinction |between global initializers |between global initializers |and ctors |and ctors http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/24312] C++ front-end doesn't correctly handle distinction between global initializers and ctors 2005-10-11 17:14 [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors sabre at nondot dot org 2005-10-11 17:15 ` [Bug c++/24312] " sabre at nondot dot org @ 2005-10-11 17:18 ` pinskia at gcc dot gnu dot org 2005-10-27 16:22 ` pinskia at gcc dot gnu dot org 2007-10-04 1:45 ` jason at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-10-11 17:18 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from pinskia at gcc dot gnu dot org 2005-10-11 17:18 ------- Confirmed, not a regression. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Known to fail| |2.95.3 3.0.4 3.2.2 3.2.3 | |3.3.1 4.0.0 3.4.0 4.1.0 Last reconfirmed|0000-00-00 00:00:00 |2005-10-11 17:18:20 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/24312] C++ front-end doesn't correctly handle distinction between global initializers and ctors 2005-10-11 17:14 [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors sabre at nondot dot org 2005-10-11 17:15 ` [Bug c++/24312] " sabre at nondot dot org 2005-10-11 17:18 ` pinskia at gcc dot gnu dot org @ 2005-10-27 16:22 ` pinskia at gcc dot gnu dot org 2007-10-04 1:45 ` jason at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-10-27 16:22 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from pinskia at gcc dot gnu dot org 2005-10-27 16:22 ------- Hmm, ICC gets it wrong too, maybe there is a misunderstanding somewhere. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/24312] C++ front-end doesn't correctly handle distinction between global initializers and ctors 2005-10-11 17:14 [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors sabre at nondot dot org ` (2 preceding siblings ...) 2005-10-27 16:22 ` pinskia at gcc dot gnu dot org @ 2007-10-04 1:45 ` jason at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu dot org @ 2007-10-04 1:45 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from jason at gcc dot gnu dot org 2007-10-04 01:45 ------- This is not a bug; Mark's comment in bug 21089 had to do with the fact that [basic.start.init] says that static initialization happens before dynamic initialization. Using foo() in Y's initializer makes Y dynamically initialized, so it is not required to be initialized before s. -- jason at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24312 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-04 1:45 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-10-11 17:14 [Bug c++/24312] New: C++ front-end doesn't correctly handle distinction between global initializers and ctors sabre at nondot dot org 2005-10-11 17:15 ` [Bug c++/24312] " sabre at nondot dot org 2005-10-11 17:18 ` pinskia at gcc dot gnu dot org 2005-10-27 16:22 ` pinskia at gcc dot gnu dot org 2007-10-04 1:45 ` jason 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).