This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/25245] Discriminant is left uninitialized.
- From: "listor1 dot rombobeorn at comhem dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Dec 2005 22:35:05 -0000
- Subject: [Bug ada/25245] Discriminant is left uninitialized.
- References: <bug-25245-5982@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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