This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve PR30911 and PR31023, Ada and VRP


> So should Richard apply his patch then?

I'd say yes, ACATS is clean at -O2 so let's try.  In fact the compiler already 
implements something equivalent in specific cases, for example:

package Values is

   type Range_Type is range 1 .. 2;
   for Range_Type'Size use 8;

   function Is_Valid (X : Range_Type) return Boolean;

end;

package body Values is

   function Is_Valid (X : Range_Type) return Boolean is
   begin
      case Integer(X) is
         when 1      => return True;
         when 2      => return True;
         when others => return False;
      end case;
   end;

end;

is optimized to "return True;" at -O, so there won't be any quantum leap.

Moreover, even if this is a little experimental, I think that this will help 
us to understand the limits of the current implementation of Ada subtypes.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]