aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-08-02 13:19:38 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1997-08-02 13:19:38 -0400
commit17f5f329caf90ce8f545c1790218606b37282f85 (patch)
tree01023786dd035098ce448a7de3e3df0e114a48cd
parent8960ab1a988069cd69a711111177b4c44bfb8512 (diff)
(expand_computed_goto): If -fcheck-memory-usage, check that computed address of a goto is executable.
(expand_computed_goto): If -fcheck-memory-usage, check that computed address of a goto is executable. (expand_asm, expand_asm_operands): If -fcheck-memory-usage, disallow asm statments. From-SVN: r14616
-rw-r--r--gcc/stmt.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 0dcb4cba8cb..dcc5fa331fe 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -627,6 +627,11 @@ expand_computed_goto (exp)
#endif
emit_queue ();
+ /* Be sure the function is executable. */
+ if (flag_check_memory_usage)
+ emit_library_call (chkr_check_exec_libfunc, 1,
+ VOIDmode, 1, x, ptr_mode);
+
do_pending_stack_adjust ();
emit_indirect_jump (x);
}
@@ -1352,6 +1357,12 @@ expand_asm (body)
return;
}
+ if (flag_check_memory_usage)
+ {
+ error ("`asm' cannot be used with `-fcheck-memory-usage'");
+ return;
+ }
+
if (TREE_CODE (body) == ADDR_EXPR)
body = TREE_OPERAND (body, 0);
@@ -1404,6 +1415,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
return;
}
+ if (flag_check_memory_usage)
+ {
+ error ("`asm' cannot be used with `-fcheck-memory-usage'");
+ return;
+ }
+
/* Count the number of meaningful clobbered registers, ignoring what
we would ignore later. */
nclobbers = 0;
@@ -1502,7 +1519,8 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
mark_addressable (TREE_VALUE (tail));
output_rtx[i]
- = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode, 0);
+ = expand_expr (TREE_VALUE (tail), NULL_RTX, VOIDmode,
+ EXPAND_MEMORY_USE_WO);
if (! allows_reg && GET_CODE (output_rtx[i]) != MEM)
error ("output number %d not directly addressable", i);