[Patch, Fortran] PR fortran/31822: Runtime string length check for pointer assignment
Daniel Kraft
d@domob.eu
Thu Dec 18 10:20:00 GMT 2008
Tobias Burnus wrote:
> Daniel Kraft wrote:
>> building upon my recent patch for PR 38137 (runtime string length
>> checking for arguments to MERGE), this implements string length checks
>> for pointer assignment enabled by -fbounds-check. Additionally, I
>> changed the code doing the compile time checks to use
>> gfc_check_same_strlen instead of doing it inline, which also means it
>> gives a more detailed error message now (including the unequal string
>> lengths).
>>
>> Regression testing on GNU/Linux-x86-32 at the moment, but I don't
>> expect any (did a test on a nearly identical patch version before).
>> Is this ok for trunk/4.4? Or should we wait for 4.5 with it, as it
>> got a somewhat lengthier patch than the one before?
> OK if it passed the regtesting.
Passed, commmitted to trunk as revision 142808.
> + /* Check character lengths if character expression. */
> + if (expr1->ts.type == BT_CHARACTER && expr2->expr_type != EXPR_NULL)
> + {
> + gcc_assert (expr2->ts.type == BT_CHARACTER);
> + gcc_assert (lse.string_length && rse.string_length);
> + gfc_trans_same_strlen_check ("pointer assignment", &expr1->where,
> + lse.string_length, rse.string_length,
> + &block);
> + }
>
>
> I wonder whether one should add a comment that the check is only done
> for -fbounds-check or not. (The option is checked for in
> gfc_trans_same_strlen_check).
>
> +! { dg-shouldfail "Unequal character lengths \\(17/10\\)" }
>
>
> As written before in a private email, dg-shouldfail only looks at the
> exit status code and does not do any pattern matching - the string is
> only a comment. For pattern matching one has to use dg-output. Can you
> fix this?
Corrected those, the final patch committed is attached.
Thanks for the review, Tobias!
Daniel
--
Done: Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch2.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081218/12493a2e/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch2.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081218/12493a2e/attachment-0001.ksh>
More information about the Fortran
mailing list