public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19603] New: code generation error
@ 2005-01-24 11:40 rwgk at yahoo dot com
  2005-01-24 11:49 ` [Bug c++/19603] " rwgk at yahoo dot com
  2005-01-24 13:27 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: rwgk at yahoo dot com @ 2005-01-24 11:40 UTC (permalink / raw)
  To: gcc-bugs

gcc CVS mainline, 2005/01/23 12:10 PST
Configured with: /net/legless/scratch1/rwgk/gcc_cvs_head/configure --
prefix=/usr/local_cci/gcc_cvs_head_20050123 --enable-languages=c,c++
Red Hat Enterprise Linux WS release 3 (Taroon)
Boost CVS mainline, 2005/01/06 10:09 PST

The following piece of code works correctly only if CCTBX_GCC4_WORKAROUND is 
defined:

  rt_mx rt_mx::new_denominators(int r_den, int t_den) const
  {
    rt_mx result(*this);
#ifndef CCTBX_GCC4_WORKAROUND
    if (r_den) result.r_ = result.r_.new_denominator(r_den);
#else
    if (r_den) {
      rot_mx r = result.r_.new_denominator(r_den);
      result.r_ = r;
    }     
#endif
    if (t_den) result.t_ = result.t_.new_denominator(t_den);
    return result;
  }   

A reproducer is available here:

http://cci.lbl.gov/~rwgk/bugs/gcc_cvs_head_20050123/gcc4_debug.tar.gz

To build:

gunzip -c gcc4_debug.tar.gz | tar xf -
cd gcc4_debug
make

Expected output:

g++ -fPIC -ftemplate-depth-120 -w -DBOOST_DISABLE_THREADS -DNDEBUG -O3 -ffast-
math -I. -c gcc4_debug.cpp
g++ -fPIC -ftemplate-depth-120 -w -DBOOST_DISABLE_THREADS -DNDEBUG -O3 -ffast-
math -I. -c cctbx.cpp -o cctbx_normal.o
g++ -o normal gcc4_debug.o cctbx_normal.o
g++ -fPIC -ftemplate-depth-120 -w -DBOOST_DISABLE_THREADS -DNDEBUG -O3 -ffast-
math -I. -DCCTBX_GCC4_WORKAROUND -c cctbx.cpp -o cctbx_hacked.o
g++ -o hacked gcc4_debug.o cctbx_hacked.o

This will only take a few seconds to build the commands "normal" and "hacked". 
The expected output is:

./normal

y,z,x
x,y,z

./hacked

y,z,x
y,z,x

The output of ./normal is wrong, the output of ./hacked is correct. The only 
difference is the CCTBX_GCC4_WORKAROUND.

The same code works fine (without the workaround) with gcc 3.2.3 and many other 
compilers.

I will try to attach the reproducer if possible. It still is 877kB in size, 
starting from 15+MB, mainly because of the Boost headers. I spent several hours 
stripping it down to this size. I hope you have tools to reduce the rest much 
faster.

-- 
           Summary: code generation error
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rwgk at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/19603] code generation error
  2005-01-24 11:40 [Bug c++/19603] New: code generation error rwgk at yahoo dot com
@ 2005-01-24 11:49 ` rwgk at yahoo dot com
  2005-01-24 13:27 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rwgk at yahoo dot com @ 2005-01-24 11:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rwgk at yahoo dot com  2005-01-24 11:49 -------
Created an attachment (id=8052)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8052&action=view)
Reproducer


-- 


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


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

* [Bug c++/19603] code generation error
  2005-01-24 11:40 [Bug c++/19603] New: code generation error rwgk at yahoo dot com
  2005-01-24 11:49 ` [Bug c++/19603] " rwgk at yahoo dot com
@ 2005-01-24 13:27 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-24 13:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-24 13:27 -------


*** This bug has been marked as a duplicate of 19317 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-01-24 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-24 11:40 [Bug c++/19603] New: code generation error rwgk at yahoo dot com
2005-01-24 11:49 ` [Bug c++/19603] " rwgk at yahoo dot com
2005-01-24 13:27 ` 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).