Index: gcc/config/i386/i386.c |
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c |
index fc37c410a8fd8cee7b710ebb09865d9bd6d46ee8..929b2c650c5133c9bb063fb4159f24ae67f3aac1 100644 |
--- a/gcc/config/i386/i386.c |
+++ b/gcc/config/i386/i386.c |
@@ -9377,6 +9377,23 @@ ix86_decompose_address (rtx addr, struct ix86_address *out) |
return 0; |
} |
} |
+ /* Disallow direct accees to addresses between 2GB and 4GB. |
eaeltsin
2012/05/16 13:08:37
/accees/access/
khim
2012/05/16 13:36:12
Done.
|
+ |
+ Example problem code: |
+ int f() |
+ { |
+ unsigned int x = 0xf2a3e218; |
+ return ((int*)x)[0]; |
+ } |
+ |
+ Incorrect assembly generated with -O2: |
+ popq %r11 |
+ movl -224140776(%r15), %eax |
eaeltsin
2012/05/16 13:08:37
I think you can keep only this assembly line in th
khim
2012/05/16 13:36:12
Done.
|
+ nacljmp %r11d,%r15 */ |
eaeltsin
2012/05/16 13:08:37
Please add correct assembly for the example :)
khim
2012/05/16 13:36:12
Done.
|
+ if (TARGET_64BIT && TARGET_NACL |
+ && !index_reg && base_reg && REGNO (base_reg) == R15_REG |
+ && GET_CODE (disp) == CONST_INT && INTVAL (disp) < 0) |
+ return 0; |
/* Allow arg pointer and stack pointer as index if there is not scaling. */ |
if (base_reg && index_reg && scale == 1 |