re PR tree-optimization/48129 (gcc.c-torture/execute/builtins/snprintf-chk.c ICE)
authorJakub Jelinek <jakub@redhat.com>
Tue, 15 Mar 2011 11:28:35 +0000 (12:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 15 Mar 2011 11:28:35 +0000 (12:28 +0100)
PR tree-optimization/48129
* builtins.c (fold_builtin_snprintf): Convert to type of
built_in_decls[BUILT_IN_SNPRINTF] retval instead of
implicit_built_in_decls[BUILT_IN_SNPRINTF] retval.

From-SVN: r170985

gcc/ChangeLog
gcc/builtins.c

index 3c55339f4245393766ef3911e21688913b2775b5..ec59459bc97dd6c0fc64ad5f7c93e53573e6cf50 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/48129
+       * builtins.c (fold_builtin_snprintf): Convert to type of
+       built_in_decls[BUILT_IN_SNPRINTF] retval instead of
+       implicit_built_in_decls[BUILT_IN_SNPRINTF] retval.
+
 2011-03-15  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/41490
index a59b23c50401a71d88b819c57f80c137867cef50..ad21b2d61633cfdf422f1f97184f2cbc09a29085 100644 (file)
@@ -12038,9 +12038,8 @@ fold_builtin_snprintf (location_t loc, tree dest, tree destsize, tree fmt,
 
   if (call && retval)
     {
-      retval = fold_convert_loc
-       (loc, TREE_TYPE (TREE_TYPE (implicit_built_in_decls[BUILT_IN_SNPRINTF])),
-        retval);
+      tree fn = built_in_decls[BUILT_IN_SNPRINTF];
+      retval = fold_convert_loc (loc, TREE_TYPE (TREE_TYPE (fn)), retval);
       return build2 (COMPOUND_EXPR, TREE_TYPE (retval), call, retval);
     }
   else