[Bug c/40216] New: Optimization error when compiling bfd/ecofflink.c on x86_64

2009-05-20 Thread dahowell at directv dot com
ch starts here:
#include <...> search starts here:
 .
 ../../binutils-2.15.94.0.2.2/bfd
 ../../binutils-2.15.94.0.2.2/include
 ../../binutils-2.15.94.0.2.2/intl
 ../intl
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/4.3.0/include
 /usr/include
End of search list.
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAVE_CONFIG_H' '-I.'
'-I../../binutils-2.15.94.0.2.2/bfd' '-I.' '-D_GNU_SOURCE'
'-I../../binutils-2.15.94.0.2.2/include' '-I../../binutils-2.15.94.0.2.2/intl'
'-I../intl' '-W' '-Wall' '-Wstrict-prototypes' '-Wmissing-prototypes' '-g'
'-O2' '-c' '-E' '-mtune=generic'
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAVE_CONFIG_H' '-I.'
'-I../../binutils-2.15.94.0.2.2/bfd' '-I.' '-D_GNU_SOURCE'
'-I../../binutils-2.15.94.0.2.2/include' '-I../../binutils-2.15.94.0.2.2/intl'
'-I../intl' '-W' '-Wall' '-Wstrict-prototypes' '-Wmissing-prototypes' '-g'
'-O2' '-c' '-o' '/users/hblurfrushan/.ccache/tmp.hash.els-d60685.13738.o'
'-mtune=generic'
 /usr/libexec/gcc/x86_64-redhat-linux/4.3.0/cc1 -fpreprocessed
/users/hblurfrushan/.ccache/ecofflink.tmp.els-d60685.13738.i -quiet -dumpbase
ecofflink.tmp.els-d60685.13738.i -mtune=generic -auxbase-strip
/users/hblurfrushan/.ccache/tmp.hash.els-d60685.13738.o -g -O2 -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -version -o
ecofflink.tmp.els-d60685.13738.s
GNU C (GCC) version 4.3.0 20080428 (Red Hat 4.3.0-8) (x86_64-redhat-linux)
compiled by GNU C version 4.3.0 20080428 (Red Hat 4.3.0-8), GMP version
4.2.2, MPFR version 2.3.0-p2.
warning: MPFR header version 2.3.0-p2 differs from library version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5ba4849f47331d70d30074ce61c70f61
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAVE_CONFIG_H' '-I.'
'-I../../binutils-2.15.94.0.2.2/bfd' '-I.' '-D_GNU_SOURCE'
'-I../../binutils-2.15.94.0.2.2/include' '-I../../binutils-2.15.94.0.2.2/intl'
'-I../intl' '-W' '-Wall' '-Wstrict-prototypes' '-Wmissing-prototypes' '-g'
'-O2' '-c' '-o' '/users/hblurfrushan/.ccache/tmp.hash.els-d60685.13738.o'
'-mtune=generic'
 as -V -Qy -o /users/hblurfrushan/.ccache/tmp.hash.els-d60685.13738.o
ecofflink.tmp.els-d60685.13738.s
GNU assembler version 2.18.50.0.6 (x86_64-redhat-linux) using BFD version
version 2.18.50.0.6-7.fc9 20080403
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/libexec/gcc/x86_64-redhat-linux/4.3.0/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-DHAVE_CONFIG_H' '-I.'
'-I../../binutils-2.15.94.0.2.2/bfd' '-I.' '-D_GNU_SOURCE'
'-I../../binutils-2.15.94.0.2.2/include' '-I../../binutils-2.15.94.0.2.2/intl'
'-I../intl' '-W' '-Wall' '-Wstrict-prototypes' '-Wmissing-prototypes' '-g'
'-O2' '-c' '-o' '/users/hblurfrushan/.ccache/tmp.hash.els-d60685.13738.o'
'-mtune=generic'


-- 
   Summary: Optimization error when compiling bfd/ecofflink.c on
x86_64
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dahowell at directv dot com


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



[Bug c/40216] Optimization error when compiling bfd/ecofflink.c on x86_64

2009-05-20 Thread dahowell at directv dot com


--- Comment #1 from dahowell at directv dot com  2009-05-21 03:47 ---
Created an attachment (id=17897)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17897&action=view)
ecofflink.i preprocessed source file


-- 


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



[Bug c/40216] Optimization error when compiling bfd/ecofflink.c on x86_64

2009-05-21 Thread dahowell at directv dot com


