public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32317]  New: No warning on bad arguments with explicit interface
@ 2007-06-13 13:40 terry at chem dot gu dot se
  2007-06-13 13:44 ` [Bug fortran/32317] " terry at chem dot gu dot se
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 13:40 UTC (permalink / raw)
  To: gcc-bugs

Even when an explicit interface is known, no warnings are generated when array
argument bounds (available to the compiler) don't match.  Consider the
following:

module mod
implicit none

contains

subroutine a(n,v)
integer,intent(in)::n
real,dimension(n),intent(in)::v
write(*,*)v
end subroutine a

subroutine b
real,dimension(5)::v
v=0
call a(8,v(1:4))
end subroutine b

end module mod

When b is being compiled the interface to a is known, yet no warnings are
generated of the obvious mismatch in the arguments (run.f90 just calls b):

$ gfortran -Wall -W -c --std=f2003 --pedantic -fbounds-check -O case.f90
$ gfortran -Wall -W --std=f2003 --pedantic -fbounds-check -O run.f90 case.o
$ ./a.out 
   0.000000       0.000000       0.000000       0.000000       0.000000      
0.000000     -1.1411260E-37  1.5604860E-41 -5.1655852E-38  1.5604860E-41
-6.3728095E-38  1.5604860E-41   0.000000       0.000000      5.8804453E-39  
0.000000      4.2038954E-45   0.000000      5.8809218E-39   0.000000    
-6.3728095E-38  1.5604860E-41 -8.5373851E-38  1.5604860E-41  5.8801398E-39

While this construct is probably legal as a hang-on from crappy old fortran, I
can't think of a situation when giving explicit bounds like this where simply
overrunning would be the desired effect.  A warning would be nice.

(I was going to also complain that -fbouns-check didn't come up with anything,
but then I saw PR 27989.)


-- 
           Summary: No warning on bad arguments with explicit interface
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terry at chem dot gu dot se
  GCC host triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/32317] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
@ 2007-06-13 13:44 ` terry at chem dot gu dot se
  2007-06-13 16:17 ` dfranke at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from terry at chem dot gu dot se  2007-06-13 13:43 -------
(Whoops.  Mixed up output in that last post.  Only 8 reals are printed in
reality.  My bad.)


-- 


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


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

* [Bug fortran/32317] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
  2007-06-13 13:44 ` [Bug fortran/32317] " terry at chem dot gu dot se
@ 2007-06-13 16:17 ` dfranke at gcc dot gnu dot org
  2007-06-13 16:23 ` terry at chem dot gu dot se
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-13 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dfranke at gcc dot gnu dot org  2007-06-13 16:17 -------
Neither SUN nor Intel fortran compilers issue such a warning.


-- 

dfranke 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=32317


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

* [Bug fortran/32317] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
  2007-06-13 13:44 ` [Bug fortran/32317] " terry at chem dot gu dot se
  2007-06-13 16:17 ` dfranke at gcc dot gnu dot org
@ 2007-06-13 16:23 ` terry at chem dot gu dot se
  2007-06-13 20:51 ` [Bug fortran/32317] [bounds checking] " fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2007-06-13 16:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from terry at chem dot gu dot se  2007-06-13 16:23 -------
(In reply to comment #2)
> Neither SUN nor Intel fortran compilers issue such a warning.
> 

Indeed.  That does not imply that gfortran shouldn't, though.  Hence the
enhancement request.


-- 


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (2 preceding siblings ...)
  2007-06-13 16:23 ` terry at chem dot gu dot se
@ 2007-06-13 20:51 ` fxcoudert at gcc dot gnu dot org
  2009-02-15  9:47 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-06-13 20:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |27766
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|x86_64-unknown-linux-gnu    |
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-13 20:51:01
               date|                            |
            Summary|No warning on bad arguments |[bounds checking] No warning
                   |with explicit interface     |on bad arguments with
                   |                            |explicit interface


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (3 preceding siblings ...)
  2007-06-13 20:51 ` [Bug fortran/32317] [bounds checking] " fxcoudert at gcc dot gnu dot org
@ 2009-02-15  9:47 ` burnus at gcc dot gnu dot org
  2009-02-16  0:36 ` terry at chem dot gu dot se
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-02-15  9:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2009-02-15 09:46 -------
See also PR 39195 and PR 27989.


-- 


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (4 preceding siblings ...)
  2009-02-15  9:47 ` burnus at gcc dot gnu dot org
@ 2009-02-16  0:36 ` terry at chem dot gu dot se
  2009-02-16  0:43 ` terry at chem dot gu dot se
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2009-02-16  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from terry at chem dot gu dot se  2009-02-16 00:36 -------
*** Bug 39195 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (5 preceding siblings ...)
  2009-02-16  0:36 ` terry at chem dot gu dot se
@ 2009-02-16  0:43 ` terry at chem dot gu dot se
  2009-02-16  0:59 ` jvdelisle at gcc dot gnu dot org
  2009-02-17  4:51 ` terry at chem dot gu dot se
  8 siblings, 0 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2009-02-16  0:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from terry at chem dot gu dot se  2009-02-16 00:43 -------
Can someone with a better understanding of the standard than me comment as to
whether this is actually legal Fortran when there is an explicit interface
known?  It certainly fails any principle of least surprise.

Incidentally, I think the code given in PR 39195 is slightly clearer.


-- 


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (6 preceding siblings ...)
  2009-02-16  0:43 ` terry at chem dot gu dot se
@ 2009-02-16  0:59 ` jvdelisle at gcc dot gnu dot org
  2009-02-17  4:51 ` terry at chem dot gu dot se
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2009-02-16  0:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2009-02-16 00:59 -------
:) Well we are a bit short handed.


-- 


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


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

* [Bug fortran/32317] [bounds checking] No warning on bad arguments with explicit interface
  2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
                   ` (7 preceding siblings ...)
  2009-02-16  0:59 ` jvdelisle at gcc dot gnu dot org
@ 2009-02-17  4:51 ` terry at chem dot gu dot se
  8 siblings, 0 replies; 10+ messages in thread
From: terry at chem dot gu dot se @ 2009-02-17  4:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from terry at chem dot gu dot se  2009-02-17 04:51 -------
It's not as frivolous as it sounds.  ;-)

If it is indeed illegal not to obey an explicit interface (and though I can't
see anywhere in the standard that says this, the standard is pretty stupid if
it's not) then this changes from a bound-check-related enhancement to an
accepts-invalid error.


-- 

terry at chem dot gu dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.2.0                       |4.3.3


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


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

end of thread, other threads:[~2009-02-17  4:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13 13:40 [Bug fortran/32317] New: No warning on bad arguments with explicit interface terry at chem dot gu dot se
2007-06-13 13:44 ` [Bug fortran/32317] " terry at chem dot gu dot se
2007-06-13 16:17 ` dfranke at gcc dot gnu dot org
2007-06-13 16:23 ` terry at chem dot gu dot se
2007-06-13 20:51 ` [Bug fortran/32317] [bounds checking] " fxcoudert at gcc dot gnu dot org
2009-02-15  9:47 ` burnus at gcc dot gnu dot org
2009-02-16  0:36 ` terry at chem dot gu dot se
2009-02-16  0:43 ` terry at chem dot gu dot se
2009-02-16  0:59 ` jvdelisle at gcc dot gnu dot org
2009-02-17  4:51 ` terry at chem dot gu dot se

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