public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28683]  New: ICE (segfault) when comparing pointers with -O (and higher)
@ 2006-08-10 15:30 hoserhead at woot dot net
  2006-08-10 19:37 ` [Bug c++/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) " tbm at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hoserhead at woot dot net @ 2006-08-10 15:30 UTC (permalink / raw)
  To: gcc-bugs

This bug applies to gcc 4.0 and 4.1.

The following code:

--- snip here ---
extern void Assert( const char *file, int linenum, const char *function,
               const char *condition, int &ignoreflag);

#define ASSERT(ZZ)       \
    {   static int ignore = 0; \
            if( !ignore && !(ZZ) ) \
                            Assert( __FILE__, __LINE__, __PRETTY_FUNCTION__,
#ZZ, ignore); }

class foo
{
    public:
        int x;
};

class bar
{
    public:
        foo f;
};

bar *
testcase()
{
    bar *r = new bar();
    foo *f = &r->f;
    ASSERT((void *)f == (void *)r);
    return r;
}

--- snip here ---

causes a segfault:

$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,java
--prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.4 20060730 (prerelease) (Debian 4.0.3-6)

$ g++ -c -O testcase.C -o testcase.o
distcc[30704] ERROR: compile /home/joe/.ccache/testcase.tmp.barstow.30700.ii on
localhost failed
testcase.C: In function 'bar* testcase()':
testcase.C:20: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.

$ g++-4.1 -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)
$ g++-4.1 -c -O testcase.C -o testcase.o
testcase.C: In function 'bar* testcase()':
testcase.C:20: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.

Removing the ASSERT, or changing the assert to "if ((void *)f == (void *)r)",
causes the crash to go away.


-- 
           Summary: ICE (segfault) when comparing pointers with -O (and
                    higher)
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hoserhead at woot dot net
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


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

* [Bug c++/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
@ 2006-08-10 19:37 ` tbm at gcc dot gnu dot org
  2006-08-10 20:02 ` [Bug middle-end/28683] " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tbm at gcc dot gnu dot org @ 2006-08-10 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tbm at gcc dot gnu dot org  2006-08-10 19:37 -------

(gdb) run -O2 tt.cc
Starting program: /usr/local/libexec/gcc/i686-pc-linux-gnu/4.2.0/cc1plus -O2
tt.cc
 bar* testcase()
Analyzing compilation unitPerforming intraprocedural optimizations
Assembling functions:
 bar* testcase()
Program received signal SIGSEGV, Segmentation fault.
0x08517abc in add_reg_br_prob_note (last=<value optimized out>,
probability=5347)
    at gcc/cfgexpand.c:58
58              if (!any_condjump_p (last)
(gdb) where
#0  0x08517abc in add_reg_br_prob_note (last=<value optimized out>,
probability=5347)
    at gcc/cfgexpand.c:58
#1  0x08517fd0 in expand_gimple_basic_block (bb=0x40362900)
    at gcc/cfgexpand.c:1128
#2  0x0851938c in tree_expand_cfg () at gcc/cfgexpand.c:1634
#3  0x08514c86 in execute_one_pass (pass=0x872e320) at gcc/passes.c:864
#4  0x08514e57 in execute_pass_list (pass=0x872e320) at gcc/passes.c:911
#5  0x081cc676 in tree_rest_of_compilation (fndecl=0x4040fe70)
    at gcc/tree-optimize.c:418
#6  0x08131c7d in expand_body (fn=0x4040fe70) at gcc/cp/semantics.c:3072
#7  0x08566564 in cgraph_expand_function (node=0x403e2bc8)
    at gcc/cgraphunit.c:1194
#8  0x0856954a in cgraph_optimize () at gcc/cgraphunit.c:1259
#9  0x080d6aba in cp_finish_file () at gcc/cp/decl2.c:3341
#10 0x0819abef in c_common_parse_file (set_yydebug=0) at gcc/c-opts.c:1165
#11 0x084e0a0d in toplev_main (argc=3, argv=0xbffff9f4) at gcc/toplev.c:999
#12 0x081a9972 in main (argc=Cannot access memory at address 0x29
) at gcc/main.c:35
(gdb)


-- 

tbm at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.0.3 4.1.1 4.2.0
      Known to work|                            |3.3.6 3.4.6
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-10 19:37:19
               date|                            |
            Summary|ICE (segfault) when         |[4.0/4.1/4.2 regression] ICE
                   |comparing pointers with -O  |(segfault in
                   |(and higher)                |add_reg_br_prob_note) when
                   |                            |comparing pointers with -O
                   |                            |(and higher)


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
  2006-08-10 19:37 ` [Bug c++/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) " tbm at gcc dot gnu dot org
@ 2006-08-10 20:02 ` pinskia at gcc dot gnu dot org
  2006-08-11 16:17 ` janis at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-10 20:02 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
           Severity|normal                      |critical
   Target Milestone|---                         |4.0.4


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
  2006-08-10 19:37 ` [Bug c++/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) " tbm at gcc dot gnu dot org
  2006-08-10 20:02 ` [Bug middle-end/28683] " pinskia at gcc dot gnu dot org
