From patchwork Thu Oct 12 07:54:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 151873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1093629vqb; Thu, 12 Oct 2023 02:29:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOwrm20DpFvezqxSgvLs2QQhd90YNOlDY+YvdRgYK0iBAFDkq8NlLA+5YFLYx1o3qu+Tti X-Received: by 2002:a05:6402:22e2:b0:53d:b418:caa5 with SMTP id dn2-20020a05640222e200b0053db418caa5mr4165243edb.14.1697102987633; Thu, 12 Oct 2023 02:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697102987; cv=none; d=google.com; s=arc-20160816; b=D/Q8/bI/vHDeXb73w9WI8tXywdPiPRo3mY/hhCNbESVM8mtAbWzQmFWE/ffjL4syWg poHORqWFFO0ZGwtLgD+i0T4tEf4J0NqGl5RTBCOCJCHNvCE/KnxaUQh/gY02Hq/PlBmF NbUd2NHKZ+mgSWE39yLUiAP4U0UfAh1OO0D7heubL2pxXigEyDKZvprdJHdkFveFjeJv BpJlPvxRzj0Pw9L6qGgiWGWqxyWjJim8Xh3PTO+ARxwxXk/46aMHxHxuC8WC2caLhdv7 K18PH4oq+MZpfUo+KxTs+7Ngt/JDyczQgza7vqA6W33V3fhfFUNeVy/y8bUezDnE/oR7 EYPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :dmarc-filter:delivered-to; bh=r3ebFK4fjduJ9yXRZqb/Pfg9zT7hgNFd3K+3ECMxMwk=; fh=O6+16l+PT/vi9m0Q2u//34Smlo3JiIbA9/ej9ygykqU=; b=JNq/70TuDkVhzOzeK0sPDGyyivv/5uO/YytGYwD7Apgrv6IF5dgSohCdngzLpwfhyh 1TsF2+DNt/jfwqXGZgS3vEuSkyKV4uTLQ2PfyYwR0GtunbtrNZD7EJYHC+0FQE9QU6we PunBDjQE8X44OOfrjtMRstQgnPnWhJgXU8bSUsahIuBi4VKUNbucU/wlUT8gkDLGU0+q BUPEZ6WBXqipyZCnWVI3Ko8Q2YGLjsIAyMs8p8+lLAWW9GO+t5CErC3vwXeE8gUmesw9 yW+WbKZE7dSEnpXeTfbXNSwc8/l7CgnfuVZFUE+X91oksfLhQv0SvzKxlfGGB+jVscJO HwvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pr0ccoT+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l26-20020a056402345a00b005376fa4cfabsi7625498edc.675.2023.10.12.02.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pr0ccoT+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AF913857728 for ; Thu, 12 Oct 2023 07:54:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 DEEB43858CDA for ; Thu, 12 Oct 2023 07:54:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEEB43858CDA 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=1697097254; 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=Pr0ccoT+3qjO7Z8e9jQucY0uONbEbqqNsHAnO4U5CaNxRz4AtVJKzW8GCERFnvBBgr9W9X l+4urLZ4C9+ZQDHOmU507Wj2gPORQ38MtzctqgLiF0F5XPABNrTdKgwgfjE8LUrCebbonR d73PZ8Ut74+3kW1uNHuSjq0aySnXH40= 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: 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-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=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779541462230167622 X-GMAIL-MSGID: 1779541462230167622 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. Jakub --- 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);