* [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
@ 2020-03-02 17:28 Sharma, Alok Kumar
2020-03-02 18:43 ` Andrew Burgess
0 siblings, 1 reply; 4+ messages in thread
From: Sharma, Alok Kumar @ 2020-03-02 17:28 UTC (permalink / raw)
To: gdb-patches; +Cc: George, Jini Susan, Achra, Nitika
[-- Attachment #1: Type: text/plain, Size: 1364 bytes --]
Hi all,
I request you all to please review the patch. Below are the details.
gdb.fortran: Allow Flang kind printing in fortran testing
In lib/fortran.exp, in the helper function fortran_int4, kind
parameter is expected to be printed as (kind=4) for the LLVM
Fortran compiler, Flang along with gfortran. And in the helper
function fortran_int8 kind parameter is expected to be printed
as (kind=8). But for the Flang compiler default kind is not
printed and non default kind is printed differently than gfortran
as below.
integer(kind=4) => integer
integer(kind=8) => integer*8
real(kind=4) => real
real(kind=8) => double precision
complex(kind=4) => complex
logical(kind=4) => logical
character(kind=1) => character
This commit adds support for printing of kind parameter for the
Flang. There should be no change when testing with gfortran.
gdb/testsuite/ChangeLog:
* lib/fortran.exp (fortran_int4): Handle flang kind printing.
(fortran_int8): Likewise.
(fortran_real4): Likewise.
(fortran_real8): Likewise.
(fortran_complex4): Likewise.
(fortran_logical4): Likewise.
(fortran_character1): Likewise.
Please let me know your comments.
Regards,
Alok
[-- Attachment #2: 0001-gdb.fortran-Allow-Flang-kind-printing-in-fortran-tes.patch --]
[-- Type: application/octet-stream, Size: 4824 bytes --]
From 9c1891fe0a81ddfdd3a15414cc87c93aeebfac83 Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 2 Mar 2020 22:50:13 +0530
Subject: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
In lib/fortran.exp, in the helper function fortran_int4, kind
parameter is expected to be printed as (kind=4) for the LLVM
Fortran compiler, Flang along with gfortran. And in the helper
function fortran_int8 kind parameter is expected to be printed
as (kind=8). But for the Flang compiler default kind is not
printed and non default kind is printed differently than gfortran
as below.
integer(kind=4) => integer
integer(kind=8) => integer*8
real(kind=4) => real
real(kind=8) => double precision
complex(kind=4) => complex
logical(kind=4) => logical
character(kind=1) => character
This commit adds support for printing of kind parameter for the
Flang. There should be no change when testing with gfortran.
gdb/testsuite/ChangeLog:
* lib/fortran.exp (fortran_int4): Handle flang kind printing.
(fortran_int8): Likewise.
(fortran_real4): Likewise.
(fortran_real8): Likewise.
(fortran_complex4): Likewise.
(fortran_logical4): Likewise.
(fortran_character1): Likewise.
Change-Id: Ieb93516b65033865e51addf49ee471d3b2967db8
---
gdb/testsuite/lib/fortran.exp | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index 54f3293677..549ed65790 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -32,9 +32,10 @@ proc set_lang_fortran {} {
proc fortran_int4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "int4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "integer\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "integer"
} elseif {[test_compiler_info {icc-*}]} {
return "INTEGER\\(4\\)"
} else {
@@ -45,9 +46,10 @@ proc fortran_int4 {} {
proc fortran_int8 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "int8"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "integer\\(kind=8\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "integer*8"
} elseif {[test_compiler_info {icc-*}]} {
return "INTEGER\\(8\\)"
} else {
@@ -58,9 +60,10 @@ proc fortran_int8 {} {
proc fortran_real4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "real4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "real\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "real"
} elseif {[test_compiler_info {icc-*}]} {
return "REAL\\(4\\)"
} else {
@@ -71,9 +74,10 @@ proc fortran_real4 {} {
proc fortran_real8 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "real8"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "real\\(kind=8\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "double precision"
} elseif {[test_compiler_info {icc-*}]} {
return "REAL\\(8\\)"
} else {
@@ -84,9 +88,10 @@ proc fortran_real8 {} {
proc fortran_complex4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "complex4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "complex\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "complex"
} elseif {[test_compiler_info {icc-*}]} {
return "COMPLEX\\(4\\)"
} else {
@@ -97,9 +102,10 @@ proc fortran_complex4 {} {
proc fortran_logical4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "logical4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "logical\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "logical"
} elseif {[test_compiler_info {icc-*}]} {
return "LOGICAL\\(4\\)"
} else {
@@ -110,9 +116,10 @@ proc fortran_logical4 {} {
proc fortran_character1 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "character1"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "character\\(kind=1\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "character"
} elseif {[test_compiler_info {icc-*}]} {
return "CHARACTER\\(1\\)"
} else {
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
2020-03-02 17:28 [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing Sharma, Alok Kumar
@ 2020-03-02 18:43 ` Andrew Burgess
2020-03-03 5:31 ` Sharma, Alok Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Burgess @ 2020-03-02 18:43 UTC (permalink / raw)
To: Sharma, Alok Kumar; +Cc: gdb-patches, George, Jini Susan, Achra, Nitika
* Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-03-02 17:27:58 +0000]:
>
> diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
> index 54f3293677..549ed65790 100644
> --- a/gdb/testsuite/lib/fortran.exp
> +++ b/gdb/testsuite/lib/fortran.exp
> @@ -32,9 +32,10 @@ proc set_lang_fortran {} {
> proc fortran_int4 {} {
> if {[test_compiler_info {gcc-4-[012]-*}]} {
> return "int4"
> - } elseif {[test_compiler_info {gcc-*}]
> - || [test_compiler_info {clang-*}]} {
> + } elseif {[test_compiler_info {gcc-*}]} {
> return "integer\\(kind=4\\)"
> + } elseif {[test_compiler_info {clang-*}]} {
> + return "integer"
The clang-* line that is being removed was added by this commit:
commit c3b149eb7697b376df1b3a47d0102afda389ee6d
Author: Alok Kumar Sharma <alokkumar.sharma@amd.com>
Date: Tue Feb 4 17:17:20 2020 +0000
gdb/fortran: Allow for using Flang in Fortran testing
So I wonder what the story is here? Do different versions of Flang
print the values differently? Should we be checking for specific Flang
versions like we do with GCC, or was the first patch just wrong?
Which would be absolutely fine, it would just be nice if the commit
message explained why this patch is changing something that was only
committed a month ago.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
2020-03-02 18:43 ` Andrew Burgess
@ 2020-03-03 5:31 ` Sharma, Alok Kumar
2020-03-03 18:23 ` Andrew Burgess
0 siblings, 1 reply; 4+ messages in thread
From: Sharma, Alok Kumar @ 2020-03-03 5:31 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches, George, Jini Susan, Achra, Nitika
[-- Attachment #1: Type: text/plain, Size: 2342 bytes --]
[AMD Official Use Only - Internal Distribution Only]
Hi Andrew,
Thanks for your comments.
Earlier patch was incomplete and based on assumption that flang should be changed to dump a type with kind like the way gfortan does. Later it was realized that the way flang dumps this info is not incorrect but different. And instead of changing flang, changes in gdb test framework are finalized. So yes, earlier patch is incorrect and need to be changed to current one.
I have updated the patch with modified comment with this info. Please have a look.
Regards,
Alok
-----Original Message-----
From: Andrew Burgess <andrew.burgess@embecosm.com>
Sent: Tuesday, March 3, 2020 12:14 AM
To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>
Cc: gdb-patches@sourceware.org; George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>
Subject: Re: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
[CAUTION: External Email]
* Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-03-02 17:27:58 +0000]:
>
> diff --git a/gdb/testsuite/lib/fortran.exp
> b/gdb/testsuite/lib/fortran.exp index 54f3293677..549ed65790 100644
> --- a/gdb/testsuite/lib/fortran.exp
> +++ b/gdb/testsuite/lib/fortran.exp
> @@ -32,9 +32,10 @@ proc set_lang_fortran {} { proc fortran_int4 {} {
> if {[test_compiler_info {gcc-4-[012]-*}]} {
> return "int4"
> - } elseif {[test_compiler_info {gcc-*}]
> - || [test_compiler_info {clang-*}]} {
> + } elseif {[test_compiler_info {gcc-*}]} {
> return "integer\\(kind=4\\)"
> + } elseif {[test_compiler_info {clang-*}]} {
> + return "integer"
The clang-* line that is being removed was added by this commit:
commit c3b149eb7697b376df1b3a47d0102afda389ee6d
Author: Alok Kumar Sharma <alokkumar.sharma@amd.com>
Date: Tue Feb 4 17:17:20 2020 +0000
gdb/fortran: Allow for using Flang in Fortran testing
So I wonder what the story is here? Do different versions of Flang print the values differently? Should we be checking for specific Flang versions like we do with GCC, or was the first patch just wrong?
Which would be absolutely fine, it would just be nice if the commit message explained why this patch is changing something that was only committed a month ago.
Thanks,
Andrew
[-- Attachment #2: 0001-gdb.fortran-Allow-Flang-kind-printing-in-fortran-tes.patch --]
[-- Type: application/octet-stream, Size: 5269 bytes --]
From 09767c97a3389130d8e7f4401c579539269303e8 Mon Sep 17 00:00:00 2001
From: Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
Date: Mon, 2 Mar 2020 22:50:13 +0530
Subject: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
In lib/fortran.exp, in the helper function fortran_int4, kind
parameter is expected to be printed as (kind=4) for the LLVM
Fortran compiler, Flang along with gfortran. And in the helper
function fortran_int8 kind parameter is expected to be printed
as (kind=8). But for the Flang compiler default kind is not
printed and non default kind is printed differently than gfortran
as below.
integer(kind=4) => integer
integer(kind=8) => integer*8
real(kind=4) => real
real(kind=8) => double precision
complex(kind=4) => complex
logical(kind=4) => logical
character(kind=1) => character
This commit adds support for printing of kind parameter for the
Flang. There should be no change when testing with gfortran.
Note: The current patch overrides earlier patch with below details.
commit c3b149eb7697b376df1b3a47d0102afda389ee6d
Author Alok Kumar Sharma (alokkumar.sharma@amd.com)
Earlier patch was incomplete and based on assumption that flang
should be changed to dump a type with kind like the way gfortan does.
Later it was realized that the way flang dumps this info is not
incorrect but different. And changes in gdb test framework are
finalized.
gdb/testsuite/ChangeLog:
* lib/fortran.exp (fortran_int4): Handle flang kind printing.
(fortran_int8): Likewise.
(fortran_real4): Likewise.
(fortran_real8): Likewise.
(fortran_complex4): Likewise.
(fortran_logical4): Likewise.
(fortran_character1): Likewise.
Change-Id: Ieb93516b65033865e51addf49ee471d3b2967db8
---
gdb/testsuite/lib/fortran.exp | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index 54f3293677..549ed65790 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -32,9 +32,10 @@ proc set_lang_fortran {} {
proc fortran_int4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "int4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "integer\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "integer"
} elseif {[test_compiler_info {icc-*}]} {
return "INTEGER\\(4\\)"
} else {
@@ -45,9 +46,10 @@ proc fortran_int4 {} {
proc fortran_int8 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "int8"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "integer\\(kind=8\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "integer*8"
} elseif {[test_compiler_info {icc-*}]} {
return "INTEGER\\(8\\)"
} else {
@@ -58,9 +60,10 @@ proc fortran_int8 {} {
proc fortran_real4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "real4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "real\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "real"
} elseif {[test_compiler_info {icc-*}]} {
return "REAL\\(4\\)"
} else {
@@ -71,9 +74,10 @@ proc fortran_real4 {} {
proc fortran_real8 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "real8"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "real\\(kind=8\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "double precision"
} elseif {[test_compiler_info {icc-*}]} {
return "REAL\\(8\\)"
} else {
@@ -84,9 +88,10 @@ proc fortran_real8 {} {
proc fortran_complex4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "complex4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "complex\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "complex"
} elseif {[test_compiler_info {icc-*}]} {
return "COMPLEX\\(4\\)"
} else {
@@ -97,9 +102,10 @@ proc fortran_complex4 {} {
proc fortran_logical4 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "logical4"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "logical\\(kind=4\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "logical"
} elseif {[test_compiler_info {icc-*}]} {
return "LOGICAL\\(4\\)"
} else {
@@ -110,9 +116,10 @@ proc fortran_logical4 {} {
proc fortran_character1 {} {
if {[test_compiler_info {gcc-4-[012]-*}]} {
return "character1"
- } elseif {[test_compiler_info {gcc-*}]
- || [test_compiler_info {clang-*}]} {
+ } elseif {[test_compiler_info {gcc-*}]} {
return "character\\(kind=1\\)"
+ } elseif {[test_compiler_info {clang-*}]} {
+ return "character"
} elseif {[test_compiler_info {icc-*}]} {
return "CHARACTER\\(1\\)"
} else {
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
2020-03-03 5:31 ` Sharma, Alok Kumar
@ 2020-03-03 18:23 ` Andrew Burgess
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Burgess @ 2020-03-03 18:23 UTC (permalink / raw)
To: Sharma, Alok Kumar; +Cc: gdb-patches, George, Jini Susan, Achra, Nitika
* Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-03-03 05:30:56 +0000]:
> [AMD Official Use Only - Internal Distribution Only]
>
> Hi Andrew,
>
> Thanks for your comments.
>
> Earlier patch was incomplete and based on assumption that flang
> should be changed to dump a type with kind like the way gfortan
> does. Later it was realized that the way flang dumps this info
> is not incorrect but different. And instead of changing flang,
> changes in gdb test framework are finalized. So yes, earlier
> patch is incorrect and need to be changed to current one.
>
> I have updated the patch with modified comment with this
> info. Please have a look.
That's fine, and thanks for updating the commit message, it's always
nice to have this kind of history recorded in the commit log.
Feel free to push this.
Thanks,
Andrew
>
> Regards,
> Alok
>
> -----Original Message-----
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Sent: Tuesday, March 3, 2020 12:14 AM
> To: Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>
> Cc: gdb-patches@sourceware.org; George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>
> Subject: Re: [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing
>
> [CAUTION: External Email]
>
> * Sharma, Alok Kumar <AlokKumar.Sharma@amd.com> [2020-03-02 17:27:58 +0000]:
>
> >
> > diff --git a/gdb/testsuite/lib/fortran.exp
> > b/gdb/testsuite/lib/fortran.exp index 54f3293677..549ed65790 100644
> > --- a/gdb/testsuite/lib/fortran.exp
> > +++ b/gdb/testsuite/lib/fortran.exp
> > @@ -32,9 +32,10 @@ proc set_lang_fortran {} { proc fortran_int4 {} {
> > if {[test_compiler_info {gcc-4-[012]-*}]} {
> > return "int4"
> > - } elseif {[test_compiler_info {gcc-*}]
> > - || [test_compiler_info {clang-*}]} {
> > + } elseif {[test_compiler_info {gcc-*}]} {
> > return "integer\\(kind=4\\)"
> > + } elseif {[test_compiler_info {clang-*}]} {
> > + return "integer"
>
> The clang-* line that is being removed was added by this commit:
>
> commit c3b149eb7697b376df1b3a47d0102afda389ee6d
> Author: Alok Kumar Sharma <alokkumar.sharma@amd.com>
> Date: Tue Feb 4 17:17:20 2020 +0000
>
> gdb/fortran: Allow for using Flang in Fortran testing
>
> So I wonder what the story is here? Do different versions of Flang print the values differently? Should we be checking for specific Flang versions like we do with GCC, or was the first patch just wrong?
> Which would be absolutely fine, it would just be nice if the commit message explained why this patch is changing something that was only committed a month ago.
>
> Thanks,
> Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-03 18:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 17:28 [PATCH] gdb.fortran: Allow Flang kind printing in fortran testing Sharma, Alok Kumar
2020-03-02 18:43 ` Andrew Burgess
2020-03-03 5:31 ` Sharma, Alok Kumar
2020-03-03 18:23 ` Andrew Burgess
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).