The following program crashes with -fbounds-check; if one replaces the the "t(i)" by "t(1)" it works.
In associated.c, GFC_DESCRIPTOR_DATA(target) is ok, but for GFC_DESCRIPTOR_DATA(pointer), one gets a memory access error. ---------------- TYPE particle_type INTEGER, POINTER :: p(:) END TYPE particle_type TYPE(particle_type), POINTER :: t(:) integer :: i i = 1 allocate(t(1)) allocate(t(1)%p(0)) print *, associated(t(i)%p,t(i)%p) end ---------------- Note 1: In the example, I used the same pointer for "target" and "pointer", but the same problem occurs, if they are different. Note 2: Found by running CP2K with -fbounds-option. There it associated() is used in deallocate_particle_set(). -- Summary: Bounds check generates wrong code for associated(p1(i)%p2,p1(i)%p2) Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org OtherBugsDependingO 29975 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30190