aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-08-18 13:41:27 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-08-18 13:41:27 +0000
commit41dd7cf7479cd0051e4a7baa7e680d7bb02af331 (patch)
tree0e5342264c77f1513865bd33dd1eb5a9dcb91b25 /gcc
parentec8a2131b6a1384c71a69eb0ca24b234621437b6 (diff)
downloadgcc-41dd7cf7479cd0051e4a7baa7e680d7bb02af331.zip
gcc-41dd7cf7479cd0051e4a7baa7e680d7bb02af331.tar.gz
gcc-41dd7cf7479cd0051e4a7baa7e680d7bb02af331.tar.bz2
re PR middle-end/67222 (ICE in gimple_call_arg with bogus posix_memalign)
PR middle-end/67222 * gimple-low.c (lower_stmt): Don't lower BUILT_IN_POSIX_MEMALIGN if the call isn't valid. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Check builtins using gimple_call_builtin_p. (call_may_clobber_ref_p_1): Likewise. (stmt_kills_ref_p): Likewise. * gcc.dg/torture/pr67222.c: New test. From-SVN: r226969
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/gimple-low.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr67222.c19
-rw-r--r--gcc/tree-ssa-alias.c6
5 files changed, 39 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dcd5d47..90b7893 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2015-08-18 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/67222
+ * gimple-low.c (lower_stmt): Don't lower BUILT_IN_POSIX_MEMALIGN
+ if the call isn't valid.
+ * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Check builtins using
+ gimple_call_builtin_p.
+ (call_may_clobber_ref_p_1): Likewise.
+ (stmt_kills_ref_p): Likewise.
+
2015-08-18 Robert Suchanek <robert.suchanek@imgtec.com>
* config/mips/mips-protos.h (mips_hard_regno_rename_ok): New prototype.
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index d4697e2..4eae3a0 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -346,7 +346,8 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
return;
}
else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_POSIX_MEMALIGN
- && flag_tree_bit_ccp)
+ && flag_tree_bit_ccp
+ && gimple_builtin_call_types_compatible_p (stmt, decl))
{
lower_builtin_posix_memalign (gsi);
return;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aff223c..97322ac 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-18 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/67222
+ * gcc.dg/torture/pr67222.c: New test.
+
2015-08-18 Robert Suchanek <robert.suchanek@imgtec.com>
* gcc.target/mips/interrupt_handler-bug-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr67222.c b/gcc/testsuite/gcc.dg/torture/pr67222.c
new file mode 100644
index 0000000..739f869
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr67222.c
@@ -0,0 +1,19 @@
+/* PR middle-end/67222 */
+/* { dg-do compile } */
+
+void
+foo (void **p)
+{
+ posix_memalign (); /* { dg-warning "implicit declaration" } */
+ posix_memalign (p);
+ posix_memalign (0);
+ posix_memalign (p, 1);
+ posix_memalign (p, "foo");
+ posix_memalign ("gnu", "gcc");
+ posix_memalign (1, p);
+ posix_memalign (1, 2);
+ posix_memalign (1, 2, 3);
+ posix_memalign (p, p, p);
+ posix_memalign (p, "qui", 3);
+ posix_memalign (p, 1, 2);
+}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index e103220..0445052 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1535,7 +1535,7 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref)
escape points. See tree-ssa-structalias.c:find_func_aliases
for the list of builtins we might need to handle here. */
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && gimple_call_builtin_p (call, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
{
/* All the following functions read memory pointed to by
@@ -1941,7 +1941,7 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref)
escape points. See tree-ssa-structalias.c:find_func_aliases
for the list of builtins we might need to handle here. */
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && gimple_call_builtin_p (call, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
{
/* All the following functions clobber memory pointed to by
@@ -2341,7 +2341,7 @@ stmt_kills_ref_p (gimple stmt, ao_ref *ref)
{
tree callee = gimple_call_fndecl (stmt);
if (callee != NULL_TREE
- && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+ && gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_FREE: