public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept
@ 2011-01-31 22:54 zsojka at seznam dot cz
  2011-02-01 12:04 ` [Bug tree-optimization/47559] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-31 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE: verify_stmts failed: statement marked for throw,
                    but doesn't with -fnon-call-exceptions and noexcept
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 23189
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23189
reduced testcase (from g++.dg/opt/pr46864.C)

Compiler output:
$ gcc -O -fnon-call-exceptions testcase.C -std=c++0x
testcase.C: In function 'void foo(int*)':
testcase.C:1:6: error: statement marked for throw, but doesn't
k__lsm.1_5 = 0;

testcase.C:1:6: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


(gdb) bt
#0  error (gmsgid=0x12aaf08 "statement marked for throw, but doesn%'t") at
/mnt/svn/gcc-trunk/gcc/diagnostic.c:747
#1  0x0000000000a385e3 in verify_stmt () at
/mnt/svn/gcc-trunk/gcc/tree-cfg.c:4175
#2  verify_stmts () at /mnt/svn/gcc-trunk/gcc/tree-cfg.c:4382
#3  0x0000000000b4d92d in verify_ssa (check_modified_stmt=1 '\001') at
/mnt/svn/gcc-trunk/gcc/tree-ssa.c:878
#4  0x00000000009393f9 in execute_function_todo (data=<value optimized out>) at
/mnt/svn/gcc-trunk/gcc/passes.c:1245
#5  0x0000000000939aed in execute_todo (flags=1) at
/mnt/svn/gcc-trunk/gcc/passes.c:1276
#6  0x000000000093c0cf in execute_one_pass (pass=0x17886a0) at
/mnt/svn/gcc-trunk/gcc/passes.c:1584
#7  0x000000000093c395 in execute_pass_list (pass=0x17886a0) at
/mnt/svn/gcc-trunk/gcc/passes.c:1616
#8  0x000000000093c3a7 in execute_pass_list (pass=0x1788760) at
/mnt/svn/gcc-trunk/gcc/passes.c:1617
#9  0x000000000093c3a7 in execute_pass_list (pass=0x17879e0) at
/mnt/svn/gcc-trunk/gcc/passes.c:1617
#10 0x0000000000a7eab6 in tree_rest_of_compilation (fndecl=0x7ffff5d39700) at
/mnt/svn/gcc-trunk/gcc/tree-optimize.c:422
#11 0x0000000000c46302 in cgraph_expand_function (node=0x7ffff5d48000) at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1563
#12 0x0000000000c48a0a in cgraph_expand_all_functions () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1622
#13 cgraph_optimize () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:1882
#14 0x0000000000c48f8a in cgraph_finalize_compilation_unit () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1083
#15 0x00000000005b35fa in cp_write_global_declarations () at
/mnt/svn/gcc-trunk/gcc/cp/decl2.c:3977
#16 0x0000000000a27a34 in compile_file (argc=16, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:591
#17 do_compile (argc=16, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1874
#18 toplev_main (argc=16, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1937
#19 0x00007ffff65f1bbd in __libc_start_main () from /lib/libc.so.6
#20 0x00000000004f9dd5 in _start ()


Tested revisions:
r169440 - crash
4.5 r168785 - doesn't know noexcept


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

* [Bug tree-optimization/47559] ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept
  2011-01-31 22:54 [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept zsojka at seznam dot cz
@ 2011-02-01 12:04 ` rguenth at gcc dot gnu.org
  2011-02-01 16:16 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.02.01 12:03:49
                 CC|                            |rakdver at gcc dot gnu.org
          Component|middle-end                  |tree-optimization
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-01 12:03:49 UTC ---
LIM produces

void foo(int*) (int * k)
Eh tree:
   1 must_not_throw
{
  int k__lsm.1;

<bb 2>:
  k__lsm.1_4 = MEM[(int *)k_1(D)];

<bb 3>:
  [MNT 1] k__lsm.1_5 = 0;

<bb 4>:
  goto <bb 3>;

}

