[Bug fortran/50981] [4.4/4.5/4.6/4.7 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 3 17:12:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50981
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.4.7
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-03 17:12:15 UTC ---
(In reply to comment #1)
> No bootstraped compiler at hand; does this work?
Does not help. (Nit: in trans-array.c "se.want..." instead of "se->".)
Now the segfaults already for "ff" where the "b" argument is present. The
segfault occurs at
ELEMENTAL REAL(KIND=8) FUNCTION gg(a,b)
...
IF(PRESENT(b)) THEN
b1=b ! <<< here
While "ff" now looks reasonable:
ff (real(kind=8) & restrict a, integer(kind=4) * b)
integer(kind=4) * D.1747;
D.1747 = b;
val.0 = gg (&ac[S.1 + -1], D.1747) + val.0;
one has an issue with the call:
rr[S.5 + -1] = ff (&aa[S.5 + -1], 1);
as it is probably not a good idea to dereference the literal "1", unless you
really want to access the memory address 0x1 ...
* * *
Works:
4.4.5 20100627 (prerelease) [gcc-4_4-branch revision 161471]
Fails:
4.4.5 20100627 (prerelease) [gcc-4_4-branch revision 161472]
Unless I made a mistake with building those versions, the regression is caused
by:
Rev. 161472 (PR fortran/43841 and PR 43843).
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161472
* trans-expr.c (gfc_conv_expr): Supply an address expression for
GFC_SS_REFERENCE.
(gfc_conv_expr_reference): Call gfc_conv_expr and return for
GFC_SS_REFERENCE.
* trans-array.c (gfc_add_loop_ss_code): Store the value rather
than the address of a GFC_SS_REFERENCE.
* trans.h : Change comment on GFC_SS_REFERENCE.
More information about the Gcc-bugs
mailing list