public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx
@ 2021-08-27 20:22 mpolacek at gcc dot gnu.org
  2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-27 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102105
           Summary: x86_64: ABI break with vector in union and -mno-mmx
                    -mavx
           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: ---

This looks like another ABI break.  Started with r271213.

-mno-mmx -mavx is an unusual combination I guess, but I'm filing this anyway.

$ cat m.c
void vector_1_x();
int main() { vector_1_x(); }
$ cat x.c
typedef int di;
typedef di __attribute__((vector_size(8))) v1di;
typedef union {
  v1di v;
  di a[1];
} u1di;
v1di g_v1di;
int pass_v1di_j;
di pass_v1di_a[1];
di pass_v1di_a_0;
u1di pass_v1di_u;
void test_v8qi();
void pass_v8qi() {}
void test_v1di();
void checkp_1di();
void pass_v1di(v1di v) {
  pass_v1di_u.v = v;
  pass_v1di_a_0 = pass_v1di_u.a[pass_v1di_j];
  checkp_1di(pass_v1di_a);
}
void vector_1_x() {
  test_v8qi();
  test_v1di();
}
$ cat y.c
typedef int qi;
typedef int __attribute__((mode(DI))) di;
int test_v8qi_i, checkp_1di_i;
extern __attribute__((__vector_size__(sizeof(di)))) di g_v1di;
void abort();
typedef union {
  __attribute__((__vector_size__(2 * sizeof(qi)))) qi v;
  qi a[8];
} u8qi;
void pass_v8qi();
void checkp_8qi(qi *p) {
  for (; 0;)
    if (p)
      abort();
}
void test_v8qi() {
  u8qi u;
  qi *p = u.a;
  for (; test_v8qi_i;)
    u.a[test_v8qi_i] = test_v8qi_i;
  pass_v8qi(u.v);
  checkp_8qi(p);
}
void pass_v1di();
void checkp_1di(di *p) {
  if (p[checkp_1di_i])
    abort();
}
void test_v1di() { pass_v1di(g_v1di); }

And then:
$ xgcc-11 -c m.c
$ xgcc-11 -c x.c -mno-mmx -mavx
$ xgcc-9 -c y.c  -mno-mmx -mavx
$ xgcc-11 m.o x.o y.o -o foo
$ ./foo
Aborted (core dumped)
$ xgcc-10 -c y.c -mno-mmx -mavx
$ xgcc-11 m.o x.o y.o -o foo
$ ./foo && echo ok
ok

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

end of thread, other threads:[~2023-07-07  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-08-27 20:28 ` mpolacek at gcc dot gnu.org
2021-08-27 21:33 ` hjl.tools at gmail dot com
2021-08-28  1:09 ` [Bug target/102105] " hjl.tools at gmail dot com
2022-06-28 10:46 ` [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx jakub at gcc dot gnu.org
2023-07-07  9:45 ` rguenth 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).