--- Comment #3 from dahowell at directv dot com  2009-05-21 21:17 ---
(In reply to comment #2)
So this is a false negative for -Wstrict-aliasing=3. It is flagged by
-Wstrict-aliasing=2, however. Is -Wstrict-aliasing=3 not catching it because
the pointer is not being dereferenced, except in the called function?

Perhaps passing a pointer to a function should be treated as a dereference for
the purpose of generating a warning? This seems like something that could cause
a lot of legacy code to fail in unexpected ways as the optimizer gets better.
Should I submit a separate bug for this code failing to generate a warning with
-Wall?


-- 


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



[Bug c++/22167] New: Strange optimization bug when using -Os

2005-06-23 Thread dahowell at directv dot com
The attached file osbugs.cpp will print a "BUG" message when compiled with 
the -Os switch with g++ 3.4.4 on powerpc.  This is due to the optimizer 
generating incorrect code, by apparently incorrectly determining that S::p is 
not being changed by the method S::init() before S::~S() is called.

I found this bug originally in the 3.3.5 version of the compiler, and it was 
causing a strange crash down in the basic_string code, but I've been able 
strip the code down to what I think is about the minimum needed to reproduce 
the optimization failure.  No pre-processor directives are in the attached 
source file.

The bug has been reproduced in mips-linux 3.3.5, and i386-linux 3.3.2 and 
3.3.5.  The bug does not appear in i386-linux 3.4.4.

Sample output, showing that this bug occurs across several different 
distributions of GCC:

powerpc, 3.4.4:

$ g++-3.4 --version | head -n1
g++-3.4 (GCC) 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
$ g++-3.4 -O2 osbugs.cpp -o osbugs
$ ./osbugs
p is 0x10011050 and p2 is 0x10011050 (should be non-zero and equal)
$ g++-3.4 -Os osbugs.cpp -o osbugs
$ ./osbugs
p is 0x0 and p2 is 0x0 (should be non-zero and equal)
BUG p is 0x10011050 and p2 is 0x0

i386, 3.3.5:

$ g++ --version | head -n1
g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)
$ g++ -O2 osbugs.cpp -o osbugs
$ ./osbugs
p is 0x804a008 and p2 is 0x804a008 (should be non-zero and equal)
$ g++ -Os osbugs.cpp -o osbugs
$ ./osbugs
p is 0x0 and p2 is 0x0 (should be non-zero and equal)
BUG p is 0x804a008 and p2 is 0x0

i386, 3.3.2:

$ g++ --version | head -n1
g++ (GCC) 3.3.2 (Red Hat Linux 3.3.2-1)
$ g++ -O2 osbugs.cpp -o osbugs
$ ./osbugs
p is 0x8f0f008 and p2 is 0x8f0f008 (should be non-zero and equal)
$ g++ -Os osbugs.cpp -o osbugs
$ ./osbugs
p is 0x0 and p2 is 0x0 (should be non-zero and equal)
BUG p is 0x8497008 and p2 is 0x0

mips, 3.3.5:

$ mips-linux-g++ --version | head -n1
mips-linux-g++ (GCC) 3.3.5
$ mips-linux-g++ -O2 osbugs.cpp -o osbugs

[mipsbox]$ ./osbugs
p is 0x1240 and p2 is 0x1240 (should be non-zero and equal)

$ mips-linux-g++ -Os osbugs.cpp -o osbugs

[mipsbox]$ ./osbugs
p is 0x1240 and p2 is 0x0 (should be non-zero and equal)
BUG p is 0x1240 and p2 is 0x0

-- 
   Summary: Strange optimization bug when using -Os
   Product: gcc
   Version: 3.4.4
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: dahowell at directv dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-linux
  GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux


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


[Bug c++/22167] Strange optimization bug when using -Os

2005-06-23 Thread dahowell at directv dot com

--- Additional Comments From dahowell at directv dot com  2005-06-23 23:48 
---
Created an attachment (id=9138)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9138&action=view)
Short test file which demonstrates optimization failuer

This is pretty much what was left of basic_string.h after I removed all the
code which was not needed to cause the bug to happen.  For the curious, S was
derived from the basic_string template, A was derived from the allocator
object, and p used to be the _M_rep pointer to the basic_string::_Rep
structure.  S::init was once basic_string::append.

The function do_nothing was once the allocator's dispose method, but as you can
see it now truly should do nothing.  But it doesn't quite do nothing, it causes
the optimizer to fail when optimizing for size.  The seemingly pointless
static_cast also is needed to cause the bug.  Inlining either S::init or
do_nothing will also make the bug magically disappear.

-- 


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


[Bug c++/22167] Strange optimization bug when using -Os

2005-06-23 Thread dahowell at directv dot com


-- 
   What|Removed |Added

   Attachment #9138|Short test file which   |Short test file which
description|demonstrates optimization   |demonstrates optimization
   |failuer |failure


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