On Fri, Sep 2, 2016 at 2:11 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Fri, Sep 02, 2016 at 12:09:30PM +0000, Joseph Myers wrote: >> On Fri, 2 Sep 2016, Uros Bizjak wrote: >> >> > argument. Passing _Complex float as a variable argument never >> > worked on alpha. Thus, we have no backward compatibility issues >> >> Presumably there should be an architecture-independent execution test of >> passing _Complex float in variable arguments - either new, or a >> pre-existing one whose XFAIL or skip for alpha can be removed. (That is, >> one in the GCC testsuite rather than relying on a libffi test to test >> GCC.) > > And if it is in g*.dg/compat/, it can even test ABI compatibility between > different compilers or their versions.
What bothers me is the comment in testsuite/gcc.dg/compat/scalar-by-value-4_main.c which explicitly mentions that this test tests _Complex numbers that cannot be used in vararg lists: <q> /* Test passing scalars by value. This test includes _Complex types whose real and imaginary parts cannot be used in variable-length argument lists. */ </q> It looks that different handling of _Complex char, _Complex short and _Complex float is there on purpose. Is (was?) there a limitation in a c language standard that prevents passing of these arguments as varargs? Please note that there are no additional FAILs with mainline gcc on x86_64-linux-gnu {,-m32} test run. Uros.
Index: gcc.dg/compat/scalar-by-value-4_x.c =================================================================== --- gcc.dg/compat/scalar-by-value-4_x.c (revision 239943) +++ gcc.dg/compat/scalar-by-value-4_x.c (working copy) @@ -13,6 +13,7 @@ TYPE x05, TYPE x06, TYPE x07, TYPE x08, \ TYPE x09, TYPE x10, TYPE x11, TYPE x12, \ TYPE x13, TYPE x14, TYPE x15, TYPE x16); \ +extern void testva##NAME (int n, ...); \ \ void \ check##NAME (TYPE x, TYPE v) \ @@ -62,6 +63,81 @@ g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ DEBUG_NL; \ DEBUG_FPUTS (#NAME); \ + DEBUG_FPUTS (" testva:"); \ + DEBUG_NL; \ + testva##NAME (1, \ + g01##NAME); \ + DEBUG_NL; \ + testva##NAME (2, \ + g01##NAME, g02##NAME); \ + DEBUG_NL; \ + testva##NAME (3, \ + g01##NAME, g02##NAME, g03##NAME); \ + DEBUG_NL; \ + testva##NAME (4, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME); \ + DEBUG_NL; \ + testva##NAME (5, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME); \ + DEBUG_NL; \ + testva##NAME (6, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME); \ + DEBUG_NL; \ + testva##NAME (7, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME); \ + DEBUG_NL; \ + testva##NAME (8, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME); \ + DEBUG_NL; \ + testva##NAME (9, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME); \ + DEBUG_NL; \ + testva##NAME (10, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME); \ + DEBUG_NL; \ + testva##NAME (11, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME); \ + DEBUG_NL; \ + testva##NAME (12, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME); \ + DEBUG_NL; \ + testva##NAME (13, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME); \ + DEBUG_NL; \ + testva##NAME (14, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME); \ + DEBUG_NL; \ + testva##NAME (15, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME); \ + DEBUG_NL; \ + testva##NAME (16, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ + DEBUG_NL; \ + DEBUG_FPUTS (#NAME); \ DEBUG_FPUTS (" test2: "); \ test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME, \ g09##NAME, g11##NAME, g13##NAME, g15##NAME); \ Index: gcc.dg/compat/scalar-by-value-4_y.c =================================================================== --- gcc.dg/compat/scalar-by-value-4_y.c (revision 239943) +++ gcc.dg/compat/scalar-by-value-4_y.c (working copy) @@ -65,6 +65,23 @@ check##NAME (x14, 14); \ check##NAME (x15, 15); \ check##NAME (x16, 16); \ +} \ + \ +void \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + va_list ap; \ + if (test_va) \ + { \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + { \ + TYPE t = va_arg (ap, TYPE); \ + check##NAME (t, i+1); \ + } \ + va_end (ap); \ + } \ } #ifndef SKIP_COMPLEX Index: gcc.dg/compat/scalar-return-4_x.c =================================================================== --- gcc.dg/compat/scalar-return-4_x.c (revision 239943) +++ gcc.dg/compat/scalar-return-4_x.c (working copy) @@ -1,12 +1,22 @@ #include "compat-common.h" +#ifdef SKIP_VA +const int test_va = 0; +#else +const int test_va = 1; +#endif + #define T(NAME, TYPE, INITVAL) \ -TYPE g01##NAME; \ +TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ \ extern void init##NAME (TYPE *p, TYPE v); \ extern void checkg##NAME (void); \ extern TYPE test0##NAME (void); \ extern TYPE test1##NAME (TYPE); \ +extern TYPE testva##NAME (int n, ...); \ \ void \ check##NAME (TYPE x, TYPE v) \ @@ -22,6 +32,21 @@ DEBUG_FPUTS (#NAME); \ DEBUG_FPUTS (" init: "); \ init##NAME (&g01##NAME, 1); \ + init##NAME (&g02##NAME, 2); \ + init##NAME (&g03##NAME, 3); \ + init##NAME (&g04##NAME, 4); \ + init##NAME (&g05##NAME, 5); \ + init##NAME (&g06##NAME, 6); \ + init##NAME (&g07##NAME, 7); \ + init##NAME (&g08##NAME, 8); \ + init##NAME (&g09##NAME, 9); \ + init##NAME (&g10##NAME, 10); \ + init##NAME (&g11##NAME, 11); \ + init##NAME (&g12##NAME, 12); \ + init##NAME (&g13##NAME, 13); \ + init##NAME (&g14##NAME, 14); \ + init##NAME (&g15##NAME, 15); \ + init##NAME (&g16##NAME, 16); \ checkg##NAME (); \ DEBUG_NL; \ DEBUG_FPUTS (#NAME); \ @@ -33,6 +58,28 @@ DEBUG_FPUTS (" test1: "); \ rslt = test1##NAME (g01##NAME); \ check##NAME (rslt, g01##NAME); \ + if (test_va) \ + { \ + DEBUG_NL; \ + DEBUG_FPUTS (#NAME); \ + DEBUG_FPUTS (" testva: "); \ + rslt = testva##NAME (1, g01##NAME); \ + check##NAME (rslt, g01##NAME); \ + rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME); \ + check##NAME (rslt, g05##NAME); \ + rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME); \ + check##NAME (rslt, g09##NAME); \ + rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME, \ + g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, \ + g16##NAME); \ + check##NAME (rslt, g16##NAME); \ + } \ DEBUG_NL; \ } Index: gcc.dg/compat/scalar-return-4_y.c =================================================================== --- gcc.dg/compat/scalar-return-4_y.c (revision 239943) +++ gcc.dg/compat/scalar-return-4_y.c (working copy) @@ -2,14 +2,11 @@ #include "compat-common.h" -#ifdef SKIP_VA -const int test_va = 0; -#else -const int test_va = 1; -#endif - #define T(NAME, TYPE, INITVAL) \ -extern TYPE g01##NAME; \ +extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ \ extern void check##NAME (TYPE x, TYPE v); \ \ @@ -23,6 +20,21 @@ checkg##NAME (void) \ { \ check##NAME (g01##NAME, 1+INITVAL); \ + check##NAME (g02##NAME, 2+INITVAL); \ + check##NAME (g03##NAME, 3+INITVAL); \ + check##NAME (g04##NAME, 4+INITVAL); \ + check##NAME (g05##NAME, 5+INITVAL); \ + check##NAME (g06##NAME, 6+INITVAL); \ + check##NAME (g07##NAME, 7+INITVAL); \ + check##NAME (g08##NAME, 8+INITVAL); \ + check##NAME (g09##NAME, 9+INITVAL); \ + check##NAME (g10##NAME, 10+INITVAL); \ + check##NAME (g11##NAME, 11+INITVAL); \ + check##NAME (g12##NAME, 12+INITVAL); \ + check##NAME (g13##NAME, 13+INITVAL); \ + check##NAME (g14##NAME, 14+INITVAL); \ + check##NAME (g15##NAME, 15+INITVAL); \ + check##NAME (g16##NAME, 16+INITVAL); \ } \ \ TYPE \ @@ -35,6 +47,19 @@ test1##NAME (TYPE x01) \ { \ return x01; \ +} \ + \ +TYPE \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + TYPE rslt; \ + va_list ap; \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + rslt = va_arg (ap, TYPE); \ + va_end (ap); \ + return rslt; \ } #ifndef SKIP_COMPLEX