public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm
@ 2012-02-08 15:51 lloyd at randombit dot net
  2012-02-08 15:53 ` [Bug middle-end/52173] " lloyd at randombit dot net
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: lloyd at randombit dot net @ 2012-02-08 15:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52173
           Summary: internal compiler error: verify_ssa failed possibly
                    caused by itm
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lloyd@randombit.net


Testcase, attached, fails to compile under -O3. Fine under -O2. The error does
not occur if I comment out the __transaction_relaxed

$ g++-4.7.0 -O3 -std=c++11 -fgnu-tm concur.cpp -o concur -litm
concur.cpp: In function 'void many_sets()':
concur.cpp:19:6: error: definition in block 8 does not dominate use in block 98
for SSA_NAME: D.40799_64 in statement:
D.43917_72 = (size_type) D.40799_64;
concur.cpp:19:6: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Version info:

$ g++-4.7.0 -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++-4.7.0
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7.0-r183974/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-svn/configure --prefix=/usr/local/gcc-4.7.0-r183974
--enable-languages=c,c++,go --program-suffix=-4.7.0-r183974
Thread model: posix
gcc version 4.7.0 20120207 (experimental) (GCC)


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
@ 2012-02-08 15:53 ` lloyd at randombit dot net
  2012-02-08 15:54 ` lloyd at randombit dot net
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: lloyd at randombit dot net @ 2012-02-08 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jack Lloyd <lloyd at randombit dot net> 2012-02-08 15:52:19 UTC ---
Created attachment 26615
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26615
Testcase


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
  2012-02-08 15:53 ` [Bug middle-end/52173] " lloyd at randombit dot net
@ 2012-02-08 15:54 ` lloyd at randombit dot net
  2012-02-15  3:50 ` regehr at cs dot utah.edu
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: lloyd at randombit dot net @ 2012-02-08 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

Jack Lloyd <lloyd at randombit dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #26615|0                           |1
        is obsolete|                            |

--- Comment #2 from Jack Lloyd <lloyd at randombit dot net> 2012-02-08 15:54:25 UTC ---
Created attachment 26616
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26616
Testcase

Elide the thread stuff from the testcase, doesn't affect the error


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
  2012-02-08 15:53 ` [Bug middle-end/52173] " lloyd at randombit dot net
  2012-02-08 15:54 ` lloyd at randombit dot net
@ 2012-02-15  3:50 ` regehr at cs dot utah.edu
  2012-02-15  3:54 ` pinskia at gcc dot gnu.org
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: regehr at cs dot utah.edu @ 2012-02-15  3:50 UTC (permalink / raw)
  To: gcc-bugs

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

John Regehr <regehr at cs dot utah.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |regehr at cs dot utah.edu

--- Comment #3 from John Regehr <regehr at cs dot utah.edu> 2012-02-15 03:50:18 UTC ---
Smaller testcase in pure C for apparently the same problem.

[regehr@gamow 1]$ current-gcc -Ofast small.c
small.c: In function 'f':
small.c:3:6: error: definition in block 8 does not dominate use in block 9
for SSA_NAME: .MEM_22 in statement:
# .MEM_29 = VDEF <.MEM_22>
c[0] = c_I_lsm.9_32;
small.c:3:6: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[regehr@gamow 1]$ cat small.c
int a, b, c[10], d[10] = { 0, 0 };

void f (void) {
  for (a = 1; a <= 4; a += 1)
    d[a] = d[1];
  for (; b; ++b)
    c[0] |= 1;
}
[regehr@gamow 1]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r184237-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r184237-install
--program-prefix=r184237- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20120214 (experimental) (GCC)


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (2 preceding siblings ...)
  2012-02-15  3:50 ` regehr at cs dot utah.edu
@ 2012-02-15  3:54 ` pinskia at gcc dot gnu.org
  2012-02-15  3:58 ` regehr at cs dot utah.edu
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-15  3:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-15 03:53:52 UTC ---
(In reply to comment #3)
> Smaller testcase in pure C for apparently the same problem.

This is a different issue, Can you file a bug report about this one?


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (3 preceding siblings ...)
  2012-02-15  3:54 ` pinskia at gcc dot gnu.org
