public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
@ 2020-04-03 19:29 tk at giga dot or.at
  2020-04-06  6:35 ` [Bug target/94479] " rguenth at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: tk at giga dot or.at @ 2020-04-03 19:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

            Bug ID: 94479
           Summary: NetBSD: internal compiler error: in
                    recompute_tree_invariant_for_addr_expr
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tk at giga dot or.at
  Target Milestone: ---

When compiling git-2.26.0 with gcc 8.3.0, 8.4.0, or 9.3.0 on NetBSD/amd64 with
-fstack-check, I see (output from 8.4.0):


builtin/rebase.c: In function 'cmd_rebase__interactive':
builtin/rebase.c:473:41: internal compiler error: in
recompute_tree_invariant_for_addr_expr, at tree.c:4487
   { OPTION_CALLBACK, 'k', "keep-empty", &options, NULL,
                                         ^~~~~~~~

I used creduce to get a minimal test case, save the following to rebase.i and
run:
# gcc -o rebase.o -c -fstack-check rebase.i

---- begin ----
int a;
struct b {
  char c;
  void *d;  
};
struct b e() {
  struct b f[] = {{}, "", f, a};
}
---- end ----

I tried running this in 8.3.0 and 9.3.0 on https://godbolt.org/ (where I had to
add -fpermissive for it to compile) but it doesn't seem to trigger the problem
there. So perhaps it's fine on Linux.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
@ 2020-04-06  6:35 ` rguenth at gcc dot gnu.org
  2020-04-06  6:40 ` tk at giga dot or.at
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-06  6:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-06
          Component|c                           |target
             Target|                            |x86_64-netbsd
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you provide a full backtrace of the ICE?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
  2020-04-06  6:35 ` [Bug target/94479] " rguenth at gcc dot gnu.org
@ 2020-04-06  6:40 ` tk at giga dot or.at
  2020-04-06 17:12 ` tk at giga dot or.at
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tk at giga dot or.at @ 2020-04-06  6:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #2 from Thomas Klausner <tk at giga dot or.at> ---
I can provide one for gcc 8.3.0:

rebase.i: In function ‘e’:
rebase.i:7:23: warning: initialization of ‘char’ from ‘char *’ makes integer
from pointer without a cast [-Wint-conversion]
   struct b f[] = {{}, "", f, a};
                       ^~
rebase.i:7:23: note: (near initialization for ‘f[1].c’)
rebase.i:7:27: internal compiler error: in
recompute_tree_invariant_for_addr_expr, at tree.c:4487
   struct b f[] = {{}, "", f, a};
                           ^
0x12d5513 recompute_tree_invariant_for_addr_expr(tree_node*)
        ../../gcc-8.3.0/gcc/tree.c:4487
0x7d57b2 gimplify_addr_expr
        ../../gcc-8.3.0/gcc/gimplify.c:6080
0x7d57b2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11577
0x7dd9b8 gimplify_modify_expr
        ../../gcc-8.3.0/gcc/gimplify.c:5649
