From: Jakub Jelinek Date: Thu, 21 Dec 2017 23:10:45 +0000 (+0100) Subject: re PR middle-end/83487 (ICE in expand_call, at calls.c:4098) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=604aac48157176b932b5a8772db4d4919199c300;p=gcc.git re PR middle-end/83487 (ICE in expand_call, at calls.c:4098) PR middle-end/83487 * config/i386/i386.c (ix86_function_arg_boundary): Return PARM_BOUNDARY for TYPE_EMPTY_P types. * gcc.c-torture/compile/pr83487.c: New test. * gcc.dg/compat/pr83487-1.h: New file. * gcc.dg/compat/pr83487-1_main.c: New test. * gcc.dg/compat/pr83487-1_x.c: New file. * gcc.dg/compat/pr83487-1_y.c: New file. * gcc.dg/compat/pr83487-2_main.c: New test. * gcc.dg/compat/pr83487-2_x.c: New file. * gcc.dg/compat/pr83487-2_y.c: New file. * g++.dg/abi/pr83487.C: New test. * g++.dg/compat/abi/pr83487-1_main.C: New test. * g++.dg/compat/abi/pr83487-1_x.C: New file. * g++.dg/compat/abi/pr83487-1_y.C: New file. * g++.dg/compat/abi/pr83487-2_main.C: New test. * g++.dg/compat/abi/pr83487-2_x.C: New file. * g++.dg/compat/abi/pr83487-2_y.C: New file. From-SVN: r255961 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 082223d5e59..585a70b9f8d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2017-12-21 Jakub Jelinek + PR middle-end/83487 + * config/i386/i386.c (ix86_function_arg_boundary): Return + PARM_BOUNDARY for TYPE_EMPTY_P types. + PR c/83448 * gimple-ssa-sprintf.c (maybe_warn): Don't call set_caret_index if navail is >= dir.len. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index beeabff53e3..8d02eb26812 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8973,6 +8973,8 @@ ix86_function_arg_boundary (machine_mode mode, const_tree type) the main variant type. */ type = TYPE_MAIN_VARIANT (type); align = TYPE_ALIGN (type); + if (TYPE_EMPTY_P (type)) + return PARM_BOUNDARY; } else align = GET_MODE_ALIGNMENT (mode); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2f5fd089be8..df630ad7871 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,22 @@ 2017-12-21 Jakub Jelinek + PR middle-end/83487 + * gcc.c-torture/compile/pr83487.c: New test. + * gcc.dg/compat/pr83487-1.h: New file. + * gcc.dg/compat/pr83487-1_main.c: New test. + * gcc.dg/compat/pr83487-1_x.c: New file. + * gcc.dg/compat/pr83487-1_y.c: New file. + * gcc.dg/compat/pr83487-2_main.c: New test. + * gcc.dg/compat/pr83487-2_x.c: New file. + * gcc.dg/compat/pr83487-2_y.c: New file. + * g++.dg/abi/pr83487.C: New test. + * g++.dg/compat/abi/pr83487-1_main.C: New test. + * g++.dg/compat/abi/pr83487-1_x.C: New file. + * g++.dg/compat/abi/pr83487-1_y.C: New file. + * g++.dg/compat/abi/pr83487-2_main.C: New test. + * g++.dg/compat/abi/pr83487-2_x.C: New file. + * g++.dg/compat/abi/pr83487-2_y.C: New file. + PR c/83448 * gcc.c-torture/compile/pr83448.c: New test. * gcc.dg/tree-ssa/builtin-snprintf-warn-4.c: New test. diff --git a/gcc/testsuite/g++.dg/abi/pr83487.C b/gcc/testsuite/g++.dg/abi/pr83487.C new file mode 100644 index 00000000000..b1ef1bfb260 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/pr83487.C @@ -0,0 +1,13 @@ +/* PR middle-end/83487 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct __attribute__ ((__aligned__)) A {}; +struct A a; +void bar (int, int, int, int, int, int, int, struct A); + +void +foo () +{ + bar (0, 1, 2, 3, 4, 5, 6, a); +} diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-1_main.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_main.C new file mode 100644 index 00000000000..cd7cd94d1f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_main.C @@ -0,0 +1,8 @@ +extern void do_test (void); + +int +main () +{ + do_test (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-1_x.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_x.C new file mode 100644 index 00000000000..f21464741f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_x.C @@ -0,0 +1 @@ +#include "../../../gcc.dg/compat/pr83487-1_x.c" diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-1_y.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_y.C new file mode 100644 index 00000000000..fc514987a5e --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-1_y.C @@ -0,0 +1 @@ +#include "../../../gcc.dg/compat/pr83487-1_y.c" diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-2_main.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_main.C new file mode 100644 index 00000000000..cd7cd94d1f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_main.C @@ -0,0 +1,8 @@ +extern void do_test (void); + +int +main () +{ + do_test (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-2_x.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_x.C new file mode 100644 index 00000000000..c24fd60fef4 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_x.C @@ -0,0 +1 @@ +#include "../../../gcc.dg/compat/pr83487-2_x.c" diff --git a/gcc/testsuite/g++.dg/compat/abi/pr83487-2_y.C b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_y.C new file mode 100644 index 00000000000..e5253d21467 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/abi/pr83487-2_y.C @@ -0,0 +1 @@ +#include "../../../gcc.dg/compat/pr83487-2_y.c" diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83487.c b/gcc/testsuite/gcc.c-torture/compile/pr83487.c new file mode 100644 index 00000000000..9effb1eef03 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr83487.c @@ -0,0 +1,11 @@ +/* PR middle-end/83487 */ + +struct __attribute__ ((aligned)) A {}; +struct A a; +void bar (int, int, int, int, int, int, int, struct A); + +void +foo (void) +{ + bar (0, 1, 2, 3, 4, 5, 6, a); +} diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-1.h b/gcc/testsuite/gcc.dg/compat/pr83487-1.h new file mode 100644 index 00000000000..f39d5fd89dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-1.h @@ -0,0 +1,9 @@ +#ifdef PR83487_LARGE +struct __attribute__ ((aligned (128))) A {}; +struct B {}; +struct C { struct B c[128]; }; +#else +struct __attribute__ ((aligned (16))) A {}; +struct B {}; +struct C { struct B c[16]; }; +#endif diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-1_main.c b/gcc/testsuite/gcc.dg/compat/pr83487-1_main.c new file mode 100644 index 00000000000..cd7cd94d1f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-1_main.c @@ -0,0 +1,8 @@ +extern void do_test (void); + +int +main () +{ + do_test (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-1_x.c b/gcc/testsuite/gcc.dg/compat/pr83487-1_x.c new file mode 100644 index 00000000000..043a4c449ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-1_x.c @@ -0,0 +1,63 @@ +#include "pr83487-1.h" + +extern +#ifdef __cplusplus +"C" +#endif +void abort (); + +void +f1 (int i, int j, int k, int l, int m, int n, int o, struct A x) +{ + if (i != 6 || j != 0 || k != 1 || l != 2 || m != 3 || n != 4 || o != 5) + abort (); +} + +void +f2 (int i, int j, int k, int l, int m, int n, int o, struct A x, int p, int q) +{ + if (i != 6 || j != 0 || k != 1 || l != 2 || m != 3 || n != 4 || o != 5 || p != 7 || q != 8) + abort (); +} + +void +f3 (int i, int j, int k, int l, int m, int n, int o, struct B x, int p, int q) +{ + if (i != 6 || j != 0 || k != 1 || l != 2 || m != 3 || n != 4 || o != 5 || p != 7 || q != 8) + abort (); +} + +void +f4 (int i, int j, int k, int l, int m, int n, int o, struct C x, int p, int q) +{ + if (i != 6 || j != 0 || k != 1 || l != 2 || m != 3 || n != 4 || o != 5 || p != 7 || q != 8) + abort (); +} + +void +f5 (int o, struct A x) +{ + if (o != 5) + abort (); +} + +void +f6 (int o, struct A x, int p, int q) +{ + if (o != 5 || p != 7 || q != 8) + abort (); +} + +void +f7 (int o, struct B x, int p, int q) +{ + if (o != 5 || p != 7 || q != 8) + abort (); +} + +void +f8 (int o, struct C x, int p, int q) +{ + if (o != 5 || p != 7 || q != 8) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-1_y.c b/gcc/testsuite/gcc.dg/compat/pr83487-1_y.c new file mode 100644 index 00000000000..ef927bb21e5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-1_y.c @@ -0,0 +1,27 @@ +#include "pr83487-1.h" + +struct A a; +struct B b; +struct C c; + +extern void f1 (int i, int j, int k, int l, int m, int n, int o, struct A); +extern void f2 (int i, int j, int k, int l, int m, int n, int o, struct A, int p, int q); +extern void f3 (int i, int j, int k, int l, int m, int n, int o, struct B, int p, int q); +extern void f4 (int i, int j, int k, int l, int m, int n, int o, struct C, int p, int q); +extern void f5 (int o, struct A); +extern void f6 (int o, struct A, int p, int q); +extern void f7 (int o, struct B, int p, int q); +extern void f8 (int o, struct C, int p, int q); + +void +do_test () +{ + f1 (6, 0, 1, 2, 3, 4, 5, a); + f2 (6, 0, 1, 2, 3, 4, 5, a, 7, 8); + f3 (6, 0, 1, 2, 3, 4, 5, b, 7, 8); + f4 (6, 0, 1, 2, 3, 4, 5, c, 7, 8); + f5 (5, a); + f6 (5, a, 7, 8); + f7 (5, b, 7, 8); + f8 (5, c, 7, 8); +} diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-2_main.c b/gcc/testsuite/gcc.dg/compat/pr83487-2_main.c new file mode 100644 index 00000000000..276ae3b8c68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-2_main.c @@ -0,0 +1 @@ +#include "pr83487-1_main.c" diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-2_x.c b/gcc/testsuite/gcc.dg/compat/pr83487-2_x.c new file mode 100644 index 00000000000..494abd7e3a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-2_x.c @@ -0,0 +1,2 @@ +#define PR83487_LARGE +#include "pr83487-1_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/pr83487-2_y.c b/gcc/testsuite/gcc.dg/compat/pr83487-2_y.c new file mode 100644 index 00000000000..e5a67d5444c --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/pr83487-2_y.c @@ -0,0 +1,2 @@ +#define PR83487_LARGE +#include "pr83487-1_y.c"