[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 23:09:51 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123857
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:1fdbcef462b5ffde1d03eda79c2db41829b84a46
commit r15-10746-g1fdbcef462b5ffde1d03eda79c2db41829b84a46
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