@ 2012-02-15  3:58 ` regehr at cs dot utah.edu
  2012-08-13  6:57 ` jakub at gcc dot gnu.org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: regehr at cs dot utah.edu @ 2012-02-15  3:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from John Regehr <regehr at cs dot utah.edu> 2012-02-15 03:58:22 UTC ---
Sorry, see PR52255


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (4 preceding siblings ...)
  2012-02-15  3:58 ` regehr at cs dot utah.edu
@ 2012-08-13  6:57 ` jakub at gcc dot gnu.org
  2012-09-12 19:53 ` aldyh at gcc dot gnu.org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-13  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-08-13
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
     Ever Confirmed|0                           |1


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (5 preceding siblings ...)
  2012-08-13  6:57 ` jakub at gcc dot gnu.org
@ 2012-09-12 19:53 ` aldyh at gcc dot gnu.org
  2012-09-12 19:53 ` aldyh at gcc dot gnu.org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-09-12 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-12 19:52:55 UTC ---
I'll take a look.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (6 preceding siblings ...)
  2012-09-12 19:53 ` aldyh at gcc dot gnu.org
@ 2012-09-12 19:53 ` aldyh at gcc dot gnu.org
  2012-09-14 21:20 ` aldyh at gcc dot gnu.org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-09-12 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-12 19:52:55 UTC ---
I'll take a look.

--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-12 19:53:30 UTC ---
I'll take a look.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (7 preceding siblings ...)
  2012-09-12 19:53 ` aldyh at gcc dot gnu.org
@ 2012-09-14 21:20 ` aldyh at gcc dot gnu.org
  2012-09-19 19:44 ` aldyh at gcc dot gnu.org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-09-14 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-14 21:20:23 UTC ---
Created attachment 28195
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28195
reduced testcase

Further reduced testcase that triggers on either C/C++.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (8 preceding siblings ...)
  2012-09-14 21:20 ` aldyh at gcc dot gnu.org
@ 2012-09-19 19:44 ` aldyh at gcc dot gnu.org
  2012-09-20  7:44 ` rguenther at suse dot de
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-09-19 19:44 UTC (permalink / raw)
  To: gcc-bugs


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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com,
                   |                            |dnovillo at gcc dot
                   |                            |gnu.org, rguenth at gcc dot
                   |                            |gnu.org

--- Comment #9 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-19 19:44:14 UTC ---
Richi, Diego.  Perhaps you can shed light on this.

Here we have a loop unroll that triggers a "virtual def operand missing..." for
a GIMPLE_TRANSACTION:

    int vec[500];

    void func()
    {
        __transaction_relaxed
        {
          vec[123] = 456;
        }
    }

    main()
    {
      int i;
      for(i = 0; i < 10; ++i)
        func();
    }

The unroller wants to unroll into something like:

  <bb 2>:
  # .MEM_6 = VDEF <.MEM_13>
  __transaction_relaxed        <-- PROBLEMATIC INSN (VDEF's)

  <bb 3>:
  # .MEM_9 = VDEF <.MEM_59>
  vec[123] = 456;
  # .MEM_2 = VDEF <.MEM_9>
  __builtin__ITM_commitTransaction ();

  <bb 4>:
  ivtmp_14 = 9;
  # .MEM_11 = VDEF <.MEM_13>
  __transaction_relaxed

  <bb 5>:
  # .MEM_18 = VDEF <.MEM_59>
  vec[123] = 456;
  # .MEM_19 = VDEF <.MEM_18>
  __builtin__ITM_commitTransaction ();

etc etc etc.

Putting aside how incredibly inefficient this is... (We should be duplicating
the vector store, not the entire transaction)...

The problem here is that, after unrolling, the VDEF of the problematic insn is
.MEM_6, but the DEF_OP of the insn is .MEM_59.  So gimple_vdef() !=
gimple_vdef_op() and we trigger a "virtual def operand missing for stmt".

The problem is that the unroller's call to gimple_duplicate_bb() will make a
copy of the problematic instruction, maintaining its gimple_vdef, but changing
all its def_ops from under us, thus making gimple_vdef() != gimple_vdef_op().

Before loop unrolling we have this snippet that is about to be unrolled:

  <bb 3>:
  # .MEM_13 = PHI <.MEM_8(6), .MEM_3(D)(2)>
  # ivtmp_1 = PHI <ivtmp_10(6), 10(2)>
  # .MEM_6 = VDEF <.MEM_13>
  __transaction_relaxed

After loop unrolling the above remains unchanged, but the following is inserted
*before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), but
before cleanup_tree_cfg() for clarity.]

 <bb 8>:
  # .MEM_12 = PHI <.MEM_3(D)(2)>
  # ivtmp_5 = PHI <10(2)>
  # .MEM_6 = VDEF <.MEM_13>     <-- *************************** -->
                  ^^^^^^^^^^^^  <-- shouldn't this be <.MEM_12> ?????
                                <-- *************************** -->
  __transaction_relaxed
...
...more unrolling
...
 <bb 40>:
  # .MEM_57 = PHI <.MEM_8(39)>
  # ivtmp_58 = PHI <ivtmp_10(39)>
  # .MEM_53 = VDEF <.MEM_13>    <-- ************************** -->
                                <-- shouldn't this be <.MEM_57> ????
                                <-- ************************** -->
  __transaction_relaxed
...
...
 <bb 3>
 ..

Notice that both BB8 and BB40 invalidate MEM_13 in its virtual definition. 
Shouldn't the VDEF<.MEM_13> be rewritten as I have indicated above?  Especially
since now .MEM_13 is defined much further down in bb 3:

<bb 8>
    # invalidates VDEF<.MEM_13>
...
<bb 40>
    # invalidates VDEF<.MEM_13>
..
<bb 3>
    # define .MEM_13  = ....

It seems gimple_duplicate_bb() renames all the phis and the operands, but does
not update the VDEF's for the transaction. Gimple_duplicate_bb() says it
doesn't maintain SSA form, so I assume this in on purpose (?).  So how is this
supposed to be cleaned up?  Or is this even the problem?


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (9 preceding siblings ...)
  2012-09-19 19:44 ` aldyh at gcc dot gnu.org
