public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44592]  New: [4.5/4.6 Regression] wrong code at -O3
@ 2010-06-19 17:17 dominiq at lps dot ens dot fr
  2010-06-19 19:05 ` [Bug middle-end/44592] " rguenth at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-06-19 17:17 UTC (permalink / raw)
  To: gcc-bugs

The following code is miscompiled at -O3 with trunk and 4.5.0:


! From forall_12.f90
! Fails with loop reversal at -O3
!
  character(len=1) :: b(4) = (/"1","2","3","4"/), c(4)
  c = b
  i = 1
  ! This statement must be here for the abort below
  b(1:3)(i:i) = b(2:4)(i:i)

  b = c
  b(4:2:-1)(i:i) = b(3:1:-1)(i:i)

  ! This fails.  If the condition is printed, the result is F F F F
  if (any (b .ne. (/"1","1","2","3"/))) i = 2
  print *, b
  print *, b .ne. (/"1","1","2","3"/)
  if (i == 2) call abort
end


[macbook] f90/bug% gfc -O3 forall_12_db.f90
[macbook] f90/bug% a.out
 1123
 F F F F
Abort

Abort is not called if the test 'if (any ...' is replaced with

  if (any (b .ne. (/"1","1","2","4"/))) i = 2

As spotted by Tobias Burnus, the problem comes from

...
  static character(kind=1)[1:1] * A.5[4] = {&"1"[1]{lb: 1 sz: 1}, &"1"[1]{lb: 1
sz: 1}, &"2"[1]{lb: 1 sz: 1}, &"3"[1]{lb: 1 sz: 1}};
...

<bb 5>:
  D.1645_85 = A.5[3];
  D.1646_86 = (*D.1645_85)[1]{lb: 1 sz: 1};
  if (D.1646_86 != D.1596_154)
    goto <bb 7>;
  else
    goto <bb 6>;

<bb 6>:
...


-- 
           Summary: [4.5/4.6 Regression] wrong code at -O3
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
@ 2010-06-19 19:05 ` rguenth at gcc dot gnu dot org
  2010-06-24 21:58 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-19 19:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|rguenther at suse dot de    |rguenth at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.5.1


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
  2010-06-19 19:05 ` [Bug middle-end/44592] " rguenth at gcc dot gnu dot org
@ 2010-06-24 21:58 ` rguenth at gcc dot gnu dot org
  2010-06-25  3:38 ` hjl dot tools at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-24 21:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-06-24 21:58 -------
Fails also at -O2 -funroll-loops.

I can't see anything wrong with the tree-level code.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2010-06-24 21:58:27
               date|                            |


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
  2010-06-19 19:05 ` [Bug middle-end/44592] " rguenth at gcc dot gnu dot org
  2010-06-24 21:58 ` rguenth at gcc dot gnu dot org
@ 2010-06-25  3:38 ` hjl dot tools at gmail dot com
  2010-06-25 11:27 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-06-25  3:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-06-25 03:38 -------
It is caused by revision 152236:

http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00987.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matz at gcc dot gnu dot org


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (2 preceding siblings ...)
  2010-06-25  3:38 ` hjl dot tools at gmail dot com
@ 2010-06-25 11:27 ` jakub at gcc dot gnu dot org
  2010-06-25 15:34 ` matz at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-06-25 11:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-06-25 11:26 -------
This goes wrong with -O2 -funroll-loops already during tree opts.  In vrp2 we
have:
  b[2][1]{lb: 1 sz: 1} = D.1599_148;
  b[3][1]{lb: 1 sz: 1} = D.1599_154;
  D.1635_152 = 2;
  D.1636_151 = &b[2][1]{lb: 1 sz: 1};
  D.1637_146 = 3;
  D.1638_145 = &b[3][1]{lb: 1 sz: 1};
  __builtin_memcpy (D.1638_145, D.1636_151, 1);
...
  D.1647_84 = b[3][1]{lb: 1 sz: 1};
  D.1648_85 = A.5[3];
  D.1649_86 = (*D.1648_85)[1]{lb: 1 sz: 1};
  if (D.1647_84 != D.1649_86)

but in dom2:
  b[2][1]{lb: 1 sz: 1} = D.1599_148;
  b[3][1]{lb: 1 sz: 1} = D.1599_154;
  D.1635_152 = 2;
  D.1636_151 = &b[2][1]{lb: 1 sz: 1};
  D.1637_146 = 3;
  D.1638_145 = &b[3][1]{lb: 1 sz: 1};
  D.1680_170 = b[2][1]{lb: 1 sz: 1};
  b[3][1]{lb: 1 sz: 1} = D.1680_170;
...
  D.1647_84 = D.1599_154;
  D.1648_85 = A.5[3];
  D.1649_86 = (*D.1648_85)[1]{lb: 1 sz: 1};
  if (D.1649_86 != D.1599_154)

b[3] at that point isn't D.1599_154 though, but D.1599_148 (== D.1680_170).


-- 


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (3 preceding siblings ...)
  2010-06-25 11:27 ` jakub at gcc dot gnu dot org
@ 2010-06-25 15:34 ` matz at gcc dot gnu dot org
  2010-06-28 15:14 ` matz at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: matz at gcc dot gnu dot org @ 2010-06-25 15:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from matz at gcc dot gnu dot org  2010-06-25 15:34 -------
Indeed.  Mine.


-- 

matz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |matz at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-06-24 21:58:27         |2010-06-25 15:34:24
               date|                            |


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


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

