summaryrefslogtreecommitdiff
path: root/gcc/ada/decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2006-09-29 06:52:04 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2006-09-29 06:52:04 +0000
commitb55e7f34bc21a482d35dc2a9eaf38a878e0afbe4 (patch)
treed53b9b08a5977db3599ce6576e9b27bd13562c90 /gcc/ada/decl.c
parent4f6c213142e5ce6f5ee17ef5d0f1cb85cd0ff573 (diff)
downloadgcc-b55e7f34bc21a482d35dc2a9eaf38a878e0afbe4.tar.gz
decl.c (gnat_to_gnu_entity): Do not set "const" flag on "pure" Ada subprograms if SJLJ exceptions are used.
* decl.c (gnat_to_gnu_entity) <E_Procedure>: Do not set "const" flag on "pure" Ada subprograms if SJLJ exceptions are used. * trans.c (Handled_Sequence_Of_Statements_to_gnu): Set TREE_NO_WARNING on the declaration node of JMPBUF_SAVE. * utils.c (init_gigi_decls): Set DECL_IS_PURE on the declaration nodes of Get_Jmpbuf_Address_Soft and Get_GNAT_Exception. * utils2.c (build_call_0_expr): Do not set TREE_SIDE_EFFECTS. From-SVN: r117299
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r--gcc/ada/decl.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index c49e834bf49..fac6f2f06e3 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -3768,11 +3768,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (TREE_CODE (gnu_return_type) == VOID_TYPE)
pure_flag = false;
+ /* The semantics of "pure" in Ada essentially matches that of "const"
+ in the back-end. In particular, both properties are orthogonal to
+ the "nothrow" property. But this is true only if the EH circuitry
+ is explicit in the internal representation of the back-end. If we
+ are to completely hide the EH circuitry from it, we need to declare
+ that calls to pure Ada subprograms that can throw have side effects
+ since they can trigger an "abnormal" transfer of control flow; thus
+ they can be neither "const" nor "pure" in the back-end sense. */
gnu_type
= build_qualified_type (gnu_type,
- (TYPE_QUALS (gnu_type)
- | (TYPE_QUAL_CONST * pure_flag)
- | (TYPE_QUAL_VOLATILE * volatile_flag)));
+ TYPE_QUALS (gnu_type)
+ | (Exception_Mechanism == Back_End_Exceptions
+ ? TYPE_QUAL_CONST * pure_flag : 0)
+ | (TYPE_QUAL_VOLATILE * volatile_flag));
Sloc_to_locus (Sloc (gnat_entity), &input_location);
@@ -3841,6 +3850,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
inline_flag, public_flag,
extern_flag, attr_list,
gnat_entity);
+
DECL_STUBBED_P (gnu_decl)
= Convention (gnat_entity) == Convention_Stubbed;
}