This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/39195] New: Illegal empty array argument not detected at compile or runtime


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]