* [Bug middle-end/44592] [4.5/4.6 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (4 preceding siblings ...)
  2010-06-25 15:34 ` matz at gcc dot gnu dot org
@ 2010-06-28 15:14 ` matz at gcc dot gnu dot org
  2010-06-28 15:16 ` [Bug middle-end/44592] [4.5 " matz at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: matz at gcc dot gnu dot org @ 2010-06-28 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from matz at gcc dot gnu dot org  2010-06-28 15:14 -------
Subject: Bug 44592

Author: matz
Date: Mon Jun 28 15:14:31 2010
New Revision: 161496

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161496
Log:
        PR middle-end/44592
        * gimple-fold.c (gimplify_and_update_call_from_tree): Maintain
        proper VDEF chain for intermediate stores in the sequence.

testsuite/
        PR middle-end/44592
        * gfortran.dg/pr44592.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr44592.f90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (5 preceding siblings ...)
  2010-06-28 15:14 ` matz at gcc dot gnu dot org
@ 2010-06-28 15:16 ` matz at gcc dot gnu dot org
  2010-06-28 20:42 ` dominiq at lps dot ens dot fr
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: matz at gcc dot gnu dot org @ 2010-06-28 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from matz at gcc dot gnu dot org  2010-06-28 15:16 -------
Fixed for 4.6, waiting a bit for 4.5.


-- 

matz at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.5/4.6 Regression] wrong  |[4.5 Regression] wrong code
                   |code at -O3                 |at -O3


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (6 preceding siblings ...)
  2010-06-28 15:16 ` [Bug middle-end/44592] [4.5 " matz at gcc dot gnu dot org
@ 2010-06-28 20:42 ` dominiq at lps dot ens dot fr
  2010-07-01 12:16 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-06-28 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dominiq at lps dot ens dot fr  2010-06-28 20:42 -------
> Fixed for 4.6, waiting a bit for 4.5.

Revision 161496 caused pr44699.


-- 


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (7 preceding siblings ...)
  2010-06-28 20:42 ` dominiq at lps dot ens dot fr
@ 2010-07-01 12:16 ` dominiq at lps dot ens dot fr
  2010-07-01 12:21 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-07-01 12:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from dominiq at lps dot ens dot fr  2010-07-01 12:16 -------
> > Fixed for 4.6, waiting a bit for 4.5.
>
> Revision 161496 caused pr44699.

I think the PRINTs are of no use in the testsuite for gfortran.dg/pr44592.f90.
I'ld suggest to apply the following patch:

--- ../_clean/gcc/testsuite/gfortran.dg/pr44592.f90     2010-06-28
17:51:41.000000000 +0200
+++ gcc/testsuite/gfortran.dg/pr44592.f90       2010-07-01 14:12:38.000000000
+0200
@@ -13,8 +13,5 @@
   b(4:2:-1)(i:i) = b(3:1:-1)(i:i)

   ! This fails.  If the condition is printed, the result is F F F F
-  if (any (b .ne. (/"1","1","2","3"/))) i = 2
-  print *, b
-  print *, b .ne. (/"1","1","2","3"/)
-  if (i == 2) call abort
+  if (any (b .ne. (/"1","1","2","3"/))) call abort
 end


-- 


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (8 preceding siblings ...)
  2010-07-01 12:16 ` dominiq at lps dot ens dot fr
@ 2010-07-01 12:21 ` jakub at gcc dot gnu dot org
  2010-07-01 13:18 ` dominiq at lps dot ens dot fr
  2010-07-31  9:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-01 12:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2010-07-01 12:21 -------
The important question is if the testcase still ICEs with the fix reverted when
you do that change.


-- 


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (9 preceding siblings ...)
  2010-07-01 12:21 ` jakub at gcc dot gnu dot org
@ 2010-07-01 13:18 ` dominiq at lps dot ens dot fr
  2010-07-31  9:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-07-01 13:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from dominiq at lps dot ens dot fr  2010-07-01 13:18 -------
> The important question is if the testcase still ICEs with the fix reverted when
> you do that change.

The test aborts with revisions before 161496.


-- 


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


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

* [Bug middle-end/44592] [4.5 Regression] wrong code at -O3
  2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
                   ` (10 preceding siblings ...)
  2010-07-01 13:18 ` dominiq at lps dot ens dot fr
@ 2010-07-31  9:35 ` rguenth at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-31  9:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2010-07-31 09:29 -------
GCC 4.5.1 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.5.1                       |4.5.2


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


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

end of thread, other threads:[~2010-07-31  9:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 Regression] wrong code at -O3 dominiq at lps dot ens dot fr
2010-06-19 19:05 ` [Bug middle-end/44592] " rguenth at gcc dot gnu dot org
2010-06-24 21:58 ` rguenth at gcc dot gnu dot org
2010-06-25  3:38 ` hjl dot tools at gmail dot com
2010-06-25 11:27 ` jakub at gcc dot gnu dot org
2010-06-25 15:34 ` matz at gcc dot gnu dot org
2010-06-28 15:14 ` matz at gcc dot gnu dot org
2010-06-28 15:16 ` [Bug middle-end/44592] [4.5 " matz at gcc dot gnu dot org
2010-06-28 20:42 ` dominiq at lps dot ens dot fr
2010-07-01 12:16 ` dominiq at lps dot ens dot fr
2010-07-01 12:21 ` jakub at gcc dot gnu dot org
2010-07-01 13:18 ` dominiq at lps dot ens dot fr
2010-07-31  9:35 ` rguenth at gcc dot gnu dot 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).