This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/21985] [4.0/4.1 Regression] miscompiled or wrong code snippet?
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jun 2005 23:45:46 -0000
- Subject: [Bug middle-end/21985] [4.0/4.1 Regression] miscompiled or wrong code snippet?
- References: <20050609161354.21985.marcus@jet.franken.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From steven at gcc dot gnu dot org 2005-06-10 23:45 -------
This is broken:
*************** fold (tree expr)
*** 7074,7084 ****
{
HOST_WIDE_INT diff;
! if (TREE_CODE (arg0) == ADDR_EXPR
! && TREE_CODE (arg1) == ADDR_EXPR
! && ptr_difference_const (TREE_OPERAND (arg0, 0),
! TREE_OPERAND (arg1, 0),
! &diff))
return build_int_cst_type (type, diff);
}
--- 7074,7082 ----
{
HOST_WIDE_INT diff;
! if ((TREE_CODE (arg0) == ADDR_EXPR
! || TREE_CODE (arg1) == ADDR_EXPR)
! && ptr_difference_const (arg0, arg1, &diff))
return build_int_cst_type (type, diff);
}
ptr_difference_const returns true for:
#1 0x00000000006d5593 in fold_binary (code=MINUS_EXPR, type=0x2a95896c30,
op0=0x2a95a3d240,
op1=0x2a95a3d200) at fold-const.c:7958
7958 if ((TREE_CODE (arg0) == ADDR_EXPR
(gdb) p ptr_difference_const (arg0, arg1, &diff)
$3 = 1 '\001'
(gdb) p debug_generic_expr(op1)
(long intD.2) bD.1572
$4 = void
(gdb) p debug_generic_expr(op1)
(long intD.2) bD.1572
$5 = void
(gdb)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21985