public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39179]  New: Wrong code in c++ for const members initialized in external file
@ 2009-02-13 15:45 ktietz at gcc dot gnu dot org
  2009-02-14 16:55 ` [Bug target/39179] " rguenth at gcc dot gnu dot org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: ktietz at gcc dot gnu dot org @ 2009-02-13 15:45 UTC (permalink / raw)
  To: gcc-bugs

It seems so that for optimization levels one or higher, gcc produces wrong code
for the two test files below.
If I compile the same test with -O or -Os everything works fine.
On taking a look into produced assembly, it seems that it wrongly assumes the
assert alway have to raise.

File 1: t1.cpp
      //class.h
      struct K {
       static const unsigned k;
      };

      #include <assert.h>

      int main() {
       assert ( K::k == 1 );
       return 1;
      }

File 2: t2.cpp
      struct K {
       static const unsigned k;
      };

      //class.cpp
      const unsigned K::k = 1;

Then compile both file g++ -o tst t1.cpp t2.cpp -O2


-- 
           Summary: Wrong code in c++ for const members initialized in
                    external file
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ktietz at gcc dot gnu dot org
GCC target triplet: x86_64-pc-mingw32


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


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

end of thread, other threads:[~2009-02-19  1:12 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-13 15:45 [Bug c++/39179] New: Wrong code in c++ for const members initialized in external file ktietz at gcc dot gnu dot org
2009-02-14 16:55 ` [Bug target/39179] " rguenth at gcc dot gnu dot org
2009-02-14 17:03 ` rguenth at gcc dot gnu dot org
2009-02-14 17:16 ` ebotcazou at gcc dot gnu dot org
2009-02-14 18:48 ` rguenth at gcc dot gnu dot org
2009-02-14 18:49 ` rguenth at gcc dot gnu dot org
2009-02-14 20:10 ` ktietz at gcc dot gnu dot org
2009-02-14 21:12 ` rguenth at gcc dot gnu dot org
2009-02-14 21:25 ` ktietz at gcc dot gnu dot org
2009-02-14 22:56 ` nightstrike at gmail dot com
2009-02-14 23:13 ` ktietz at gcc dot gnu dot org
2009-02-17 18:23 ` [Bug target/39179] [4.4 Regression] " jason at gcc dot gnu dot org
2009-02-17 18:30 ` hjl dot tools at gmail dot com
2009-02-17 18:48 ` rguenth at gcc dot gnu dot org
2009-02-17 18:52 ` hjl dot tools at gmail dot com
2009-02-17 18:54 ` rguenth at gcc dot gnu dot org
2009-02-17 18:56 ` ebotcazou at gcc dot gnu dot org
2009-02-17 22:57 ` jason at gcc dot gnu dot org
2009-02-17 23:01 ` jason at gcc dot gnu dot org
2009-02-17 23:40 ` jakub at gcc dot gnu dot org
2009-02-18  2:04 ` jason at gcc dot gnu dot org
2009-02-18 17:48 ` jason at gcc dot gnu dot org
2009-02-18 17:51 ` jason at gcc dot gnu dot org
2009-02-18 18:07 ` jason at gcc dot gnu dot org
2009-02-18 18:11 ` jason at gcc dot gnu dot org
2009-02-18 18:31 ` jason at gcc dot gnu dot org
2009-02-18 21:01 ` jason at gcc dot gnu dot org
2009-02-18 21:09 ` jason at gcc dot gnu dot org
2009-02-18 22:11 ` ebotcazou at gcc dot gnu dot org
2009-02-19  1:12 ` 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).