public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/110406] New: d: Wrong code-gen returning POD structs by value
@ 2023-06-26  2:25 ibuclaw at gcc dot gnu.org
  2023-06-26  2:33 ` [Bug d/110406] " pinskia at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-06-26  2:25 UTC (permalink / raw)
  To: gcc-bugs

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;

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-06-28 18:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26  2:25 [Bug d/110406] New: d: Wrong code-gen returning POD structs by value ibuclaw at gcc dot gnu.org
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

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