Hi! On some targets implicit_built_in_decls[BUILT_IN_SNPRINTF] is NULL, but as we want only the return type of the snprintf function and fold_builtin_snprintf in that case is only used when __builtin_* variant is used explicitly, using built_in_decls is better and avoids the ICE.
Bootstrapped/regtested on x86_64-linux and i686-linux, tested on the testcase with cross to cris-elf, committed to trunk as obvious. 2011-03-15 Jakub Jelinek <ja...@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. --- gcc/builtins.c.jj 2011-03-15 09:47:12.000000000 +0100 +++ gcc/builtins.c 2011-03-15 10:05:25.000000000 +0100 @@ -12038,9 +12038,8 @@ fold_builtin_snprintf (location_t loc, t 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 Jakub