According to the standard, the instruction S'Remainder(X,Y) must raised a
Constraint_Error is raised if Y is zero (Annex A.5.3, point 47).

The following code, if build and launch (with gnat v3.15) returns 3.0 instead
of raising an exception.

package Test is
   type T_Master is digits 8;
   type T is new T_Master range 0.0 .. 10.0;
   subtype S is T range 0.0 .. 1.0;
end Test;

with System;
with Ada.Text_Io; use Ada.Text_Io;
with Test; use Test;
procedure Main is
   typ: T;
   Fraction: T:=3.0;
   package Float_Io is new Ada.Text_IO.Float_IO (T);

begin
   Typ:=S'Remainder(Fraction,0.0);  -- must raise a CONSTRAINT_ERROR
   Put("remainder: ");
   Float_Io.Put(Typ);          
   New_Line;

end Main;


-- 
           Summary: Non conformity with the Ada95 language standard.
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: grimalseverine at yahoo dot fr
 GCC build triplet: ?
  GCC host triplet: ?
GCC target triplet: ?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24212

Reply via email to