public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39195]  New: Illegal empty array argument not detected at compile or runtime
@ 2009-02-15  8:32 terry at chem dot gu dot se
  2009-02-15  9:46 ` [Bug fortran/39195] [Bounds check] " burnus at gcc dot gnu dot org
  2009-02-16  0:36 ` terry at chem dot gu dot se
  0 siblings, 2 replies; 3+ messages in thread
From: terry at chem dot gu dot se @ 2009-02-15  8:32 UTC (permalink / raw)
  To: gcc-bugs

This looks like the compiler ignoring the interface that's available, or
something.

[tjf@fkpc167 ~/MiscCode]$ cat slabtest.f90 
module service
implicit none
contains
subroutine Partition(N,x)
integer,intent(in)::N
real,dimension(3,N),intent(out)::x
write(*,*)size(x,1),size(x,2)
x=0
end subroutine Partition
end module service

program decom
use service
implicit none
real,dimension(3,384)::x
call Partition(64,x(:,321:64))
end program decom


[tjf@fkpc167 ~/MiscCode]$ gfortran --verbose -o slabdecomp -fbounds-check -Wall
slabtest.f90
Driving: gfortran -v -o slabdecomp -fbounds-check -Wall slabtest.f90
-lgfortranbegin -lgfortran -lm -shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.3.3/configure --disable-multilib
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.3.3 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' 'slabdecomp' '-fbounds-check' '-Wall'
'-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.3.3/f951 slabtest.f90 -quiet
-dumpbase slabtest.f90 -mtune=generic -auxbase slabtest -Wall -version
-fbounds-check -fintrinsic-modules-path
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/finclude -o /tmp/ccvJgRkc.s
GNU F95 (GCC) version 4.3.3 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.3, GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '-o' 'slabdecomp' '-fbounds-check' '-Wall'
'-shared-libgcc' '-mtune=generic'
 as -V -Qy -o /tmp/ccMWihvf.o /tmp/ccvJgRkc.s
GNU assembler version 2.18.0 (x86_64-linux-gnu) using BFD version (GNU Binutils
for Ubuntu) 2.18.0.20080103
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.3.3/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.3.3/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'slabdecomp' '-fbounds-check' '-Wall'
'-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.3.3/collect2 --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o slabdecomp
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/crtbegin.o
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/../../.. /tmp/ccMWihvf.o
-lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.3/crtend.o
/usr/lib/../lib64/crtn.o

[tjf@fkpc167 ~/MiscCode]$ ./slabdecomp 
           3          64


This probably bombed at compile time, but certainly should have raised some
sort of bounds violation.  If the declaration of x in Partition is made
automatic [(:,:)] then I get what I'd expect, an empty section:

[tjf@fkpc167 ~/MiscCode]$ ./slabdecomp
           3           0


-- 
           Summary: Illegal empty array argument not detected at compile or
                    runtime
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          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=39195


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

* [Bug fortran/39195] [Bounds check] Illegal empty array argument not detected at compile or runtime
  2009-02-15  8:32 [Bug fortran/39195] New: Illegal empty array argument not detected at compile or runtime terry at chem dot gu dot se
@ 2009-02-15  9:46 ` burnus at gcc dot gnu dot org
  2009-02-16  0:36 ` terry at chem dot gu dot se
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-02-15  9:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-02-15 09:46 -------
None of my compilers prints a compile-time diagnostic, however, with (only) NAG
f95 it correctly prints:
  Actual argument for dummy array X too small -
  0 elements instead of 192

 * * *

This bug seems to be a variant of PR 32317 or PR 27989. Remark in the latter:

"Maybe this should not be done with -fbounds-check, but put into a different
 option. (NAG uses not -C=array but -C=call for this.)

"The reason is that some programs (e.g. Exciting.sf.net) passes an array(n-1)
to
 a subroutine foo(n,b) with "real :: b(n)" but only accesses the first n-1
 elements."


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |27766
              nThis|                            |
   GCC host triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |diagnostic
            Summary|Illegal empty array argument|[Bounds check] Illegal empty
                   |not detected at compile or  |array argument not detected
                   |runtime                     |at compile or runtime


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


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

* [Bug fortran/39195] [Bounds check] Illegal empty array argument not detected at compile or runtime
  2009-02-15  8:32 [Bug fortran/39195] New: Illegal empty array argument not detected at compile or runtime terry at chem dot gu dot se
  2009-02-15  9:46 ` [Bug fortran/39195] [Bounds check] " burnus at gcc dot gnu dot org
@ 2009-02-16  0:36 ` terry at chem dot gu dot se
  1 sibling, 0 replies; 3+ messages in thread
From: terry at chem dot gu dot se @ 2009-02-16  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from terry at chem dot gu dot se  2009-02-16 00:36 -------
Well, that's rather embarrassing.  But it does illustrate this hasn't been
fixed since I reported it in 2007.

PR 27989 is different, as there is no explicit interface in that case.


*** This bug has been marked as a duplicate of 32317 ***


-- 

terry at chem dot gu dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2009-02-16  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-15  8:32 [Bug fortran/39195] New: Illegal empty array argument not detected at compile or runtime terry at chem dot gu dot se
2009-02-15  9:46 ` [Bug fortran/39195] [Bounds check] " burnus at gcc dot gnu dot org
2009-02-16  0:36 ` 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).