public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions
@ 2022-10-18 19:21 jakub.s7920 at gmail dot com
  2022-10-22 11:12 ` [Bug ada/107309] GNAT does not apply type conversion " ebotcazou at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub.s7920 at gmail dot com @ 2022-10-18 19:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107309

            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=53726&action=edit
if / case expression example

According to AARM 4.5.7 (10/3), if the conditional expression is an argument 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 doesn'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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/107309] GNAT does not apply type conversion to dependent expressions of conditional expressions
  2022-10-18 19:21 [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions jakub.s7920 at gmail dot com
@ 2022-10-22 11:12 ` ebotcazou at gcc dot gnu.org
  2022-10-22 11:13 ` ebotcazou at gcc dot gnu.org
  2022-11-08 10:22 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2022-10-22 11:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107309

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-10-22
             Status|UNCONFIRMED                 |NEW
            Summary|GNAT does not apply type    |GNAT does not apply type
                   |conversion rules to         |conversion to dependent
                   |dependent expressions of    |expressions of conditional
                   |conditional expressions     |expressions
                 CC|                            |ebotcazou at gcc dot gnu.org
   Target Milestone|---                         |13.0

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
The RM 4.5.7(10/3) rule is quite irregular but should be applied indeed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/107309] GNAT does not apply type conversion to dependent expressions of conditional expressions
  2022-10-18 19:21 [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions jakub.s7920 at gmail dot com
  2022-10-22 11:12 ` [Bug ada/107309] GNAT does not apply type conversion " ebotcazou at gcc dot gnu.org
@ 2022-10-22 11:13 ` ebotcazou at gcc dot gnu.org
  2022-11-08 10:22 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2022-10-22 11:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107309

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/107309] GNAT does not apply type conversion to dependent expressions of conditional expressions
  2022-10-18 19:21 [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions jakub.s7920 at gmail dot com
  2022-10-22 11:12 ` [Bug ada/107309] GNAT does not apply type conversion " ebotcazou at gcc dot gnu.org
  2022-10-22 11:13 ` ebotcazou at gcc dot gnu.org
@ 2022-11-08 10:22 ` ebotcazou at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2022-11-08 10:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107309

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2022-Novembe
                   |                            |r/605314.html
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Implemented on mainline.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-08 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 19:21 [Bug ada/107309] New: GNAT does not apply type conversion rules to dependent expressions of conditional expressions jakub.s7920 at gmail dot com
2022-10-22 11:12 ` [Bug ada/107309] GNAT does not apply type conversion " ebotcazou at gcc dot gnu.org
2022-10-22 11:13 ` ebotcazou at gcc dot gnu.org
2022-11-08 10:22 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).