From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 009343858D1E; Fri, 13 Oct 2023 07:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 009343858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697181006; bh=Y+aREfixdzRkCZD9szobNiMrKRA1ty3Rja31uA4nE40=; h=From:To:Subject:Date:From; b=ojxba+QJWsdMjqzI4rEBCJWoBCqsegR3bRnGZU+/HarOJY7XQM4NbtZ8QfFyTC5kb 88V5WQRc0cySSuSKtkR8bhvo+IfOnjjk2spL9iTdHl35rHRzhqxmEfuiliAJXJI9g+ RIfPQ9LGuELAHmFbMHmT8Cq58NTW6wwIl3KMJhYQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-4613] libstdc++: Fix tr1/8_c_compatibility/cstdio/functions.cc regression with recent glibc X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 6decda1a35be5764101987c210b5693a0d914e58 X-Git-Newrev: badb798f5e96a995bb9fa8c4ea48071aa4f2b4b3 Message-Id: <20231013071006.009343858D1E@sourceware.org> Date: Fri, 13 Oct 2023 07:10:06 +0000 (GMT) List-Id: https://gcc.gnu.org/g:badb798f5e96a995bb9fa8c4ea48071aa4f2b4b3 commit r14-4613-gbadb798f5e96a995bb9fa8c4ea48071aa4f2b4b3 Author: Jakub Jelinek Date: Fri Oct 13 09:09:32 2023 +0200 libstdc++: Fix tr1/8_c_compatibility/cstdio/functions.cc regression with recent glibc The following testcase started FAILing recently after the https://sourceware.org/git/?p=glibc.git;a=commit;h=64b1a44183a3094672ed304532bedb9acc707554 glibc change which marked vfscanf with nonnull (1) attribute. While vfwscanf hasn't been marked similarly (strangely), the patch changes that too. By using va_arg one hides the value of it from the compiler (volatile keyword would do too, or making the FILE* stream a function argument, but then it might need to be guarded by #if or something). 2023-10-13 Jakub Jelinek * testsuite/tr1/8_c_compatibility/cstdio/functions.cc (test01): Initialize stream to va_arg(ap, FILE*) rather than 0. * testsuite/tr1/8_c_compatibility/cwchar/functions.cc (test01): Likewise. Diff: --- libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc | 2 +- libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc index 88809469751..db8d9dc0f67 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc @@ -35,7 +35,7 @@ void test01(int dummy, ...) char* s = 0; const char* cs = 0; const char* format = "%i"; - FILE* stream = 0; + FILE* stream = va_arg(ap, FILE*); std::size_t n = 0; int ret; diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc index 9fddaf54a90..df9d7e6be98 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc @@ -42,7 +42,7 @@ void test01(int dummy, ...) #endif #if _GLIBCXX_HAVE_VFWSCANF - FILE* stream = 0; + FILE* stream = va_arg(arg, FILE*); const wchar_t* format1 = 0; int ret1; ret1 = std::tr1::vfwscanf(stream, format1, arg);