Objects are unnecessarily initialized to valid values. The initialization algorithm is described here:
`Enumeration types' Objects of an enumeration type are initialized to all one-bits, i.e. to the value `2 ** typ'Size - 1' unless the subtype excludes the literal whose Pos value is zero, in which case a code of zero is used. This choice will always generate an invalid value if one exists. But the conclusion is wrong because it does not consider enumeration types with holes. -- Run through gnatchop. Compile with -O2. pragma Normalize_Scalars; with Ada.Text_IO; use Ada.Text_IO; procedure Bug4 is type T is (A, B); for T use (A => 1, B => 255); for T'Size use 8; X : T; begin if X'Valid then Put_Line ("FAIL"); else Put_Line ("PASS"); end if; end Bug4; -- Summary: Normalize_Scalars and enumeration types with holes Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fw at deneb dot enyo dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23354