https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114141

--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to kargl from comment #5)
> (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.
Agreed.

>  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.).
> 
This is about x%im, which is a different expression from log(cmplx(-1, 0)).
x is an associate-name, and thus (I think) an object-name, and a valid
designator, even if it's associated selector isn't.

Reply via email to