[gcc r9-8367] libstdc++: Fix test failure due to -Wnonnull warnings

Jonathan Wakely redi@gcc.gnu.org
Thu Mar 12 17:39:44 GMT 2020


https://gcc.gnu.org/g:55925fe3a97c38eb770a9839916d61b219b90d00

commit r9-8367-g55925fe3a97c38eb770a9839916d61b219b90d00
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Mar 12 17:39:05 2020 +0000

    libstdc++: Fix test failure due to -Wnonnull warnings
    
    This test fails in the Fedora RPM build (but not elsewhere, for unknown
    reasons). The warning is correct, we're passing a null pointer.
    
    Backport from mainline
    2020-03-12  Jonathan Wakely  <jwakely@redhat.com>
    
            * testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Do not pass
            a null pointer to functions with nonnull(1) attribute.

Diff:
---
 libstdc++-v3/ChangeLog                                            | 6 ++++++
 libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7608f7028f6..fd80d5d091f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
 2020-03-12  Jonathan Wakely  <jwakely@redhat.com>
 
+	Backport from mainline
+	2020-03-12  Jonathan Wakely  <jwakely@redhat.com>
+
+	* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Do not pass
+	a null pointer to functions with nonnull(1) attribute.
+
 	Backport from mainline
 	2020-02-28  Jonathan Wakely  <jwakely@redhat.com>
 
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
index e1feef99582..0f00a94da42 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdlib/functions.cc
@@ -30,7 +30,7 @@ void test01()
 #if _GLIBCXX_USE_C99_STDLIB
 
   long long i = 0;
-  const char* s = 0;
+  const char* s = "";
   char** endptr = 0;
   int base = 0;


More information about the Gcc-cvs mailing list