This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Unbreak ia64 bootstrap (PR debug/45006)


Hi!

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  <jakub@redhat.com>

	PR debug/45006
	* 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,
 				     subreg_lowpart_offset (mode,
 							    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);
 	else
 	  op0 = gen_rtx_SIGN_EXTEND (mode, op0);

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]