This is the mail archive of the
mailing list for the GCC project.
[PATCH] Unbreak ia64 bootstrap (PR debug/45006)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Jul 2010 18:36:14 +0200
- Subject: [PATCH] Unbreak ia64 bootstrap (PR debug/45006)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
My PR45003 fix apparently broke IA-64 bootstrap, because there
FUNCTION_DECLs have DECL_MODE DImode, while TYPE_MODE of FUNCTION_TYPE
is TImode. Guess that's related to fn descriptors.
The following patch is an attempt to fix that. For FUNCTION_DECLs,
I don't see how SIGN_EXTEND/ZERO_EXTEND on the MEM would be ever useful,
FUNCTION_DECLs ought to appear in DEBUG stmts only inside of ADDR_EXPR
where the MEM is not used anyway and we just use the address.
The adjust_mode path isn't hit just for unary expressions
(PAREN_EXPR/NOP_EXPR/CONVERT_EXPR), but also for decls and SSA_NAMEs.
The latter ones of course don't have TREE_OPERAND (exp, 0), while usually
the modes ought to match, it is IMHO better to try to be cautious.
Either of the hunks should fix the ICE, though without the first hunk
we just won't be able to emit useful debug info (as ADDR_EXPR <FUNCTION_DECL>
will return NULL on ia64 then), and without the second hunk we risk we hit
similar ICE later on.
Ok for trunk?
2010-07-20 Jakub Jelinek <email@example.com>
* cfgexpand.c (expand_debug_expr): Don't go through adjust_mode
path for FUNCTION_DECLs. Only look at TYPE_UNSIGNED of
operand's type if exp is tcc_unary class tree.
--- gcc/cfgexpand.c.jj 2010-07-20 12:12:14.000000000 +0200
+++ gcc/cfgexpand.c 2010-07-20 18:06:13.000000000 +0200
@@ -2369,7 +2369,10 @@ expand_debug_expr (tree exp)
below would ICE. While it is likely a FE bug,
try to be robust here. See PR43166. */
|| mode == BLKmode
- || (mode == VOIDmode && GET_MODE (op0) != VOIDmode))
+ || (mode == VOIDmode && GET_MODE (op0) != VOIDmode)
+ /* On some targets DECL_MODE of a FUNCTION_DECL is
+ different from TYPE_MODE of its type. */
+ || (TREE_CODE (exp) == FUNCTION_DECL && MEM_P (op0)))
gcc_assert (MEM_P (op0));
op0 = adjust_address_nv (op0, mode, 0);
@@ -2427,7 +2430,9 @@ expand_debug_expr (tree exp)
op0 = simplify_gen_subreg (mode, op0, inner_mode,
- else if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))))
+ else if (TREE_CODE_CLASS (TREE_CODE (exp)) == tcc_unary
+ ? TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))
+ : unsignedp)
op0 = gen_rtx_ZERO_EXTEND (mode, op0);
op0 = gen_rtx_SIGN_EXTEND (mode, op0);