From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2312A3857BA2; Wed, 24 Jan 2024 12:16:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2312A3857BA2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1706098591; bh=rpyDKlp0u+rjaF3rDy2a53fIQL5PG9KeVLNlQbNTF5s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nB+uE5iqj2FJTNqSeAGMQ+ofB0DD0R2wYSsxhfoZRisq9F1KEdt1B4LeesU7eRiRl AdEK/TeIZroCCYABUQhDyxhb4lWID6e5aKJkW00tNQuyzoO/5HnF7PX7t4Iu/OLf1m WvnKivzLdtBRRX2lKpvlVvQAhySsuAPezQOpbhRI= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug fortran/31282] [gdb/fortran] logical type doesn't match documentation of TYPE_CODE_BOOL Date: Wed, 24 Jan 2024 12:16:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: fortran X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31282 --- Comment #3 from Tom de Vries --- (In reply to Tom Tromey from comment #1) > It's also worth considering how hardbool should work. Ah, interesting, thanks. I found some explanation here ( https://gcc.gnu.org/onlinedocs/gnat_rm/Hardened-Booleans.html ). So let's try with this program: ... with Text_IO; use Text_IO; procedure hello is type HBool is new Boolean; for HBool use (0, 1); for HBool'Size use 8; A : HBool :=3D True; begin Put_Line("Hello world!"); end hello; ... This dwarf is generated, it's a subrange_type: ... <2><168e>: Abbrev Number: 3 (DW_TAG_subrange_type) <168f> DW_AT_lower_bound : 0 <1690> DW_AT_upper_bound : 1 <1691> DW_AT_name : hello__hbool <1695> DW_AT_type : <0x16a7> <1><16a7>: Abbrev Number: 5 (DW_TAG_base_type) <16a8> DW_AT_byte_size : 1 <16a9> DW_AT_encoding : 2 (boolean) <16aa> DW_AT_name : hello__hboolB <16ae> DW_AT_artificial : 1 ... Now let's try this change: ... - for HBool use (0, 1); + for HBool use (0, 2); ... Also a subrange_type, but with a different basis type. ... <2><168a>: Abbrev Number: 3 (DW_TAG_enumeration_type) <168b> DW_AT_name : hello__hboolB <168f> DW_AT_encoding : 7 (unsigned) <1690> DW_AT_byte_size : 1 <1694> DW_AT_artificial : 1 <3><1698>: Abbrev Number: 4 (DW_TAG_enumerator) <1699> DW_AT_name : false <169d> DW_AT_const_value : 0 <3><169e>: Abbrev Number: 4 (DW_TAG_enumerator) <169f> DW_AT_name : true <16a3> DW_AT_const_value : 2 <2><16a5>: Abbrev Number: 5 (DW_TAG_subrange_type) <16a6> DW_AT_lower_bound : 0 <16a7> DW_AT_upper_bound : 2 <16a8> DW_AT_name : hello__hbool <16ac> DW_AT_type : <0x168a> ... Likewise for: ... - for HBool use (0, 1); + for HBool use (1, 2); ... which sort of suggests that DW_ATE_boolean means 0/1, but that is contradic= ted by the use of DW_ATE_boolean in ifort. --=20 You are receiving this mail because: You are on the CC list for the bug.=