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

            Bug ID: 104258
           Summary: [11/12 regression] Generic formal ">" used incorrectly
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---
              Host: x86_64-apple-darwin15
            Target: x86_64-apple-darwin15
             Build: x86_64-apple-darwin15

Created attachment 52301
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52301&action=edit
Reproducer

I have a generic with a formal private type Element_Type and a formal
function ">" (L, R : Element_Type) return Boolean. This gives me
puzzling and compiler-dependent behaviour when I instantiate with
Element_Type => Integer and ">" => "<" (or, as in the code below, ">"
=> Less_Than, where Less_Than outputs a message if it's called).

The output from the code attached is

GCC 10.1.0:

   Data'Length: 2
   Data'Length > 1: TRUE
   Integer'(Data'Length) > 1: TRUE
   Standard.">" (Data'Length, 1): TRUE
   Standard.">" (Integer'(Data'Length), 1): TRUE

GCC 11.2.0, 12.0.0 of 2022-01-11:

   Data'Length: 2
   Data'Length > 1: **less_than ( 2,  1) returns FALSE** FALSE
   Integer'(Data'Length) > 1: TRUE
   Standard.">" (Data'Length, 1): **less_than ( 2,  1) returns FALSE** FALSE
   Standard.">" (Integer'(Data'Length), 1): TRUE

Reply via email to