[Bug ada/33908] New: gcc Ada does not handle fixed point division correctly in Ada 83 mode

dewi dot daniels at silver-software dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 26 14:33:00 GMT 2007


gcc -c -gnat83 test.adb

procedure Test
is
   type T is delta 0.1 range 0.0 .. 10.0;
   X : T;
begin
   X := 10.0;
   X := T (X / 10.0);
end Test;

XD-Ada rejects the test program with the following error message,

%ADAC-E-UNIVFIXUNIVOPND, (1) Multiplication or division for fixed-point type T
is not allowed with an operand of type {universal_real} [LRM 4.5.5(10-11)]

gcc Ada compiles the test program (in Ada 83 mode) with no errors.

I believe XD-Ada to be correct, and gcc Ada to be incorrect, for the following
reason. Ada 83 LRM 4.6 states, "An implicit conversion of a convertible
universal operand is applied if and only if the innermost complete context (see
8.7) determines a unique (numeric) target type for the implicit conversion, and
there is no legal interpretation of this context without this conversion". In
this case, there is no unique target type for the implicit conversion, since
Ada 83 allowed division between any two fixed point types.


-- 
           Summary: gcc Ada does not handle fixed point division correctly
                    in Ada 83 mode
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dewi dot daniels at silver-software dot com


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



More information about the Gcc-bugs mailing list