[Ada] Fix internal error on pragma Machine_Attribute with string constant

Eric Botcazou botcazou@adacore.com
Sun Oct 26 09:24:04 GMT 2025


This was reported a long time ago and is a fairly pathological case, so the 
fix is purposely ad hoc: when the attribute name of a pragma Machine_Attribute 
is not a string literal, its processing needs to be delayed for the back-end.

Tested on x86-64/Linux, applied on the mainline.


2025-10-26  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/13370
	* sem_prag.adb (Analyze_Pragma) <Pragma_Machine_Attribute>: Set the
	Has_Delayed_Freeze flag if the argument is not a literal.


2025-10-26  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/machine_attr3.ads, gnat.dg/machine_attr3.adb: New test.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr13370.diff
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20251026/8371c23e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: machine_attr3.ads
Type: text/x-adasrc
Size: 154 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20251026/8371c23e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: machine_attr3.adb
Type: text/x-adasrc
Size: 99 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20251026/8371c23e/attachment-0002.bin>


More information about the Gcc-patches mailing list