This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/47727] [x32] Many passes can't handle const symbol when Pmode != ptr_mode
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 14 Feb 2011 17:25:15 +0000
- Subject: [Bug middle-end/47727] [x32] Many passes can't handle const symbol when Pmode != ptr_mode
- Auto-submitted: auto-generated
- References: <bug-47727-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47727
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2011-02-14 17:24:56 UTC ---
The problem may be in convert_memory_address_addr_space:
case PLUS:
case MULT:
/* For addition we can safely permute the conversion and addition
operation if one operand is a constant and converting the constant
does not change it or if one operand is a constant and we are
using a ptr_extend instruction (POINTERS_EXTEND_UNSIGNED < 0).
We can always safely permute them if we are making the address
narrower. */
if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode)
|| (GET_CODE (x) == PLUS
&& CONST_INT_P (XEXP (x, 1))
&& (XEXP (x, 1) == convert_memory_address_addr_space
(to_mode, XEXP (x, 1), as)
|| POINTERS_EXTEND_UNSIGNED < 0)))
return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
convert_memory_address_addr_space
(to_mode, XEXP (x, 0), as),
XEXP (x, 1));
It will generate new instructions for
(plus:SI (symbol_ref:SI ("__CTOR_END__") [flags 0x2] <var_decl 0x7ffff0cf0000
__CTOR_END__>)
(const_int -4 [0xfffffffffffffffc]))
since
(const_int -4 [0xfffffffffffffffc])
is converted to
(const_int 4294967292 [0xfffffffc])