From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C8E7F3858C52 for ; Thu, 12 Oct 2023 07:54:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8E7F3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697097255; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=r3ebFK4fjduJ9yXRZqb/Pfg9zT7hgNFd3K+3ECMxMwk=; b=fyTEE0myC5TkakjtXBezRNgIaWZYQuRj31HvAEBDJwz6vFpAh9JF6p8rMS9sJpJ8+8My48 2SagllLfY5xL2T0qi8wHBqebr9Ei2pmJV2/WH5Q2je6m2PSDOQGrE4t2ZvZgP9QsBd2b+w 3Y/f58pTuYBMlVjRB3vF0GqdVUBC8+E= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-636-CUMsYGdPMuKEKRbTu4AouA-1; Thu, 12 Oct 2023 03:54:08 -0400 X-MC-Unique: CUMsYGdPMuKEKRbTu4AouA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0A86A1C2B66C; Thu, 12 Oct 2023 07:54:08 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB7B7215670B; Thu, 12 Oct 2023 07:54:07 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 39C7s4Ss225019 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 12 Oct 2023 09:54:05 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 39C7s4HY225018; Thu, 12 Oct 2023 09:54:04 +0200 Date: Thu, 12 Oct 2023 09:54:03 +0200 From: Jakub Jelinek To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Siddhesh Poyarekar Subject: [PATCH] libstdc++: Fix tr1/8_c_compatibility/cstdio/functions.cc regression with recent glibc Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! 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). Tested on x86_64-linux, ok for trunk? 2023-10-12 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. --- libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc.jj 2023-01-16 23:19:06.651711546 +0100 +++ libstdc++-v3/testsuite/tr1/8_c_compatibility/cstdio/functions.cc 2023-10-12 09:46:28.695011763 +0200 @@ -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; --- libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc.jj 2023-01-16 23:19:06.651711546 +0100 +++ libstdc++-v3/testsuite/tr1/8_c_compatibility/cwchar/functions.cc 2023-10-12 09:46:19.236141897 +0200 @@ -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); Jakub