+2018-09-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * builtins.c (fold_builtin_strlen): Remove TODO comment.
+
2018-09-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
revert:
return fold_convert_loc (loc, type, len);
if (!nonstr)
- c_strlen (arg, 1, &nonstr); /* TODO: add test coverage here. */
+ c_strlen (arg, 1, &nonstr);
if (nonstr)
{
+2018-09-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * gcc.dg/warn-strlen-no-nul.c: Add some missing test cases.
+
2018-09-14 Martin Sebor <msebor@redhat.com>
* gcc.dg/warn-stpcpy-no-nul.c: New test.
int v0 = 0;
int v1 = 1;
+volatile int v2;
void sink (int, ...);
T (v0 ? b[i0] : &b[i3][i0] + i1); /* { dg-warning "nul" } */
T (v0 ? b[i1] : &b[i3][i1] + v0); /* { dg-warning "nul" } */
-/* It's possible to detect the missing nul in the following two
- expressions but GCC doesn't do it yet. */
-T (v0 ? &b[3][1] + v0 : b[2]); /* { dg-warning "nul" "bug" } */
-T (v0 ? &b[3][v0] : &b[3][v1]); /* { dg-warning "nul" "bug" } */
+T (v0 ? &b[3][1] + v0 : b[2]); /* { dg-warning "nul" } */
+T (v0 ? &b[3][v0] : &b[3][v1]); /* { dg-warning "nul" } */
struct A { char a[5], b[5]; };
T (v0 ? ba[0].a[0].a : ba[0].a[1].b);
T (v0 ? ba[0].a[1].b : ba[0].a[0].a);
+
+T (v2 ? b[1] : &b[3][1] + v2); /* { dg-warning "nul" } */
+T (v2 ? &b[3][1] + v2 : b[2]); /* { dg-warning "nul" } */
+T (v2 ? &b[3][v2] : &b[2][v2]); /* { dg-warning "nul" } */