0x7d4c56 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11530
0x7d6f48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6686
0x7d70d6 gimplify_and_add(tree_node*, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:441
0x7d70d6 gimplify_init_ctor_eval
        ../../gcc-8.3.0/gcc/gimplify.c:4602
0x7d6fe4 gimplify_init_ctor_eval
        ../../gcc-8.3.0/gcc/gimplify.c:4597
0x7da0ec gimplify_init_constructor
        ../../gcc-8.3.0/gcc/gimplify.c:4998
0x7daa62 gimplify_modify_expr_rhs
        ../../gcc-8.3.0/gcc/gimplify.c:5261
0x7dd931 gimplify_modify_expr_rhs
        ../../gcc-8.3.0/gcc/gimplify.c:5149
0x7dd931 gimplify_modify_expr
        ../../gcc-8.3.0/gcc/gimplify.c:5604
0x7d4c56 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11530
0x7d6f48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6686
0x7dca80 gimplify_and_add(tree_node*, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:441
0x7dca80 gimplify_decl_expr
        ../../gcc-8.3.0/gcc/gimplify.c:1711
0x7d5512 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11727
0x7d6f48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6686
0x7d77ee gimplify_bind_expr
        ../../gcc-8.3.0/gcc/gimplify.c:1331
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
  2020-04-06  6:35 ` [Bug target/94479] " rguenth at gcc dot gnu.org
  2020-04-06  6:40 ` tk at giga dot or.at
@ 2020-04-06 17:12 ` tk at giga dot or.at
  2020-04-07  6:11 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tk at giga dot or.at @ 2020-04-06 17:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #3 from Thomas Klausner <tk at giga dot or.at> ---
Here's a backtrace from 9.3.0:

rebase.i:5:1: warning: no semicolon at end of struct or union
    5 | } e() {
      | ^
rebase.i: In function 'e':
rebase.i:6:23: warning: initialization of 'char' from 'char *' makes integer
from pointer without a cast [-Wint-conversion]
    6 |   struct b f[] = {{}, "", f, a};
      |                       ^~
rebase.i:6:23: note: (near initialization for 'f[1].c')
rebase.i:6:27: internal compiler error: in
recompute_tree_invariant_for_addr_expr, at tree.c:4556
    6 |   struct b f[] = {{}, "", f, a};
      |                           ^
0x1399587 recompute_tree_invariant_for_addr_expr(tree_node*)
        ../.././gcc/tree.c:4556
0xc37df2 gimplify_addr_expr
        ../.././gcc/gimplify.c:6101
0xc5824a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../.././gcc/gimplify.c:12556
0xc36133 gimplify_modify_expr
        ../.././gcc/gimplify.c:5671
0xc57eca gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../.././gcc/gimplify.c:12509
0xc3a4aa gimplify_stmt(tree_node**, gimple**)
        ../.././gcc/gimplify.c:6719
0xc2545a gimplify_and_add(tree_node*, gimple**)
        ../.././gcc/gimplify.c:466
0xc331ef gimplify_init_ctor_eval
        ../.././gcc/gimplify.c:4625
0xc3319c gimplify_init_ctor_eval
        ../.././gcc/gimplify.c:4620
0xc34375 gimplify_init_constructor
        ../.././gcc/gimplify.c:5015
0xc34ee6 gimplify_modify_expr_rhs
        ../.././gcc/gimplify.c:5279
0xc36006 gimplify_modify_expr
        ../.././gcc/gimplify.c:5626
0xc57eca gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../.././gcc/gimplify.c:12509
0xc3a4aa gimplify_stmt(tree_node**, gimple**)
        ../.././gcc/gimplify.c:6719
0xc2545a gimplify_and_add(tree_node*, gimple**)
        ../.././gcc/gimplify.c:466
0xc29558 gimplify_decl_expr
        ../.././gcc/gimplify.c:1741
0xc58c1c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../.././gcc/gimplify.c:12706
0xc3a4aa gimplify_stmt(tree_node**, gimple**)
        ../.././gcc/gimplify.c:6719
0xc27e27 gimplify_bind_expr
        ../.././gcc/gimplify.c:1362
0xc58c3d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../.././gcc/gimplify.c:12710
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (2 preceding siblings ...)
  2020-04-06 17:12 ` tk at giga dot or.at
@ 2020-04-07  6:11 ` rguenth at gcc dot gnu.org
  2020-04-07  6:29 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-07  6:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|WAITING                     |ASSIGNED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, that's

      /* The FEs may end up building ADDR_EXPRs early on a decl with
         an incomplete type.  Re-build ADDR_EXPRs in canonical form
         here.  */
      if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr))))
        *expr_p = build_fold_addr_expr (op0);

      /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly.  */
      recompute_tree_invariant_for_addr_expr (*expr_p);

and I can very well imagine build_fold_addr_expr not producing an ADDR_EXPR.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (3 preceding siblings ...)
  2020-04-07  6:11 ` rguenth at gcc dot gnu.org
@ 2020-04-07  6:29 ` rguenth at gcc dot gnu.org
  2020-04-07 13:26 ` tk at giga dot or.at
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-07  6:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I still can't reproduce the issue so can you please test the following patch
ontop of GCC 9?  It probably applies to GCC 8 as well.  Thanks.

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index bd8bd6d7e06..fb4a03eacd2 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6095,7 +6095,10 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p)
         an incomplete type.  Re-build ADDR_EXPRs in canonical form
         here.  */
       if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr))))
-       *expr_p = build_fold_addr_expr (op0);
+       {
+         *expr_p = build_fold_addr_expr (op0);
+         STRIP_USELESS_TYPE_CONVERSION (*expr_p);
+       }

       /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly.  */
       recompute_tree_invariant_for_addr_expr (*expr_p);

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (4 preceding siblings ...)
  2020-04-07  6:29 ` rguenth at gcc dot gnu.org
@ 2020-04-07 13:26 ` tk at giga dot or.at
  2020-04-07 14:29 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tk at giga dot or.at @ 2020-04-07 13:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #6 from Thomas Klausner <tk at giga dot or.at> ---
I can most easily test 8.3.0. I adapted your patch:

