public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51958] New: [4.7 Regression] -ffrontend-optimize generates wrong code
@ 2012-01-23  8:27 burnus at gcc dot gnu.org
  2012-01-23  9:01 ` [Bug fortran/51958] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-23  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51958
           Summary: [4.7 Regression] -ffrontend-optimize generates wrong
                    code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: tkoenig@gcc.gnu.org


Reported at http://gcc.gnu.org/ml/fortran/2012-01/msg00201.html by Don Simons.

The following program works without front-end optimization but with, the
program does not enter "else if" body. (The program has been modified to call
abort() if this does not happen.)

>From -fdump-tree-original -ffrontend-optimize:

  if (charq[1]{lb: 1 sz: 1} == 32)
    {
          integer(kind=4) __var_1;
...
    }
  else
    {
      if (__var_1 > 96 && __var_1 <= 103)


Thus, the issue is obvious. 

(While I think there is a general issue, I think one should also consider to
not do this optimization for (i)(a)char. I could imagine that the ME has a
simpler task to only track charq[1] instead of also tracking __var_1 and the
assignment to it.)


! ----------------------------------------------
      logical :: passed
      character*1 charq
      charq = 'c'
      passed = .false.
      print*,'ichar is ',ichar(charq)
      if (charq .eq. ' ') then
        print*,'charq is blank'
      else if ((ichar(charq).ge.97 .and. ichar(charq).le.103)) then
        print*,'passed the main test'
        passed = .true.
      end if
      if (.not. passed) then
        print *, 'BUG'
        call abort()
      end if
      print*,'Done'
      end


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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-23  8:27 [Bug fortran/51958] New: [4.7 Regression] -ffrontend-optimize generates wrong code burnus at gcc dot gnu.org
2012-01-23  9:01 ` [Bug fortran/51958] " burnus at gcc dot gnu.org
2012-01-23 10:08 ` jakub at gcc dot gnu.org
2012-01-23 19:52 ` tkoenig at gcc dot gnu.org
2012-01-28 18:56 ` tkoenig at gcc dot gnu.org
2012-02-01 19:41 ` tkoenig at gcc dot gnu.org
2012-02-01 20:53 ` burnus 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).