* [PATCH] Another non-prototype builtin issue (PR middle-end/55890)
@ 2013-01-07 21:04 Jakub Jelinek
2013-01-08 8:24 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-01-07 21:04 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Another non-prototype builtin issue (PR middle-end/55890)
2013-01-07 21:04 [PATCH] Another non-prototype builtin issue (PR middle-end/55890) Jakub Jelinek
@ 2013-01-08 8:24 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-01-08 8:24 UTC (permalink / raw)
To: Jakub Jelinek, Jakub Jelinek; +Cc: gcc-patches
Jakub Jelinek <jakub@redhat.com> wrote:
>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?
Ok.
Thanks,
Richard.
>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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-08 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-07 21:04 [PATCH] Another non-prototype builtin issue (PR middle-end/55890) Jakub Jelinek
2013-01-08 8:24 ` Richard Biener
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).