public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "S dot Diederich at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/27795]  New: optimizer produces faulty code
Date: Mon, 29 May 2006 16:52:00 -0000	[thread overview]
Message-ID: <bug-27795-12751@http.gcc.gnu.org/bugzilla/> (raw)

The attached (simple) piece of code segfaults if compiled with (>=)-O2.
There are several possibilities to trigger the error.
1. Using the attached cpp, compile with -O2 ends in segfault when running the
app (-O{0,1} is fine)
2. If the cout in the last line is removed, everything seems to be fine
3. If line 16 is exchanged with line 15, everything is fine, too.
(tested on gentoo and SuSE)

Output of "g++ -v -save-temps -O2 compilerbugCPP.cpp -o compilerbug":
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp
--enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib
--with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic
--host=i586-suse-linux
Thread model: posix
gcc version 4.1.0 (SUSE Linux)
 /usr/lib/gcc/i586-suse-linux/4.1.0/cc1plus -E -quiet -v -D_GNU_SOURCE
compilerbugCPP.cpp -mtune=generic -O2 -fpch-preprocess -o compilerbugCPP.ii
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.1.0
 /usr/include/c++/4.1.0/i586-suse-linux
 /usr/include/c++/4.1.0/backward
 /usr/local/include
 /usr/lib/gcc/i586-suse-linux/4.1.0/include
 /usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc/i586-suse-linux/4.1.0/cc1plus -fpreprocessed compilerbugCPP.ii
-quiet -dumpbase compilerbugCPP.cpp -mtune=generic -auxbase compilerbugCPP -O2
-version -o compilerbugCPP.s
GNU C++ version 4.1.0 (SUSE Linux) (i586-suse-linux)
        compiled by GNU C version 4.1.0 (SUSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129317
Compiler executable checksum: c877835e2478fb620b785c23d7318e1f
 /usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/bin/as -V -Qy
-o compilerbugCPP.o compilerbugCPP.s
GNU assembler version 2.16.91.0.5 (i586-suse-linux) using BFD version
2.16.91.0.5 20051219 (SUSE Linux)
 /usr/lib/gcc/i586-suse-linux/4.1.0/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o compilerbug
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crt1.o
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crti.o
/usr/lib/gcc/i586-suse-linux/4.1.0/crtbegin.o
-L/usr/lib/gcc/i586-suse-linux/4.1.0 -L/usr/lib/gcc/i586-suse-linux/4.1.0
-L/usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/lib
-L/usr/lib/gcc/i586-suse-linux/4.1.0/../../.. compilerbugCPP.o -lstdc++ -lm
-lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i586-suse-linux/4.1.0/crtend.o
/usr/lib/gcc/i586-suse-linux/4.1.0/../../../crtn.o


-- 
           Summary: optimizer produces faulty code
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: S dot Diederich at gmx dot de


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


             reply	other threads:[~2006-05-29 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29 16:52 S dot Diederich at gmx dot de [this message]
2006-05-29 16:53 ` [Bug c++/27795] " S dot Diederich at gmx dot de
2006-05-29 16:54 ` S dot Diederich at gmx dot de
2006-05-29 16:58 ` [Bug tree-optimization/27795] [4.1/4.2 Regression] optimizer produces faulty code [tree-vrp] pinskia at gcc dot gnu dot org
2006-05-29 17:05 ` [Bug tree-optimization/27795] [4.1 " pinskia at gcc dot gnu dot org
2006-05-29 18:03 ` pinskia at gcc dot gnu dot org
2006-05-30 13:46 ` rguenth at gcc dot gnu dot org
2006-07-21 12:27 ` rguenth at gcc dot gnu dot org
2006-07-24  8:26 ` rguenth at gcc dot gnu dot org
2006-07-24  8:29 ` rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27795-12751@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).