public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
@ 2012-01-28 16:40 zsojka at seznam dot cz
  2012-01-28 16:48 ` [Bug tree-optimization/52028] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2012-01-28 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52028
           Summary: [4.7 Regression] wrong code with -O2
                    -ftree-loop-distribution
    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 26489
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26489
reduced testcase

Compiler output:
$ gcc -O2 -ftree-loop-distribution testcase4.c
$ valgrind -q ./a.out 
==32144== Conditional jump or move depends on uninitialised value(s)
==32144==    at 0x4C2D333: bcmp (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==32144==    by 0x4005F4: main (in /home/smatz/gcc-bug/1063/a.out)
==32144== 
==32144== Conditional jump or move depends on uninitialised value(s)
==32144==    at 0x4005F7: main (in /home/smatz/gcc-bug/1063/a.out)
==32144== 
Aborted

Tested revisions:
r183666 - fail
r180540 - fail
r178498 - fail
4.6 r180325 - OK


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
@ 2012-01-28 16:48 ` dominiq at lps dot ens.fr
  2012-01-28 16:52 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-28 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-28
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-28 15:12:13 UTC ---
Reduced range:
revision 177649 - OK,
revision 178509 - fail.


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
  2012-01-28 16:48 ` [Bug tree-optimization/52028] " dominiq at lps dot ens.fr
@ 2012-01-28 16:52 ` jakub at gcc dot gnu.org
  2012-01-30 10:51 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-28 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-28 16:39:47 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178028


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
  2012-01-28 16:48 ` [Bug tree-optimization/52028] " dominiq at lps dot ens.fr
  2012-01-28 16:52 ` jakub at gcc dot gnu.org
@ 2012-01-30 10:51 ` rguenth at gcc dot gnu.org
  2012-01-30 14:13 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30 10:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 09:37:53 UTC ---
Mine then.


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2012-01-30 10:51 ` rguenth at gcc dot gnu.org
@ 2012-01-30 14:13 ` rguenth at gcc dot gnu.org
  2012-01-30 14:28 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 13:57:30 UTC ---
loop distribution splits the

  for (;;)
    {
...
      if (K != k)
        break;
      K += 16;
    }

loop into three portions, the first writing to K[0..13], the next
writing to K[14] and the last writing to K[15].  All of which is
reasonable at a first glance.  But then the first loop is discarded
completely CDDCE2, so something is wrong.


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2012-01-30 14:13 ` rguenth at gcc dot gnu.org
@ 2012-01-30 14:28 ` rguenth at gcc dot gnu.org
  2012-01-30 16:17 ` rguenth at gcc dot gnu.org
  2012-01-30 16:39 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 14:16:51 UTC ---
Virtual SSA form is corrupt (and we don't detect that - bah).

<bb 3>:
  # .MEM_723 = PHI <.MEM_666(3), .MEM_661(D)(2)>
  # ivtmp.297_722 = PHI <ivtmp.297_648(3), ivtmp.297_1354(2)>
  D.2523_1353 = (void *) ivtmp.297_722;
  # .MEM_666 = VDEF <.MEM_723>
  MEM[base: D.2523_1353, offset: 0B] = 0;
  ivtmp.297_648 = ivtmp.297_722 + 4;
  if (ivtmp.297_648 != D.2525_653)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 4>:
...

<bb 5>:
  # K_1035 = PHI <&MEM[(void *)&k + 64B](5), &k(4)>
  # .MEM_703 = PHI <.MEM_562(5), .MEM_666(4)>
...
  # .MEM_562 = VDEF <.MEM_561>
  MEM[(unsigned int *)K_1035 + 52B] = pretmp.262_1186;
  D.1989_556 = D.1916_553 + 512;
  D.1990_563 = D.1989_556 * 4;
  D.1991_566 = &CAST_S_table + D.1990_563;
  # VUSE <.MEM_562>
  D.1992_567 = *D.1991_566;
  if (&k != K_1035)
    goto <bb 6>;
  else
    goto <bb 5>;

<bb 6>:
  K_1352 = &k;
  X$0_719 = 0;

<bb 7>:
  # K_1147 = PHI <&k(6), &MEM[(void *)&k + 64B](7)>
  # .MEM_1141 = PHI <.MEM_666(6), .MEM_1343(7)>
...

We have overlapping life-ranges for .MEM_666 and .MEM_562  (at least).

I have a patch.


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2012-01-30 14:28 ` rguenth at gcc dot gnu.org
@ 2012-01-30 16:17 ` rguenth at gcc dot gnu.org
  2012-01-30 16:39 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 15:52:02 UTC ---
Fixed.


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

* [Bug tree-optimization/52028] [4.7 Regression] wrong code with -O2 -ftree-loop-distribution
  2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2012-01-30 16:17 ` rguenth at gcc dot gnu.org
@ 2012-01-30 16:39 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 15:51:34 UTC ---
Author: rguenth
Date: Mon Jan 30 15:51:23 2012
New Revision: 183730

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

    PR tree-optimization/52028
    * tree-loop-distribution.c (ldist_gen): Properly update
    virtual SSA form.

    * gcc.dg/torture/pr52028.c: New testcase.
    * gfortran.dg/ldist-pr45199.f: Adjust.
    * gcc.dg/tree-ssa/ldist-16.c: Likewise.
    * gcc.dg/tree-ssa/ldist-17.c: Likewise.
    * gcc.dg/tree-ssa/ldist-pr45948.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr52028.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ldist-17.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ldist-pr45948.c
    trunk/gcc/testsuite/gfortran.dg/ldist-pr45199.f
    trunk/gcc/tree-loop-distribution.c


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

end of thread, other threads:[~2012-01-30 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-28 16:40 [Bug tree-optimization/52028] New: [4.7 Regression] wrong code with -O2 -ftree-loop-distribution zsojka at seznam dot cz
2012-01-28 16:48 ` [Bug tree-optimization/52028] " dominiq at lps dot ens.fr
2012-01-28 16:52 ` jakub at gcc dot gnu.org
2012-01-30 10:51 ` rguenth at gcc dot gnu.org
2012-01-30 14:13 ` rguenth at gcc dot gnu.org
2012-01-30 14:28 ` rguenth at gcc dot gnu.org
2012-01-30 16:17 ` rguenth at gcc dot gnu.org
2012-01-30 16:39 ` rguenth 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).