Please have a look at the following source, variable "a" is a two-dimension array (5 X 5):
program array2 integer a(5, 5) do i = 1, 5 do j = 1, 5 a(i, j) = i * j write (*, *) a(i, j) end do end do end program After using gfortran to compile it, use "readelf -wi array2" to see the outputed debuginfo: <2><89>: Abbrev Number: 3 (DW_TAG_variable) DW_AT_name : a DW_AT_decl_file : 1 DW_AT_decl_line : 2 DW_AT_type : <be> DW_AT_location : 3 byte block: 75 94 7f (DW_OP_breg5: -108) ... <1><be>: Abbrev Number: 7 (DW_TAG_array_type) DW_AT_type : <b6> <2><c3>: Abbrev Number: 8 (DW_TAG_subrange_type) DW_AT_type : <b6> DW_AT_lower_bound : 0 DW_AT_upper_bound : 24 >From the above, we can see that two-dimension array a(5, 5) is flatten to a one-dimension array with 25 elements (0 - 24). This will hinder GDB from correctly inteprete "a". This might also has some other negative impacts. Feng Wang ever said that (I put him in the CC list): It's not only gdb problem, but also affects performance and optimization on the tree-level. We lose the dimension infomation and can not get correct data dependency. This limits many optimizations like loop interchange and loop distribution, etc. -- Summary: dimension information is lost for multi-dimension array Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: woodzltc at sources dot redhat dot com CC: gcc-bugs at gcc dot gnu dot org,wf_cs at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244