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]

Re: [PATCH][TUPLES] Fix for a number of ICE's in g++ regression test.


On 5/9/08 4:23 PM, Doug Kwan (éæå) wrote:
 	     }
+	  /* Sometimes the C++ front-end generates a POINTER_PLUS_EXPR whose
+	     operand 0 has type not trivailly convertible to the expression
+	     type.  We need to do a conversion.  */
+	  if (!useless_type_conversion_p (TREE_TYPE (*expr_p),
+					  TREE_TYPE (TREE_OPERAND (*expr_p,
+								   0))))
+	    {
+	      tmp = fold_convert (TREE_TYPE (*expr_p),
+				  TREE_OPERAND (*expr_p, 0));
+	      *expr_p = build2 (POINTER_PLUS_EXPR, TREE_TYPE (*expr_p),
+				tmp, TREE_OPERAND (*expr_p, 1));
+	      break;
+	    }
+	

Andrew suggests changing the C++ FE here, but I actually would rather allow the FEs more latitude. The gimplifier is here to do all these conversions when needed. Andrew, was your intention to make POINTER_PLUS_EXPR stricter even for the FEs?



/* FALLTHRU */
default:
Index: gcc/gcc/gimple.h
===================================================================
--- gcc/gcc/gimple.h (revision 135125)
+++ gcc/gcc/gimple.h (working copy)
@@ -1468,8 +1468,8 @@ gimple_call_return_type (const_gimple gs
tree fn = gimple_call_fn (gs);
tree type = TREE_TYPE (fn);
- /* See through pointer to functions. */
- if (TREE_CODE (type) == POINTER_TYPE)
+ /* See through pointer or reference to functions. */
+ if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)

Use POINTER_TYPE_P here as Andrew suggested.



OK otherwise.



Diego.



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