@ 2012-09-20  7:44 ` rguenther at suse dot de
  2012-09-20 15:09 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenther at suse dot de @ 2012-09-20  7:44 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> 2012-09-20 07:43:56 UTC ---
On Wed, 19 Sep 2012, aldyh at gcc dot gnu.org wrote:

> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52173
> 
> Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |amacleod at redhat dot com,
>                    |                            |dnovillo at gcc dot
>                    |                            |gnu.org, rguenth at gcc dot
>                    |                            |gnu.org
> 
> --- Comment #9 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-09-19 19:44:14 UTC ---
> Richi, Diego.  Perhaps you can shed light on this.
> 
> Here we have a loop unroll that triggers a "virtual def operand missing..." for
> a GIMPLE_TRANSACTION:
> 
>     int vec[500];
> 
>     void func()
>     {
>         __transaction_relaxed
>         {
>           vec[123] = 456;
>         }
>     }
> 
>     main()
>     {
>       int i;
>       for(i = 0; i < 10; ++i)
>         func();
>     }
> 
> The unroller wants to unroll into something like:
> 
>   <bb 2>:
>   # .MEM_6 = VDEF <.MEM_13>
>   __transaction_relaxed        <-- PROBLEMATIC INSN (VDEF's)
> 
>   <bb 3>:
>   # .MEM_9 = VDEF <.MEM_59>
>   vec[123] = 456;
>   # .MEM_2 = VDEF <.MEM_9>
>   __builtin__ITM_commitTransaction ();
> 
>   <bb 4>:
>   ivtmp_14 = 9;
>   # .MEM_11 = VDEF <.MEM_13>
>   __transaction_relaxed
> 
>   <bb 5>:
>   # .MEM_18 = VDEF <.MEM_59>
>   vec[123] = 456;
>   # .MEM_19 = VDEF <.MEM_18>
>   __builtin__ITM_commitTransaction ();
> 
> etc etc etc.
> 
> Putting aside how incredibly inefficient this is... (We should be duplicating
> the vector store, not the entire transaction)...
> 
> The problem here is that, after unrolling, the VDEF of the problematic insn is
> .MEM_6, but the DEF_OP of the insn is .MEM_59.  So gimple_vdef() !=
> gimple_vdef_op() and we trigger a "virtual def operand missing for stmt".
> 
> The problem is that the unroller's call to gimple_duplicate_bb() will make a
> copy of the problematic instruction, maintaining its gimple_vdef, but changing
> all its def_ops from under us, thus making gimple_vdef() != gimple_vdef_op().

Setting a DEF will change the vdef.  If it does not, the stmt was
not updated properly.

> Before loop unrolling we have this snippet that is about to be unrolled:
> 
>   <bb 3>:
>   # .MEM_13 = PHI <.MEM_8(6), .MEM_3(D)(2)>
>   # ivtmp_1 = PHI <ivtmp_10(6), 10(2)>
>   # .MEM_6 = VDEF <.MEM_13>
>   __transaction_relaxed
> 
> After loop unrolling the above remains unchanged, but the following is inserted
> *before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), but
> before cleanup_tree_cfg() for clarity.]
> 
>  <bb 8>:
>   # .MEM_12 = PHI <.MEM_3(D)(2)>
>   # ivtmp_5 = PHI <10(2)>
>   # .MEM_6 = VDEF <.MEM_13>     <-- *************************** -->
>                   ^^^^^^^^^^^^  <-- shouldn't this be <.MEM_12> ?????
>                                 <-- *************************** -->

Yes.

>   __transaction_relaxed
> ...
> ...more unrolling
> ...
>  <bb 40>:
>   # .MEM_57 = PHI <.MEM_8(39)>
>   # ivtmp_58 = PHI <ivtmp_10(39)>
>   # .MEM_53 = VDEF <.MEM_13>    <-- ************************** -->
>                                 <-- shouldn't this be <.MEM_57> ????
>                                 <-- ************************** -->

Yes.

>   __transaction_relaxed
> ...
> ...
>  <bb 3>
>  ..
> 
> Notice that both BB8 and BB40 invalidate MEM_13 in its virtual definition. 
> Shouldn't the VDEF<.MEM_13> be rewritten as I have indicated above?  Especially
> since now .MEM_13 is defined much further down in bb 3:
> 
> <bb 8>
>     # invalidates VDEF<.MEM_13>
> ...
> <bb 40>
>     # invalidates VDEF<.MEM_13>
> ..
> <bb 3>
>     # define .MEM_13  = ....
> 
> It seems gimple_duplicate_bb() renames all the phis and the operands, but does
> not update the VDEF's for the transaction. Gimple_duplicate_bb() says it
> doesn't maintain SSA form, so I assume this in on purpose (?).  So how is this
> supposed to be cleaned up?  Or is this even the problem?

The problem must be in the IL before unrolling I believe.

Richard.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (10 preceding siblings ...)
  2012-09-20  7:44 ` rguenther at suse dot de
