public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35381]  New: Real initialization problem (invalid error): Exponent at (1) must be INTEGER for an initialization expression
@ 2008-02-26 17:20 thomas dot orgis at awi dot de
  2008-02-26 17:38 ` [Bug fortran/35381] Misleading error message with derived types: " thomas dot orgis at awi dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: thomas dot orgis at awi dot de @ 2008-02-26 17:20 UTC (permalink / raw)
  To: gcc-bugs

We have a set of code that works with SUN and Intel compilers and that should
be correct to the best of our knowledge, but triggers a strange error by
gfortran 4.1.0 and 4.2.3 .
The stripped-down exapmple here has been tested with 4.1.0 on x86-64, I got the
qualitatively same error on the full source with 4.2.3 on x86, too.

Here is the output of compilation:

me@box> gfortran -v -save-temps -c -g baddata.f90
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,java,ada --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/4.1.0 --enable-ssp --disable-libssp
--enable-java-awt=gtk --enable-gtk-cairo --disable-libjava-multilib
--with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --without-system-libunwind --with-cpu=generic
--host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.0 (SUSE Linux)
 /usr/lib64/gcc/x86_64-suse-linux/4.1.0/f951 baddata.f90 -quiet -dumpbase
baddata.f90 -mtune=generic -auxbase baddata -g -version -o baddata.s
GNU F95 version 4.1.0 (SUSE Linux) (x86_64-suse-linux)
        compiled by GNU C version 4.1.0 (SUSE Linux).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 In file baddata.f90:50

    1._dp / (1._dp - rxyzkappa), &
        1
Error: Exponent at (1) must be INTEGER for an initialization expression
 In file baddata.f90:72

    rerg = rconst * rrhoTheta**dat_sig%gamma
                1
Error: Symbol 'rconst' at (1) has no IMPLICIT type


And here is the code (baddata.f90):

! This example file is stripped from a program that compiles and works fine
with Intel or SUN compilers...
! gfortran 4.2.3 showed an identical error as 4.1.0
! During reduction of code for the example, the complained position varied but
the basic parser error stayed the same with 4.1.0 .
! The essence is this:
!    1._dp / (1._dp - rxyzkappa), &
!        1
!Error: Exponent at (1) must be INTEGER for an initialization expression

MODULE precision

  IMPLICIT NONE
  PUBLIC

  INTEGER, PARAMETER :: dp = 4

END MODULE precision

MODULE data

  USE precision

  IMPLICIT NONE
  PRIVATE

  INTEGER, PARAMETER :: dat_dimension = 2
  TYPE dat_sigtype
    INTEGER :: dimension
    real(kind=4), DIMENSION(dat_dimension) :: rmin
    real(kind=4), DIMENSION(dat_dimension) :: rmax
    real(kind=4) :: gravity
    real(kind=4) :: omega
    real(kind=4) :: gasconst
    real(kind=4) :: p0
    real(kind=4) :: kappa
    real(kind=4) :: gamma
    real(kind=4) :: rcp
  END TYPE dat_sigtype

  real(kind=4), PARAMETER :: rxyzR= 287.E-6_dp
  real(kind=4), PARAMETER :: rxyzkappa= 0.284_dp
  TYPE(dat_sigtype), PARAMETER :: dat_sig = dat_sigtype( &
    dat_dimension, &
    (/ 0._dp, 0._dp /), &
    (/ 28.0E3_dp, 10.0_dp /), &
    9.81E-3_dp, &
    7.292E-5_dp, &
    rxyzR, &
    .101300_dp, &
    rxyzkappa, &
    1._dp / (1._dp - rxyzkappa), &
    rxyzR / rxyzkappa )

CONTAINS

! The code compiles fine when you remove that function.
! It has trouble with rconst...
!    rerg = rconst * rrhoTheta**dat_sig%gamma
!                1
! Error: Symbol 'rconst' at (1) has no IMPLICIT type

  FUNCTION dat_diagP(rrhoTheta) RESULT(rerg)
    IMPLICIT NONE

    real(kind=4), INTENT(in) :: rrhoTheta

    real(kind=4) :: rerg

    real(kind=4), PARAMETER :: rconst &
      = dat_sig%gasconst**dat_sig%gamma / &
      dat_sig%p0**(dat_sig%kappa*dat_sig%gamma)

    rerg = rconst * rrhoTheta**dat_sig%gamma

  END FUNCTION dat_diagP


END MODULE data


-- 
           Summary: Real initialization problem (invalid error): Exponent at
                    (1) must be INTEGER for an initialization expression
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thomas dot orgis at awi dot de
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-28 10:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 17:20 [Bug fortran/35381] New: Real initialization problem (invalid error): Exponent at (1) must be INTEGER for an initialization expression thomas dot orgis at awi dot de
2008-02-26 17:38 ` [Bug fortran/35381] Misleading error message with derived types: " thomas dot orgis at awi dot de
2008-02-27  2:14 ` jvdelisle at gcc dot gnu dot org
2008-02-27 10:13 ` thomas dot orgis at awi dot de
2008-02-28  5:00 ` jvdelisle at gcc dot gnu dot org
2008-02-28 10:11 ` fxcoudert at gcc dot gnu dot org
2008-02-28 10:41 ` thomas dot orgis at awi dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).