public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
@ 2011-10-09 19:07 zsojka at seznam dot cz
  2011-10-10  9:43 ` [Bug tree-optimization/50682] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2011-10-09 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50682
           Summary: [4.7 Regression] ICE: SIGSEGV in main_block_label with
                    -O2 -fnon-call-exceptions -ftracer
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 25450
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25450
reduced testcase

Compiler output:
$ gcc -O2 -fnon-call-exceptions -ftracer -fno-tree-ccp -fno-tree-copy-prop
-fno-tree-dce testcase.C
==3654== Invalid read of size 4
==3654==    at 0xB65233: main_block_label(tree_node*) (tree-cfg.c:1082)
==3654==    by 0xB6965E: cleanup_dead_labels() (tree-cfg.c:1111)
==3654==    by 0xBBA2EC: execute_cleanup_cfg_post_optimizing()
(tree-optimize.c:162)
==3654==    by 0xA62BF7: execute_one_pass(opt_pass*) (passes.c:2064)
==3654==    by 0xA62F64: execute_pass_list(opt_pass*) (passes.c:2119)
==3654==    by 0xBBACFD: tree_rest_of_compilation(tree_node*)
(tree-optimize.c:420)
==3654==    by 0x815EE5: cgraph_expand_function(cgraph_node*)
(cgraphunit.c:1805)
==3654==    by 0x817E2B: cgraph_optimize() (cgraphunit.c:1864)
==3654==    by 0x818219: cgraph_finalize_compilation_unit() (cgraphunit.c:1312)
==3654==    by 0x64266A: cp_write_global_declarations() (decl2.c:4008)
==3654==    by 0xB58803: toplev_main(int, char**) (toplev.c:581)
==3654==    by 0x674ED2C: (below main) (in /lib64/libc-2.12.2.so)
==3654==  Address 0x50 is not stack'd, malloc'd or (recently) free'd
==3654== 
testcase.C: In function 'void test01()':
testcase.C:29:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r179711 - crash
r178498 - crash
4.6 r177922 - OK


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
@ 2011-10-10  9:43 ` rguenth at gcc dot gnu.org
  2011-10-10 15:34 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-10  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
  2011-10-10  9:43 ` [Bug tree-optimization/50682] " rguenth at gcc dot gnu.org
@ 2011-10-10 15:34 ` rguenth at gcc dot gnu.org
  2011-11-23 16:53 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-10 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-10-10
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-10 15:33:23 UTC ---
Confirmed.


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
  2011-10-10  9:43 ` [Bug tree-optimization/50682] " rguenth at gcc dot gnu.org
  2011-10-10 15:34 ` rguenth at gcc dot gnu.org
@ 2011-11-23 16:53 ` jakub at gcc dot gnu.org
  2011-11-23 17:17 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-11-23 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-23 16:43:36 UTC ---
The problem here is that with all the -fno-* options we end up with code like:
<bb 14>:
  D.2284_38 = &__size;

<bb 35>:
  # D.2281_58 = PHI <&__size(14)>
  D.2283_59 = D.2281_58;
  D.2281_60 = D.2281_58;
  D.2281_61 = D.2281_58;
  __r_62 = *D.2281_58;
at the beginning of ehcleanup2 pass.  Then we clean up eh and as something
changed, TODO_cleanup_cfg is requested.  Only the cfgcleanup after ehcleanup2
will attempt to merge the above two blocks, which changes it to
  D.2284_38 = &__size;
  D.2283_59 = &__size;
  D.2281_60 = &__size;
  D.2281_61 = &__size;
  __r_62 = &__size;
which unfortunately means that the last stmt in thise bb is considered to no
longer throw and gimple_purge_dead_eh_edges is called on it.  But there is no
further ehcleanup afterwards.  Calling remove_unreachable_handlers () from
execute_cleanup_cfg_post_optimizing or scheduling another ehcleanup pass right
before it would fix it, but it would make compilation tiny bit slower because
of another pass through all stmts.


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-11-23 16:53 ` jakub at gcc dot gnu.org
@ 2011-11-23 17:17 ` jakub at gcc dot gnu.org
  2011-11-27 16:05 ` zsojka at seznam dot cz
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-11-23 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-23 16:47:04 UTC ---
Created attachment 25903
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25903
gcc47-pr50682.patch

