public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Jon Turney <jon.turney@dronecode.org.uk>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: bug with printf positional arguments?
Date: Mon, 3 Jul 2023 13:14:59 +0200	[thread overview]
Message-ID: <ZKKtsxWLzEEuCo3K@calimero.vinschen.de> (raw)
In-Reply-To: <e194922d-3f1b-a947-8a51-10206706564f@dronecode.org.uk>

On Jun 28 14:28, Jon Turney wrote:
> 
> The following trivial program (extracted from a glib testcase)
> 
> > #include <stdio.h>
> > 
> > int main()
> > {
> >   printf ("%1$*2$.*3$s", "abc", 5, 2);
> > }
> 
> does not produce the expected output of "   ab", on 64-bit Cygwin.
> 
> From a bit of staring at and stepping through get_args() in
> libc/stdio/vfprintf.c, it looks like the problem is (something like) we
> don't have the knowledge that the first positional variadic argument should
> be treated as a pointer, at the point that we store it's value, so it gets
> treated as an integer (the default), which is going to lead to truncation on
> LP64 platforms.
> 
> A straightforward way to fix this eludes me.

Can you point out where in the code this problem occurs, so maybe
we can discuss the necessary code changes in this thread?


Thanks,
Corinna


  reply	other threads:[~2023-07-03 11:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 13:28 Jon Turney
2023-07-03 11:14 ` Corinna Vinschen [this message]
2023-07-03 14:49   ` Jon Turney
2023-07-26 13:26     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZKKtsxWLzEEuCo3K@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=jon.turney@dronecode.org.uk \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).