summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc
diff options
context:
space:
mode:
authorHiroaki Etoh <etoh@cvs.openbsd.org>2004-02-17 04:47:24 +0000
committerHiroaki Etoh <etoh@cvs.openbsd.org>2004-02-17 04:47:24 +0000
commitf9c504d61561e15c24e88dbd2f69c31838522dd6 (patch)
tree174d3984e54d90c1f77270bdcc33d24572d4c0ba /gnu/usr.bin/gcc
parentb68839e733d0a06288e8e91ef7819e2dfe3c04ea (diff)
qmake on sparc64 uses a character array with the size of 1 and pp moves its location in the stack. then, pp breaks the memory alignment of every local variables.
This fixes the problem not to change the location when the array is not aligned based on word boundary. This also changes SUSPICIOUS_BUF_SIZE from zero to eight. This is the original pp protection. ok espie@, sturm@, drahn@, brad@
Diffstat (limited to 'gnu/usr.bin/gcc')
-rw-r--r--gnu/usr.bin/gcc/gcc/protector.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gnu/usr.bin/gcc/gcc/protector.c b/gnu/usr.bin/gcc/gcc/protector.c
index c161eb89e60..5e7cdbcffb4 100644
--- a/gnu/usr.bin/gcc/gcc/protector.c
+++ b/gnu/usr.bin/gcc/gcc/protector.c
@@ -117,7 +117,7 @@ static void change_arg_use_in_operand
static void validate_insns_of_varrefs PARAMS ((rtx insn));
static void validate_operand_of_varrefs PARAMS ((rtx insn, rtx *loc));
-#define SUSPICIOUS_BUF_SIZE 0
+#define SUSPICIOUS_BUF_SIZE 8
#define AUTO_BASEPTR(X) \
(GET_CODE (X) == PLUS ? XEXP (X, 0) : X)
@@ -948,6 +948,7 @@ arrange_var_order (block)
&& ! DECL_INLINE (types) /* don't sweep inlined string */
&& DECL_RTL_SET_P (types)
&& GET_CODE (DECL_RTL (types)) == MEM
+ && GET_MODE (DECL_RTL (types)) == BLKmode
&& (is_array=0, search_string_def (TREE_TYPE (types))
|| (! current_function_defines_vulnerable_string
@@ -972,11 +973,9 @@ arrange_var_order (block)
((TREE_INT_CST_LOW (DECL_SIZE (types)) + BITS_PER_UNIT - 1)
/ BITS_PER_UNIT);
- if (GET_MODE (DECL_RTL (types)) == BLKmode)
- {
- int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
- var_size = CEIL_ROUND (var_size, alignment);
- }
+ /* confirmed it is BLKmode. */
+ int alignment = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
+ var_size = CEIL_ROUND (var_size, alignment);
/* skip the variable if it is top of the region
specified by sweep_frame_offset */