From patchwork Wed Jul 5 10:08:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Bunt X-Patchwork-Id: 72163 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C8B4385700B for ; Wed, 5 Jul 2023 10:09:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C8B4385700B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688551776; bh=o9ABZvsbBYLahkOL3nKxJ+Dj4FFwGqicnW5gPXHulyE=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=KX7vz0R+7+Yg9/1oaLIpzPRpUacS/LbCj1+nLjIb3x3xvvISeV6xPE/GsM78kxB5F VMQONi2ekzJXFtXXFfljdA0ILSzFHCEkQPF3o5ecZy2lQ7JX90hnjnVWf8NhcJK9oh vR05ikPSIIBYTJ/xNUafHJGh9uwB9Hss/F2CrrP4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 9B8513858415 for ; Wed, 5 Jul 2023 10:09:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B8513858415 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc244d39dso87254805e9.3 for ; Wed, 05 Jul 2023 03:09:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688551749; x=1691143749; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o9ABZvsbBYLahkOL3nKxJ+Dj4FFwGqicnW5gPXHulyE=; b=diRmSBKwGMvRLHT7ZFxHRm66fDhszPifzzEMFp9RoKr5kBhyohvwtx3C+YuNdm617m rKts+vc0bm7i83NJdpVHdk1qPxMiyMPPO+fyUgsNXIWZI6iSHAvhhQQvpFUetSpBp9FR PgMKFacLZeH3UaHYaGKVwFjo0qKmIHBr6bguYGBIFSphdXa94DtA1ksJhnZv/9PFu/Ih X+J8skLsln68TakOy2AWApFx8xfd6LkSFxvb+9PgODwCkNBfbJvz1B7QGZ7MQytwARiW jfd8JQ0LcRAHAVSkBzyfr002TqcMa2EGlhtdWkkfCUfW5vupyOqoTeJaANtXtkREAusA tVSg== X-Gm-Message-State: AC+VfDwFJF1GsKWvTHV6bd70jfWTmcGZkUxfD3xyS20K94Je7kKbOOHm 89Qx1GsOd63eWPVrl3RVEhsS25TBeaA4hdwBsFU= X-Google-Smtp-Source: ACHHUZ6fpu4eTxMQnaeRQ6HmYWft2VzJSZgHw0+44ym/KIA6dA2RvzR6BWUE6rirKhrc04dtzuflYw== X-Received: by 2002:a1c:7c0a:0:b0:3f7:f2d0:b904 with SMTP id x10-20020a1c7c0a000000b003f7f2d0b904mr21507451wmc.8.1688551749262; Wed, 05 Jul 2023 03:09:09 -0700 (PDT) Received: from whitegate.. ([31.94.19.107]) by smtp.gmail.com with ESMTPSA id l7-20020a7bc347000000b003fbc0ea491dsm1664376wmj.40.2023.07.05.03.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 03:09:08 -0700 (PDT) To: gdb-patches@sourceware.org, agontarek@nvidia.com Cc: Richard Bunt Subject: [PATCH v2] gdb/testsuite: Testing with the nvfortran compiler Date: Wed, 5 Jul 2023 11:08:31 +0100 Message-Id: <20230705100831.1167665-1-richard.bunt@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Bunt via Gdb-patches From: Richard Bunt Reply-To: Richard Bunt Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Currently, the Fortran test suite does not run with NVIDIA's Fortran compiler (nvfortran). The goal here is to get the tests running and preventing further regressions during future work. This change does not do anything to fix existing failures. Teach the compiler detection about nvfortran. There is no underlying information about whether this compiler is related to flang classic or flang, so we cannot reuse the main and type definitions. Therefore, we explicitly record the main method and type information observed when using nvfortran. The main name was extracted by trying to set breakpoints on both MAIN_ and MAIN__. The following mapping of test to type names was used to extract how nvfortran reports types. info-types.exp: fortran_int4, fortran_int8, fortran_real4, fortran_logical4 common-block.exp: fortran_real8 complex.exp: fortran_complex4 fortran_complex8 logical.exp: fortran_character1. Ran ptype on "c". Types defined as fortran_complex16 do not compile with nvfortran, so it was left unset. gdb.fortran regression tests run with GNU, Intel, Intel LLVM and ACfL. No regressions detected. The gdb.fortran test results with nvfortran 23.3 are as follows. Before: # of expected passes 523 # of unexpected failures 107 # of known failures 2 # of unresolved testcases 1 # of untested testcases 7 # of duplicate test names 2 After: # of expected passes 5696 # of unexpected failures 271 # of known failures 12 # of untested testcases 9 # of unsupported tests 5 As can be seen from the above, there are now considerably more passing assertions. --- gdb/testsuite/lib/compiler.F90 | 4 ++++ gdb/testsuite/lib/fortran.exp | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/lib/compiler.F90 b/gdb/testsuite/lib/compiler.F90 index 14a6521a8a4..8804f7f175d 100644 --- a/gdb/testsuite/lib/compiler.F90 +++ b/gdb/testsuite/lib/compiler.F90 @@ -24,6 +24,10 @@ set compiler_info [join {gfortran __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} - set compiler_info [join {armflang __armclang_major__ __armclang_minor__ 0} -] #endif +#if defined (__NVCOMPILER_MAJOR__) +set compiler_info [join {nvfortran __NVCOMPILER_MAJOR__ __NVCOMPILER_MINOR__ __NVCOMPILER_PATCHLEVEL__} -] +#endif + /* Classic flang and LLVM flang emit their respective macros differently. */ /* LLVM flang complains about non Fortran tokens so we do not use "{" here. */ diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp index 357a2c12358..2fd678df0a1 100644 --- a/gdb/testsuite/lib/fortran.exp +++ b/gdb/testsuite/lib/fortran.exp @@ -34,7 +34,8 @@ proc fortran_int4 {} { return "int4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "integer\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "integer" } elseif {[test_compiler_info {ifort-*} f90]} { return "INTEGER\\(4\\)" @@ -50,7 +51,8 @@ proc fortran_int8 {} { return "int8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "integer\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "integer\\*8" } elseif {[test_compiler_info {ifort-*} f90]} { return "INTEGER\\(8\\)" @@ -66,7 +68,8 @@ proc fortran_real4 {} { return "real4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "real\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "real" } elseif {[test_compiler_info {ifort-*} f90]} { return "REAL\\(4\\)" @@ -82,7 +85,8 @@ proc fortran_real8 {} { return "real8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "real\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "double precision" } elseif {[test_compiler_info {ifort-*} f90]} { return "REAL\\(8\\)" @@ -98,7 +102,8 @@ proc fortran_complex4 {} { return "complex4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "complex\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "complex" } elseif {[test_compiler_info {ifort-*} f90]} { return "COMPLEX\\(4\\)" @@ -114,7 +119,8 @@ proc fortran_complex8 {} { return "complex8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "complex\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "double complex" } elseif {[test_compiler_info {ifort-*} f90]} { return "COMPLEX\\(8\\)" @@ -146,7 +152,8 @@ proc fortran_logical4 {} { return "logical4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "logical\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "logical" } elseif {[test_compiler_info {ifort-*} f90]} { return "LOGICAL\\(4\\)" @@ -164,6 +171,8 @@ proc fortran_character1 {} { return "character\\(kind=1\\)" } elseif {[test_compiler_info {flang-*} f90]} { return "character" + } elseif {[test_compiler_info {nvfortran-*} f90]} { + return "character\\*1" } elseif {[test_compiler_info {ifort-*} f90]} { return "CHARACTER\\(1\\)" } elseif {[test_compiler_info {ifx-*} f90]} { @@ -181,7 +190,8 @@ proc fortran_main {} { || [test_compiler_info {ifx-*} f90] || [test_compiler_info {flang-llvm-*} f90]} { return "MAIN__" - } elseif {[test_compiler_info {flang-classic-*} f90]} { + } elseif {[test_compiler_info {flang-classic-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "MAIN_" } else { return "unknown"