In the latest gfortran snapshot4.4.0 20080821 (but also in 4.2.3 and 4.3.0) on a 32-bit machine, the attached piece of code crashes on execution (e.g. compiled with -g -Wall), with error
*** glibc detected *** a.out: free(): invalid pointer: 0x0805fb48 *** Running with valgrind indicates ==16436== Invalid write of size 8 ==16436== at 0x8048944: MAIN__ (bounds_issue.f90:9) ==16436== by 0x8048B36: main (in /...bounds_... This suggests the array assignment is writing out of the bounds of the array. The code executes without issue on all other f95 compilers tried out. This bug is a showstopper in using gfortran with the hoppet package, http://projects.hepforge.org/hoppet/ ------------------------------------------------------- gfortran -v Using built-in specs. Target: i586-pc-linux-gnu Configured with: /home/fx/gfortran_nightbuild/trunk/configure --prefix=/home/fx/gfortran_nightbuild/irun-20080821 --enable-languages=c,fortran --build=i586-pc-linux-gnu --enable-checking=release --with-gmp=/home/fx/gfortran_nightbuild/software Thread model: posix gcc version 4.4.0 20080821 (experimental) [trunk revision 139368] (GCC) -- Summary: array assignment from function writes out of bounds Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: salam at lpthe dot jussieu dot fr GCC host triplet: Linux bison 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 200 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37199