------- Comment #1 from thomas dot orgis at awi dot de  2008-02-26 17:37 -------
I stripped a bit more and I think I got the root of the problem, illustrated by
this more minimal example:

MODULE data

  IMPLICIT NONE
  PRIVATE

  INTEGER, PARAMETER :: dat_dimension = 2
  TYPE dat_sigtype
    real(kind=4) :: gamma
  END TYPE dat_sigtype

  TYPE(dat_sigtype), PARAMETER :: dat_sig = dat_sigtype( 1.3_4 )

  real(kind=4), PARAMETER :: expo = 1.3_4

  real(kind=4), PARAMETER :: rconst  = 2._4**dat_sig%gamma
  real(kind=4), PARAMETER :: rconst2 = 2._4**expo

CONTAINS

END MODULE data

...and these gcc messages:

 In file baddata.f90:11

  TYPE(dat_sigtype), PARAMETER :: dat_sig = dat_sigtype( 1.3_4 )
                                                       1
Error: Exponent at (1) must be INTEGER for an initialization expression
 In file baddata.f90:16

  real(kind=4), PARAMETER :: rconst2 = 2._4**expo
                                                1
Error: Exponent at (1) must be INTEGER for an initialization expression


So we are dealing with a limitation (in accordance to F95 standard, as I
read... and thus correct here) with initialization.
The problem I still have with gcc here is that when the exponent comes from a
derived type, the error message points to the exponents definition (which is
correct code) and not the the bad initialization code (which is not correct
code).


-- 

thomas dot orgis at awi dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Real initialization problem |Misleading error message
                   |(invalid error): Exponent at|with derived types: Exponent
                   |(1) must be INTEGER for an  |at (1) must be INTEGER for
                   |initialization expression   |an initialization expression


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

Reply via email to