This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ICE in add_const_value_attribute (PR bootstrap/41457)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jan Hubicka <jh at suse dot cz>
- Date: Thu, 24 Sep 2009 12:07:41 +0200
- Subject: [PATCH] Fix ICE in add_const_value_attribute (PR bootstrap/41457)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
CONST_FIXED and HIGH are valid CONSTANT_P's, so add_const_value_attribute
should handle them, even just to ignore them. This fixes the testcase from
powerpc-darwin bootstrap in the PR.
Another issue is that now that add_const_value_attribute returns a boolean
whether it actually added some attribute or not, calling it and returning
true anyway looks wrong, it means we might return true even when it actually
didn't add anything.
Fixed thusly, ok for trunk?
2009-09-24 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/41457
* dwarf2out.c (add_const_value_attribute): For HIGH and CONST_FIXED,
return false instead of gcc_unreachable (). For CONST return the
value returned by recursive call instead of always returning true.
(tree_add_const_value_attribute): Return the value returned by
add_const_value_attribute instead of always returning true if rtl
is non-NULL.
--- gcc/dwarf2out.c.jj 2009-09-24 11:32:36.000000000 +0200
+++ gcc/dwarf2out.c 2009-09-24 11:59:07.000000000 +0200
@@ -13445,10 +13445,7 @@ add_const_value_attribute (dw_die_ref di
case CONST:
if (CONSTANT_P (XEXP (rtl, 0)))
- {
- add_const_value_attribute (die, XEXP (rtl, 0));
- return true;
- }
+ return add_const_value_attribute (die, XEXP (rtl, 0));
/* FALLTHROUGH */
case SYMBOL_REF:
if (GET_CODE (rtl) == SYMBOL_REF
@@ -13473,6 +13470,10 @@ add_const_value_attribute (dw_die_ref di
values in Dwarf, so for now we just punt and generate nothing. */
return false;
+ case HIGH:
+ case CONST_FIXED:
+ return false;
+
default:
/* No other kinds of rtx should be possible here. */
gcc_unreachable ();
@@ -14098,10 +14099,7 @@ tree_add_const_value_attribute (dw_die_r
rtl = rtl_for_decl_init (init, type);
if (rtl)
- {
- add_const_value_attribute (die, rtl);
- return true;
- }
+ return add_const_value_attribute (die, rtl);
/* If the host and target are sane, try harder. */
else if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
&& initializer_constant_valid_p (init, type))
Jakub