This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21135] [4.0/4.1 Regression] &a[-2] ICE at the top level
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2005 03:48:05 -0000
- Subject: [Bug c++/21135] [4.0/4.1 Regression] &a[-2] ICE at the top level
- References: <20050420232738.21135.mrs@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-26 03:48 -------
Here is an interesting thing:
if we do:
int f[3];
int *h(void)
{
return &f[-1];
}
---
The C front-end expands it like:
(insn 10 9 11 (set (reg:SI 60)
(const_int -4 [0xfffffffc])) -1 (nil)
(nil))
(insn 11 10 12 (parallel [
(set (reg:SI 59)
(plus:SI (reg:SI 60)
(symbol_ref:SI ("f") <var_decl 0xb7c630b0 f>)))
(clobber (reg:CC 17 flags))
]) -1 (nil)
(nil))
(insn 12 11 13 (set (reg:SI 58 [ <result> ])
(reg:SI 59)) -1 (nil)
(nil))
But the C++ front-end does:
(insn 10 9 11 (set (reg:SI 60)
(symbol_ref:SI ("f") [flags 0x2] <var_decl 0xb7cbb1b8 f>)) -1 (nil)
(nil))
(insn 11 10 12 (parallel [
(set (reg:SI 59)
(plus:SI (reg:SI 60)
(const_int -4 [0xfffffffc])))
(clobber (reg:CC 17 flags))
]) -1 (nil)
(nil))
(insn 12 11 13 (set (reg:SI 58 [ <result> ])
(reg:SI 59)) -1 (nil)
(nil))
Notice how the the order of the plus happens.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21135