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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|87477                       |

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
The latest flang and ifx both complain about the case in comment 4.

pault@fedora:~/prs/pdt$ flang variant_pr122524.f90
error: Semantic errors in variant_pr122524.f90
./variant_pr122524.f90:15:21: error: 'unnormalized_tensor' was not declared a
separate module procedure
      module function unnormalized_tensor(self)
                      ^^^^^^^^^^^^^^^^^^^
./variant_pr122524.f90:18:7: error: No intrinsic or user-defined ASSIGNMENT(=)
matches operand types TYPE(tensor_t(k=8_4)) and TYPE(tensor_t(k=4_4))
        unnormalized_tensor = tensor_t(self%intercept_)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pault@fedora:~/prs/pdt$ ifx variant_pr122524.f90
variant_pr122524.f90(15): error #6115: A separate interface body must have been
declared in the program unit or an ancestor of the program unit for the
separate module procedure.   [UNNORMALIZED_TENSOR]
    module function unnormalized_tensor(self)
--------------------^
compilation aborted for variant_pr122524.f90 (code 1)

gfortran is producing an ICE because type parameter checking between lhs and
rhs in assignment is not yet implemented, when rhs resolves to a structure
constructor. The parse tree dump shows this:

...snip...
  symtree: 'unnormalized_tensor'|| symbol: 'unnormalized_tensor' 
    type spec : (DERIVED Pdttensor_t_8)
    attributes: (PROCEDURE MODULE-PROC  FUNCTION CONTAINED MODULE-PROCEDURE
MODULE-PROCEDURE IFSRC-DECL)
    result: unnormalized_tensor
    Formal arglist: self

...snip...
    ASSIGN tensor_m:unnormalized_tensor Pdttensor_t_4(4 ,
__convert_r8_r4[[((unnormalized_tensor:self % intercept_))]])


ie. The ICE arises because of an attempt to fold_convert mismatched derived
types.

Paul


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87477
[Bug 87477] [meta-bug] [F03] issues concerning the ASSOCIATE statement

Reply via email to