public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ibuclaw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug d/110406] New: d: Wrong code-gen returning POD structs by value
Date: Mon, 26 Jun 2023 02:25:20 +0000	[thread overview]
Message-ID: <bug-110406-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110406
           Summary: d: Wrong code-gen returning POD structs by value
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gcc dot gnu.org
  Target Milestone: ---

Since 13.1 (r13-1104?), structs have been set the wrong mode, causing them to
return differently to equivalent static arrays.

---
struct cpuid_abcd_t
{
    uint eax;
    uint ebx;
    uint ecx;
    uint edx;
};

cpuid_abcd_t
cpuid_insn(const uint in_eax)
{
        cpuid_abcd_t ret = void;
        asm {
            "cpuid"
            :
                "=a" ( ret.eax ),
                "=b" ( ret.ebx ),
                "=c" ( ret.ecx ),
                "=d" ( ret.edx )
            :
                "a"  ( in_eax )
            :
    ;}
        return ret;
}

uint[4]
cpuid_insn2(const uint in_eax)
{
        uint[4] ret = void;
        asm {
            "cpuid"
            :
                "=a" ( ret[0] ),
                "=b" ( ret[1] ),
                "=c" ( ret[2] ),
                "=d" ( ret[3] )
            :
                "a"  ( in_eax )
            :
    ;}
        return ret;
}
---


The first function erroneously being returned in vector registers.

  _15 = {ret$eax_3, ret$ebx_4, ret$ecx_5, ret$edx_6};
  MEM <vector(4) uint> [(void *)&D.1894] = _15;
  return D.1894;

             reply	other threads:[~2023-06-26  2:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26  2:25 ibuclaw at gcc dot gnu.org [this message]
2023-06-26  2:33 ` [Bug d/110406] " pinskia at gcc dot gnu.org
2023-06-26  2:44 ` [Bug target/110406] " pinskia at gcc dot gnu.org
2023-06-26  3:06 ` ibuclaw at gcc dot gnu.org
2023-06-26  3:10 ` ibuclaw at gcc dot gnu.org
2023-06-26  4:21 ` pinskia at gcc dot gnu.org
2023-06-26  4:28 ` pinskia at gcc dot gnu.org
2023-06-26  4:32 ` pinskia at gcc dot gnu.org
2023-06-26  9:37 ` ibuclaw at gcc dot gnu.org
2023-06-26  9:38 ` ibuclaw at gcc dot gnu.org
2023-06-26 20:55 ` ibuclaw at gcc dot gnu.org
2023-06-27  8:52 ` iains at gcc dot gnu.org
2023-06-27  9:27 ` iains at gcc dot gnu.org
2023-06-28 16:33 ` ibuclaw at gcc dot gnu.org
2023-06-28 18:19 ` cvs-commit at gcc dot gnu.org
2023-06-28 18:52 ` cvs-commit at gcc dot gnu.org
2023-06-28 18:55 ` 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-110406-4@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).