http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58270
Krzysztof Strasburger <strasbur at chkw386 dot ch.pwr.wroc.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #14 from Krzysztof Strasburger <strasbur at chkw386 dot ch.pwr.wroc.pl> --- Marking the report as invalid doesn't solve the real problem. I changed the common to unnamed and the situation is still the same. main.f: C Compile and link this file with buggy.f, using gfortran 4.6 (and probably C any newer version), with optimization enabled (at least -O1). C Run with: echo 1 2 3 | ./a.out C expected (correct) result: 1. 2. 2. program main integer*4 i1,i2,i3 real*8 dmem common dmem(3) read (*,*) i1,i2,i3 call buggy(i1,i2,i3) write (*,*) dmem(1),dmem(2),dmem(3) end buggy.f: subroutine buggy(i1, i2, i3) integer*4 i1, i2, i3 real*8 dmem common dmem(1) dmem(i1)=1. dmem(i2)=2. dmem(i3)=2. return end Better?