$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/explow.c.patch,v 1.2 2004/06/20 00:10:52 joerg Exp $ diff -u ../gcc.orig/explow.c explow.c --- ../gcc.orig/explow.c 2004-06-19 22:27:11.000000000 +0200 +++ explow.c 2004-06-20 01:16:04.000000000 +0200 @@ -84,7 +84,8 @@ rtx tem; int all_constant = 0; - if (c == 0) + if (c == 0 + && ! (flag_propolice_protection && x == virtual_stack_vars_rtx)) return x; restart: @@ -185,7 +186,8 @@ break; } - if (c != 0) + if (c != 0 + || (flag_propolice_protection && x == virtual_stack_vars_rtx)) x = gen_rtx_PLUS (mode, x, GEN_INT (c)); if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF) @@ -474,6 +476,26 @@ if (memory_address_p (mode, oldx)) goto win2; + /* The stack protector keeps the addressing style of a local variable. + LEGITIMIZE_ADDRESS changes the addressing to the machine-dependent + style, so the protector split the frame address to a register using + force_reg. */ + if (flag_propolice_protection) + { +#define FRAMEADDR_P(X) (GET_CODE (X) == PLUS \ + && XEXP (X, 0) == virtual_stack_vars_rtx \ + && GET_CODE (XEXP (X, 1)) == CONST_INT) + rtx y; + if (FRAMEADDR_P (x)) + goto win; + for (y = x; y != 0 && GET_CODE (y) == PLUS; y = XEXP (y, 0)) + { + if (FRAMEADDR_P (XEXP (y, 0))) + XEXP (y, 0) = force_reg (GET_MODE (XEXP (y, 0)), XEXP (y, 0)); + if (FRAMEADDR_P (XEXP (y, 1))) + XEXP (y, 1) = force_reg (GET_MODE (XEXP (y, 1)), XEXP (y, 1)); + } + } /* Perform machine-dependent transformations on X in certain cases. This is not necessary since the code below can handle all possible cases, but machine-dependent