[Bug ada/25245] Discriminant is left uninitialized.

listor1 dot rombobeorn at comhem dot se gcc-bugzilla@gcc.gnu.org
Fri Dec 9 22:35:00 GMT 2005



------- Comment #7 from listor1 dot rombobeorn at comhem dot se  2005-12-09 22:35 -------
Subject: Re:  Discriminant is left uninitialized.

> But the constraint_error for "OS of A1b" looks correct, and if commented
> the one on "OS of A2b", it is a language mandated discriminant check
> failing. But may be I'm missing something, could you explain why you think
> an exception shouldn't be raised?

The discriminant check fails because OS doesn't contain any of the valid 
values 0, 1 or 2 (for NT, OS2 and Linux). If there is random data in the 
memory I expect a 3/256 chance that it will get a valid value.

The OS field shouldn't be random. It's fixed to Linux in the definition of 
Character_Encoding_A:

   This_OS : constant Known_OS := Linux;
   type Character_Encoding_A (Known : Boolean := False) is
     new Unified_Encoding_Record (Known => Known, OS => This_OS);

All objects of this type should therefore have OS=Linux, so the discriminant 
would be valid and would pass the check.


-- 


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



More information about the Gcc-bugs mailing list