--- gcc/gimplify.c.orig 2019-02-07 14:44:31.000000000 +0000
+++ gcc/gimplify.c
@@ -6074,7 +6074,10 @@ gimplify_addr_expr (tree *expr_p, gimple
         an incomplete type.  Re-build ADDR_EXPRs in canonical form
         here.  */
       if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr))))
+      {
        *expr_p = build_fold_addr_expr (op0);
+       STRIP_USELESS_TYPE_CONVERSION (*expr_p);
+      }

       /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly.  */
       recompute_tree_invariant_for_addr_expr (*expr_p);

but it still fails:

rebase.i: In function ‘e’:
rebase.i:7:23: warning: initialization of ‘char’ from ‘char *’ makes integer
from pointer without a cast [-Wint-conversion]
   struct b f[] = {{}, "", f, a};
                       ^~
rebase.i:7:23: note: (near initialization for ‘f[1].c’)
rebase.i:7:27: internal compiler error: in
recompute_tree_invariant_for_addr_expr, at tree.c:4487
   struct b f[] = {{}, "", f, a};
                           ^
0x12d5503 recompute_tree_invariant_for_addr_expr(tree_node*)
        ../../gcc-8.3.0/gcc/tree.c:4487
0x7d57be gimplify_addr_expr
        ../../gcc-8.3.0/gcc/gimplify.c:6083
0x7d57be gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11580
0x7dd9c8 gimplify_modify_expr
        ../../gcc-8.3.0/gcc/gimplify.c:5649
