public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94479] NetBSD: internal compiler error: in recompute_tree_invariant_for_addr_expr
Date: Tue, 07 Apr 2020 14:29:22 +0000	[thread overview]
Message-ID: <bug-94479-4-JY3KWeP7BG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94479-4@http.gcc.gnu.org/bugzilla/>

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

  parent reply	other threads:[~2020-04-07 14:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 19:29 [Bug c/94479] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94479-4-JY3KWeP7BG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).