the observation is that profiling tools (like callgrind/valgrind) will assign a fraction of the instructions to line 2 (PUBLIC S1) in a profile, similarly a debugger will jump to line 2 if one steps through the execution of this program. This is not particularly intuitive (since this line just specifies an attribute and is not executed), and doesn't happen if e.g. ifort is used for compilation.
MODULE M1 PUBLIC S1 CONTAINS SUBROUTINE S1(A,n) INTEGER :: n INTEGER :: A(n,n,n,n) A(1,1,1,1)=0 END SUBROUTINE S1 END MODULE M1 PROGRAM TEST USE M1 INTEGER :: A(2,2,2,2),i DO i=1,10000000 CALL S1(A,2) ENDDO END PROGRAM TEST -- Summary: debug info points to unexpected line Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40823