+2016-09-28 Martin Sebor <msebor@redhat.com>
+
+ 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.
+
2016-09-28 Martin Sebor <msebor@redhat.com>
PR bootstrap/77753
break;
default:
- gcc_unreachable ();
+ {
+ fmtresult res = fmtresult ();
+ res.range.min = HOST_WIDE_INT_MAX;
+ res.range.max = HOST_WIDE_INT_MAX;
+ res.bounded = false;
+ res.constant = false;
+ return res;
+ }
}
/* The type of the argument to the directive, either deduced from
switch (spec.modifier)
{
+ case FMT_LEN_l:
case FMT_LEN_none:
type = double_type_node;
break;
break;
default:
- gcc_unreachable ();
+ {
+ fmtresult res = fmtresult ();
+ res.range.min = HOST_WIDE_INT_MAX;
+ res.range.max = HOST_WIDE_INT_MAX;
+ res.bounded = false;
+ res.constant = false;
+ return res;
+ }
}
/* The minimum and maximum number of bytes produced by the directive. */
}
default:
- gcc_unreachable ();
+ {
+ fmtresult res = fmtresult ();
+ res.range.min = HOST_WIDE_INT_MAX;
+ res.range.max = HOST_WIDE_INT_MAX;
+ res.bounded = false;
+ res.constant = false;
+ return res;
+ }
}
if (0 < width)
+2016-09-28 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/77683
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases.
+
2016-09-28 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/77748
void test_sprintf_chk_e_const (void)
{
T (-1, "%E", 0.0);
+ T (-1, "%lE", 0.0);
+
T ( 0, "%E", 0.0); /* { dg-warning "into a region" } */
T ( 0, "%e", 0.0); /* { dg-warning "into a region" } */
T ( 1, "%E", 1.0); /* { dg-warning "into a region" } */
void test_sprintf_chk_e_nonconst (double d)
{
T (-1, "%E", d);
+ T (-1, "%lE", d);
+
T ( 0, "%E", d); /* { dg-warning "writing between 12 and 14 bytes into a region of size 0" } */
T ( 0, "%e", d); /* { dg-warning "into a region" } */
T ( 1, "%E", d); /* { dg-warning "into a region" } */
void test_sprintf_chk_f_nonconst (double d)
{
T (-1, "%F", d);
+ T (-1, "%lF", d);
+
T ( 0, "%F", d); /* { dg-warning "into a region" } */
T ( 0, "%f", d); /* { dg-warning "into a region" } */
T ( 1, "%F", d); /* { dg-warning "into a region" } */