From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id CE8353857C4F for ; Wed, 9 Mar 2022 10:39:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CE8353857C4F X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="254884576" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="254884576" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 02:39:46 -0800 X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="643995036" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 02:39:46 -0800 From: Nils-Christian Kempke To: gdb-patches@sourceware.org Subject: [PATCH 05/11] gdb/fortran: change default logical type to builtin_logical Date: Wed, 9 Mar 2022 11:39:16 +0100 Message-Id: <20220309103922.3257803-6-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309103922.3257803-1-nils-christian.kempke@intel.com> References: <20220309103922.3257803-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 09 Mar 2022 10:39:49 -0000 According to the Fortran standard, logical is of the size of a 'single numeric storage unit' (just like real and integer). For gfortran, flang and ifx/ifort this storage unit (or the default logical type) is of size kind 4, actually occupying 4 bytes of storage, and so the default type for logical expressions in Fortran should probably also be Logical*4 and not Logical*2. I adapted GDB's behavior to be in line with gfortran/ifort/ifx/flang. gdb/ChangeLog: 2022-02-22 Nils-Christian Kempke * f-lang.c: Change Fortran default logical to builtin_logical. gdb/testsuite/ChangeLog: 2022-02-22 Nils-Christian Kempke * gdb.fortran/types.exp: Adapt expected output. Signed-off-by: Nils-Christian Kempke --- gdb/f-lang.c | 2 +- gdb/testsuite/gdb.fortran/types.exp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index c8a0d66877..8e9af7661c 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1570,7 +1570,7 @@ f_language::language_arch_info (struct gdbarch *gdbarch, add (builtin->builtin_void); lai->set_string_char_type (builtin->builtin_character); - lai->set_bool_type (builtin->builtin_logical_s2, "logical"); + lai->set_bool_type (builtin->builtin_logical, "logical"); } /* See language.h. */ diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp index 4205d308be..8122cbcca3 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -48,10 +48,10 @@ proc test_logical_literal_types_accepted {} { # Test the only possible values for a logical, TRUE and FALSE (and # also true and false). - gdb_test "pt .TRUE." "type = logical\\*2" - gdb_test "pt .FALSE." "type = logical\\*2" - gdb_test "pt .true." "type = logical\\*2" - gdb_test "pt .false." "type = logical\\*2" + gdb_test "pt .TRUE." "type = logical\\*4" + gdb_test "pt .FALSE." "type = logical\\*4" + gdb_test "pt .true." "type = logical\\*4" + gdb_test "pt .false." "type = logical\\*4" } proc test_float_literal_types_accepted {} { -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928