delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/12/06/21:17:21

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4B72HLUH4041900
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4B72HLUH4041900
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=JYkHYbdM
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 384F53858427
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1733537839;
bh=TodALmudqnHFXa3Iz+S2euJvjI6bYbSJJfNmLNp59Pc=;
h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive:
List-Post:List-Help:List-Subscribe:From:Reply-To:From;
b=JYkHYbdMq93I8gQlpay2lpiTgu7ImZBV3ipzrSgJ0qyKy7DW7ED6rWmYoc2m/16YU
Tdz0dYcl7U48kgImGQwtsVWpj1flzVWhwfZheBrJC0VckGWZR2Ol/891rwpfLM+UCu
hgDTO3sKJjjwKnZDBPOCIVEkjASP3lwuTh4vY6KQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2305C3858CDB
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2305C3858CDB
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733537812; cv=none;
b=g+vHxhTJSf1ySAhxqmzxqGjSV8fFMJor3bui0haNz5HZFOnOdmQW6XxjbUwqUJPBkVTEFQe5ezuxpKk7OSH33YnR/FaORoOxC7/+e9NMfjx/YZQOP2HkGQn6Kk7+N6wk3KfE0Hlx5m1LhVV0D+A0z7p8eFt1BDgbxQGAMDEeAtE=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1733537812; c=relaxed/simple;
bh=nDKQQi/jfi3yrt6hFYw4C5u7s+kuqFhFzbrEfAz3GZA=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=AbzH1Op7AFYnfgc6grq8nBVD+MqEyzmIzgWhPGGH0JylnxAZhwVzOhM3B6/nMli28t7bQEN0ssy9Z1mrtoGUXX/LEXtUz1BJIIhG2VoKdsTR13OhxCr6UnlVlOKIRrcX6CQHQxnDcZWQ6koMoiKHJ+0zi8Ujv5po4tRWvw4S00Q=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2305C3858CDB
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1733537809; x=1734142609;
h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=Jh2xWXwaDKOodAlhzrxZvp/KZuWatDeIXqVjBZ7CwKA=;
b=giYAgjxAdDPFU1ajzjy42bqGFhTWcOH90A6x8SzxQgjNWGcEX6uymr3r/Oq6YDOayD
ysq6tkvQLlmpdIsrc9ydr2EiV6at9AQ1FGewiPzCdtY5dPYgxXRb9BMditCM/v2xLW9h
in1CkXbU5x8FWgdYpueuaTaLnclO7aeS5wAQgVWrFJo8hFoeWG2bjSMhQFL84A77FkR6
8a2SGGaVd8iuztTqWxHFQkLQi5yaa7vJV+UKSCNdFZMLu70vqhiF39P6bhLku4piQ7/8
N19DEtcWDE8C+ANwaWrIuL4teAyv8ldtohqmKdoJgm4YgTid8s3PtQ2gwDvIjDb/UheA
pm/g==
X-Gm-Message-State: AOJu0Yz7y9w7JWKuVNjfvjrLzC0CUq47qWtXE++nEMJxXOozBMHN5eal
cVlTLVovtgm1CjSnlzc35HgrcjpUbPOynh6ZzG+ilHXc4UlF4RHJEj8T9+GHFS8XuDpKkR6MnXJ
SfA0Kzh8anSFrMcsXTArr8Eqbhw+zotaC
X-Gm-Gg: ASbGnctnI5dbDxm2bt29vM12zKwRf1GR+OpxeJOF/0m0MSKlYJJ+es/ySDQJGK0wwjH
Z+G1sU5wI6TL/qBbNl1QDRLGqippPfH4=
X-Google-Smtp-Source: AGHT+IEaeAA9E109CKWgZ7wjUFaF2HTOr1VrPuVoZZrynbJOeL+CxQh1+K9BB7SWogbxAVij9YibqBxf1vWm7TMn7mg=
X-Received: by 2002:a5d:47cf:0:b0:385:e3c2:a47d with SMTP id
ffacd0b85a97d-3862b36ab44mr3935744f8f.23.1733537809308; Fri, 06 Dec 2024
18:16:49 -0800 (PST)
MIME-Version: 1.0
Date: Fri, 6 Dec 2024 18:16:37 -0800
Message-ID: <CAAHpriN5K1=-i9mWir57+GAhp-=har8rqAAa-b0-1JUNE6PQtw@mail.gmail.com>
Subject: Bug in handling of "1$", "2$" in printf format
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
Cc: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Keith Thompson via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

The use of "1$", "2$" et al in printf format specifiers is a
POSIX-specific feature.

On Cygwin (newlib) this is handled correctly in most cases, but one
example I tried misbehaves.
The output is correct on other implementations, including glibc and
musl on Ubuntu.

This C program:

#include <stdio.h>
int main(void) {
    long long a = 123456789876543210;
    double b=1.0/3;
    printf("a:%2$8.8lld b:%1$10.2g\n", b, a);
}

should produce this output:

a:123456789876543210 b:      0.33

Under Cygwin (fully updated), with "gcc c.c -o c && ./c", the output is:

a:140732550844138 b:  7.1e-315

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019