This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR18769, PR25049 and PR25050 - transformational functions in initialization expressions.


FX,


I'm probably mistaken here, but I thought there was a difference between what F95 allowed as initialization expr. and what F2003 allows. For example, the way I read and understood both standards, the following code:


  INTEGER, PARAMETER :: K(2)=1
  SELECT CASE(I)
  CASE(MAXLOC(K,1))
  END SELECT
  END

(from PR 25104) is invalid in F95 but valid according to F2003.

Am I right?

That is correct. However, in the absence of a simplifier, these intrinsics all do some variant on what your example does:
test2003.f90:1: internal compiler error: in gfc_conv_constant_to_tree, at fortran/trans-const.c:276


If somebody has the intestinal fortitude, they could write gfc_simplify_maxminloc and friends, changing the error in check.c to being standard dependent. At the moment, however, let's aim to make gfortran F95 compliant and get rid of these nasty ICE's.

In file test2003.f90:3

CASE(MAXLOC(K,1))
1
Error: transformational intrinsic 'maxloc' at (1) is not permitted in an initialization expression


seems friendlier, doesn't it?

Talking of intestinal fortitude, what constitutes a "strong breakfast"? .... a la danoise, with schnaps and raw fish?

Paul



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]