public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102027] New: ABI break when using vector type in function arg/return value
@ 2021-08-23 18:10 mpolacek at gcc dot gnu.org
  2021-08-23 18:10 ` [Bug target/102027] [11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-23 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

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
<check2237_ret>
=> 0x000000000040113f <+19>:    mov    %rdx,(%rax)
   0x0000000000401142 <+22>:    mov    -0x8(%rbp),%rax
   0x0000000000401146 <+26>:    pop    %rbp
   0x0000000000401147 <+27>:    ret    
End of assembler dump.

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

end of thread, other threads:[~2023-05-29 10:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 18:10 [Bug target/102027] New: ABI break when using vector type in function arg/return value mpolacek at gcc dot gnu.org
2021-08-23 18:10 ` [Bug target/102027] [11/12 Regression] " mpolacek at gcc dot gnu.org
2021-08-23 18:49 ` ubizjak at gmail dot com
2021-08-23 19:12 ` ubizjak at gmail dot com
2021-08-23 19:58 ` pinskia at gcc dot gnu.org
2021-08-23 20:25 ` hjl.tools at gmail dot com
2021-08-24  1:47 ` hjl.tools at gmail dot com
2021-08-24  1:50 ` pinskia at gcc dot gnu.org
2021-08-24  7:12 ` rguenth at gcc dot gnu.org
2021-08-24 13:08 ` hjl.tools at gmail dot com
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-04-17 15:15 ` [Bug target/102027] [11/12/13/14 " woodard at redhat dot com
2023-05-29 10:05 ` jakub 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).