The gimple-ssa-sprintf.c pass crashes on a %lf directive: $ cat v.c && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -Wformat -Wextra -Wpedantic v.c char d [3]; void f (double x) { __builtin_sprintf (d, "%lf", x); } v.c: In function ‘f’: v.c:3:6: internal compiler error: in format_floating, at gimple-ssa-sprintf.c:1163 void f (double x) ^ 0x181ba7e format_floating /src/gcc-svn/gcc/gimple-ssa-sprintf.c:1163 0x181c8b2 format_floating /src/gcc-svn/gcc/gimple-ssa-sprintf.c:1373 0x181d144 format_directive /src/gcc-svn/gcc/gimple-ssa-sprintf.c:1626 0x181e794 compute_format_length /src/gcc-svn/gcc/gimple-ssa-sprintf.c:2320 0x181f516 handle_gimple_call /src/gcc-svn/gcc/gimple-ssa-sprintf.c:2645 0x181f5f1 execute /src/gcc-svn/gcc/gimple-ssa-sprintf.c:2671 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.
Patch posted for review: https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01470.html
*** Bug 77740 has been marked as a duplicate of this bug. ***
Author: msebor Date: Wed Sep 28 16:13:12 2016 New Revision: 240583 URL: https://gcc.gnu.org/viewcvs?rev=240583&root=gcc&view=rev Log: PR middle-end/77683 - ICE on %lf directive in format_floating in gcc/testsuite/ChangeLog: PR middle-end/77683 * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases. gcc/ChangeLog: PR middle-end/77683 * gimple-ssa-sprintf.c (format_integer): Fail gracefully when length modifier is not expected. (format_floating): Ignore l length modifier and fail gracefuly when it isn't one of the other expected ones. Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-sprintf.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
Fixed by r240583.
Also verified with the testcase from Bug 77740: building Wine.