[Bug ada/123857] crash on Unchecked_Union parameter with -gnateV -gnata
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 28 22:56:54 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123857
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:a697610ed40e0389cedb4984ad69f391703b0566
commit r16-7127-ga697610ed40e0389cedb4984ad69f391703b0566
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Wed Jan 28 23:52:41 2026 +0100
Ada: Fix crash on Unchecked_Union parameter with -gnateV -gnata
The problem is that the compiler generates 'Valid_Scalars for a formal
parameter of an Unchecked_Union type, which cannot work because it is not
possible to find out where the scalars are in it, given that the parameter
does not contain the discriminants of its Unchecked_Union type. This also
changes -gnateV to work without the need for -gnata, as there is no mention
of this dependence in the documentation.
gcc/ada/
PR ada/123857
* checks.adb (Apply_Parameter_Validity_Checks.Add_Validity_Check):
Set Is_Checked on the generated {Pre,Post}_Condition pragma and
bail out if the parameter is of an Unchecked_Union type.
gcc/testsuite/
* gnat.dg/unchecked_union4.adb: New test.
More information about the Gcc-bugs
mailing list