re PR c/51527 (ICE: Segmentation fault: 'convert_to_integer' enters infinite recursion)

PR c/51527
	* convert.c (convert_to_integer): Avoid infinte recursion for
	target-defined built-in types.

From-SVN: r186899
This commit is contained in:
Richard Guenther 2012-04-27 10:51:58 +00:00 committed by Georg-Johann Lay
parent cefa345f9f
commit ae9bade9b6
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2012-04-27 Richard Guenther <rguenther@suse.de>
PR c/51527
* convert.c (convert_to_integer): Avoid infinte recursion for
target-defined built-in types.
2012-04-26 Hans-Peter Nilsson <hp@axis.com>
PR target/53120

View File

@ -769,6 +769,7 @@ convert_to_integer (tree type, tree expr)
(Otherwise would recurse infinitely in convert. */
if (TYPE_PRECISION (typex) != inprec)
{
tree otypex = typex;
/* Don't do unsigned arithmetic where signed was wanted,
or vice versa.
Exception: if both of the original operands were
@ -806,10 +807,12 @@ convert_to_integer (tree type, tree expr)
typex = unsigned_type_for (typex);
else
typex = signed_type_for (typex);
return convert (type,
fold_build2 (ex_form, typex,
convert (typex, arg0),
convert (typex, arg1)));
if (TYPE_PRECISION (otypex) == TYPE_PRECISION (typex))
return convert (type,
fold_build2 (ex_form, typex,
convert (typex, arg0),
convert (typex, arg1)));
}
}
}