public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55513] [4.7/4.8 Regression] Incorrect snprintf folding when building with -std=c++0x Date: Wed, 28 Nov 2012 15:51:00 -0000 [thread overview] Message-ID: <bug-55513-4-LV4Uk8PVeq@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55513-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55513 --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-28 15:51:21 UTC --- Reduced testcase: void f1 () { char s[10]; const int t = __builtin_snprintf (s, 10, "Hello"); __builtin_printf ("%d %s\n", t, s); } void f2 () { char s[10]; const int t = (__builtin_memcpy (s, "Hello", 6), 5); __builtin_printf ("%d %s\n", t, s); } int main () { f1 (); f2 (); } Even f2 fails to call memcpy, so it isn't related to folding the snprintf into what it folds to, but about handling COMPOUND_EXPRs with side-effects on the LHS where the only side-effects are builtin calls. If the LHS of the COMPOUND_EXPR is a non-builtin, potential_rvalue_constant_expression returns false and it is handled correctly, but even if it is say __builtin_exit (0) or similar, it is optimized away.
next prev parent reply other threads:[~2012-11-28 15:51 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-28 10:04 [Bug c++/55513] New: " gnobal at hotmail dot com 2012-11-28 10:05 ` [Bug c++/55513] " gnobal at hotmail dot com 2012-11-28 10:19 ` [Bug c++/55513] [4.7 Regression] " redi at gcc dot gnu.org 2012-11-28 12:35 ` rguenth at gcc dot gnu.org 2012-11-28 14:26 ` [Bug c++/55513] [4.7/4.8 " jakub at gcc dot gnu.org 2012-11-28 15:15 ` jakub at gcc dot gnu.org 2012-11-28 15:51 ` jakub at gcc dot gnu.org [this message] 2012-12-05 17:10 ` aldyh at gcc dot gnu.org 2012-12-06 16:16 ` rguenth at gcc dot gnu.org 2012-12-06 21:06 ` aldyh at gcc dot gnu.org 2012-12-07 5:21 ` jason at gcc dot gnu.org 2012-12-08 3:13 ` aldyh at gcc dot gnu.org 2012-12-08 3:14 ` aldyh at gcc dot gnu.org 2012-12-12 9:57 ` pluto at agmk dot net
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-55513-4-LV4Uk8PVeq@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: linkBe 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).