From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D59DB3858D20; Mon, 26 Jun 2023 02:25:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D59DB3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687746320; bh=aRWRSKQoiJLYkK/n00GbLUL7KDANrWna4iZyWIMghYo=; h=From:To:Subject:Date:From; b=ZX1wgFDYseKRILI1luNNoG/CoTUEyOKom0eW2D8hDWMv/pwh+jWyaIsQw0FGKVv8v qs1/UCTsYhNpM2wT3VlUjrRNbUnKq3rjL/UNrZb7ivbs9jW2+2aXreJnDhXk+wchsk P1M6/wDa+L+2W2hwIxHTxfCBpWReRywJjtNLp3Bw= From: "ibuclaw at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ibuclaw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110406 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 =3D void; asm { "cpuid" : "=3Da" ( ret.eax ), "=3Db" ( ret.ebx ), "=3Dc" ( ret.ecx ), "=3Dd" ( ret.edx ) : "a" ( in_eax ) : ;} return ret; } uint[4] cpuid_insn2(const uint in_eax) { uint[4] ret =3D void; asm { "cpuid" : "=3Da" ( ret[0] ), "=3Db" ( ret[1] ), "=3Dc" ( ret[2] ), "=3Dd" ( ret[3] ) : "a" ( in_eax ) : ;} return ret; } --- The first function erroneously being returned in vector registers. _15 =3D {ret$eax_3, ret$ebx_4, ret$ecx_5, ret$edx_6}; MEM [(void *)&D.1894] =3D _15; return D.1894;=