public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp
@ 2021-04-15 12:37 Kumar N, Bhuvanendra
  2021-04-15 15:23 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar N, Bhuvanendra @ 2021-04-15 12:37 UTC (permalink / raw)
  To: gdb-patches
  Cc: George, Jini Susan, Sharma, Alok Kumar, Achra, Nitika, Tomar,
	Sourabh Singh, E, Nagajyothi

[-- Attachment #1: Type: text/plain, Size: 4091 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hello All,

I request you all to please review this patch. Below are the details.

Problem Description:
In array-element.exp testcase, break point is set at "continue" statement which is at label 100 and later with "print a(1)" command and 1 is printed. Then again "print a(2)" is tried and with gfortran generated executable 2 is printed, whereas with flang generated executable 0 is printed inside the GDB session. label 100 of DO loop gets executed for each iteration with flang, whereas it does not executed with gfortran, there is a bug filed against gfortran 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 and "print a(2)" results in 0. Due to this mismatch in GDB output, test case fails for flang compiler.

Resolution:
http://www-pnp.physics.ox.ac.uk/~gronbech/intfor/node18.html
As shown in the above link, flang behavior is correct and the DO loop should be executed till and including the label 100 for each iteration. In order to print array element a(2), test case require change and instead of putting break point at "continue" statement, breakpoint location needs to be modified to "return" statement, which is outside the DO loop. This way "print a(2)" will succeed with all fortran compilers. This testcase change is done as applicable to all fortran compilers.

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

Thanks and Regards,
Bhuvan

Patch content inlined:

From c2116c02db3c7c36738a12da2135d63b3bc7c631 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
Date: Thu, 15 Apr 2021 17:20:13 +0530
Subject: [PATCH] [gdb.fortran] Breakpoint location is modified.

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/gdb.fortran/array-element.exp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/array-element.exp b/gdb/testsuite/gdb.fortran/array-element.exp
index 28b0e6f348..9518b87a62 100644
--- a/gdb/testsuite/gdb.fortran/array-element.exp
+++ b/gdb/testsuite/gdb.fortran/array-element.exp
@@ -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"
--
2.17.1

[-- Attachment #2: gdb.fortran-Breakpoint-location-is-modified.patch --]
[-- Type: application/octet-stream, Size: 2169 bytes --]

From c2116c02db3c7c36738a12da2135d63b3bc7c631 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= <Bhuvanendra.KumarN@amd.com>
Date: Thu, 15 Apr 2021 17:20:13 +0530
Subject: [PATCH] [gdb.fortran] Breakpoint location is modified.

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/gdb.fortran/array-element.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/array-element.exp b/gdb/testsuite/gdb.fortran/array-element.exp
index 28b0e6f348..9518b87a62 100644
--- a/gdb/testsuite/gdb.fortran/array-element.exp
+++ b/gdb/testsuite/gdb.fortran/array-element.exp
@@ -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"
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp
  2021-04-15 12:37 [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp Kumar N, Bhuvanendra
@ 2021-04-15 15:23 ` Andrew Burgess
  2021-04-15 16:34   ` Kumar N, Bhuvanendra
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2021-04-15 15:23 UTC (permalink / raw)
  To: Kumar N, Bhuvanendra
  Cc: gdb-patches, George, Jini Susan, Achra, Nitika, Sharma,
	Alok Kumar, E, Nagajyothi, Tomar, Sourabh Singh

* Kumar N, Bhuvanendra via Gdb-patches <gdb-patches@sourceware.org> [2021-04-15 12:37:42 +0000]:

> [AMD Official Use Only - Internal Distribution Only]
> 
> Hello All,
> 
> I request you all to please review this patch. Below are the details.
> 
> Problem Description:
> In array-element.exp testcase, break point is set at "continue" statement which is at label 100 and later with "print a(1)" command and 1 is printed. Then again "print a(2)" is tried and with gfortran generated executable 2 is printed, whereas with flang generated executable 0 is printed inside the GDB session. label 100 of DO loop gets executed for each iteration with flang, whereas it does not executed with gfortran, there is a bug filed against gfortran 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 and "print a(2)" results in 0. Due to this mismatch in GDB output, test case fails for flang compiler.
> 
> Resolution:
> http://www-pnp.physics.ox.ac.uk/~gronbech/intfor/node18.html
> As shown in the above link, flang behavior is correct and the DO loop should be executed till and including the label 100 for each iteration. In order to print array element a(2), test case require change and instead of putting break point at "continue" statement, breakpoint location needs to be modified to "return" statement, which is outside the DO loop. This way "print a(2)" will succeed with all fortran compilers. This testcase change is done as applicable to all fortran compilers.
> 
> gdb/testsuite/ChangeLog:
>         * gdb.fortran/array-element.exp: Breakpoint location is modified.
> 
> Thanks and Regards,
> Bhuvan
> 
> Patch content inlined:
> 
> From c2116c02db3c7c36738a12da2135d63b3bc7c631 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
> Date: Thu, 15 Apr 2021 17:20:13 +0530
> Subject: [PATCH] [gdb.fortran] Breakpoint location is modified.
> 
> 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.

This looks good.  Please go ahead and merge.

Thanks,
Andrew


> ---
> gdb/testsuite/gdb.fortran/array-element.exp | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.fortran/array-element.exp b/gdb/testsuite/gdb.fortran/array-element.exp
> index 28b0e6f348..9518b87a62 100644
> --- a/gdb/testsuite/gdb.fortran/array-element.exp
> +++ b/gdb/testsuite/gdb.fortran/array-element.exp
> @@ -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"
> --
> 2.17.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp
  2021-04-15 15:23 ` Andrew Burgess
@ 2021-04-15 16:34   ` Kumar N, Bhuvanendra
  0 siblings, 0 replies; 3+ messages in thread
From: Kumar N, Bhuvanendra @ 2021-04-15 16:34 UTC (permalink / raw)
  To: Andrew Burgess
  Cc: gdb-patches, George, Jini Susan, Achra, Nitika, Sharma,
	Alok Kumar, E, Nagajyothi, Tomar, Sourabh Singh

[AMD Official Use Only - Internal Distribution Only]

> This looks good.  Please go ahead and merge.

Thanks for the comments

Regards,
bhuvan

-----Original Message-----
From: Andrew Burgess <andrew.burgess@embecosm.com> 
Sent: Thursday, April 15, 2021 8:53 PM
To: Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Cc: gdb-patches@sourceware.org; George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>; Tomar, Sourabh Singh <SourabhSingh.Tomar@amd.com>
Subject: Re: [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp

[CAUTION: External Email]

* Kumar N, Bhuvanendra via Gdb-patches <gdb-patches@sourceware.org> [2021-04-15 12:37:42 +0000]:

> [AMD Official Use Only - Internal Distribution Only]
>
> Hello All,
>
> I request you all to please review this patch. Below are the details.
>
> Problem Description:
> In array-element.exp testcase, break point is set at "continue" statement which is at label 100 and later with "print a(1)" command and 1 is printed. Then again "print a(2)" is tried and with gfortran generated executable 2 is printed, whereas with flang generated executable 0 is printed inside the GDB session. label 100 of DO loop gets executed for each iteration with flang, whereas it does not executed with gfortran, there is a bug filed against gfortran in Bugzilla: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgcc.gnu.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D99816&amp;data=04%7C01%7CBhuvanendra.KumarN%40amd.com%7Cf1f926d9e4d2403df8f908d900226a70%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637540970080557911%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=x7woYD9UiRqbYaJmJezhKMGHDjwmMpgFPs3r61YZzpg%3D&amp;reserved=0. 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 and "print a(2)" results in 0. Due to this mismatch in GDB output, test case fails for flang compiler.
>
> Resolution:
> https://nam11.safelinks.protection.outlook.com/?url=http:%2F%2Fwww-pnp
> .physics.ox.ac.uk%2F~gronbech%2Fintfor%2Fnode18.html&amp;data=04%7C01%
> 7CBhuvanendra.KumarN%40amd.com%7Cf1f926d9e4d2403df8f908d900226a70%7C3d
> d8961fe4884e608e11a82d994e183d%7C0%7C0%7C637540970080557911%7CUnknown%
> 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
> VCI6Mn0%3D%7C1000&amp;sdata=8EmkljqEhjxrp4tkzR2uCaElGixXvDsHkQOiMZndV5
> o%3D&amp;reserved=0 As shown in the above link, flang behavior is 
> correct and the DO loop should be executed till and including the label 100 for each iteration. In order to print array element a(2), test case require change and instead of putting break point at "continue" statement, breakpoint location needs to be modified to "return" statement, which is outside the DO loop. This way "print a(2)" will succeed with all fortran compilers. This testcase change is done as applicable to all fortran compilers.
>
> gdb/testsuite/ChangeLog:
>         * gdb.fortran/array-element.exp: Breakpoint location is modified.
>
> Thanks and Regards,
> Bhuvan
>
> Patch content inlined:
>
> From c2116c02db3c7c36738a12da2135d63b3bc7c631 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E2=80=9Cbhkumarn=E2=80=9D?= 
> Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
> Date: Thu, 15 Apr 2021 17:20:13 +0530
> Subject: [PATCH] [gdb.fortran] Breakpoint location is modified.
>
> 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:
> https://nam11.safelinks.protection.outlook.com/?url=http:%2F%2Fwww-pnp.physics.ox.ac.uk%2F~gronbech%2Fintfor%2Fnode18.html&amp;data=04%7C01%7CBhuvanendra.KumarN%40amd.com%7Cf1f926d9e4d2403df8f908d900226a70%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637540970080557911%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=8EmkljqEhjxrp4tkzR2uCaElGixXvDsHkQOiMZndV5o%3D&amp;reserved=0.
> 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgcc
> .gnu.org%2Fbugzilla%2Fshow_bug.cgi%3Fid%3D99816&amp;data=04%7C01%7CBhu
> vanendra.KumarN%40amd.com%7Cf1f926d9e4d2403df8f908d900226a70%7C3dd8961
> fe4884e608e11a82d994e183d%7C0%7C0%7C637540970080557911%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=x7woYD9UiRqbYaJmJezhKMGHDjwmMpgFPs3r61YZzpg%3D&amp;reserved=0). 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.

This looks good.  Please go ahead and merge.

Thanks,
Andrew


> ---
> gdb/testsuite/gdb.fortran/array-element.exp | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.fortran/array-element.exp 
> b/gdb/testsuite/gdb.fortran/array-element.exp
> index 28b0e6f348..9518b87a62 100644
> --- a/gdb/testsuite/gdb.fortran/array-element.exp
> +++ b/gdb/testsuite/gdb.fortran/array-element.exp
> @@ -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"
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-15 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 12:37 [PATCH] [gdb.fortran] Update Breakpoint location in array-element.exp Kumar N, Bhuvanendra
2021-04-15 15:23 ` Andrew Burgess
2021-04-15 16:34   ` Kumar N, Bhuvanendra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).