failing to move the EH info.  I think it should just give up here - it
tries to, but only if loop exits via EH edges appear - which is not
the case for must-not-throw.  There is also no exit in that endless loop
anyway - which shows the transform isn't valid as if *k points to
readonly memory the testcase now will fail to trap as the store never
happens.  Which means this is wrong-code as well (should we simply
not do store-motion for loops without exits?).  Thus, the following
would fix the wrong-code issue (but probably not the ICE in a more
generalized test):

Index: gcc/tree-ssa-loop-im.c
===================================================================
--- gcc/tree-ssa-loop-im.c      (revision 169434)
+++ gcc/tree-ssa-loop-im.c      (working copy)
@@ -2368,6 +2368,9 @@ loop_suitable_for_sm (struct loop *loop
   unsigned i;
   edge ex;

+  if (VEC_empty (edge, exits))
+    return false;
+
   FOR_EACH_VEC_ELT (edge, exits, i, ex)
     if (ex->flags & (EDGE_ABNORMAL | EDGE_EH))
       return false;

I am testing that change now.


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

* [Bug tree-optimization/47559] ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept
  2011-01-31 22:54 [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept zsojka at seznam dot cz
  2011-02-01 12:04 ` [Bug tree-optimization/47559] " rguenth at gcc dot gnu.org
@ 2011-02-01 16:16 ` rguenth at gcc dot gnu.org
  2011-02-01 16:18 ` rguenth at gcc dot gnu.org
  2011-02-02 18:29 ` dnovillo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-01 16:16:04 UTC ---
Author: rguenth
Date: Tue Feb  1 16:15:56 2011
New Revision: 169487

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169487
Log:
2011-02-01  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/47559
    * tree-ssa-loop-im.c (can_sm_ref_p): Do not perform
    store-motion on references that can throw.

    * g++.dg/torture/pr47559.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr47559.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-im.c


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

* [Bug tree-optimization/47559] ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept
  2011-01-31 22:54 [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept zsojka at seznam dot cz
  2011-02-01 12:04 ` [Bug tree-optimization/47559] " rguenth at gcc dot gnu.org
  2011-02-01 16:16 ` rguenth at gcc dot gnu.org
@ 2011-02-01 16:18 ` rguenth at gcc dot gnu.org
  2011-02-02 18:29 ` dnovillo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-01 16:18:08 UTC ---
ICE is fixed.  I'll open a new bug for the wrong-code issue.


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

* [Bug tree-optimization/47559] ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept
  2011-01-31 22:54 [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-02-01 16:18 ` rguenth at gcc dot gnu.org
@ 2011-02-02 18:29 ` dnovillo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 18:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 18:15:57 UTC ---
Author: dnovillo
Date: Wed Feb  2 18:15:52 2011
New Revision: 169748

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169748
Log:
2011-02-01  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/47559
    * tree-ssa-loop-im.c (can_sm_ref_p): Do not perform
    store-motion on references that can throw.

    * g++.dg/torture/pr47559.C: New testcase.

Added:
    branches/google/integration/gcc/testsuite/g++.dg/torture/pr47559.C
Modified:
    branches/google/integration/gcc/ChangeLog
    branches/google/integration/gcc/testsuite/ChangeLog
    branches/google/integration/gcc/tree-ssa-loop-im.c


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

end of thread, other threads:[~2011-02-02 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-31 22:54 [Bug middle-end/47559] New: ICE: verify_stmts failed: statement marked for throw, but doesn't with -fnon-call-exceptions and noexcept zsojka at seznam dot cz
2011-02-01 12:04 ` [Bug tree-optimization/47559] " rguenth at gcc dot gnu.org
2011-02-01 16:16 ` rguenth at gcc dot gnu.org
2011-02-01 16:18 ` rguenth at gcc dot gnu.org
2011-02-02 18:29 ` dnovillo 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).