Commit 6aa12f4f by Richard Guenther Committed by Richard Biener

re PR middle-end/33666 (Type verification failure with pointer to long long conversion)

2007-10-05  Richard Guenther  <rguenther@suse.de>

	PR middle-end/33666
	* fold-const.c (fold_unary): Do not fold (long long)(int)ptr
	to (long long)ptr.

	* gcc.dg/pr33666.c: New testcase.

From-SVN: r129036
parent 1596d61e
2007-10-05 Richard Guenther <rguenther@suse.de>
PR middle-end/33666
* fold-const.c (fold_unary): Do not fold (long long)(int)ptr
to (long long)ptr.
2007-10-05 Michael Matz <matz@suse.de> 2007-10-05 Michael Matz <matz@suse.de>
PR inline-asm/33600 PR inline-asm/33600
...@@ -8128,7 +8128,7 @@ fold_unary (enum tree_code code, tree type, tree op0) ...@@ -8128,7 +8128,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
(for integers). Avoid this if the final type is a pointer (for integers). Avoid this if the final type is a pointer
since then we sometimes need the inner conversion. Likewise if since then we sometimes need the inner conversion. Likewise if
the outer has a precision not equal to the size of its mode. */ the outer has a precision not equal to the size of its mode. */
if ((((inter_int || inter_ptr) && (inside_int || inside_ptr)) if (((inter_int && inside_int)
|| (inter_float && inside_float) || (inter_float && inside_float)
|| (inter_vec && inside_vec)) || (inter_vec && inside_vec))
&& inter_prec >= inside_prec && inter_prec >= inside_prec
...@@ -8158,7 +8158,6 @@ fold_unary (enum tree_code code, tree type, tree op0) ...@@ -8158,7 +8158,6 @@ fold_unary (enum tree_code code, tree type, tree op0)
intermediate and final types differ, or intermediate and final types differ, or
- the final type is a pointer type and the precisions of the - the final type is a pointer type and the precisions of the
initial and intermediate types differ. initial and intermediate types differ.
- the final type is a pointer type and the initial type not
- the initial type is a pointer to an array and the final type - the initial type is a pointer to an array and the final type
not. */ not. */
if (! inside_float && ! inter_float && ! final_float if (! inside_float && ! inter_float && ! final_float
...@@ -8173,8 +8172,7 @@ fold_unary (enum tree_code code, tree type, tree op0) ...@@ -8173,8 +8172,7 @@ fold_unary (enum tree_code code, tree type, tree op0)
&& ! (final_ptr && inside_prec != inter_prec) && ! (final_ptr && inside_prec != inter_prec)
&& ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (type)) && ! (final_prec != GET_MODE_BITSIZE (TYPE_MODE (type))
&& TYPE_MODE (type) == TYPE_MODE (inter_type)) && TYPE_MODE (type) == TYPE_MODE (inter_type))
&& final_ptr == inside_ptr && ! (inside_ptr && final_ptr
&& ! (inside_ptr
&& TREE_CODE (TREE_TYPE (inside_type)) == ARRAY_TYPE && TREE_CODE (TREE_TYPE (inside_type)) == ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE)) && TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE))
return fold_build1 (code, type, TREE_OPERAND (op0, 0)); return fold_build1 (code, type, TREE_OPERAND (op0, 0));
......
2007-10-05 Richard Guenther <rguenther@suse.de>
PR middle-end/33666
* gcc.dg/pr33666.c: New testcase.
2007-10-05 Michael Matz <matz@suse.de> 2007-10-05 Michael Matz <matz@suse.de>
PR inline-asm/33600 PR inline-asm/33600
/* { dg-do compile } */
/* { dg-options { -std=c99 } } */
/* This used to fail with type-checking enabled because we stripped
the inner conversion to unsigned int. */
void __lock_get_list(void *dp)
{
if (((__SIZE_TYPE__)dp + 1) & ~1ULL)
;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment