public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27795]  New: optimizer produces faulty code
@ 2006-05-29 16:52 S dot Diederich at gmx dot de
  2006-05-29 16:53 ` [Bug c++/27795] " S dot Diederich at gmx dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: S dot Diederich at gmx dot de @ 2006-05-29 16:52 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c++/27795] optimizer produces faulty code
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
@ 2006-05-29 16:53 ` S dot Diederich at gmx dot de
  2006-05-29 16:54 ` S dot Diederich at gmx dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: S dot Diederich at gmx dot de @ 2006-05-29 16:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from S dot Diederich at gmx dot de  2006-05-29 16:53 -------
Created an attachment (id=11530)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11530&action=view)
cpp to reproduce the error


-- 


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


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

* [Bug c++/27795] optimizer produces faulty code
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: S dot Diederich at gmx dot de @ 2006-05-29 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from S dot Diederich at gmx dot de  2006-05-29 16:54 -------
Created an attachment (id=11531)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11531&action=view)
corresponding ii


-- 


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


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

* [Bug tree-optimization/27795] [4.1/4.2 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
  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 ` 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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 16:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
          Component|c++                         |tree-optimization
           Keywords|                            |wrong-code
            Summary|optimizer produces faulty   |[4.1/4.2 Regression]
                   |code                        |optimizer produces faulty
                   |                            |code [tree-vrp]
   Target Milestone|---                         |4.1.2


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (2 preceding siblings ...)
  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 ` pinskia at gcc dot gnu dot org
  2006-05-29 18:03 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 17:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-05-29 17:05 -------
Fixed at least on the mainline as of today (but was not as of 20060507).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression]        |[4.1 Regression] optimizer
                   |optimizer produces faulty   |produces faulty code [tree-
                   |code [tree-vrp]             |vrp]


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 18:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-05-29 18:03 -------
Still fails on the 4.1 branch.

Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-29 18:03:10
               date|                            |


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-30 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-05-30 13:45 -------
We transform the loop into an infinite loop.  Looks like a sort-of-dup of
PR27639 and/or PR26719.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu dot
                   |                            |org
  BugsThisDependsOn|                            |26719, 27639


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-21 12:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2006-07-21 12:27 -------
Backporting the fixes fixes this bug.


-- 


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-24  8:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-07-24 08:26 -------
Subject: Bug 27795

Author: rguenth
Date: Mon Jul 24 08:25:57 2006
New Revision: 115709

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115709
Log:
2006-07-21  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/27795
        PR tree-optimization/27639
        PR tree-optimization/26719
        Backport from mainline
        2006-05-24  Zdenek Dvorak <dvorakz@suse.cz>

        * tree-vrp.c (adjust_range_with_scev): Use scev_direction and adjust
        call to scev_probably_wraps_p.
        * tree-ssa-loop-niter.c (compare_trees, convert_step_widening,
        used_in_pointer_arithmetic_p, convert_step): Removed.
        (nowrap_type_p): New function.
        (scev_probably_wraps_p): Rewritten.
        * tree-scalar-evolution.c (instantiate_parameters_1): Do not call
        chrec_convert if chrec_convert_aggressive might have been used.
        * tree-chrec.c (convert_affine_scev, chrec_convert_1,
        scev_direction): New functions.
        (chrec_convert): Changed to a wrapper over chrec_convert_1.
        * tree-ssa-loop-ivopts.c (idx_find_step): Use convert_affine_scev
        instead of convert_step.
        * tree-flow.h (scev_probably_wraps_p): Declaration changed.
        (convert_step): Declaration removed.
        (convert_affine_scev, nowrap_type_p, scev_direction): Declare.

        * gcc.dg/pr27639.c: New test.
        * gcc.dg/pr26719.c: New test.
        * gcc.dg/tree-ssa/scev-cast.c: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr26719.c
      - copied unchanged from r114057, trunk/gcc/testsuite/gcc.dg/pr26719.c
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr27639.c
      - copied unchanged from r114057, trunk/gcc/testsuite/gcc.dg/pr27639.c
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c
      - copied unchanged from r114057,
trunk/gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-chrec.c
    branches/gcc-4_1-branch/gcc/tree-flow.h
    branches/gcc-4_1-branch/gcc/tree-scalar-evolution.c
    branches/gcc-4_1-branch/gcc/tree-ssa-loop-ivopts.c
    branches/gcc-4_1-branch/gcc/tree-ssa-loop-niter.c
    branches/gcc-4_1-branch/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/27795] [4.1 Regression] optimizer produces faulty code [tree-vrp]
  2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
                   ` (7 preceding siblings ...)
  2006-07-24  8:26 ` rguenth at gcc dot gnu dot org
@ 2006-07-24  8:29 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-07-24  8:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-07-24 08:28 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2006-07-24  8:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-29 16:52 [Bug c++/27795] New: optimizer produces faulty code S dot Diederich at gmx dot de
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

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).