[PATCH, Fortran] Fix PR36112: Bounds-checking on character-array-constructors
Daniel Kraft
d@domob.eu
Mon May 19 07:33:00 GMT 2008
FX wrote:
> Hi Daniel,
>
>> For array-constructors with all-constant string lengths, the compiler
>> pads the shorter strings to the maximum of all lengths', thus preventing
>> a runtime-error on different string lengths. In this case, my patch now
>> emits a compiler-error for -fbounds-check.
>
> -fbounds-check says it "enables generation of run-time checks". It
> should not have any visible influence at compile-time. If the code is
> determined to be illegal at compile-time, we should emit an error
> unconditionaly. If the code can't be determined at compile-time, we will
> do nothing if -fbounds-check is not given, and we will add run-time
> checks if -fbounds-check is used (thus slowly down runtime performance
> considerably, as you can imagine).
Ok, then I'll just make the error unconditionally.
> I have one more question: you add special cases for
> get_array_ctor_var_strlen call() to allow it to be called with len ==
> NULL, but why? When (and where) is it called with a NULL argument?
Did I? AFAIK, I added this NULL thing only to get_array_ctor_strlen,
and not to any of the others (as this function not only calculates the
length but also is_const); there it is called with NULL argument for
sub-array-constructors not at the first position (thus where we are not
interested in the length).
I'm not sure about how important is_const is, another (faster) approach
would of course be to break the loop after we've found our length; but
then we don't know about constness of following elements.
I'll provide an updated patch (with the condition on the error message
and the XXX-mark removed) when the point above (and every other review
details) are cleared, ok?
Thanks,
Daniel
--
Done: Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal
Underway: Ran-Gno-Neu-Fem
To go: Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou
More information about the Fortran
mailing list