http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55513
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-28 15:51:21 UTC --- Reduced testcase: void f1 () { char s[10]; const int t = __builtin_snprintf (s, 10, "Hello"); __builtin_printf ("%d %s\n", t, s); } void f2 () { char s[10]; const int t = (__builtin_memcpy (s, "Hello", 6), 5); __builtin_printf ("%d %s\n", t, s); } int main () { f1 (); f2 (); } Even f2 fails to call memcpy, so it isn't related to folding the snprintf into what it folds to, but about handling COMPOUND_EXPRs with side-effects on the LHS where the only side-effects are builtin calls. If the LHS of the COMPOUND_EXPR is a non-builtin, potential_rvalue_constant_expression returns false and it is handled correctly, but even if it is say __builtin_exit (0) or similar, it is optimized away.