This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[comitted] Fix crash while folding (void *)(int)&a + 4
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 7 May 2007 12:37:43 +0200
- Subject: [comitted] Fix crash while folding (void *)(int)&a + 4
Hi,
while writting the gimplifier for (void *)&a + 4 I forgot to consider
that the inner expression might not be of pointer type. This causes
crash in CSiBE benchmark.
Bootstrapped/regtested i686-linux and comitted as obvious.
Honza
Index: ChangeLog
===================================================================
*** ChangeLog (revision 124496)
--- ChangeLog (working copy)
***************
*** 1,3 ****
--- 1,8 ----
+ 2007-05-07 Jan Hubicka <jh@suse.cz>
+
+ * gimplify.c (gimplify_expr): Do not crash when folding
+ (void *)(int)&a + 4.
+
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR driver/31694
Index: gimplify.c
===================================================================
*** gimplify.c (revision 124471)
--- gimplify.c (working copy)
*************** gimplify_expr (tree *expr_p, tree *pre_p
*** 5887,5892 ****
--- 5887,5894 ----
if (POINTER_TYPE_P (TREE_TYPE (*expr_p))
&& TREE_CODE (TREE_OPERAND (*expr_p, 0)) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p,
+ 0),0)))
&& (tmp = maybe_fold_offset_to_reference
(TREE_OPERAND (TREE_OPERAND (*expr_p, 0), 0),
TREE_OPERAND (*expr_p, 1),