public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "josephcsible at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105932] New: Small structures returned incorrectly in i386 Microsoft ABI Date: Sun, 12 Jun 2022 01:32:55 +0000 [thread overview] Message-ID: <bug-105932-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105932 Bug ID: 105932 Summary: Small structures returned incorrectly in i386 Microsoft ABI Product: gcc Version: 12.1.0 Status: UNCONFIRMED Keywords: ABI, wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: josephcsible at gmail dot com Target Milestone: --- Consider this C code: struct foo { int x, y; }; extern int x, y; struct foo f(void) { struct foo rv; rv.x = x; rv.y = y; return rv; } When compiled with "-O2 -m32 -mabi=ms", it compiles to this: f: movd x, %xmm0 movl 4(%esp), %eax movd y, %xmm1 punpckldq %xmm1, %xmm0 movq %xmm0, (%eax) ret Which expects to be passed a hidden parameter to hold the address of the return value. But in the i386 Microsoft ABI, that's not how returns work for POD types that are 64 bits or smaller. Here's what it should compile to instead: f: movd x, %eax movd y, %edx ret
next reply other threads:[~2022-06-12 1:32 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-12 1:32 josephcsible at gmail dot com [this message] 2022-06-12 17:48 ` [Bug target/105932] " pinskia at gcc dot gnu.org 2022-06-14 7:58 ` rguenth at gcc dot gnu.org 2022-09-18 21:15 ` green at redhat dot com
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-105932-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: linkBe 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).