[PATCH] [gdb.fortran] test modified for clang in class-allocatable-array.exp

Kumar N, Bhuvanendra Bhuvanendra.KumarN@amd.com
Fri Apr 16 07:07:31 GMT 2021


[AMD Official Use Only - Internal Distribution Only]

Hello All,

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

Problem Description:
As mentioned in the test case itself, depending on the fortran compiler used, class member names used in the print commands and also output of these print commands varies. Existing print commands and its output are suited for gfortran, hence they were failing with clang compiler, as clang uses different naming convention for class members.

Resolution:
Test case was modified accordingly for clang compiler.

Thanks and Regards,
Bhuvan

Patch content inlined:

>From 7f71e60363820c72ed693f22bdd589a4a51b69cb 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: Fri, 16 Apr 2021 12:18:54 +0530
Subject: [PATCH] [gdb.fortran] test case modified to suit the clang
behavior.

As mentioned in the test case itself, depending on the fortran compiler
used, class member names used in the print commands and also output of
these print commands varies. Existing print commands and its output are
suited for gfortran, hence they were failing with clang compiler and test
case was modified accordingly for clang compiler.

gdb/testsuite/ChangeLog:
        * gdb.base/class-allocatable-array.exp: Modified test for clang.
---
gdb/testsuite/ChangeLog                             |  6 +++++-
.../gdb.fortran/class-allocatable-array.exp         | 13 ++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 216d985995..0aecac7a62 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-16  Bhuvanendra Kumar  Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
+
+     * gdb.base/class-allocatable-array.exp: Modified test for clang.
+
2021-04-16  Bhuvanendra Kumar  Bhuvanendra.KumarN@amd.com<mailto:Bhuvanendra.KumarN@amd.com>
     * gdb.fortran/ptype-on-functions.exp: Add type info of formal
     parameter for clang. Also removed the kind parameter for clang.
@@ -5,7 +9,7 @@
diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
index d2e3064942..e58bb164b9 100644
--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
@@ -38,6 +38,13 @@ gdb_continue_to_breakpoint "Break Here"
# different names, or maybe a completely different approach, for
# representing class like structures.  The following tests are
# cetainly going to fail.
-gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)"
-gdb_test "print this%_data" " = \\(PTR<file://(PTR> TO -> \\( Type test_type \\)\\) \[^\r\n\]+"
-gdb_test "print this%_data%b" " = \\(\\(1<file://(//(1>, 2, 3\\) \\(4<file://(4>, 5, 6\\)\\)"
+# Hence the test case is modified for clang
+if {[test_compiler_info {clang-*}]} {
+    gdb_test "print this" " = \\( a = 0, b = \\(\\(1<file://(//(1>, 2, 3\\) \\(4<file://(4>, 5, 6\\)\\) \\)"
+    gdb_test "print this%a" " = 0"
+    gdb_test "print this%b" " = \\(\\(1<file://(//(1>, 2, 3\\) \\(4<file://(4>, 5, 6\\)\\)"
+} else {
+    gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)"
+    gdb_test "print this%_data" " = \\(PTR<file://(PTR> TO -> \\( Type test_type \\)\\) \[^\r\n\]+"
+    gdb_test "print this%_data%b" " = \\(\\(1<file://(//(1>, 2, 3\\) \\(4<file://(4>, 5, 6\\)\\)"
+}
--
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb.fortran-test-case-modified-for-clang.patch
Type: application/octet-stream
Size: 2671 bytes
Desc: gdb.fortran-test-case-modified-for-clang.patch
URL: <https://sourceware.org/pipermail/gdb-patches/attachments/20210416/8c14cd64/attachment-0001.obj>


More information about the Gdb-patches mailing list