@ 2012-09-20 15:09 ` rguenth at gcc dot gnu.org
  2012-09-21  8:56 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-20 15:09 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-20 15:08:55 UTC ---
(In reply to comment #10)
> On Wed, 19 Sep 2012, aldyh at gcc dot gnu.org wrote:
> 

> > After loop unrolling the above remains unchanged, but the following is inserted
> > *before* bb 3.  [Note, the following is after update_ssa(TODO_update_ssa), but
> > before cleanup_tree_cfg() for clarity.]
> > 
> >  <bb 8>:
> >   # .MEM_12 = PHI <.MEM_3(D)(2)>
> >   # ivtmp_5 = PHI <10(2)>
> >   # .MEM_6 = VDEF <.MEM_13>     <-- *************************** -->
> >                   ^^^^^^^^^^^^  <-- shouldn't this be <.MEM_12> ?????
> >                                 <-- *************************** -->
> 
> Yes.

Btw, is_new_name says yes to .MEM_12, false for .MEM_6 and 13.  update_ssa
should have adjusted the use .MEM_13 to .MEM_12, but it didn't for some
reason.

I see that the DEF stmt for .MEM_6 is

# .MEM_59 = VDEF <.MEM_13>
__transaction_relaxed  // SUBCODE=[ GTMA_HAVE_STORE ]

though before update_ssa.  That looks bogus to me.

Now I have to leave ... maybe the above is some hints to you (or I will
try to look further tomorrow).


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (11 preceding siblings ...)
  2012-09-20 15:09 ` rguenth at gcc dot gnu.org
