From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Another non-prototype builtin issue (PR middle-end/55890)
Date: Mon, 07 Jan 2013 21:04:00 -0000 [thread overview]
Message-ID: <20130107210353.GH7269@tucnak.redhat.com> (raw)
Hi!
evaluate_stmt can be crashed similarly to what you've fixed today.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2013-01-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/55890
* tree-ssa-ccp.c (evaluate_stmt): Use gimple_call_builtin_p.
* gcc.dg/torture/pr55890-3.c: New test.
--- gcc/tree-ssa-ccp.c.jj 2012-11-19 14:41:17.000000000 +0100
+++ gcc/tree-ssa-ccp.c 2013-01-07 18:53:39.952854381 +0100
@@ -1546,7 +1546,6 @@ evaluate_stmt (gimple stmt)
&& !is_constant)
{
enum gimple_code code = gimple_code (stmt);
- tree fndecl;
val.lattice_val = VARYING;
val.value = NULL_TREE;
val.mask = double_int_minus_one;
@@ -1593,10 +1592,9 @@ evaluate_stmt (gimple stmt)
|| POINTER_TYPE_P (TREE_TYPE (rhs1)))
val = bit_value_binop (code, TREE_TYPE (rhs1), rhs1, rhs2);
}
- else if (code == GIMPLE_CALL
- && (fndecl = gimple_call_fndecl (stmt))
- && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
{
+ tree fndecl = gimple_call_fndecl (stmt);
switch (DECL_FUNCTION_CODE (fndecl))
{
case BUILT_IN_MALLOC:
--- gcc/testsuite/gcc.dg/torture/pr55890-3.c.jj 2013-01-07 18:51:27.415614201 +0100
+++ gcc/testsuite/gcc.dg/torture/pr55890-3.c 2013-01-07 18:51:22.864640151 +0100
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void *memmove ();
+
+void *
+bar ()
+{
+ return memmove ();
+}
Jakub
next reply other threads:[~2013-01-07 21:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 21:04 Jakub Jelinek [this message]
2013-01-08 8:24 ` Richard Biener
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=20130107210353.GH7269@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).