This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix tree-data-ref.c ICE on VIEW_CONVERT_EXPR<type>(0) (PR tree-optimization/33856)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sebastian Pop <spop at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 27 Oct 2007 12:10:02 -0400
- Subject: [PATCH] Fix tree-data-ref.c ICE on VIEW_CONVERT_EXPR<type>(0) (PR tree-optimization/33856)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
VIEW_CONVERT_EXPR<some_type>(0), while REFERENCE_CLASS_P, doesn't have any
base address and is really constant.
In get_references_in_stmt any operand which is DECL_P or REFERENCE_CLASS_P
is added to the references vector, but later on when for each references
vector entry it calls create_data_ref (but in other cases too)
get_base_address is called on it and expected to return non-NULL.
Either we handle get_base_address returning NULL in dr_analyze_alias
and disjoint_objects_p (and additionally need to analyze dr_analyze_indices
etc.), or we don't consider a reference to constant as a reference,
which is what the attached patch does.
Regtested on x86_64-linux, ok for trunk?
2007-10-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/33856
* tree-data-ref.c (get_references_in_stmt): Don't add
REFERENCE_CLASS_P trees to references vector if get_base_address
returns NULL on them.
* gcc.c-torture/compile/20071027-1.c: New test.
--- gcc/tree-data-ref.c.jj 2007-09-05 01:29:01.000000000 +0200
+++ gcc/tree-data-ref.c 2007-10-27 14:48:05.000000000 +0200
@@ -3953,7 +3953,7 @@ get_references_in_stmt (tree stmt, VEC (
op1 = &GIMPLE_STMT_OPERAND (stmt, 1);
if (DECL_P (*op1)
- || REFERENCE_CLASS_P (*op1))
+ || (REFERENCE_CLASS_P (*op1) && get_base_address (*op1)))
{
ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
ref->pos = op1;
@@ -3961,7 +3961,7 @@ get_references_in_stmt (tree stmt, VEC (
}
if (DECL_P (*op0)
- || REFERENCE_CLASS_P (*op0))
+ || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
{
ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
ref->pos = op0;
@@ -3978,7 +3978,7 @@ get_references_in_stmt (tree stmt, VEC (
op0 = &CALL_EXPR_ARG (call, i);
if (DECL_P (*op0)
- || REFERENCE_CLASS_P (*op0))
+ || (REFERENCE_CLASS_P (*op0) && get_base_address (*op0)))
{
ref = VEC_safe_push (data_ref_loc, heap, *references, NULL);
ref->pos = op0;
--- gcc/testsuite/gcc.c-torture/compile/20071027-1.c.jj 2007-10-27 14:09:23.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/20071027-1.c 2007-10-27 14:09:18.000000000 +0200
@@ -0,0 +1,25 @@
+/* PR tree-optimization/33856 */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+typedef struct z_key
+{
+ int key;
+ int mask;
+} z_key;
+typedef struct picture_size
+{
+ z_key key;
+} picture_size;
+
+void picture_size_new (picture_size *ps)
+{
+ z_key key;
+ ps->key = key;
+}
+
+void picture_sizes_load_default (picture_size *ps)
+{
+ int i;
+ for (i = 0; i < 5; ++i)
+ picture_size_new (ps);
+}
Jakub