From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6543 invoked by alias); 26 Feb 2008 17:20:09 -0000 Received: (qmail 5759 invoked by uid 48); 26 Feb 2008 17:19:26 -0000 Date: Tue, 26 Feb 2008 17:20:00 -0000 Subject: [Bug fortran/35381] New: Real initialization problem (invalid error): Exponent at (1) must be INTEGER for an initialization expression X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "thomas dot orgis at awi dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg02761.txt.bz2 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