the following testcase, derived from CP2K, illustrates an issue with _gfortran_internal_pack. In CP2K this causes crashes such as:
Operating system error: Cannot allocate memory Memory allocation failed while this testcase shows under valgrind: > gfortran -g -O0 test.f90 > valgrind --tool=memcheck ./a.out ==21339== Memcheck, a memory error detector. ==21339== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==21339== Using LibVEX rev 1732, a library for dynamic binary translation. ==21339== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==21339== Using valgrind-3.2.3, a dynamic binary instrumentation framework. ==21339== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==21339== For more details, rerun with: -v ==21339== ==21339== Conditional jump or move depends on uninitialised value(s) ==21339== at 0x4BF449B: _gfortran_internal_pack (in_pack_generic.c:56) ==21339== by 0x4008BC: __m1_MOD_s2 (test.f90:12) ==21339== by 0x400967: MAIN__ (test.f90:17) ==21339== by 0x40099B: main (fmain.c:21) ==21339== ==21339== Conditional jump or move depends on uninitialised value(s) ==21339== at 0x4008FA: __m1_MOD_s2 (test.f90:12) ==21339== by 0x400967: MAIN__ (test.f90:17) ==21339== by 0x40099B: main (fmain.c:21) -- Summary: [4.4 Regression] issue with _gfortran_internal_pack Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk OtherBugsDependingO 29975 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132