public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/46647] Can't inline memset with -1 Date: Wed, 24 Nov 2010 22:22:00 -0000 [thread overview] Message-ID: <bug-46647-4-9jbpSWXEk7@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-46647-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46647 --- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-24 22:11:03 UTC --- (In reply to comment #8) > I'd prefer to replace the host_integerp call in that routine with > TREE_CODE (...) == INTEGER_CST check. While currently callers check it as > well, it isn't too expensive and makes it more robust. /* Cast a target constant CST to target CHAR and if that value fits into host char type, return zero and put that value into variable pointed to by P. */ static int target_char_cast (tree cst, char *p) It is supposed to be called on integer constant. Adding a check shouldn't be too bad: diff --git a/gcc/builtins.c b/gcc/builtins.c index c9e8e68..a90bf2f 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -630,11 +630,11 @@ target_char_cast (tree cst, char *p) { unsigned HOST_WIDE_INT val, hostval; - if (!host_integerp (cst, 1) + if (TREE_CODE (cst) != INTEGER_CST || CHAR_TYPE_SIZE > HOST_BITS_PER_WIDE_INT) return 1; - val = tree_low_cst (cst, 1); + val = TREE_INT_CST_LOW (cst); if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT) val &= (((unsigned HOST_WIDE_INT) 1) << CHAR_TYPE_SIZE) - 1;
next prev parent reply other threads:[~2010-11-24 22:11 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-11-24 20:57 [Bug target/46647] New: " hjl.tools at gmail dot com 2010-11-24 21:01 ` [Bug middle-end/46647] " hjl.tools at gmail dot com 2010-11-24 21:01 ` [Bug target/46647] " hjl.tools at gmail dot com 2010-11-24 21:43 ` [Bug middle-end/46647] " hjl.tools at gmail dot com 2010-11-24 21:53 ` jakub at gcc dot gnu.org 2010-11-24 22:00 ` hjl.tools at gmail dot com 2010-11-24 22:06 ` hjl.tools at gmail dot com 2010-11-24 22:10 ` hjl.tools at gmail dot com 2010-11-24 22:11 ` jakub at gcc dot gnu.org 2010-11-24 22:22 ` hjl.tools at gmail dot com [this message] 2010-11-24 23:04 ` hjl.tools at gmail dot com 2010-11-25 14:40 ` hjl at gcc dot gnu.org 2010-11-26 9:51 ` jakub at gcc dot gnu.org 2010-11-28 14:37 ` hjl.tools 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-46647-4-9jbpSWXEk7@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).