public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/115349] New: compiler infers the wrong Accum_Type for a Reducer expression
@ 2024-06-04 22:28 devotus at yahoo dot com
  2024-06-05 11:09 ` [Bug ada/115349] " ebotcazou at gcc dot gnu.org
  2024-06-05 17:07 ` [Bug ada/115349] GNAT " devotus at yahoo dot com
  0 siblings, 2 replies; 3+ messages in thread
From: devotus at yahoo dot com @ 2024-06-04 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115349
           Summary: compiler infers the wrong Accum_Type for a Reducer
                    expression
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: devotus at yahoo dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 58349
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58349&action=edit
Minimal (non-)working example of the bug

Full description in the thread that starts on this page:
https://forum.ada-lang.io/t/regression-in-gnat-14/890?u=cantanima

Essentially, a function returns a vector of `Positive`. I call `'Reduce("+",
0)` on the result. This crashes at run time because the compiler infers that
"+" should operate on `Positive`, and 0 is not positive. The compiler does at
least warn me of this.

However, this was not the behavior in 13.x, which inferred that "+" should
operate on either `Natural` or universal integer. Several of us, including
Tucker Taft, agree that the 13.x behavior is consistent with both the wording
and the intent of ARM 4.5.10 (Taft cited (12/5-13/5) specifically). Thus, we
consider it a bug.

I am attaching what I believe is a minimal working example. (Well,
"non"-working, really.)

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

* [Bug ada/115349] compiler infers the wrong Accum_Type for a Reducer expression
  2024-06-04 22:28 [Bug ada/115349] New: compiler infers the wrong Accum_Type for a Reducer expression devotus at yahoo dot com
@ 2024-06-05 11:09 ` ebotcazou at gcc dot gnu.org
  2024-06-05 17:07 ` [Bug ada/115349] GNAT " devotus at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-06-05 11:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-06-05
                 CC|                            |ebotcazou at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
What crash do you get though?  AFAICS it's a standard Constraint_Error.

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

* [Bug ada/115349] GNAT infers the wrong Accum_Type for a Reducer expression
  2024-06-04 22:28 [Bug ada/115349] New: compiler infers the wrong Accum_Type for a Reducer expression devotus at yahoo dot com
  2024-06-05 11:09 ` [Bug ada/115349] " ebotcazou at gcc dot gnu.org
@ 2024-06-05 17:07 ` devotus at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: devotus at yahoo dot com @ 2024-06-05 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jack Perry <devotus at yahoo dot com> ---
Sorry, that's what I mean by "crash":
```
raised CONSTRAINT_ERROR : intvec.adb:14 range check failed
```

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

end of thread, other threads:[~2024-06-05 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 22:28 [Bug ada/115349] New: compiler infers the wrong Accum_Type for a Reducer expression devotus at yahoo dot com
2024-06-05 11:09 ` [Bug ada/115349] " ebotcazou at gcc dot gnu.org
2024-06-05 17:07 ` [Bug ada/115349] GNAT " devotus at yahoo dot com

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).