public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thomas dot orgis at awi dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/35381]  New: Real initialization problem (invalid error): Exponent at (1) must be INTEGER for an initialization expression
Date: Tue, 26 Feb 2008 17:20:00 -0000	[thread overview]
Message-ID: <bug-35381-15830@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-02-26 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 17:20 thomas dot orgis at awi dot de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-35381-15830@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).