In the following program it would be nice if gfortran reported that two() has
type REAL in the main program because of implicit typing but actually has type
DOUBLE PRECISION. Below is what gfortran says and then what g95 says for
comparison.

U:\vrao\fortran>type bug_print.f90 
double precision function two()
two = 2.0d0
end function two

program xx
print*,two(),kind(two())
end program xx

U:\vrao\fortran>gfortran -v 
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/coudert/local --disable-nls
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --host=i386-pc-mingw32 --disable-shared
--enable-libgomp
Thread model: win32
gcc version 4.3.0 20061021 (experimental)

U:\vrao\fortran>gfortran -W -Wall -pedantic-errors -std=f2003 -fbounds-check
-Werror bug_print.f90 

U:\vrao\fortran>a.exe
   2.000000               4

U:\vrao\fortran>g95 -v 
Using built-in specs.
Target: 
Configured with: /src/G95/gcc-4.0-20060302/configure --with-gcc --with-gnu-ld
--with-ld=/mingw/bin/ld --with-gnu-as --with-as=/mingw/bin/as --host=mingw32
--target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable-languages=c --disable-win32-registry --disable-shared --without-x
--disable-libmudflap --disable-libssp
Thread model: win32
gcc version 4.0.3 (g95 0.91!) Jan 23 2007

U:\vrao\fortran>g95 -Wall -pedantic -fbounds-check -ftrace=full bug_print.f90 
In file bug_print.f90:1

double precision function two()
                          1
In file bug_print.f90:6

print*,two(),kind(two())
       2
Error: FUNCTION 'two' is of type REAL(8) at (1) and type REAL(4) at (2)

This program was discussed in the gg95 newsgroup in a thread "bug with double
precision function" at
http://groups.google.com/group/gg95/browse_frm/thread/73ea96b2925195f0?hl=en


-- 
           Summary: catch function of wrong type
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


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

Reply via email to