gdb/fortran: Breakpoint location is modified.
authorBhuvanendra Kumar N <Bhuvanendra.KumarN@amd.com>
Tue, 11 May 2021 11:56:46 +0000 (17:26 +0530)
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Tue, 11 May 2021 12:20:00 +0000 (17:50 +0530)
Breakpoint location is modified to "return" statement which is
outside the DO loop. Because the label 100 of DO loop should get
executed for each iteration as shared in this external link:
http://www-pnp.physics.ox.ac.uk/~gronbech/intfor/node18.html.
flang compiler is following this fortran standard, whereas gfortran
compiler is not following, hence the test case is passing with
gfortran and failing with flang. but to correct this gfortran
behavior, bug has been filed in bugzilla
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99816). As reported in
the bug, with gfortran, label 100 of DO loop is reached only after
the completion of the entire DO loop. Hence at label 100, all the
array elements are set and printing of array element a(2) succeeds.
whereas with flang, when we are at label 100 for first time, array
element a(2) is not yet set, only a(1) is set, hence moving the
breakpoint location to outside the DO loop, so that once we are
outside the DO loop, we can print any of the array elements. This
change in test case is done irrespective of any fortran compiler.

gdb/testsuite/ChangeLog:
        * gdb.fortran/array-element.exp: Breakpoint location is modified.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/array-element.exp

index c188719cd575a48665d7a370d240038986944476..ee963ee6ab296e95edf3a4c6b374d9352ea8a720 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-11  Bhuvanendra Kumar  <Bhuvanendra.KumarN@amd.com>
+
+       * gdb.fortran/array-element.exp: Breakpoint location is modified.
+
 2021-05-10  Lancelot Six  <lsix@lancelotsix.com>
 
        PR gdb/27614
index 28b0e6f348c1b4f35f14aecaf9c203c41c672ee8..9518b87a623671ed0be49f71c3cff5f9bb246936 100644 (file)
@@ -31,8 +31,8 @@ if ![runto sub_] then {
     continue
 }
 
-gdb_breakpoint [gdb_get_line_number "continue"]
-gdb_continue_to_breakpoint "continue"
+gdb_breakpoint [gdb_get_line_number "return"]
+gdb_continue_to_breakpoint "return"
 
 gdb_test "print a(1)" ".*1 = 1.*" "print the first element of array a"
 gdb_test "print a(2)" ".*2 = 2.*" "print the second element of array a"