public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/51958] New: [4.7 Regression] -ffrontend-optimize generates wrong code
Date: Mon, 23 Jan 2012 08:27:00 -0000	[thread overview]
Message-ID: <bug-51958-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-01-23  7:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23  8:27 burnus at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51958-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).