http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55501



--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-28 
10:48:58 UTC ---

(In reply to comment #2)

>   type(MPI_Datatype) :: MPI_INTEGER = merge(MPI_Datatype(4), MPI_Datatype(8),

> .false.)



The problem is related to having array PARAMETERs. For normal parameters,

simply their value is stored in the .mod file and always inserted when used.



For array parameters, a static array in read-only memory is created, which can

then be accessed at run time. That avoids replicating the information several

times. In addition, the expression is also stored in the .mod file.



Especially if constructors are involved, the current compile-time

simplification doesn't work that well. Additionally, the question is also

whether it always makes sense to expand constructors if one wants to simplify

code.



In any case, there is room for improvement. See also PR 44856 and PR 51260.



* * *



In gfc_simplify_merge, the compiler gives up when the type is not an

EXPR_CONSTANT:



3976      if (tsource->expr_type != EXPR_CONSTANT

3977          || fsource->expr_type != EXPR_CONSTANT

3978          || mask->expr_type != EXPR_CONSTANT)

3979        return NULL;





For the test case of this PR, one has an EXPR_STRUCTURE. Maybe replacing the

check by calls to gfc_is_constant_expr() is sufficient.

Reply via email to