From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id B2CB83858D35 for ; Wed, 21 Jun 2023 09:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B2CB83858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f865f0e16cso5755167e87.3 for ; Wed, 21 Jun 2023 02:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687340408; x=1689932408; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Vdp2dpsH0vpg0ezStAznJ0W3PW5dE0bgMLzp4SWS0tE=; b=NWRc4Zu/f8k8pvoeFcZfkOc+2p8MUG5NAswnnyuH0lRT5vOHKf1bUpuEPie8FxsWmS oqcgI3ICNu9y5cebf6G7RjngvEbQdZBHsRbUwAIpc83y7qztB69Z3R8/qqQI19lWIHmp n66Cews+Ea/A5QApz2gvKnlgPTPUFMx+5MSCvlVCSXgv/ZBuM6HWsnTRqoh+f8135sJs mcR1D8nrt5VZaQrE3m/Cx6Yw09Xfg7bokT71YeobHcCP3/OKyMOLYbIjhKVXZ7MqB9NM ZCkCTaOHmLGYPYKtXpvFKPA03yX3zxe3oETzSLkRUE7oY0CO3pKrZ6Ir8rndhLup1aPb ffRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687340408; x=1689932408; 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=Vdp2dpsH0vpg0ezStAznJ0W3PW5dE0bgMLzp4SWS0tE=; b=h26uzObdVOr7hShGnoDHUopGVEwIGyCThO8l3UsJR6+ox60RRfacFvJTYba+WWtV8F Kqo3Sh1pQTZdumdL7iajuxPZq6cKS3AYwImy82SVaZZGsuyFxbndYJEsRzNndUVO+VIZ diSOoe93ful2vuuQOYXJLjQvlsQ9dJPgNj9TTBimhKXyjuCiEt4Z2GEodMF/9UwsYB1Q fws4MjxiLBeqwbtkkPkeG4iR4FCfSiwC/b9HVF2to5lj0gUPWL9ID8nk84yzMqtkbqXr 8D3+MrS+tWsUFIIKBKy2P4TDj2QCzmkMPPZcRT+ksu/Q6gYyw8yWdVABCJMgafGmcbEo GFuA== X-Gm-Message-State: AC+VfDy3tvydzoE1LGT5H8yb+c8U7Qy7o+knd3z4w0T5/YABNOCVhEba u3fh/9gtHMkTqqoIq5K+lQqeQCzJew6xU3n3eJo= X-Google-Smtp-Source: ACHHUZ5jI23h7UfqzBXGN5fX0XB9V9ieolS6WTGXwPdseHyOSM2BM7/RazyUzw+U3Vvkk/g7M4ZyhA== X-Received: by 2002:a05:6512:32a8:b0:4f8:6d38:b091 with SMTP id q8-20020a05651232a800b004f86d38b091mr6233381lfe.25.1687340408071; Wed, 21 Jun 2023 02:40:08 -0700 (PDT) Received: from whitegate.. ([31.94.39.233]) by smtp.gmail.com with ESMTPSA id e10-20020a5d65ca000000b002f28de9f73bsm3984012wrw.55.2023.06.21.02.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:40:07 -0700 (PDT) From: Richard Bunt To: gdb-patches@sourceware.org, agontarek@nvidia.com Cc: Richard Bunt Subject: [PATCH v1] gdb/testsuite: Testing with the nvfortran compiler Date: Wed, 21 Jun 2023 10:39:50 +0100 Message-Id: <20230621093950.2172645-1-richard.bunt@linaro.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_ABUSEAT,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 List-Id: 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..fb24ee315be 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" -- 2.32.0