RecordFlux
RecordFlux copied to clipboard
Missing integer type conversions for assignments
For certain assignments, the generated code will not compile due to a missing integer type conversion.
Assignment to message field
package Test is
type A is mod 2 ** 32;
type M is
message
F : A;
end message;
type B is mod 2 ** 32;
generic
session S with
Initial => I,
Final => F
is
M : Test::M;
begin
state I
is
X : B;
begin
X := M.F; -- missing type conversion in generated code
transition
goto F
exception
goto F
end I;
state F is null state;
end S;
end Test;
rflx-test-s.adb:21:21: error: expected type "B" defined at rflx-test.ads:32
rflx-test-s.adb:21:21: error: found type "A" defined at rflx-test.ads:8
Assignment to function call (#1055)
X := F
, if the function F
returns a different integer type than the type of X
.
Assignment to multiplication with 'Size
(#1110)
package Test is
type U8 is range 0 .. 2 ** 8 - 1 with
Size => 8;
type Length is range 0 .. 2 ** 16 - 1 with Size => 16;
type Entr is
message
A : U8;
end message;
generic
Transport : Channel with Readable, Writable;
session Session with
Initial => Init,
Final => End_Session
is
Source : Entr;
begin
state Init
is
begin
Source'Reset;
transition
goto Recv
end Init;
state Recv
is
begin
Transport'Read (Source);
transition
goto Handle
end Recv;
state Handle
is
Len : Length;
begin
Source.A := Source'Size * 8; -- Works
Source.A := Source'Size / 8; -- Works
Len := Source'Size / 8; -- Works
Len := Source'Size * 8; -- Breaks
transition
goto End_Session
exception
goto End_Session
end Handle;
state End_Session is null state;
end Session;
end Test;
Compile
[Ada] rflx-rflx_builtin_types.ads
[Ada] rflx-rflx_types.ads
[Ada] rflx-rflx_builtin_types-conversions.ads
[Ada] rflx-test.ads
[Ada] rflx-test-session_allocator.adb
[Ada] rflx.ads
[Ada] rflx-rflx_arithmetic.adb
[Ada] rflx-rflx_generic_types.adb
[Ada] rflx-test-session.adb
rflx-test-session.adb:107:48: error: expected type "Length" defined at rflx-test.ads:35
rflx-test-session.adb:107:48: error: found type "Bit_Length" defined at rflx-rflx_builtin_types.ads:25
gprbuild: *** compilation phase failed