This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22589] [3.4 regression] ICE casting to long long
- From: "rsandifo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jul 2005 17:31:44 -0000
- Subject: [Bug c/22589] [3.4 regression] ICE casting to long long
- References: <20050721134542.22589.lex.augusteijn@philips.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rsandifo at gcc dot gnu dot org 2005-07-27 17:31 -------
This seems to be caused by:
2004-02-15 Roger Sayle <roger@eyesopen.com>
Backport from mainline:
2004-02-07 Roger Sayle <roger@eyesopen.com>
PR middle-end/13696
* fold-const.c (fold_convert): New function to provide type
conversion to the middle-end without using convert.
(negate_expr, associate_trees, size_diffop, omit_one_operand,
operand_equal_for_comparison_p, pedantic_omit_one_operand,
invert_truthvalue, optimize_bit_field_compare, range_binop,
decode_field_reference, make_range, build_range_check, unextend,
fold_truthop, extract_muldiv_1, fold_mathfn_compare,
fold_binary_op_with_conditional_arg, fold_inf_compare,
fold_single_bit_test, fold, multiple_of_p): Replace all calls to
convert with calls to fold_convert.
convert() uses CONVERT_EXPR rather than NOP_EXPR for pointer-to-integer
conversions, but after the patch above, the original <CONVERT_EXPR int foo>
will be "folded" to <NOP_EXPR int foo>.
On 3.4, get_narrower(<NOP_EXPR int foo>) returns "foo", which has
a pointer type, and causes the segfault in shorten_compare().
This was fixed (worked around?) on mainline by:
2004-07-08 Alexandre Oliva <aoliva@redhat.com>
Introduce H8SX support.
....
2004-06-16 Alexandre Oliva <aoliva@redhat.com>
* tree.c (get_narrower): Don't narrow integral types into
non-integral types.
and backporting that patch seems to fix the testcase.
I'm not a tree expert, and I can't find any discussion of Alex's patch:
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01644.html
so I'm not sure if CONVERT_EXPR really is required here. But given
that this bug is specific to a release branch, and that the branch
is deep into "maintenance only" mode, I think that backporting
Alex's patch is the best fix here. I'm regression testing it now.
Richard
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rsandifo at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-07-21 16:36:13 |2005-07-27 17:31:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22589