public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ibuclaw at gdcproject dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug d/110712] d: ICE: verify_gimple_failed (conversion of register to a different size in 'view_convert_expr')
Date: Wed, 19 Jul 2023 15:16:42 +0000	[thread overview]
Message-ID: <bug-110712-4-kItLSDQPm7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110712-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
(In reply to Richard Biener from comment #1)
> this_2(D)->ap = VIEW_CONVERT_EXPR<struct [1]>(ap_3(D));
> 
> it looks odd since ap_3(D) is a is_gimple_reg but a struct[1] definitely
> would not.  Maybe you are missing a dereference here?  In C
> struct[1] would decay to a pointer so
> 
>  this.ap = ap;
> 
> wouldn't work (besides that va_list copying requires va_copy).

Static arrays in D are passed around by value, rather than decaying to a
pointer. However va_list is an inconsistent type on this front.

In some D compilers, it's always a pointer type to get around the
incompatibility with C/C++ - though this requires locals and fields to be
specially initialized before being passed to va_start() or va_copy().

i.e, underneath the hood it does:
---
void va_start(T)(out va_list ap, ref T parmn,
                 va_list storage = alloca(__va_list_tag.sizeof))
{
    ap = storage;
    // initialize *ap
}

void va_copy(out va_list ap, va_list src,
             va_list storage = alloca(__va_list_tag.sizeof))
{
    ap = storage;
    // copy *src.
}
---

GDC doesn't do this, rather - in a way that mimics C/C++ - va_list static
arrays are decayed to a pointer type when used as a parameter, but semantically
it's still treated as a static array.

I think some extra errors during the D front-end codegen pass are likely the
most appropriate thing to do here, as you say, such things are rejected by
C/C++, so GDC ought to reject them too.

  parent reply	other threads:[~2023-07-19 15:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 10:37 [Bug d/110712] New: " ibuclaw at gdcproject dot org
2023-07-18 11:55 ` [Bug d/110712] " rguenth at gcc dot gnu.org
2023-07-19 15:16 ` ibuclaw at gdcproject dot org [this message]
2023-07-19 15:24 ` ibuclaw at gdcproject dot org
2023-10-29 19:21 ` cvs-commit at gcc dot gnu.org
2023-10-29 19:23 ` cvs-commit at gcc dot gnu.org
2023-10-29 19:23 ` cvs-commit at gcc dot gnu.org
2023-10-29 19:25 ` ibuclaw 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-110712-4-kItLSDQPm7@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).