re PR c/12245 (Uses lots of memory when compiling large initialized arrays)

PR c/12245
	PR c++/14179
	* convert.c (convert_to_integer): Use fold_convert for
	converting an INTEGER_CST to integer type.

From-SVN: r183214
This commit is contained in:
Jan Hubicka 2012-01-16 17:40:38 +01:00 committed by Jason Merrill
parent 7aeb037b25
commit c53153e7a0
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2012-01-16 Jan Hubicka <jh@suse.cz>
PR c/12245
PR c++/14179
* convert.c (convert_to_integer): Use fold_convert for
converting an INTEGER_CST to integer type.
2012-01-16 Jason Merrill <jason@redhat.com>
PR c++/14179

View file

@ -860,6 +860,10 @@ convert_to_integer (tree type, tree expr)
break;
}
/* When parsing long initializers, we might end up with a lot of casts.
Shortcut this. */
if (TREE_CODE (expr) == INTEGER_CST)
return fold_convert (type, expr);
return build1 (CONVERT_EXPR, type, expr);
case REAL_TYPE: