From: Bernd Edlinger Date: Fri, 14 Sep 2018 20:36:19 +0000 (+0000) Subject: builtins.c (fold_builtin_strlen): Remove TODO comment. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2870a4da4f2c928346ac92e69aef16515c76049e;p=gcc.git builtins.c (fold_builtin_strlen): Remove TODO comment. 2018-09-14 Bernd Edlinger * builtins.c (fold_builtin_strlen): Remove TODO comment. testsuite: 2018-09-14 Bernd Edlinger * gcc.dg/warn-strlen-no-nul.c: Add some missing test cases. From-SVN: r264334 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b33b938cc8f..76619e9fc50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-09-14 Bernd Edlinger + + * builtins.c (fold_builtin_strlen): Remove TODO comment. + 2018-09-14 Bernd Edlinger revert: diff --git a/gcc/builtins.c b/gcc/builtins.c index b2b7ca30b17..3f39d10977d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8462,7 +8462,7 @@ fold_builtin_strlen (location_t loc, tree type, tree arg) 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 36867ba0e50..43ce2d964fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-09-14 Bernd Edlinger + + * gcc.dg/warn-strlen-no-nul.c: Add some missing test cases. + 2018-09-14 Martin Sebor * gcc.dg/warn-stpcpy-no-nul.c: New test. diff --git a/gcc/testsuite/gcc.dg/warn-strlen-no-nul.c b/gcc/testsuite/gcc.dg/warn-strlen-no-nul.c index d2bc5257d53..997dfc3540f 100644 --- a/gcc/testsuite/gcc.dg/warn-strlen-no-nul.c +++ b/gcc/testsuite/gcc.dg/warn-strlen-no-nul.c @@ -9,6 +9,7 @@ const char a[5] = "12345"; /* { dg-message "declared here" } */ int v0 = 0; int v1 = 1; +volatile int v2; void sink (int, ...); @@ -117,10 +118,8 @@ T (v0 ? b[i0] : &b[i3][i0] + i1); /* { dg-warning "nul" } */ 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]; }; @@ -299,3 +298,7 @@ T (v0 ? &ba[3].a[1].a[1] : ba[0].a[0].a); /* { dg-warning "nul" } */ 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" } */