scalar-by-value-4_x.c: Also test passing of variable arguments.
authorUros Bizjak <ubizjak@gmail.com>
Mon, 12 Sep 2016 20:32:17 +0000 (22:32 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 12 Sep 2016 20:32:17 +0000 (22:32 +0200)
* gcc.dg/compat/scalar-by-value-4_x.c: Also test passing of
variable arguments.
* gcc.dg/compat/scalar-by-value-4_y.c (testva##NAME): New.
* gcc.dg/compat/scalar-by-value-4_main.c: Update description comment.
* gcc.dg/compat/scalar-return-4_x.c: Also test returning of
variable argument.
* gcc.dg/compat/scalar-return-4_y.c (testva##NAME): New.
* gcc.dg/compat/scalar-return-4_main.c: Update description comment.

From-SVN: r240099

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_main.c
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_x.c
gcc/testsuite/gcc.dg/compat/scalar-by-value-4_y.c
gcc/testsuite/gcc.dg/compat/scalar-return-4_main.c
gcc/testsuite/gcc.dg/compat/scalar-return-4_x.c
gcc/testsuite/gcc.dg/compat/scalar-return-4_y.c

index 4fc83772bb86716048464eec0f746ca218bea998..93cfbe5030dbb04a7ee1d35572d55ef8d985051d 100644 (file)
@@ -1,3 +1,14 @@
+2016-09-12  Uros Bizjak  <ubizjak@gmail.com>
+
+       * gcc.dg/compat/scalar-by-value-4_x.c: Also test passing of
+       variable arguments.
+       * gcc.dg/compat/scalar-by-value-4_y.c (testva##NAME): New.
+       * gcc.dg/compat/scalar-by-value-4_main.c: Update description comment.
+       * gcc.dg/compat/scalar-return-4_x.c: Also test returning of
+       variable argument.
+       * gcc.dg/compat/scalar-return-4_y.c (testva##NAME): New.
+       * gcc.dg/compat/scalar-return-4_main.c: Update description comment.
+
 2016-09-12  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR c++/77496
index 8164b44283a0f8fee51c3898e49a7f538b37921b..bd024c0542df6f2f029482dea5f5116487202782 100644 (file)
@@ -1,5 +1,5 @@
 /* Test passing scalars by value.  This test includes _Complex types
-   whose real and imaginary parts cannot be used in variable-length
+   whose real and imaginary parts can be used in variable-length
    argument lists.  */
 
 extern void scalar_by_value_4_x (void);
index a4e73c9fdb6267a7793774a405322a6bedc5df8a..a36a06081f14217912b765339c07ce63e6e9480a 100644 (file)
@@ -13,6 +13,7 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04,           \
             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 @@ testit##NAME (void)                                          \
              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 e0fa7053996f6f310f0dbdb8da2281a88e8f373f..38b17d5006646121a0456dcec86f3b7a3fe443dc 100644 (file)
@@ -65,6 +65,23 @@ test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04,          \
   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 2bcfa04872f5c659987eac752037eb3b6488d576..866121e5dd33890e171a01caf230101a38fa32b2 100644 (file)
@@ -1,5 +1,5 @@
 /* Test function return values.  This test includes _Complex types
-   whose real and imaginary parts cannot be used in variable-length
+   whose real and imaginary parts can be used in variable-length
    argument lists.  */
 
 extern void scalar_return_4_x (void);
index 50305be4d351acd6520693efe6eb7cd5080ceca0..11f4688a6d080c0e927da94a847c20c00d0d1aee 100644 (file)
@@ -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 @@ testit##NAME (void)                                          \
   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,13 +58,35 @@ testit##NAME (void)                                         \
   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;                                                    \
 }
 
 #ifndef SKIP_COMPLEX
 #ifndef SKIP_COMPLEX_INT
 T(cc, _Complex char, CINT (0, 1))
-T(cs, _Complex short, CINT (1 + 2))
+T(cs, _Complex short, CINT (1, 2))
 #endif
 T(cf, _Complex float, CDBL (1.0, 2.0))
 #endif
index 3c96856975f24b9d518348de54202b35208e19ae..3ae0749bab88892959fc6f804c0482c0cebb86f3 100644 (file)
@@ -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 @@ void                                                         \
 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 @@ TYPE                                                         \
 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