Hi All

Using the command line: gfortran -fbounds-check test.f95, I compiled this:

program test
integer :: it, neighbrs(var)
neighbrs = pack( (/ ( it, it=1, 30 ) /),   (/ ( it, it=1, 30 ) /) < 3,  (/ ( 0,
it=1, 30 ) /)  )
end program test

substituting different values for var to get different results.  
When var is not chosen well, the non-conforming sizes of the array asignment
are not caught as errors.  
Sometimes at running glibc catches errors.

Examples - all of these should fail with incorrect array sizes, but they don't:

if var=18
*** glibc detected *** ./a.out: free(): invalid next size (fast):
0x0000000000508460 ***
(plus a whole lot of other guff.  let me know if you want to see that)

if var=19
*** glibc detected *** ./a.out: double free or corruption (out):
0x0000000000508460 ***

if var = 27 it compiles and runs without error

Thanks, Gareth


-- 
           Summary: non-conforming array sizes in assignment using pack not
                    caught
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: glv at maths dot otago dot ac dot nz
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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

Reply via email to