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/114171] [13/14 Regression] gdc -O2 -mavx generates misaligned vmovdqa instruction
Date: Fri, 01 Mar 2024 13:25:25 +0000	[thread overview]
Message-ID: <bug-114171-4-zAUUOBwp6A@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114171-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Removed druntime dependency.
---
import gcc.builtins;
struct Token {
    string label;
}
struct BreakStatement {
    ulong pad;
    Token label;
}

pragma(inline, false)
auto newclass()
{
    void *p = __builtin_malloc(BreakStatement.sizeof);
    __builtin_memset(p, 0, BreakStatement.sizeof);
    return cast(BreakStatement*) p;
}

int main ()
{
    auto bn = newclass();
    return bn.label is Token.init;
}
---



Roughly the equivalent C++
---
struct Token {
    struct {
    __SIZE_TYPE__ length;
    const char *ptr;
    } label;
};
struct BreakStatement {
    __UINT64_TYPE__ pad;
    Token label;
};

__attribute__((noinline))
BreakStatement *newclass()
{
    void *p = __builtin_malloc(sizeof(BreakStatement));
    __builtin_memset(p, 0, sizeof(BreakStatement));
    return (BreakStatement*) p;
}

int main ()
{
    auto bn = newclass();
    auto init = Token();
    return *(__uint128_t*)&bn->label == *(__uint128_t*)&init;
}
---

  parent reply	other threads:[~2024-03-01 13:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 15:53 [Bug d/114171] New: " a.horodniceanu at proton dot me
2024-03-01  4:59 ` [Bug d/114171] " pinskia at gcc dot gnu.org
2024-03-01  6:28 ` liuhongt at gcc dot gnu.org
2024-03-01  7:05 ` rguenth at gcc dot gnu.org
2024-03-01  8:38 ` a.horodniceanu at proton dot me
2024-03-01 13:25 ` ibuclaw at gdcproject dot org [this message]
2024-03-01 13:37 ` rguenth at gcc dot gnu.org
2024-03-01 14:13 ` ibuclaw at gdcproject dot org
2024-03-03  1:33 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:35 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:37 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:39 ` cvs-commit at gcc dot gnu.org
2024-03-03  1:39 ` ibuclaw at gdcproject dot 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-114171-4-zAUUOBwp6A@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).