public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g"
@ 2011-07-01  0:00 arthur.j.odwyer at gmail dot com
  2011-07-01  7:05 ` [Bug middle-end/49602] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2011-07-01  0:00 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: verify_ssa failed (definition does not dominate use)
                    with "-O2 -g"
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arthur.j.odwyer@gmail.com


Created attachment 24649
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24649
Output of "ajo-gcc -std=c99 -O2 -g -w -c test.c -v"

This failure reproduces for me with svn revision 175547
(2011-06-27). I've seen it twice in random testing, and never saw it back in
May, so it must be a fairly new regression. I'm on Ubuntu 10.10, x86-64.


cat >test.c <<EOF
static void use(int *p_29) { }
void func_25(int *p_29) {
    for (short p_26 = 0; p_26 == 1; ++p_26)
      p_29 = 0;
    use(p_29);
}
EOF
gcc -std=c99 -O2 -g -w -c test.c

test.c: In function ‘func_25’:
test.c:6:1: error: definition in block 3 does not dominate use in block 5
for SSA_NAME: p_29_3 in statement:
# DEBUG D#1 => p_29_3
test.c:6:1: internal compiler error: verify_ssa failed


Bug 40711 (from 2009) has the same symptom, but doesn't require "-g", so it
probably has a different root cause.

This test case is reduced from the output of Csmith 2.1.0 (git hash 01aa8b04,
https://github.com/Quuxplusone/csmith/), using the following command line:
csmith --no-paranoid --longlong --pointers --no-arrays --jumps --no-consts
--volatiles --checksum --no-divs --muls --no-bitfields --no-packed-struct -s
651222746


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

* [Bug middle-end/49602] [4.7 Regression] verify_ssa failed (definition does not dominate use) with "-O2 -g"
  2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
@ 2011-07-01  7:05 ` rguenth at gcc dot gnu.org
  2011-07-01 11:16 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-01  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.01 07:04:56
          Component|tree-optimization           |middle-end
      Known to work|                            |4.6.1
   Target Milestone|---                         |4.7.0
            Summary|verify_ssa failed           |[4.7 Regression] verify_ssa
                   |(definition does not        |failed (definition does not
                   |dominate use) with "-O2 -g" |dominate use) with "-O2 -g"
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-01 07:04:56 UTC ---
Huh, this is from into-SSA.  Confirmed.


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

* [Bug middle-end/49602] [4.7 Regression] verify_ssa failed (definition does not dominate use) with "-O2 -g"
  2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
  2011-07-01  7:05 ` [Bug middle-end/49602] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-07-01 11:16 ` jakub at gcc dot gnu.org
  2011-07-01 14:53 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-01 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

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-07-01 11:16:14 UTC ---
Caused by my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175288
so I'll have a look...


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

* [Bug middle-end/49602] [4.7 Regression] verify_ssa failed (definition does not dominate use) with "-O2 -g"
  2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
  2011-07-01  7:05 ` [Bug middle-end/49602] [4.7 Regression] " rguenth at gcc dot gnu.org
  2011-07-01 11:16 ` jakub at gcc dot gnu.org
@ 2011-07-01 14:53 ` jakub at gcc dot gnu.org
  2011-07-04 17:21 ` [Bug debug/49602] " jakub at gcc dot gnu.org
  2011-07-04 18:25 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-01 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-01 14:52:30 UTC ---
The problem is that for the debug uses before going into SSA we obviously don't
want the uses to affect code generation and thus we don't call
set_livein_block.
Unfortunately that means get_current_def is sometimes incorrect during rewrite_

--- tree-into-ssa.c.jj 22011-06-23 10:13:58.000000000 +0200
+++ tree-into-ssa.c 2011-07-01 16:23:04.000000000 +0200
@@ -1343,7 +1343,15 @@ rewrite_debug_stmt_uses (gimple stmt)
             }
         }
       else
-        def = get_current_def (var);
+        {
+          def = get_current_def (var);
+          if (def
+              && !SSA_NAME_IS_DEFAULT_DEF (def)
+              && gimple_bb (SSA_NAME_DEF_STMT (def)) != gimple_bb (stmt)
+              && !dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt),
+                                  gimple_bb (SSA_NAME_DEF_STMT (def))))
+            def = NULL;
+        }
       if (def == NULL)
         {
           gimple_debug_bind_reset_value (stmt);

seems to fix the ICE, the question is if get_current_def can be trusted to be
the right SSA_NAME even after this check.
I guess if the definition bb is the same as stmt's bb, it can, similarly
if get_phi_state (var) == NEED_PHI_STATE_NO (plus the dominated_by_p check
above), or if bitmap_bit_p (get_def_blocks_for (var)->livein_blocks, gimple_bb
(stmt)->index).  Any other cases?


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

* [Bug debug/49602] [4.7 Regression] verify_ssa failed (definition does not dominate use) with "-O2 -g"
  2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
                   ` (2 preceding siblings ...)
  2011-07-01 14:53 ` jakub at gcc dot gnu.org
@ 2011-07-04 17:21 ` jakub at gcc dot gnu.org
  2011-07-04 18:25 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 17:19:54 UTC ---
Author: jakub
Date: Mon Jul  4 17:19:52 2011
New Revision: 175818

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175818
Log:
    PR debug/49602
    * tree-into-ssa.c (rewrite_debug_stmt_uses): Disregard
    get_current_def return value if it can't be trusted to be
    the current value of the variable in the current bb.

    * gcc.dg/pr49602.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr49602.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-into-ssa.c


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

* [Bug debug/49602] [4.7 Regression] verify_ssa failed (definition does not dominate use) with "-O2 -g"
  2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
                   ` (3 preceding siblings ...)
  2011-07-04 17:21 ` [Bug debug/49602] " jakub at gcc dot gnu.org
@ 2011-07-04 18:25 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 18:24:39 UTC ---
Fixed.


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

end of thread, other threads:[~2011-07-04 18:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-01  0:00 [Bug tree-optimization/49602] New: verify_ssa failed (definition does not dominate use) with "-O2 -g" arthur.j.odwyer at gmail dot com
2011-07-01  7:05 ` [Bug middle-end/49602] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-07-01 11:16 ` jakub at gcc dot gnu.org
2011-07-01 14:53 ` jakub at gcc dot gnu.org
2011-07-04 17:21 ` [Bug debug/49602] " jakub at gcc dot gnu.org
2011-07-04 18:25 ` 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).