[Patch, fortran] PR47348 - wrong string length with array constructor
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sat Feb 19 10:13:00 GMT 2011
The attached is straight forward. Instead of quitting the evaluation
of the length of a substring if it is not constant, we now evaluate
the expression for the constructor element. Whilst not as efficient
as evaluating string-lengths directly, it is quite bomb-proof.
bounds_check_10.f90 needed a wildcard for the run-time error message
since the elements compared go from 1:2 to 1:3 as the level of
optimization increases, changing this part of the message from "1/2"
to "1/4". I am not sure why this happens but the error is still
picked up and the message remains correct.
Bootstrapped and regtested on Ubuntu/i686 - OK for trunk?
Paul
2011-02-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/47348
* trans-array.c (get_array_ctor_all_strlen): Move up in file.
(get_array_ctor_var_strlen): Add block dummy and add call to
get_array_ctor_all_strlen instead of giving up on substrings.
Call gcc_unreachable for default case.
(get_array_ctor_strlen): Add extra argument to in call to
get_array_ctor_var_strlen.
2011-02-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/47348
* gfortran.dg/array_constructor_36.f90 : New test.
* gfortran.dg/bounds_check_10.f90 : Change dg-output message to
allow for comparison between different elements of the array
constructor at different levels of optimization.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 6880 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110219/34076052/attachment.bin>
More information about the Gcc-patches
mailing list