summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/convert.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dd13d0bbc72..9efdd70ddbf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/convert.c b/gcc/convert.c
index f04b2048194..dbe2c7eb32e 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -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: