* [PATCH] Fix tree-data-ref.c ICE (PR tree-optimization/71872)
@ 2016-07-14 15:28 Jakub Jelinek
2016-07-14 16:09 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-07-14 15:28 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
As mentioned in the PR, we ICE on the following testcase, because
tree-data-ref.c for VIEW_CONVERT_EXPR<struct S>(0) attempts to create
ADDR_EXPR of INTEGER_CST, which is not really valid.
I've successfully bootstrapped/regtested earlier version of this patch
with is_gimple_constant instead of is_gimple_min_invariant on x86_64-linux
and i686-linux, ok for trunk if even this version succeeds?
2016-07-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/71872
* tree-data-ref.c (get_references_in_stmt): Ignore references
with is_gimple_constant get_base_address.
* gcc.c-torture/compile/pr71872.c: New test.
--- gcc/tree-data-ref.c.jj 2016-07-11 22:18:08.000000000 +0200
+++ gcc/tree-data-ref.c 2016-07-14 14:03:57.902899566 +0200
@@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, ve
if (DECL_P (op1)
|| (REFERENCE_CLASS_P (op1)
&& (base = get_base_address (op1))
- && TREE_CODE (base) != SSA_NAME))
+ && TREE_CODE (base) != SSA_NAME
+ && !is_gimple_min_invariant (base)))
{
ref.ref = op1;
ref.is_read = true;
--- gcc/testsuite/gcc.c-torture/compile/pr71872.c.jj 2016-07-14 14:14:17.132889043 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr71872.c 2016-07-14 14:14:05.000000000 +0200
@@ -0,0 +1,15 @@
+/* PR tree-optimization/71872 */
+
+struct __attribute__((may_alias)) S { int a; };
+
+void
+foo (int *x, struct S *y)
+{
+ int i;
+ for (i = 0; i < 16; i++)
+ {
+ int a = 0;
+ if (*x)
+ *(struct S *) y = *(struct S *) &a;
+ }
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix tree-data-ref.c ICE (PR tree-optimization/71872)
2016-07-14 15:28 [PATCH] Fix tree-data-ref.c ICE (PR tree-optimization/71872) Jakub Jelinek
@ 2016-07-14 16:09 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-07-14 16:09 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On July 14, 2016 5:28:03 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>As mentioned in the PR, we ICE on the following testcase, because
>tree-data-ref.c for VIEW_CONVERT_EXPR<struct S>(0) attempts to create
>ADDR_EXPR of INTEGER_CST, which is not really valid.
>
>I've successfully bootstrapped/regtested earlier version of this patch
>with is_gimple_constant instead of is_gimple_min_invariant on
>x86_64-linux
>and i686-linux, ok for trunk if even this version succeeds?
OK.
Richard.
>2016-07-14 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/71872
> * tree-data-ref.c (get_references_in_stmt): Ignore references
> with is_gimple_constant get_base_address.
>
> * gcc.c-torture/compile/pr71872.c: New test.
>
>--- gcc/tree-data-ref.c.jj 2016-07-11 22:18:08.000000000 +0200
>+++ gcc/tree-data-ref.c 2016-07-14 14:03:57.902899566 +0200
>@@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, ve
> if (DECL_P (op1)
> || (REFERENCE_CLASS_P (op1)
> && (base = get_base_address (op1))
>- && TREE_CODE (base) != SSA_NAME))
>+ && TREE_CODE (base) != SSA_NAME
>+ && !is_gimple_min_invariant (base)))
> {
> ref.ref = op1;
> ref.is_read = true;
>--- gcc/testsuite/gcc.c-torture/compile/pr71872.c.jj 2016-07-14
>14:14:17.132889043 +0200
>+++ gcc/testsuite/gcc.c-torture/compile/pr71872.c 2016-07-14
>14:14:05.000000000 +0200
>@@ -0,0 +1,15 @@
>+/* PR tree-optimization/71872 */
>+
>+struct __attribute__((may_alias)) S { int a; };
>+
>+void
>+foo (int *x, struct S *y)
>+{
>+ int i;
>+ for (i = 0; i < 16; i++)
>+ {
>+ int a = 0;
>+ if (*x)
>+ *(struct S *) y = *(struct S *) &a;
>+ }
>+}
>
> Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-14 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 15:28 [PATCH] Fix tree-data-ref.c ICE (PR tree-optimization/71872) Jakub Jelinek
2016-07-14 16:09 ` 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).