public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6399] [Ada] Make pragma Inspection_Point work for constants
@ 2022-01-10 9:41 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-10 9:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0c6fbbfc83a8faefb74232cbb29fa1f79348b3e5
commit r12-6399-g0c6fbbfc83a8faefb74232cbb29fa1f79348b3e5
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Sat Dec 18 22:36:40 2021 +0100
[Ada] Make pragma Inspection_Point work for constants
gcc/ada/
* gcc-interface/trans.c (lvalue_required_p) <N_Pragma>: New case.
<N_Pragma_Argument_Association>: Likewise.
(Pragma_to_gnu) <Pragma_Inspection_Point>: Fetch the corresponding
variable of a constant before marking it as addressable.
Diff:
---
gcc/ada/gcc-interface/trans.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index f767cc6bc3b..47fbbc9672e 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -865,6 +865,20 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
|| must_pass_by_ref (gnu_type)
|| default_pass_by_ref (gnu_type));
+ case N_Pragma_Argument_Association:
+ return lvalue_required_p (gnat_parent, gnu_type, constant,
+ address_of_constant);
+
+ case N_Pragma:
+ if (Is_Pragma_Name (Chars (Pragma_Identifier (gnat_parent))))
+ {
+ const unsigned char id
+ = Get_Pragma_Id (Chars (Pragma_Identifier (gnat_parent)));
+ return id == Pragma_Inspection_Point;
+ }
+ else
+ return 0;
+
case N_Indexed_Component:
/* Only the array expression can require an lvalue. */
if (Prefix (gnat_parent) != gnat_node)
@@ -1387,6 +1401,9 @@ Pragma_to_gnu (Node_Id gnat_node)
char *comment;
#endif
gnu_expr = maybe_unconstrained_array (gnu_expr);
+ if (TREE_CODE (gnu_expr) == CONST_DECL
+ && DECL_CONST_CORRESPONDING_VAR (gnu_expr))
+ gnu_expr = DECL_CONST_CORRESPONDING_VAR (gnu_expr);
gnat_mark_addressable (gnu_expr);
#ifdef ASM_COMMENT_START
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-10 9:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 9:41 [gcc r12-6399] [Ada] Make pragma Inspection_Point work for constants Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).