[flang] Complex expression dump fixes
1. Dump negative parts in complex constants without parentheses (-1., 0.) was dumped as ((-1.), 0.) from f18 expression format. The latter format is only valid with the complex constructor extension that is not supported by all compilers. This commit ensure the former fromat is used in dumps so that dumps can be used by all fortran compilers. It turns out the parenthesis added by REAL::AsFortran are not required because operation lowering is already taking care of this. 2. Dump evaluate::ComplexComponent with REAL/IMAG instead of %RE/%IM f18 was failing to reparse its own dump in some cases involving complex expressions like `-z**i`. The reason was %RE and %IM were used to dump ComplexComponents. %RE and %IM can only be used on designators but ComplexComponent can contain arbitrary complex expressions. Hence, %RE and %IM cannot be used to dump ComplexComponent. This commit replace them with call to intrinsic function REAL/IMAG. Note that this may unfortunatly be unsafe if the user shadowed REAL or IMAG but I do not see an easy way to solve this... The current dump is not correct. Original-commit: flang-compiler/f18@4550a23d0bdce4ffa8d8765a1da4b35151eebe50 Reviewed-on: https://github.com/flang-compiler/f18/pull/851
Loading
Please sign in to comment