This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ada: Give better oversize warnings
Sorry, I sent a wrong example.
Here is another one which generates spurious messages:
with A;
package B is
C_Max_Integer : constant Integer := A.The_Size;
subtype T_Nb_Integer is Integer range 0 .. C_Max_Integer;
type T_Tab_Integer is array (T_Nb_Integer range <>) of Integer;
C_Tab_Integer : constant T_Tab_Integer (1 .. C_Max_Integer) :=
(others => 1);
type T_Info_Integer
(Nb : T_Nb_Integer := C_Max_Integer) is
record
Tab : T_Tab_Integer (1 .. Nb);
end record;
C_Info_Integer : constant T_Info_Integer := (Nb => C_Max_Integer, Tab => C_Tab_Integer);
end B;
package A is
function The_Size return Integer;
end B;
package body B is
function The_Size return Integer is
begin
return 1500;
end The_Size;
end B;
--
I haven't checked also the following case:
<<
procedure A is
subtype Index is Natural range 1..10;
subtype Length is Natural range 0..10;
type A is array(Index range <>) of Integer;
type Mutable(Size: Natural := 1) is
record
Comp: A(1..Size);
end record;
begin
null;
end A;
>>