@ 2006-08-11 16:17 ` janis at gcc dot gnu dot org
  2006-08-18  4:37 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-08-11 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2006-08-11 16:17 -------
A regression hunt using an i686-linux cross compiler for the submitter's
testcase with "-O2 -march=i486 -mtune=i686" identified the following patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=105606

    r105606 | bonzini | 2005-10-19 10:37:31 +0000 (Wed, 19 Oct 2005)

This was after the 4.0 branch was created; the same patch was added to that
branch two days later.


-- 


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (2 preceding siblings ...)
  2006-08-11 16:17 ` janis at gcc dot gnu dot org
@ 2006-08-18  4:37 ` pinskia at gcc dot gnu dot org
  2006-08-20 22:36 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-08-18  4:37 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |blocker


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (3 preceding siblings ...)
  2006-08-18  4:37 ` pinskia at gcc dot gnu dot org
@ 2006-08-20 22:36 ` mmitchel at gcc dot gnu dot org
  2006-08-23 14:18 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-20 22:36 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (4 preceding siblings ...)
  2006-08-20 22:36 ` mmitchel at gcc dot gnu dot org
@ 2006-08-23 14:18 ` jakub at gcc dot gnu dot org
  2006-08-23 18:16 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-08-23 14:18 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-08-10 19:37:19         |2006-08-23 14:18:30
               date|                            |


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (5 preceding siblings ...)
  2006-08-23 14:18 ` jakub at gcc dot gnu dot org
@ 2006-08-23 18:16 ` patchapp at dberlin dot org
  2006-08-26  7:32 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: patchapp at dberlin dot org @ 2006-08-23 18:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2006-08-23 18:16 -------
Subject: Bug number PR middle-end/28683

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00836.html


-- 


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


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

* [Bug middle-end/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (6 preceding siblings ...)
  2006-08-23 18:16 ` patchapp at dberlin dot org
@ 2006-08-26  7:32 ` jakub at gcc dot gnu dot org
  2006-09-01  7:48 ` [Bug middle-end/28683] [4.0/4.1 " jakub at gcc dot gnu dot org
  2007-02-03 18:51 ` [Bug middle-end/28683] [4.0 " gdr at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-08-26  7:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2006-08-26 07:31 -------
Subject: Bug 28683

Author: jakub
Date: Sat Aug 26 07:31:30 2006
New Revision: 116467

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116467
Log:
        PR middle-end/28683
        * cfgexpand.c (add_reg_br_prob_note): Check if last has exactly
        3 following insns.

        * gcc.c-torture/compile/20060823-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/20060823-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/28683] [4.0/4.1 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (7 preceding siblings ...)
  2006-08-26  7:32 ` jakub at gcc dot gnu dot org
@ 2006-09-01  7:48 ` jakub at gcc dot gnu dot org
  2007-02-03 18:51 ` [Bug middle-end/28683] [4.0 " gdr at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-09-01  7:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2006-09-01 07:48 -------
Subject: Bug 28683

Author: jakub
Date: Fri Sep  1 07:48:22 2006
New Revision: 116620

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116620
Log:
        PR middle-end/28683
        * cfgexpand.c (add_reg_br_prob_note): Check if last has exactly
        3 following insns.

        * gcc.c-torture/compile/20060823-1.c: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/20060823-1.c
      - copied unchanged from r116467,
trunk/gcc/testsuite/gcc.c-torture/compile/20060823-1.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/cfgexpand.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/28683] [4.0 regression] ICE (segfault in add_reg_br_prob_note) when comparing pointers with -O (and higher)
  2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
                   ` (8 preceding siblings ...)
  2006-09-01  7:48 ` [Bug middle-end/28683] [4.0/4.1 " jakub at gcc dot gnu dot org
@ 2007-02-03 18:51 ` gdr at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2007-02-03 18:51 -------
Fixed in GCC-4.1.2.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.0.4                       |4.1.2


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


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

end of thread, other threads:[~2007-02-03 18:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-10 15:30 [Bug c++/28683] New: ICE (segfault) when comparing pointers with -O (and higher) hoserhead at woot dot net
2006-08-10 19:37 ` [Bug c++/28683] [4.0/4.1/4.2 regression] ICE (segfault in add_reg_br_prob_note) " tbm at gcc dot gnu dot org
2006-08-10 20:02 ` [Bug middle-end/28683] " pinskia at gcc dot gnu dot org
2006-08-11 16:17 ` janis at gcc dot gnu dot org
2006-08-18  4:37 ` pinskia at gcc dot gnu dot org
2006-08-20 22:36 ` mmitchel at gcc dot gnu dot org
2006-08-23 14:18 ` jakub at gcc dot gnu dot org
2006-08-23 18:16 ` patchapp at dberlin dot org
2006-08-26  7:32 ` jakub at gcc dot gnu dot org
2006-09-01  7:48 ` [Bug middle-end/28683] [4.0/4.1 " jakub at gcc dot gnu dot org
2007-02-03 18:51 ` [Bug middle-end/28683] [4.0 " gdr 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).