public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30668]  New: catch function of wrong type
@ 2007-02-01 14:54 vivekrao4 at yahoo dot com
  2007-02-02  7:51 ` [Bug fortran/30668] " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-02-01 14:54 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/30668] catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
@ 2007-02-02  7:51 ` burnus at gcc dot gnu dot org
  2007-03-18 17:53 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-02  7:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-02-02 07:50 -------
This actually planed to do, cf.
http://gcc.gnu.org/wiki/GFortran43

"Projects for inclusion into gfortran-4.3"

"Formal/actual argument checking for same file procedures

There are a large number of PRs associated with this. [...] The main wrinkle is
to deal with actual arguments for references to procedures that have not yet
been seen. [...] PR26227 (refers to PRs28809, 28443, 27587, 27586 and 27594),
PR27318 and PR24878"


-- 


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


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

* [Bug fortran/30668] catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
  2007-02-02  7:51 ` [Bug fortran/30668] " burnus at gcc dot gnu dot org
@ 2007-03-18 17:53 ` fxcoudert at gcc dot gnu dot org
  2009-04-09 17:15 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-18 17:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-18 17:53:03
               date|                            |


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


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

* [Bug fortran/30668] catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
  2007-02-02  7:51 ` [Bug fortran/30668] " burnus at gcc dot gnu dot org
  2007-03-18 17:53 ` fxcoudert at gcc dot gnu dot org
@ 2009-04-09 17:15 ` pinskia at gcc dot gnu dot org
  2009-05-03 13:53 ` [Bug fortran/30668] -fwhole-file should " fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-09 17:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-04-09 17:15 -------
*** Bug 39700 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/30668] -fwhole-file should catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
                   ` (2 preceding siblings ...)
  2009-04-09 17:15 ` pinskia at gcc dot gnu dot org
@ 2009-05-03 13:53 ` fxcoudert at gcc dot gnu dot org
  2009-12-15  8:44 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-03 13:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2009-05-03 13:53 -------
I guess -fwhole-file should catch this one, but it does not. The testcase I
used is:

integer function two()
  two = 2
end function two

program xx
  ! real, external :: two
  print *, two(), kind(two())
end program xx


You can comment or uncomment the line with "external", both versions should be
caught.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org
           Severity|enhancement                 |minor
   Last reconfirmed|2007-03-18 17:53:03         |2009-05-03 13:53:02
               date|                            |
            Summary|catch function of wrong type|-fwhole-file should catch
                   |                            |function of wrong type


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


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

* [Bug fortran/30668] -fwhole-file should catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
                   ` (3 preceding siblings ...)
  2009-05-03 13:53 ` [Bug fortran/30668] -fwhole-file should " fxcoudert at gcc dot gnu dot org
@ 2009-12-15  8:44 ` burnus at gcc dot gnu dot org
  2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-15  8:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2009-12-15 08:44 -------
It also should check (kind/length) type-parameters, cf.
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/d710371aed91e75f
This is kind of a follow up to PR 41235; cf. also PR 41603.


-- 


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


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

* [Bug fortran/30668] -fwhole-file should catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
                   ` (4 preceding siblings ...)
  2009-12-15  8:44 ` burnus at gcc dot gnu dot org
@ 2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
  2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
  2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-25 18:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2010-05-25 18:10 -------
Subject: Bug 30668

Author: dfranke
Date: Tue May 25 18:10:01 2010
New Revision: 159838

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159838
Log:
gcc/fortran/:
2010-05-25  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/30668
        PR fortran/31346
        PR fortran/34260
        * resolve.c (resolve_global_procedure): Add check for global
        procedures with implicit interfaces and assumed-shape or optional
        dummy arguments. Verify that function return type, kind and string
        lengths match.

gcc/testsuite/:
2010-05-25  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/30668
        PR fortran/31346
        PR fortran/34260
        * gfortran.dg/pr40999.f: Fix function type.
        * gfortran.dg/whole_file_5.f90: Likewise.
        * gfortran.dg/whole_file_6.f90: Likewise.
        * gfortran.dg/whole_file_16.f90: New.
        * gfortran.dg/whole_file_17.f90: New.
        * gfortran.dg/whole_file_18.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/whole_file_16.f90
    trunk/gcc/testsuite/gfortran.dg/whole_file_17.f90
    trunk/gcc/testsuite/gfortran.dg/whole_file_18.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/pr40999.f
    trunk/gcc/testsuite/gfortran.dg/whole_file_5.f90
    trunk/gcc/testsuite/gfortran.dg/whole_file_6.f90


-- 


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


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

* [Bug fortran/30668] -fwhole-file should catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
                   ` (5 preceding siblings ...)
  2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
@ 2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
  2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-07-18 20:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2010-07-18 20:49 -------
Subject: Bug 30668

Author: dfranke
Date: Sun Jul 18 20:49:30 2010
New Revision: 162287

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162287
Log:
gcc/fortran/:
2010-07-18  Daniel Franke  <franke.daniel@gmail.com>
            Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30668
        PR fortran/31346
        PR fortran/34260
        * resolve.c (resolve_global_procedure): Improved checking if an
        explicit interface is required.

        PR fortran/40011
        * resolve.c (resolve_global_procedure): Resolve the gsymbol's
        namespace before trying to reorder the gsymbols.

gcc/testsuite/:
2010-07-18  Daniel Franke  <franke.daniel@gmail.com>
            Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30668
        PR fortran/31346
        PR fortran/34260
        PR fortran/40011
        * gfortran.dg/pr40999.f: Fix function type.
        * gfortran.dg/whole_file_5.f90: Likewise.
        * gfortran.dg/whole_file_6.f90: Likewise.
        * gfortran.dg/whole_file_16.f90: New.
        * gfortran.dg/whole_file_17.f90: New.
        * gfortran.dg/whole_file_18.f90: New.
        * gfortran.dg/whole_file_19.f90: New.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_16.f90
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_17.f90
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_18.f90
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_19.f90
Modified:
    branches/gcc-4_5-branch/gcc/fortran/ChangeLog
    branches/gcc-4_5-branch/gcc/fortran/resolve.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/pr40999.f
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_5.f90
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/whole_file_6.f90


-- 


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


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

* [Bug fortran/30668] -fwhole-file should catch function of wrong type
  2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
                   ` (6 preceding siblings ...)
  2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
@ 2010-07-18 21:13 ` dfranke at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-07-18 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dfranke at gcc dot gnu dot org  2010-07-18 21:12 -------
Fixed in trunk and 4.5. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.1


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


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

end of thread, other threads:[~2010-07-18 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-01 14:54 [Bug fortran/30668] New: catch function of wrong type vivekrao4 at yahoo dot com
2007-02-02  7:51 ` [Bug fortran/30668] " burnus at gcc dot gnu dot org
2007-03-18 17:53 ` fxcoudert at gcc dot gnu dot org
2009-04-09 17:15 ` pinskia at gcc dot gnu dot org
2009-05-03 13:53 ` [Bug fortran/30668] -fwhole-file should " fxcoudert at gcc dot gnu dot org
2009-12-15  8:44 ` burnus at gcc dot gnu dot org
2010-05-25 18:10 ` dfranke at gcc dot gnu dot org
2010-07-18 20:50 ` dfranke at gcc dot gnu dot org
2010-07-18 21:13 ` dfranke at gcc dot gnu dot org

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).