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-28 15:16 ` [Bug middle-end/44592] [4.5 " matz at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ 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] 12+ messages in thread

end of thread, other threads:[~2011-01-17 11:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44592-4@http.gcc.gnu.org/bugzilla/>
2010-10-10 19:36 ` [Bug middle-end/44592] [4.5 Regression] wrong code at -O3 dominiq at lps dot ens.fr
2010-10-10 20:04 ` rguenther at suse dot de
2010-11-14 11:57 ` rguenth at gcc dot gnu.org
2010-12-16 13:12 ` rguenth at gcc dot gnu.org
2011-01-17 11:39 ` rguenth at gcc dot gnu.org
2011-01-17 11:51 ` rguenth at gcc dot gnu.org
2010-06-19 17:17 [Bug fortran/44592] New: [4.5/4.6 " dominiq at lps dot ens dot fr
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).