With GNU Fortran 95 (GCC) 4.3.0 20070125 (experimental), the programme program main integer size integer*1 var open (10, file="conftestval", status="unknown") inquire (iolength=size) var write (10, *) size close (10) end
compiled with the options /Users/eschnett/gcc/bin/gfortran -o conftest conftest.f -malign-double leads to a bus error: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00002ff8 0x0025ca38 in *__gfortran_st_iolength (dtp=0xbffff0c0) at /Users/eschnett/src/gcc/libgfortran/io/transfer.c:2630 2630 *dtp->iolength = 0; The problem seems to be that struct st_parameter_dt changes its layout depending on whether -malign-double is in effect or not, making the compiled programme incompatible with the run-time library. I see two solutions: Either this struct should be modified so that it is independent of -malign-double, or the compiler should take special measures when building the tree for this structure, making sure to use standard alignments. Since I don't know how to build trees with non-standard alignments, I will send a patch that permutes the elements st_parameter_dt. -- Summary: Calling inquire (iolength) crashes with -malign-double Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schnetter at aei dot mpg dot de GCC build triplet: i386-apple-darwin8.8.1 GCC host triplet: i386-apple-darwin8.8.1 GCC target triplet: i386-apple-darwin8.8.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30594