public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zack+srcbugz at owlfolio dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/108675] FAIL: gcc.c-torture/execute/builtins/*printf.c when stdio.h includes definitions
Date: Mon, 06 Feb 2023 17:34:35 +0000	[thread overview]
Message-ID: <bug-108675-4-7vvsCHLTJ8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108675-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108675

--- Comment #6 from Zack Weinberg <zack+srcbugz at owlfolio dot org> ---
Note that what you (mingw) have in this header is a pretty serious
anti-optimization.  Functions that call __builtin_va_start cannot be inlined
under any circumstances whatsoever (try tagging it
__attribute__((always_inline)) and see what happens) so you're emitting a
redundant copy of this function in every translation unit that calls fprintf,
and you're not getting any actual codegen improvement in exchange.

You _could_ do like glibc bits/stdio2.h

__mingw_ovr
__attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
int printf (const char *__format, ...)
{
  return __mingw_fprintf(stdout, __format, __builtin_va_arg_pack());
}

but this doesn't let you synthesize a direct call to __mingw_vfprintf.

I'd recommend scrapping the entire mess, abandoning the idea of getting direct
calls to v*printf/v*scanf, and using asm() symbol renaming to add the __mingw_
prefix.  That should also avoid stepping on the GCC testcases' toes.

  parent reply	other threads:[~2023-02-06 17:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05  5:51 [Bug testsuite/108675] New: " nightstrike at gmail dot com
2023-02-06  7:52 ` [Bug testsuite/108675] " rguenth at gcc dot gnu.org
2023-02-06  9:19 ` nightstrike at gmail dot com
2023-02-06 10:11 ` 10walls at gmail dot com
2023-02-06 10:42 ` lh_mouse at 126 dot com
2023-02-06 16:40 ` nightstrike at gmail dot com
2023-02-06 17:34 ` zack+srcbugz at owlfolio dot org [this message]
2023-02-07  2:12 ` lh_mouse at 126 dot com
2023-02-07  5:51 ` nightstrike at gmail dot com
2023-02-11  5:33 ` nightstrike at gmail dot com

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=bug-108675-4-7vvsCHLTJ8@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).