From patchwork Tue Oct 15 19:05:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel F. T. Gomes" X-Patchwork-Id: 1177315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105981-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=inconstante.net.br Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="xDT43xPQ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46t4g13m5xz9sPc for ; Wed, 16 Oct 2019 06:07:09 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:content-type; q=dns; s=default; b=EbEG2ecUrsyczmFUo3Cif4d0EhGcgH867fHW5XH2wms zsMjcRgBcEUOux8efylQyiAIHJnF5RBTczapNFVz/oYYD8LUR/d3Qjb2WTyd8uQ+ RP3BUGqnt5LT+1jig2iYznRD1rbKF02xS0Fjmp3Nap6T+/fsLhKpk3hVqNsUwE5A = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:content-type; s=default; bh=/8Po+DEavpTfIExsdyuGDRonRlM=; b=xDT43xPQqINp1umSI elfk3BKOAa9OM9h+sz03zTxLOKMxnpwnidAuCqXBKHG7DABTqyNEMru4rhikJ1Pc bSyGoRFbYvd5vyEeZ8wDTvKb8+sQBNMLENHeflWjUmS2XB88Occ6P7pPFWx4PY9G xyjcspMrqqUgI5mB7DbXVt/xLk= Received: (qmail 100074 invoked by alias); 15 Oct 2019 19:06:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 99987 invoked by uid 89); 15 Oct 2019 19:06:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=2000000 X-HELO: smtpout1.mo528.mail-out.ovh.net From: "Gabriel F. T. Gomes" To: Subject: [PATCH 06/31] ldbl-128ibm-compat: Test positional arguments Date: Tue, 15 Oct 2019 16:05:04 -0300 Message-ID: <20191015190529.11559-7-gabriel@inconstante.net.br> In-Reply-To: <20191015190529.11559-1-gabriel@inconstante.net.br> References: <20191015190529.11559-1-gabriel@inconstante.net.br> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1775262680938761923 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrjeefgddufeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenuc From: "Gabriel F. T. Gomes" The format string can request positional parameters, instead of relying on the order in which they appear as arguments. Since this has an effect on how the type of each argument is determined, this patch extends the test cases to use positional parameters with mixed double and long double types, to verify that the IEEE long double implementations of *printf work correctly in this scenario. Tested for powerpc64le. --- .../ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c | 12 +++++++++++- .../ldbl-128ibm-compat/test-printf-ldbl-compat.c | 12 +++++++++++- .../test-wprintf-chk-ldbl-compat.c | 9 ++++++++- .../ldbl-128ibm-compat/test-wprintf-ldbl-compat.c | 9 ++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c index e8e124425b..153a35d451 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-chk-ldbl-compat.c @@ -139,6 +139,10 @@ do_test_call (void) /* Print in hexadecimal notation. */ do_test_call_rarg (stdout, "%.10La, %.10a", ld, d); do_test_call_varg (stdout, "%.10La, %.10a", ld, d); + + /* Test positional parameters. */ + do_test_call_varg (stdout, "%3$Lf, %2$Lf, %1$f", + (double) 1, (long double) 2, (long double) 3); } static int @@ -172,7 +176,13 @@ do_test (void) " __vfprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vsnprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" - " __vsprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n"; + " __vsprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" + " __vasprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vdprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vfprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vsnprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vsprintf_chk: 3.000000, 2.000000, 1.000000\n"; TEST_COMPARE_STRING (expected, result.out.buffer); return 0; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c index 2b8d424473..5b0e8d3bae 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.c @@ -130,6 +130,10 @@ do_test_call (void) /* Print in hexadecimal notation. */ do_test_call_rarg (stdout, "%.10La, %.10a", ld, d); do_test_call_varg (stdout, "%.10La, %.10a", ld, d); + + /* Test positional parameters. */ + do_test_call_varg (stdout, "%3$Lf, %2$Lf, %1$f", + (double) 1, (long double) 2, (long double) 3); } static int @@ -163,7 +167,13 @@ do_test (void) " vfprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " vprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " vsnprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" - " vsprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"; + " vsprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" + " vasprintf: 3.000000, 2.000000, 1.000000\n" + " vdprintf: 3.000000, 2.000000, 1.000000\n" + " vfprintf: 3.000000, 2.000000, 1.000000\n" + " vprintf: 3.000000, 2.000000, 1.000000\n" + " vsnprintf: 3.000000, 2.000000, 1.000000\n" + " vsprintf: 3.000000, 2.000000, 1.000000\n"; TEST_COMPARE_STRING (expected, result.out.buffer); return 0; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c index 0dcabec38a..49174625d4 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-chk-ldbl-compat.c @@ -85,6 +85,10 @@ do_test_call (void) /* Print in hexadecimal notation. */ do_test_call_rarg (stdout, L"%.10La, %.10a", ld, d); do_test_call_varg (stdout, L"%.10La, %.10a", ld, d); + + /* Test positional parameters. */ + do_test_call_varg (stdout, L"%3$Lf, %2$Lf, %1$f", + (double) 1, (long double) 2, (long double) 3); } static int @@ -106,7 +110,10 @@ do_test (void) " __wprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vfwprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " __vswprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" - " __vwprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n"; + " __vwprintf_chk: -0x1.0000000000p+0, -0x1.0000000000p+0\n" + " __vfwprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vswprintf_chk: 3.000000, 2.000000, 1.000000\n" + " __vwprintf_chk: 3.000000, 2.000000, 1.000000\n"; TEST_COMPARE_STRING (expected, result.out.buffer); return 0; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c index def4337571..008275f529 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-wprintf-ldbl-compat.c @@ -83,6 +83,10 @@ do_test_call (void) /* Print in hexadecimal notation. */ do_test_call_rarg (stdout, L"%.10La, %.10a", ld, d); do_test_call_varg (stdout, L"%.10La, %.10a", ld, d); + + /* Test positional parameters. */ + do_test_call_varg (stdout, L"%3$Lf, %2$Lf, %1$f", + (double) 1, (long double) 2, (long double) 3); } static int @@ -104,7 +108,10 @@ do_test (void) " wprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " vfwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" " vswprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" - " vwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n"; + " vwprintf: -0x1.0000000000p+0, -0x1.0000000000p+0\n" + " vfwprintf: 3.000000, 2.000000, 1.000000\n" + " vswprintf: 3.000000, 2.000000, 1.000000\n" + " vwprintf: 3.000000, 2.000000, 1.000000\n"; TEST_COMPARE_STRING (expected, result.out.buffer); return 0;