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