[Patch, fortran] PR29821 - Failure to resolve variable parameter array sections
Paul Thomas
paulthomas2@wanadoo.fr
Tue Nov 21 08:46:00 GMT 2006
:ADDPATCH fortran:
This patch and its testcase are self-explanatory. I spent a lot of time
trying to fix the rules of engagement of gfc_simplify_expr, as described
in its heading comment. In principle, this should return FAILURE only
if an error has been found. If simplification has not occurred, it
should be up to the caller to detect this. Apparently, this rule has
been multiply violated and FAILURE is being used to indicate a lack of
simplification. The most immediate example of this is my fault; in
find_array_section, where non-constant index expressions return
FAILURE. Changing this to SUCCESS fixes this problem but breaks other
things. Fixing those, cascades down to cause more breakages. I
therefore took a middle path and did a test in the caller, which is
resolve_operator here, to see if the expression is constant before
returning the result of the call to gfc_simplify_expr. In fact, I am
not convinced that the result should be returned here at all - removing
it breaks nothing. I would be open to the reviewer suggesting that
course of action :-)
Regtested on suse10.1/amd64 - OK for trunk, 4.2 and 4.1?
Paul
2006-11-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29821
* resolve.c (resolve_operator): Only return result of
gfc_simplify_expr if expression is constant.
2006-11-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29821
* gfortran.dg/parameter_array_section_1.f90: New test.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr29821.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061121/ae18cef3/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Change.Logs
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061121/ae18cef3/attachment-0001.ksh>
More information about the Gcc-patches
mailing list