[Bug ada/123832] stack corruption with concatenation and 'Image of composite type
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 28 22:56:44 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123832
--- Comment #5 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:ea0f31d040c10e4f9b42f1cf818970bcaf5277a8
commit r16-7126-gea0f31d040c10e4f9b42f1cf818970bcaf5277a8
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Wed Jan 28 23:31:49 2026 +0100
Ada: Fix stack corruption with concatenation and 'Image of composite type
The issue is that the expansion of 'Image for composite types is
heavyweight
and involves a mix of Expression_With_Actions and controlled object that
does not work properly when it is the argument of a call to a subprogram,
so this replaces it by the canonical scheme used for controlled
temporaries.
gcc/ada/
PR ada/123832
* exp_imgv.adb: Add with and use clauses for Exp_Ch7.
(Expand_Image_Attribute): Establish a transient scope before
rewriting the attribute as a call to Put_Image.
(Expand_Wide_Image_Attribute): Likewise.
(Expand_Wide_Wide_Image_Attribute): Likewise.
* exp_put_image.ads (Build_Image_Call): Add note about the
need for a transient scope when the function is invoked.
* exp_put_image.adb (Build_Image_Call): Call Insert_Actions
to immediately insert the actions instead of wrapping them
in an Expression_With_Actions node.
gcc/testsuite/
* gnat.dg/put_image2.adb: New test.
More information about the Gcc-bugs
mailing list