From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4076D3858C2C; Mon, 23 Aug 2021 18:10:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4076D3858C2C From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102027] New: ABI break when using vector type in function arg/return value Date: Mon, 23 Aug 2021 18:10:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2021 18:10:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102027 Bug ID: 102027 Summary: ABI break when using vector type in function arg/return value Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- We have an ABI break. Discovered by Running /root/rpmbuild/BUILD/gcc-11.2.1-20210728/gcc/testsuite/gcc.dg/compat/struct= -layout-1.exp ... FAIL: tmpdir-gcc.dg-struct-layout-1/t025 c_compat_x_tst.o-c_compat_y_alt.o execute=20 FAIL: tmpdir-gcc.dg-struct-layout-1/t025 c_compat_x_alt.o-c_compat_y_tst.o execute Started with r11-263. $ cat m.c extern void test2237(); int main() { test2237(); } $ cat x.c #include "x.h" extern struct U2SF check2237(); void test2237() { check2237(); } $ cat y.c #include "x.h" struct U2SF check2237_ret; struct U2SF check2237() { return check2237_ret; } $ cat x.h struct U2SF { __attribute__((__vector_size__(2 * sizeof(float)))) float v; }; $ xgcc-11 -c m.c $ xgcc-11 -c x.c $ xgcc-10 -c y.c $ xgcc-11 m.o x.o y.o -o foo ./foo Segmentation fault (core dumped) while $ xgcc-11 -c y.c $ xgcc-11 m.o x.o y.o -o foo $ ./foo # OK $ gdb ./foo (gdb) r Starting program: /home/mpolacek/x/trunk/gcc/foo=20 Program received signal SIGSEGV, Segmentation fault. 0x000000000040113f in check2237 () (gdb) bt #0 0x000000000040113f in check2237 () #1 0x0000000000401129 in test2237 () #2 0x0000000000401114 in main () (gdb) disas Dump of assembler code for function check2237: 0x000000000040112c <+0>: push %rbp 0x000000000040112d <+1>: mov %rsp,%rbp 0x0000000000401130 <+4>: mov %rdi,-0x8(%rbp) 0x0000000000401134 <+8>: mov -0x8(%rbp),%rax 0x0000000000401138 <+12>: mov 0x2ef1(%rip),%rdx # 0x404030 =3D> 0x000000000040113f <+19>: mov %rdx,(%rax) 0x0000000000401142 <+22>: mov -0x8(%rbp),%rax 0x0000000000401146 <+26>: pop %rbp 0x0000000000401147 <+27>: ret=20=20=20=20 End of assembler dump.=