From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AF5913858D32; Tue, 18 Oct 2022 19:21:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF5913858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666120875; bh=qyi8ebJ3/qMhMRsd9ImI83HTxjOrqlUu/XdKMSCgPyI=; h=From:To:Subject:Date:From; b=rKuVuksWo6fpQQGgRqcTDERUemV3ey825D+3+fP5Quv5lfMjxNv2hmlWpMZ8Vsz2f H9P4TWZK4uU+0YirN6aAg3noZX1ocsp/MzOsZjohqt8ZA1cpuSKa6knD9R2s1eh6PC IJNghuYXb00RKLrnuUbF9RJVkmU9kF9CafQOMz3M= From: "jakub.s7920 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions Date: Tue, 18 Oct 2022 19:21:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub.s7920 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107309 Bug ID: 107309 Summary: GNAT does not apply type conversion rules to dependent expressions of conditional expressions Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: jakub.s7920 at gmail dot com Target Milestone: --- Created attachment 53726 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53726&action=3Dedit if / case expression example According to AARM 4.5.7 (10/3), if the conditional expression is an argumen= t of a type conversion then said conversion should apply to each of the dependent expressions. I tried compiling an example taken straight from AARM on GNAT 12.1.0 and GNAT 10.3.0 but got the following error message: > $ gnat make if_exp.adb > x86_64-linux-gnu-gcc-12 -c if_exp.adb > if_exp.adb:5:34: error: expected an integer type > if_exp.adb:5:34: error: found type universal real > x86_64-linux-gnu-gnatmake-12: "if_exp.adb" compilation error Similar results with an equivalent case expression: > $ gnat make case_exp.adb > x86_64-linux-gnu-gcc-12 -c case_exp.adb > case_exp.adb:7:30: error: expected type universal integer > case_exp.adb:7:30: error: found type universal real > x86_64-linux-gnu-gnatmake-12: "case_exp.adb" compilation error I've attached the source code of both files. The commented out code is, to = my understanding, semantically the same as the corresponding version that does= n't compile. http://www.ada-auth.org/standards/12rat/html/Rat12-3-2.html http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-4-5-7.html=