This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/40383] [4.5 Regression] incorrect bounds checking with optional character arguments
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2009 10:29:51 -0000
- Subject: [Bug fortran/40383] [4.5 Regression] incorrect bounds checking with optional character arguments
- References: <bug-40383-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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