aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-09-09 10:06:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-09-09 10:06:54 +0000
commita135b1c41c63e75ad1b8d74345eca520e973e2f9 (patch)
treea02c315a092276000b54f52506607d0102e2325c /gcc
parent6e548df501d6447f40d294f8fc01b7d8f3b72887 (diff)
downloadgcc-a135b1c41c63e75ad1b8d74345eca520e973e2f9.zip
gcc-a135b1c41c63e75ad1b8d74345eca520e973e2f9.tar.gz
gcc-a135b1c41c63e75ad1b8d74345eca520e973e2f9.tar.bz2
re PR tree-optimization/37433 (tree check: expected function_decl, have string_cst in ccp_fold, at tree-ssa-ccp.c:1050)
2008-09-09 Richard Guenther <rguenther@suse.de> PR tree-optimization/37433 * tree-ssa-ccp.c (ccp_fold): Properly guard folding of function calls. * gcc.c-torture/compile/pr37433.c: New testcase. From-SVN: r140143
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37433.c11
-rw-r--r--gcc/tree-ssa-ccp.c1
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c7848ff..970450b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2008-09-09 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/37433
+ * tree-ssa-ccp.c (ccp_fold): Properly guard folding of
+ function calls.
+
+2008-09-09 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/37387
* tree-ssa-ifcombine.c (ifcombine_iforif): Convert the name
and bits to a common type.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c83bb25..1378257 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2008-09-09 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/37433
+ * gcc.c-torture/compile/pr37433.c: New testcase.
+
+2008-09-09 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/37387
* gcc.c-torture/compile/pr37387.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433.c b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
new file mode 100644
index 0000000..0ba1179
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433.c
@@ -0,0 +1,11 @@
+int regex_subst(void)
+{
+ const void *subst = "";
+ return (*(int (*)(int))subst) (0);
+}
+
+int foobar (void)
+{
+ int x;
+ return (*(int (*)(void))&x) ();
+}
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 8f700c4..22626a5 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1047,6 +1047,7 @@ ccp_fold (gimple stmt)
fn = val->value;
}
if (TREE_CODE (fn) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
&& DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
{
tree *args = XALLOCAVEC (tree, gimple_call_num_args (stmt));