0x7d4c56 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11533
0x7d6f58 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6689
0x7d70e6 gimplify_and_add(tree_node*, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:441
0x7d70e6 gimplify_init_ctor_eval
        ../../gcc-8.3.0/gcc/gimplify.c:4602
0x7d6ff4 gimplify_init_ctor_eval
        ../../gcc-8.3.0/gcc/gimplify.c:4597
0x7da0fc gimplify_init_constructor
        ../../gcc-8.3.0/gcc/gimplify.c:4998
0x7daa72 gimplify_modify_expr_rhs
        ../../gcc-8.3.0/gcc/gimplify.c:5261
0x7dd941 gimplify_modify_expr_rhs
        ../../gcc-8.3.0/gcc/gimplify.c:5149
0x7dd941 gimplify_modify_expr
        ../../gcc-8.3.0/gcc/gimplify.c:5604
0x7d4c56 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11533
0x7d6f58 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6689
0x7dca90 gimplify_and_add(tree_node*, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:441
0x7dca90 gimplify_decl_expr
        ../../gcc-8.3.0/gcc/gimplify.c:1711
0x7d5512 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-8.3.0/gcc/gimplify.c:11730
0x7d6f58 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-8.3.0/gcc/gimplify.c:6689
0x7d77fe gimplify_bind_expr
        ../../gcc-8.3.0/gcc/gimplify.c:1331
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (5 preceding siblings ...)
  2020-04-07 13:26 ` tk at giga dot or.at
@ 2020-04-07 14:29 ` rguenth at gcc dot gnu.org
  2020-04-07 17:22 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-07 14:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, built a cross to x86_64-netbsd and I see we go from

Breakpoint 8, gimplify_addr_expr (expr_p=0x7ffff6cdec28, pre_p=0x7fffffffd8b0, 
    post_p=0x7fffffffcc40) at /space/rguenther/src/gcc/gcc/gimplify.c:6171
6171          ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p,
(gdb) p debug_tree (expr)
 <addr_expr 0x7ffff6d050c0
    type <pointer_type 0x7ffff6ce23f0
        type <array_type 0x7ffff6ce2e70 type <record_type 0x7ffff6ce2c78 b>
            BLK
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce2e70
            pointer_to_this <pointer_type 0x7ffff6ce23f0>>
        unsigned DI
        size <integer_cst 0x7ffff6bb7cd8 constant 64>
        unit-size <integer_cst 0x7ffff6bb7cf0 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce23f0>

    arg:0 <var_decl 0x7ffff7fefbd0 f
        type <array_type 0x7ffff6ce2498 type <record_type 0x7ffff6ce2c78 b>
            sizes-gimplified BLK
            size <integer_cst 0x7ffff6bd53a8 constant 384>
            unit-size <integer_cst 0x7ffff6ce9d08 constant 48>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce2498 domain <integer_type 0x7ffff6ce2540>
            pointer_to_this <pointer_type 0x7ffff6ce25e8>>
        addressable used read BLK t.c:7:14 size <integer_cst 0x7ffff6bd53a8
384> unit-size <integer_cst 0x7ffff6ce9d08 48>
        align:64 warn_if_not_align:0 context <function_decl 0x7ffff6d03000 e>
        value-expr <indirect_ref 0x7ffff6d05160 type <array_type
0x7ffff6ce2498>
            nothrow arg:0 <var_decl 0x7ffff7fefc60 f.0>>>
    t.c:7:29 start: t.c:7:29 finish: t.c:7:29>

to

6178          prepare_gimple_addressable (&TREE_OPERAND (expr, 0), pre_p);
(gdb) p debug_tree (expr)
 <addr_expr 0x7ffff6d050c0
    type <pointer_type 0x7ffff6ce23f0
        type <array_type 0x7ffff6ce2e70 type <record_type 0x7ffff6ce2c78 b>
            BLK
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce2e70
            pointer_to_this <pointer_type 0x7ffff6ce23f0>>
        unsigned DI
        size <integer_cst 0x7ffff6bb7cd8 constant 64>
        unit-size <integer_cst 0x7ffff6bb7cf0 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce23f0>

    arg:0 <mem_ref 0x7ffff6cdec30
        type <array_type 0x7ffff6ce2498 type <record_type 0x7ffff6ce2c78 b>
            sizes-gimplified BLK
            size <integer_cst 0x7ffff6bd53a8 constant 384>
            unit-size <integer_cst 0x7ffff6ce9d08 constant 48>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6ce2498 domain <integer_type 0x7ffff6ce2540>
            pointer_to_this <pointer_type 0x7ffff6ce25e8>>
        nothrow
        arg:0 <var_decl 0x7ffff7fefc60 f.0 type <pointer_type 0x7ffff6ce25e8>
            used unsigned DI t.c:7:14 size <integer_cst 0x7ffff6bb7cd8 64>
unit-size <integer_cst 0x7ffff6bb7cf0 8>
            align:64 warn_if_not_align:0 context <function_decl 0x7ffff6d03000
e>>
        arg:1 <integer_cst 0x7ffff6ce9e28 constant 0>
        t.c:7:29 start: t.c:7:29 finish: t.c:7:29>
    t.c:7:29 start: t.c:7:29 finish: t.c:7:29>

via the DECL_VALUE_EXPR of 'f'.  Now we're basically the do_indirect_ref
case but via MEM_REF but we're only checking for INDIRECT_REF here.

The following fixes the cross compilation for me:

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 787435c38cd..8cdfae26510 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -6181,7 +6181,9 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p)

       /* For various reasons, the gimplification of the expression
         may have made a new INDIRECT_REF.  */
-      if (TREE_CODE (op0) == INDIRECT_REF)
+      if (TREE_CODE (op0) == INDIRECT_REF
+         || (TREE_CODE (op0) == MEM_REF
+             && integer_zerop (TREE_OPERAND (op0, 1))))
        goto do_indirect_ref;

       mark_addressable (TREE_OPERAND (expr, 0));

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (6 preceding siblings ...)
  2020-04-07 14:29 ` rguenth at gcc dot gnu.org
@ 2020-04-07 17:22 ` cvs-commit at gcc dot gnu.org
  2020-04-07 17:23 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-07 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:3d947f1f27188e3a61ba7f42399b1c348469fe13

commit r10-7604-g3d947f1f27188e3a61ba7f42399b1c348469fe13
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 7 16:29:37 2020 +0200

    middle-end/94479 - fix gimplification of address

    When gimplifying an address operand we may expose an indirect
    ref via DECL_VALUE_EXPR for example.  This is dealt with in the
    code already but it fails to consider that INDIRECT_REFs get
    gimplified to MEM_REFs.

    Fixed which makes the ICE observed on x86_64-netbsd go away.

    2020-04-07  Richard Biener  <rguenther@suse.de>

            PR middle-end/94479
            * gimplify.c (gimplify_addr_expr): Also consider generated
            MEM_REFs.

            * gcc.dg/torture/pr94479.c: New testcase.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (7 preceding siblings ...)
  2020-04-07 17:22 ` cvs-commit at gcc dot gnu.org
@ 2020-04-07 17:23 ` rguenth at gcc dot gnu.org
  2020-04-08  6:53 ` tk at giga dot or.at
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-07 17:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.0

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (8 preceding siblings ...)
  2020-04-07 17:23 ` rguenth at gcc dot gnu.org
@ 2020-04-08  6:53 ` tk at giga dot or.at
  2020-04-08  7:15 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: tk at giga dot or.at @ 2020-04-08  6:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #10 from Thomas Klausner <tk at giga dot or.at> ---
Thank you for the quick fix!
It works for me as well.

Just for my education, why is this problem only visible on NetBSD and not e.g.
Linux?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (9 preceding siblings ...)
  2020-04-08  6:53 ` tk at giga dot or.at
@ 2020-04-08  7:15 ` rguenther at suse dot de
  2020-04-16 12:29 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenther at suse dot de @ 2020-04-08  7:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 8 Apr 2020, tk at giga dot or.at wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479
> 
> --- Comment #10 from Thomas Klausner <tk at giga dot or.at> ---
> Thank you for the quick fix!
> It works for me as well.
> 
> Just for my education, why is this problem only visible on NetBSD and not e.g.
> Linux?

I have no idea ...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (10 preceding siblings ...)
  2020-04-08  7:15 ` rguenther at suse dot de
@ 2020-04-16 12:29 ` cvs-commit at gcc dot gnu.org
  2021-03-17 10:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-16 12:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:0f1cf13ecee1b4f9d963426b35acb5a0625816c4

commit r9-8503-g0f1cf13ecee1b4f9d963426b35acb5a0625816c4
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 7 16:29:37 2020 +0200

    middle-end/94479 - fix gimplification of address

    When gimplifying an address operand we may expose an indirect
    ref via DECL_VALUE_EXPR for example.  This is dealt with in the
    code already but it fails to consider that INDIRECT_REFs get
    gimplified to MEM_REFs.

    Fixed which makes the ICE observed on x86_64-netbsd go away.

    2020-04-07  Richard Biener  <rguenther@suse.de>

            PR middle-end/94479
            * gimplify.c (gimplify_addr_expr): Also consider generated
            MEM_REFs.

            * gcc.dg/torture/pr94479.c: New testcase.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (11 preceding siblings ...)
  2020-04-16 12:29 ` cvs-commit at gcc dot gnu.org
@ 2021-03-17 10:20 ` cvs-commit at gcc dot gnu.org
  2021-03-17 10:20 ` rguenth at gcc dot gnu.org
  2021-09-11 14:29 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-17 10:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:27b298a840e5046ac8a8e045b580128a88d25c44

commit r8-10799-g27b298a840e5046ac8a8e045b580128a88d25c44
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 7 16:29:37 2020 +0200

    middle-end/94479 - fix gimplification of address

    When gimplifying an address operand we may expose an indirect
    ref via DECL_VALUE_EXPR for example.  This is dealt with in the
    code already but it fails to consider that INDIRECT_REFs get
    gimplified to MEM_REFs.

    Fixed which makes the ICE observed on x86_64-netbsd go away.

    2020-04-07  Richard Biener  <rguenther@suse.de>

            PR middle-end/94479
            * gimplify.c (gimplify_addr_expr): Also consider generated
            MEM_REFs.

            * gcc.dg/torture/pr94479.c: New testcase.

    (cherry picked from commit 0f1cf13ecee1b4f9d963426b35acb5a0625816c4)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (12 preceding siblings ...)
  2021-03-17 10:20 ` cvs-commit at gcc dot gnu.org
@ 2021-03-17 10:20 ` rguenth at gcc dot gnu.org
  2021-09-11 14:29 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-17 10:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.4.1
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |8.4.0

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
  2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
                   ` (13 preceding siblings ...)
  2021-03-17 10:20 ` rguenth at gcc dot gnu.org
@ 2021-09-11 14:29 ` pinskia at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-11 14:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94479

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-09-11 14:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 19:29 [Bug c/94479] New: NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr tk at giga dot or.at
2020-04-06  6:35 ` [Bug target/94479] " rguenth at gcc dot gnu.org
2020-04-06  6:40 ` tk at giga dot or.at
2020-04-06 17:12 ` tk at giga dot or.at
2020-04-07  6:11 ` rguenth at gcc dot gnu.org
2020-04-07  6:29 ` rguenth at gcc dot gnu.org
2020-04-07 13:26 ` tk at giga dot or.at
2020-04-07 14:29 ` rguenth at gcc dot gnu.org
2020-04-07 17:22 ` cvs-commit at gcc dot gnu.org
2020-04-07 17:23 ` rguenth at gcc dot gnu.org
2020-04-08  6:53 ` tk at giga dot or.at
2020-04-08  7:15 ` rguenther at suse dot de
2020-04-16 12:29 ` cvs-commit at gcc dot gnu.org
2021-03-17 10:20 ` cvs-commit at gcc dot gnu.org
2021-03-17 10:20 ` rguenth at gcc dot gnu.org
2021-09-11 14:29 ` pinskia at gcc dot gnu.org

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).