public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40383] [4.5 Regression] incorrect bounds checking with optional character arguments
Date: Tue, 09 Jun 2009 10:30:00 -0000	[thread overview]
Message-ID: <20090609102951.4540.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40383-6642@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from burnus at gcc dot gnu dot org  2009-06-09 10:29 -------
I think the patch for PR fortran/37746 is OK, but something else goes wrong:

f1 (character(kind=1)[1:80] * a, character(kind=1)[1:80] * b,
character(kind=1)[1:80] * c, character(kind=1)[1:80] * d, integer(kind=4) _a,
integer(kin
d=4) _b, integer(kind=4) _c, integer(kind=4) _d)

if ((logical(kind=4)) __builtin_expect ((integer(kind=8))
                                        (_d <= 79 && (_d != 0 || a != 0B)), 0))


The the check itself is OK, but it should be _a and not _d:
                                        (_a <= 79 && (_a != 0 || a != 0B))


For some reason the length of the last string is always used. The source looks
OK:

        fsym = formal->sym;
        cl = fsym->ts.cl;
        cond = fold_build2 (comparison, boolean_type_node,
                            cl->passed_length, cl->backend_decl);

Thus somehow cl->backend_decl is wrong. That is probably a side effect of all
having the same length.


-- 

burnus at gcc dot gnu dot org changed:

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


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


  parent reply	other threads:[~2009-06-09 10:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09  7:41 [Bug fortran/40383] New: " jv244 at cam dot ac dot uk
2009-06-09  7:44 ` [Bug fortran/40383] " jv244 at cam dot ac dot uk
2009-06-09 10:02 ` burnus at gcc dot gnu dot org
2009-06-09 10:30 ` burnus at gcc dot gnu dot org [this message]
2009-06-09 12:09 ` burnus at gcc dot gnu dot org
2009-06-10 12:02 ` burnus at gcc dot gnu dot org
2009-06-10 12:05 ` burnus at gcc dot gnu dot org
2009-06-16  6:57 ` burnus at gcc dot gnu dot org
2009-06-16  6:58 ` burnus at gcc dot gnu dot 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=20090609102951.4540.qmail@sourceware.org \
    --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).