https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114141
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P4 |P5 Severity|normal |enhancement --- Comment #5 from kargl at gcc dot gnu.org --- (In reply to Mikael Morin from comment #4) > (In reply to kargl from comment #3) > > Yep, agreed. I went back an re-read the section about ASSOCIATE. > > Not sure how I convinced myself that a constant expression, which > > reduces to a constant is okay. > > > Not sure how you convinced yourself it isn't. ;-) x => log(cmplx(-1,0)) R1104 association is associate-name => selector R1105 selector is expr or variable R902 variable is designator or function-reference R901 designator is object-name or array-element or array-section or coindexed-named-object or complex-part-designator or structure-component or substring log(cmplx(-1,0)) is certainly not a designator. log(cmplx(-1,0)) is a function-reference. But this then leads to C902 (R902) function-reference shall have a data pointer result. log(cmplx(-1,0)) violates C902, so this then means that it must be an expr. One now needs R915 complex-part-designator is designator % RE or designator % IM C922 (R915) The designator shall be of complex type. which shows that expr%im is invalid; even though log(cmplx(-1,0)) reduces to a constant (i.e., it's not a named constant. This is likely the error [pun intended] in my ways.). Sometimes the trees get in the way of seeing the forest. Arguably, the error message is wrong gfortran13 -c a.f90 a.f90:6:13: 6 | y = x%im | 1 Error: Symbol 'x' at (1) has no IMPLICIT type 'x' has the type of COMPLEX. The version of the code where Jerry wraps log(cmplx(-1,0)) in parentheses. Generates a better error message $ gfc pr114141.f90 pr114141.f90:6:14: 6 | y = x%im | 1 Error: The RE or IM part_ref at (1) must be applied to a COMPLEX expression but this is still wrong in that RE and IM are applied to a designator. I'll leave the PR open has an enhancement request.