@ 2012-09-21  8:56 ` rguenth at gcc dot gnu.org
  2012-09-21 12:39 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-21  8:56 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |srdjan.stipic at gmail dot
                   |                            |com

--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-21 08:55:25 UTC ---
*** Bug 54646 has been marked as a duplicate of this bug. ***


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (12 preceding siblings ...)
  2012-09-21  8:56 ` rguenth at gcc dot gnu.org
@ 2012-09-21 12:39 ` rguenth at gcc dot gnu.org
  2012-09-21 13:28 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-21 12:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-21 12:39:19 UTC ---
Simpler testcase from PR54646, fails at -O2:

int a;

int main()
{
  int i;
  for (i = 0; i < 1; ++i)
    __transaction_atomic { ++a; }
  return 0;
}


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (13 preceding siblings ...)
  2012-09-21 12:39 ` rguenth at gcc dot gnu.org
@ 2012-09-21 13:28 ` rguenth at gcc dot gnu.org
  2012-09-21 13:30 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-21 13:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-21 13:27:30 UTC ---
We have broken immediate uses of .MEM_2 (for example).  Before update-ssa:

main ()
{
  int a.1;
  int a.0;
  int i;

  <bb 2>:

  <bb 8>:
  # i_10 = PHI <0(2)>
  # .MEM_11 = PHI <.MEM_3(D)(2)>

  <bb 9>:
  # .MEM_4 = VDEF <.MEM_2>
  __transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]
...
  <bb 3>:
  # .MEM_12 = VDEF <.MEM_2>
  __transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]
...
  <bb 7>:
  # VUSE <.MEM_2>
  return 0;

but debug_immediate_uses shows:

.MEM_2 : -->2 uses.
# VUSE <.MEM_2>
return 0;
# .MEM_12 = VDEF <.MEM_2>
__transaction_atomic  // SUBCODE=[ GTMA_HAVE_LOAD GTMA_HAVE_STORE ]

that means that update_stmt didn't do its job or it wasn't called.

Aahhhh.  Because in gimple_copy:

  /* Make copy of operands.  */
  if (num_ops > 0)
    {
...
      /* SSA operands need to be updated.  */
      gimple_set_modified (copy, true);
    }

there are zero (real) operands but we _do_ have virtual ops.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (14 preceding siblings ...)
  2012-09-21 13:28 ` rguenth at gcc dot gnu.org
@ 2012-09-21 13:30 ` rguenth at gcc dot gnu.org
  2012-09-24  8:57 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-21 13:30 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|aldyh at gcc dot gnu.org    |rguenth at gcc dot gnu.org

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-21 13:30:06 UTC ---
I have a patch:

Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c        (revision 191613)
--- gcc/gimple.c        (working copy)
*************** gimple_copy (gimple stmt)
*** 2333,2355 ****
      }

    /* Make copy of operands.  */
!   if (num_ops > 0)
!     {
!       for (i = 0; i < num_ops; i++)
!       gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));

!       /* Clear out SSA operand vectors on COPY.  */
!       if (gimple_has_ops (stmt))
!       {
!         gimple_set_def_ops (copy, NULL);
!         gimple_set_use_ops (copy, NULL);
!       }

!       if (gimple_has_mem_ops (stmt))
!       {
!         gimple_set_vdef (copy, gimple_vdef (stmt));
!         gimple_set_vuse (copy, gimple_vuse (stmt));
!       }

        /* SSA operands need to be updated.  */
        gimple_set_modified (copy, true);
--- 2333,2352 ----
      }

    /* Make copy of operands.  */
!   for (i = 0; i < num_ops; i++)
!     gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));

!   if (gimple_has_mem_ops (stmt))
!     {
!       gimple_set_vdef (copy, gimple_vdef (stmt));
!       gimple_set_vuse (copy, gimple_vuse (stmt));
!     }

!   /* Clear out SSA operand vectors on COPY.  */
!   if (gimple_has_ops (stmt))
!     {
!       gimple_set_def_ops (copy, NULL);
!       gimple_set_use_ops (copy, NULL);

        /* SSA operands need to be updated.  */
        gimple_set_modified (copy, true);


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (15 preceding siblings ...)
  2012-09-21 13:30 ` rguenth at gcc dot gnu.org
