Next: , Previous: Ugly Null Arguments, Up: Distensions



9.9.3 Ugly Complex Part Extraction

The -fugly-complex option enables use of the REAL() and AIMAG() intrinsics with arguments that are COMPLEX types other than COMPLEX(KIND=1).

With -ff90 in effect, these intrinsics return the unconverted real and imaginary parts (respectively) of their argument.

With -fno-f90 in effect, these intrinsics convert the real and imaginary parts to REAL(KIND=1), and return the result of that conversion.

Due to this ambiguity, the GNU Fortran language defines these constructs as invalid, except in the specific case where they are entirely and solely passed as an argument to an invocation of the REAL() intrinsic. For example,

     REAL(REAL(Z))

is permitted even when Z is COMPLEX(KIND=2) and -fno-ugly-complex is in effect, because the meaning is clear.

g77 enforces this restriction, unless -fugly-complex is specified, in which case the appropriate interpretation is chosen and no diagnostic is issued.

See CMPAMBIG, for information on how to cope with existing code with unclear expectations of REAL() and AIMAG() with COMPLEX(KIND=2) arguments.

See RealPart Intrinsic, for information on the REALPART() intrinsic, used to extract the real part of a complex expression without conversion. See ImagPart Intrinsic, for information on the IMAGPART() intrinsic, used to extract the imaginary part of a complex expression without conversion.