aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-07-11 12:44:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-07-11 12:44:26 +0000
commit941a9479d0a4d5fb26182ee6c485c4bf210a6499 (patch)
tree29119b8b42e6cea42c417962f700ad7f2f026831 /gcc
parentd5e1c95e49927a55aef30e2c8f4091fdd49aba2d (diff)
downloadgcc-941a9479d0a4d5fb26182ee6c485c4bf210a6499.zip
gcc-941a9479d0a4d5fb26182ee6c485c4bf210a6499.tar.gz
gcc-941a9479d0a4d5fb26182ee6c485c4bf210a6499.tar.bz2
re PR tree-optimization/36765 (Revision 137573 miscompiles 464.h264ref in SPEC CPU 2006)
2008-07-11 Richard Guenther <rguenther@suse.de> PR tree-optimization/36765 * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add aliases from HEAP vars to SMTs. * gcc.c-torture/execute/pr36765.c: New testcase. From-SVN: r137715
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr36765.c15
-rw-r--r--gcc/tree-ssa-alias.c20
4 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e5d68ed..04004fa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-11 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36765
+ * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Add
+ aliases from HEAP vars to SMTs.
+
2008-07-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (LOOSE_WARN, STRICT_WARN): Update comments.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0b83fa5..f26bcbf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-11 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36765
+ * gcc.c-torture/execute/pr36765.c: New testcase.
+
2008-07-10 Joseph Myers <joseph@codesourcery.com>
PR middle-end/29056
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36765.c b/gcc/testsuite/gcc.c-torture/execute/pr36765.c
new file mode 100644
index 0000000..6883b0c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr36765.c
@@ -0,0 +1,15 @@
+int __attribute__((noinline))
+foo(int i)
+{
+ int *p = __builtin_malloc (4 * sizeof(int));
+ *p = 0;
+ p[i] = 1;
+ return *p;
+}
+extern void abort (void);
+int main()
+{
+ if (foo(0) != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d4a1e21..3aa79fe 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2370,6 +2370,8 @@ have_common_aliases_p (bitmap tag1aliases, bitmap tag2aliases)
static void
compute_flow_insensitive_aliasing (struct alias_info *ai)
{
+ referenced_var_iterator rvi;
+ tree var;
size_t i;
timevar_push (TV_FLOW_INSENSITIVE);
@@ -2460,6 +2462,24 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
add_may_alias (tag1, tag2);
}
}
+
+ /* We have to add all HEAP variables to all SMTs aliases bitmaps.
+ As we don't know which effective type the HEAP will have we cannot
+ do better here and we need the conflicts with obfuscated pointers
+ (a simple (*(int[n] *)ptr)[i] will do, with ptr from a VLA array
+ allocation). */
+ for (i = 0; i < ai->num_pointers; i++)
+ {
+ struct alias_map_d *p_map = ai->pointers[i];
+ tree tag = symbol_mem_tag (p_map->var);
+
+ FOR_EACH_REFERENCED_VAR (var, rvi)
+ {
+ if (var_ann (var)->is_heapvar)
+ add_may_alias (tag, var);
+ }
+ }
+
timevar_pop (TV_FLOW_INSENSITIVE);
}