This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/40383] [4.5 Regression] incorrect bounds checking with optional character arguments



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]