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 c/86869] ICE when taking address of array member of __memx struct pointer
Date: Mon, 04 Dec 2023 12:30:52 +0000	[thread overview]
Message-ID: <bug-86869-4-pyoWmvfvDL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-86869-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c
   Last reconfirmed|                            |2023-12-04
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It still ICEs.  The IL from the frontend looks wrong.  We have

  p = &s->y;

but we should have a ADDR_SPACE_CONVERT_EXPR here, but we have

 <decl_expr 0x7ffff6b2d7e0
    type <void_type 0x7ffff6a210a8 void VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6a210a8
        pointer_to_this <pointer_type 0x7ffff6a21150>>
    side-effects
    arg:0 <var_decl 0x7ffff6b62000 p
        type <pointer_type 0x7ffff6b45e70 type <array_type 0x7ffff6b45dc8>
            unsigned HI
...

and its DECL_INITIAL is

 <nop_expr 0x7ffff6b2d7c0
    type <pointer_type 0x7ffff6b45e70
        type <array_type 0x7ffff6b45dc8 type <integer_type 0x7ffff6a2a0a8 char>
            HI
            size <integer_cst 0x7ffff6a0ba98 constant 16>
            unit-size <integer_cst 0x7ffff6a0bab0 constant 2>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45dc8 domain <integer_type 0x7ffff6b45930>
            pointer_to_this <pointer_type 0x7ffff6b45e70>>
        unsigned HI size <integer_cst 0x7ffff6a0ba98 16> unit-size <integer_cst
0x7ffff6a0bab0 2>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45e70>
    readonly
    arg:0 <addr_expr 0x7ffff6b2d7a0
        type <pointer_type 0x7ffff6b45d20 type <array_type 0x7ffff6b45c78>
            unsigned HI size <integer_cst 0x7ffff6a0ba98 16> unit-size
<integer_cst 0x7ffff6a0bab0 2>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45d20>
        readonly
        arg:0 <component_ref 0x7ffff6b5f120 type <array_type 0x7ffff6b45c78>
            readonly
            arg:0 <indirect_ref 0x7ffff6b2d780 type <record_type 0x7ffff6b45a80
S address-space-7>
                readonly arg:0 <parm_decl 0x7ffff7fc8080 s>
                t.c:6:26 start: t.c:6:26 finish: t.c:6:27> arg:1 <field_decl
0x7ffff6a28e40 y>
            t.c:6:26 start: t.c:6:25 finish: t.c:6:28>
        t.c:6:24 start: t.c:6:24 finish: t.c:6:28>
    t.c:6:24 start: t.c:6:24 finish: t.c:6:28>

and the issue is that while the RECORD_TYPE has the correct address-space
qualification the array-type does not (the array-type component does).

That's the fault of the C frontend c_build_qualified_type which
special-cases ARRAY_TYPE and doesn't behave like build_array_type_1 would.

I have a fix.

       reply	other threads:[~2023-12-04 12:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-86869-4@http.gcc.gnu.org/bugzilla/>
2023-12-04 12:30 ` rguenth at gcc dot gnu.org [this message]
2023-12-05  7:31 ` cvs-commit at gcc dot gnu.org
2023-12-05  7:32 ` rguenth 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-86869-4-pyoWmvfvDL@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).