Hello! We allow addresses, zero extended with (AND (Dimode OP) (0x0ffffffff)). Since we now track address mode precisely, we should convert this operand to a SImode subreg before passing it further down of ix86_decompose_address function. This fixes a small hole, where operands in wrong mode could squeeze through.
2012-03-13 Uros Bizjak <ubiz...@gmail.com> * config/i386/i386.c (ix86_decompose_address): Handle subregs of AND zero extended address correctly. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros.
Index: i386.c =================================================================== --- i386.c (revision 185327) +++ i386.c (working copy) @@ -11435,10 +11435,14 @@ ix86_decompose_address (rtx addr, struct ix86_addr { addr = XEXP (addr, 0); - /* Strip subreg. */ - if (GET_CODE (addr) == SUBREG - && GET_MODE (SUBREG_REG (addr)) == SImode) + /* Adjust SUBREGs. */ + if (GET_MODE (addr) == DImode) + addr = gen_rtx_SUBREG (SImode, addr, 0); + else if (GET_CODE (addr) == SUBREG + && GET_MODE (SUBREG_REG (addr)) == SImode) addr = SUBREG_REG (addr); + else + return 0; } }