public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-11149] libstdc++: Fix tr1/8_c_compatibility/cstdio/functions.cc regression with recent glibc
Date: Sun, 17 Dec 2023 13:55:05 +0000 (GMT)	[thread overview]
Message-ID: <20231217135505.0F22D3858418@sourceware.org> (raw)

https://gcc.gnu.org/g:8c64ae47a57ea97279e5673a856c7ccc529b68e9

commit r11-11149-g8c64ae47a57ea97279e5673a856c7ccc529b68e9
Author: Jakub Jelinek <jakub@redhat.com>
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  <jakub@redhat.com>
    
            * 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.
    
    (cherry picked from commit badb798f5e96a995bb9fa8c4ea48071aa4f2b4b3)

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 2d9371bb590..a62e1fe3dc2 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 a7a0ad83c65..b5b8b1564ce 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);

                 reply	other threads:[~2023-12-17 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231217135505.0F22D3858418@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).