We can perhaps only call it if any landing pads were actually removed after the
last ehcleanup pass.


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2011-11-23 17:17 ` jakub at gcc dot gnu.org
@ 2011-11-27 16:05 ` zsojka at seznam dot cz
  2011-11-28 21:06 ` jakub at gcc dot gnu.org
  2011-11-28 21:18 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2011-11-27 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Zdenek Sojka <zsojka at seznam dot cz> 2011-11-27 13:13:45 UTC ---
Created attachment 25919
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25919
another testcase

This testcase doesn't need any -fno-* flags. It might be the same problem (the
backtrace is the same).

$ gcc -O2 -fnon-call-exceptions -mfma4 testcase.C
==18808== Invalid read of size 4
==18808==    at 0xB961F3: main_block_label(tree_node*) (tree-cfg.c:1092)
==18808==    by 0xB9A56B: cleanup_dead_labels() (tree-cfg.c:1121)
==18808==    by 0xBEAB9C: execute_cleanup_cfg_post_optimizing()
(tree-optimize.c:162)
==18808==    by 0xA89CF4: execute_one_pass(opt_pass*) (passes.c:2074)
==18808==    by 0xA8A094: execute_pass_list(opt_pass*) (passes.c:2129)
==18808==    by 0xBEB5BD: tree_rest_of_compilation(tree_node*)
(tree-optimize.c:420)
==18808==    by 0x83F949: cgraph_expand_function(cgraph_node*)
(cgraphunit.c:1819)
==18808==    by 0x8416EB: cgraph_optimize() (cgraphunit.c:1886)
==18808==    by 0x841E59: cgraph_finalize_compilation_unit()
(cgraphunit.c:1327)
==18808==    by 0x6632EA: cp_write_global_declarations() (decl2.c:4050)
==18808==    by 0xB7EE43: toplev_main(int, char**) (toplev.c:581)
==18808==    by 0x674ED2C: (below main) (in /lib64/libc-2.12.2.so)
==18808==  Address 0x50 is not stack'd, malloc'd or (recently) free'd
==18808== 
testcase.C: In function 'void test01()':
testcase.C:21:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

However, when the code is modified a little (ternary operator is replaced by
if/else), the crash is different:
$ gcc -O2 -fnon-call-exceptions -mfma4 testcase.C                     
testcase.C: In function 'void test01()':
testcase.C:21:1: error: BB 2 can not throw but has an EH edge
testcase.C:21:1: internal compiler error: verify_flow_info failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2011-11-27 16:05 ` zsojka at seznam dot cz
@ 2011-11-28 21:06 ` jakub at gcc dot gnu.org
  2011-11-28 21:18 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-11-28 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-28 21:02:33 UTC ---
Author: jakub
Date: Mon Nov 28 21:02:27 2011
New Revision: 181785

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181785
Log:
    PR tree-optimization/50682
    * tree-eh.c (maybe_remove_unreachable_handlers): New function.
    * tree-flow.h (maybe_remove_unreachable_handlers): New prototype.
    * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Call it.

    * g++.dg/opt/pr50682.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr50682.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-eh.c
    trunk/gcc/tree-flow.h
    trunk/gcc/tree-optimize.c


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

* [Bug tree-optimization/50682] [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer
  2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2011-11-28 21:06 ` jakub at gcc dot gnu.org
@ 2011-11-28 21:18 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-11-28 21:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-28 21:08:07 UTC ---
Fixed.


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

end of thread, other threads:[~2011-11-28 21:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09 19:07 [Bug tree-optimization/50682] New: [4.7 Regression] ICE: SIGSEGV in main_block_label with -O2 -fnon-call-exceptions -ftracer zsojka at seznam dot cz
2011-10-10  9:43 ` [Bug tree-optimization/50682] " rguenth at gcc dot gnu.org
2011-10-10 15:34 ` rguenth at gcc dot gnu.org
2011-11-23 16:53 ` jakub at gcc dot gnu.org
2011-11-23 17:17 ` jakub at gcc dot gnu.org
2011-11-27 16:05 ` zsojka at seznam dot cz
2011-11-28 21:06 ` jakub at gcc dot gnu.org
2011-11-28 21:18 ` jakub at gcc dot gnu.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).