@ 2012-09-24  8:57 ` rguenth at gcc dot gnu.org
  2012-09-24  8:58 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-24  8:57 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #16 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-24 08:57:12 UTC ---
Author: rguenth
Date: Mon Sep 24 08:57:08 2012
New Revision: 191658

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191658
Log:
2012-09-24  Richard Guenther  <rguenther@suse.de>

    PR middle-end/52173
    * gimple.c (gimple_copy): Properly mark the copy modified
    if SSA operands are present.

    * gcc.dg/tm/pr52173-1.c: New.
    * gcc.dg/tm/pr52173-2.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/tm/pr52173-1.c
    trunk/gcc/testsuite/gcc.dg/tm/pr52173-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (16 preceding siblings ...)
  2012-09-24  8:57 ` rguenth at gcc dot gnu.org
@ 2012-09-24  8:58 ` rguenth at gcc dot gnu.org
  2012-11-28 20:57 ` aldyh at gcc dot gnu.org
  2012-11-28 20:58 ` aldyh at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-24  8:58 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
      Known to work|                            |4.8.0
         AssignedTo|rguenth at gcc dot gnu.org  |unassigned at gcc dot
                   |                            |gnu.org
      Known to fail|                            |4.7.2

--- Comment #17 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-24 08:58:20 UTC ---
Fixed on trunk.


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (17 preceding siblings ...)
  2012-09-24  8:58 ` rguenth at gcc dot gnu.org
@ 2012-11-28 20:57 ` aldyh at gcc dot gnu.org
  2012-11-28 20:58 ` aldyh at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-11-28 20:57 UTC (permalink / raw)
  To: gcc-bugs


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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

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

--- Comment #18 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-11-28 20:56:44 UTC ---
fixed on trunk


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

* [Bug middle-end/52173] internal compiler error: verify_ssa failed possibly caused by itm
  2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
                   ` (18 preceding siblings ...)
  2012-11-28 20:57 ` aldyh at gcc dot gnu.org
@ 2012-11-28 20:58 ` aldyh at gcc dot gnu.org
  19 siblings, 0 replies; 21+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-11-28 20:58 UTC (permalink / raw)
  To: gcc-bugs


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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

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

--- Comment #19 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-11-28 20:58:06 UTC ---
My bad.  Didn't notice this was for 4.7.  Reopening.


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

end of thread, other threads:[~2012-11-28 20:58 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08 15:51 [Bug middle-end/52173] New: internal compiler error: verify_ssa failed possibly caused by itm lloyd at randombit dot net
2012-02-08 15:53 ` [Bug middle-end/52173] " lloyd at randombit dot net
2012-02-08 15:54 ` lloyd at randombit dot net
2012-02-15  3:50 ` regehr at cs dot utah.edu
2012-02-15  3:54 ` pinskia at gcc dot gnu.org
2012-02-15  3:58 ` regehr at cs dot utah.edu
2012-08-13  6:57 ` jakub at gcc dot gnu.org
2012-09-12 19:53 ` aldyh at gcc dot gnu.org
2012-09-12 19:53 ` aldyh at gcc dot gnu.org
2012-09-14 21:20 ` aldyh at gcc dot gnu.org
2012-09-19 19:44 ` aldyh at gcc dot gnu.org
2012-09-20  7:44 ` rguenther at suse dot de
2012-09-20 15:09 ` rguenth at gcc dot gnu.org
2012-09-21  8:56 ` rguenth at gcc dot gnu.org
2012-09-21 12:39 ` rguenth at gcc dot gnu.org
2012-09-21 13:28 ` rguenth at gcc dot gnu.org
2012-09-21 13:30 ` rguenth at gcc dot gnu.org
2012-09-24  8:57 ` rguenth at gcc dot gnu.org
2012-09-24  8:58 ` rguenth at gcc dot gnu.org
2012-11-28 20:57 ` aldyh at gcc dot gnu.org
2012-11-28 20:58 ` aldyh 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).