This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/21573] 'Valid attribute on enumeration types with holes
- From: "fw at deneb dot enyo dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2005 15:24:04 -0000
- Subject: [Bug ada/21573] 'Valid attribute on enumeration types with holes
- References: <20050514190612.21573.fw@deneb.enyo.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From fw at deneb dot enyo dot de 2005-08-12 15:23 -------
Another test case, this time without Unchecked_Conversion. See the discussion
at <http://gcc.gnu.org/ml/gcc/2005-08/msg00344.html>.
-- Another test case for PR21573. Note that if PR23354 is fixed and
-- X is initialized to a different value, this test case might no
-- longer check the same bug (but it should still print SUCCESS).
-- (The Bug3_P package is necessary to prevent compile-time
-- evaluation.)
pragma Normalize_Scalars;
with Bug3_P; use Bug3_P;
procedure Bug3 is
X : U;
-- The subtype causes X to be initialized with 0, according to the
-- current Normalize_Scalars rules.
begin
Test (X);
end Bug3;
with Ada.Text_IO; use Ada.Text_IO;
package Bug3_P is
type T is (A, B, C, D);
for T'Size use 8;
for T use (A => 2, B => 3, C => 5, D => 7);
subtype U is T range B .. D;
procedure Test (X : T);
end Bug3_P;
package body Bug3_P is
procedure Test (X : T) is
begin
-- Check with a debugger that X is zero at this point.
if X'Valid then
Put_Line ("FAIL");
else
Put_Line ("SUCCESS");
end if;
end Test;
end Bug3_P;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21573