From patchwork Mon Aug 29 13:34:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 57140 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4231385737E for ; Mon, 29 Aug 2022 13:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4231385737E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661780098; bh=6S+FWlb1jobgJPWRZ0UY/y5ZZjz3OTmJKblRGZ5YJB0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MVPzgdWs3etCN8pvmW8yh+481DAEekglA2mrS9NyDwMkhdMwErQhkJtkw9vq5LUjD YVk3Mc2/PdteJzKtd9cB4xZvZtYpe4Cw//uOOx1O+4CmvnWcGJDjTB3hTraaMEIg3j 6fBNW/55WEFXzmvxPqZS+5oQu7cmyRblG+K7mH7I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id DF2AC3858D32 for ; Mon, 29 Aug 2022 13:34:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF2AC3858D32 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4ED191F88C for ; Mon, 29 Aug 2022 13:34:31 +0000 (UTC) Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 485E82C141 for ; Mon, 29 Aug 2022 13:34:31 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id 25786444AFD; Mon, 29 Aug 2022 15:34:31 +0200 (CEST) To: libc-alpha@sourceware.org Subject: [PATCH] Add test for bug 29530 X-Yow: A KAISER ROLL?! What good is a Kaiser Roll without a little COLE SLAW on the SIDE? Date: Mon, 29 Aug 2022 15:34:30 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.91 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andreas Schwab via Libc-alpha From: Andreas Schwab Reply-To: Andreas Schwab Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This tests for a bug that was introduced in commit edc1686af0 ("vfprintf: Reuse work_buffer in group_number") and fixed as a side effect of commit 6caddd34bd ("Remove most vfprintf width/precision-dependent allocations (bug 14231, bug 26211)."). --- stdio-common/Makefile | 2 ++ stdio-common/tst-grouping2.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 stdio-common/tst-grouping2.c diff --git a/stdio-common/Makefile b/stdio-common/Makefile index b1e9144de0..e11aaedd96 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -174,6 +174,7 @@ tests := \ tst-fwrite \ tst-gets \ tst-grouping \ + tst-grouping2 \ tst-long-dbl-fphex \ tst-memstream-string \ tst-obprintf \ @@ -295,6 +296,7 @@ $(objpfx)bug14.out: $(gen-locales) $(objpfx)scanf13.out: $(gen-locales) $(objpfx)test-vfprintf.out: $(gen-locales) $(objpfx)tst-grouping.out: $(gen-locales) +$(objpfx)tst-grouping2.out: $(gen-locales) $(objpfx)tst-sprintf.out: $(gen-locales) $(objpfx)tst-sscanf.out: $(gen-locales) $(objpfx)tst-swprintf.out: $(gen-locales) diff --git a/stdio-common/tst-grouping2.c b/stdio-common/tst-grouping2.c new file mode 100644 index 0000000000..2eff649073 --- /dev/null +++ b/stdio-common/tst-grouping2.c @@ -0,0 +1,36 @@ +/* Test printf with grouping and large width (bug 29530) + Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +static int +do_test (void) +{ + char buf[1001]; + + xsetlocale (LC_NUMERIC, "de_DE.UTF-8"); + + /* This used to crash in group_number. */ + sprintf (buf, "%'1000d", 1000); + + return 0; +} + +#include