public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34090]  New: -O3 wrong code, -O2 OK
@ 2007-11-14  3:15 rwgk at yahoo dot com
  2007-11-14  3:15 ` [Bug c++/34090] " rwgk at yahoo dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rwgk at yahoo dot com @ 2007-11-14  3:15 UTC (permalink / raw)
  To: gcc-bugs

Platform:
  Fedora release 7 (Moonshine)
  Linux idle.lbl.gov 2.6.22.9-91.fc7 #1 SMP Thu Sep 27 20:47:39 EDT 2007 x86_64
x86_64 x86_64 GNU/Linux

% g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /net/rosie/scratch2/rwgk/gcc_trunk/configure
--prefix=/net/cci-filer1/vol1/tmp/rwgk/gcc_trunk_130159_x86_64_fc7
--enable-languages=c,c++,fortran --with-mpfr=/usr
Thread model: posix
gcc version 4.3.0 20071113 (experimental) (GCC)

I'll attach a tiny reproducer.

To reproduce the problem:

% ./demo.csh
123
Traceback (most recent call last):
  File "run.py", line 2, in <module>
    print foo(start=1, stop=3)
Boost.Python.ArgumentError: Python argument types in
    demo.foo()
did not match C++ signature:
    foo(int None, int stop)

The "123" is the correct result as obtained when compiling with -O2.
The Python traceback is due to wrong code produced with -O3.

Sorry, I know the reproducer isn't minimal at all, even though it
is tiny. It is a hell to reduce. I'm hoping for some kind of
miracle... or at least suggestions for reducing this with a reasonable
amount of effort.

Ralf


-- 
           Summary: -O3 wrong code, -O2 OK
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rwgk at yahoo dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c++/34090] -O3 wrong code, -O2 OK
  2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
@ 2007-11-14  3:15 ` rwgk at yahoo dot com
  2007-11-14 18:39 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rwgk at yahoo dot com @ 2007-11-14  3:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rwgk at yahoo dot com  2007-11-14 03:15 -------
Created an attachment (id=14550)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14550&action=view)
reproducer


-- 


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


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

* [Bug c++/34090] -O3 wrong code, -O2 OK
  2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
  2007-11-14  3:15 ` [Bug c++/34090] " rwgk at yahoo dot com
@ 2007-11-14 18:39 ` manu at gcc dot gnu dot org
  2007-11-14 19:22 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-14 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2007-11-14 18:39 -------
It would be better if you could include a preprocessed testcase
(http://gcc.gnu.org/bugs.html#detailed).


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/34090] -O3 wrong code, -O2 OK
  2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
  2007-11-14  3:15 ` [Bug c++/34090] " rwgk at yahoo dot com
  2007-11-14 18:39 ` manu at gcc dot gnu dot org
@ 2007-11-14 19:22 ` pinskia at gcc dot gnu dot org
  2007-11-15  2:18 ` rwgk at yahoo dot com
  2007-11-15  4:26 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-14 19:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-11-14 19:22 -------
What happens if you add -fno-strict-aliasing ?  And maybe even try with
warnings turned on.


-- 


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


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

* [Bug c++/34090] -O3 wrong code, -O2 OK
  2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
                   ` (2 preceding siblings ...)
  2007-11-14 19:22 ` pinskia at gcc dot gnu dot org
@ 2007-11-15  2:18 ` rwgk at yahoo dot com
  2007-11-15  4:26 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rwgk at yahoo dot com @ 2007-11-15  2:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rwgk at yahoo dot com  2007-11-15 02:18 -------
(In reply to comment #3)
> What happens if you add -fno-strict-aliasing ?

That's it!

> And maybe even try with
> warnings turned on.
> 

-Wall doesn't lead to any warnings.

I've been compiling the boost_python runtime library with -fno-strict-aliasing
for some time (just out of fear, although it didn't make a difference so far)
but I used to get away with cutting corners when compiling our extensions
without the -fno-strict-aliasing.

The bulk of our code is expected to be safe with strict aliasing. The
problem is, much of it is in header files as templates. If the Python
bindings dictate that I have to use -fno-strict-aliasing, unfortunately
that means almost all our templates are compiled with the same setting.

But that's not a g++ problem! I suggest closing this problem report.

Thanks!

Ralf


-- 


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


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

* [Bug c++/34090] -O3 wrong code, -O2 OK
  2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
                   ` (3 preceding siblings ...)
  2007-11-15  2:18 ` rwgk at yahoo dot com
@ 2007-11-15  4:26 ` bangerth at dealii dot org
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2007-11-15  4:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from bangerth at dealii dot org  2007-11-15 04:26 -------
So done.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2007-11-15  4:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-14  3:15 [Bug c++/34090] New: -O3 wrong code, -O2 OK rwgk at yahoo dot com
2007-11-14  3:15 ` [Bug c++/34090] " rwgk at yahoo dot com
2007-11-14 18:39 ` manu at gcc dot gnu dot org
2007-11-14 19:22 ` pinskia at gcc dot gnu dot org
2007-11-15  2:18 ` rwgk at yahoo dot com
2007-11-15  4:26 ` bangerth at dealii 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).