OSDN Git Service

2003-05-05 Janis Johnson <janis187@us.ibm.com>
authorjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 May 2003 21:59:35 +0000 (21:59 +0000)
committerjanis <janis@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 May 2003 21:59:35 +0000 (21:59 +0000)
* Makefile.in: (site.exp): Add ALT_CC_UNDER_TEST, add quotes around
expanded variables.
* doc/sourcebuild.texi (C tests): Describe gcc.dg/compat tests.
testsuite:
* lib/compat.exp (compat-execute): New argument.
* g++.dg/compat/compat.exp: Pass new argument to compat-execute.
* gcc.dg/compat: New test directory.
* gcc.dg/compat/compat.exp: New expect script.
* gcc.dg/compat/scalar-by-value-1_main.c: New test file.
* gcc.dg/compat/scalar-by-value-1_x.c: New test file.
* gcc.dg/compat/scalar-by-value-1_y.c: New test file.
* gcc.dg/compat/scalar-by-value-2_main.c: New test file.
* gcc.dg/compat/scalar-by-value-2_x.c: New test file.
* gcc.dg/compat/scalar-by-value-2_y.c: New test file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66506 138bc75d-0d04-0410-961f-82ee72b054a4

13 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/compat/compat.exp
gcc/testsuite/gcc.dg/compat/compat.exp [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-1_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-1_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-1_y.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-2_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-2_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/scalar-by-value-2_y.c [new file with mode: 0644]
gcc/testsuite/lib/compat.exp

index 6ba41bd..6ec2e92 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-05  Janis Johnson  <janis187@us.ibm.com>
+
+       * Makefile.in: (site.exp): Add ALT_CC_UNDER_TEST, add quotes around
+       expanded variables.
+       * doc/sourcebuild.texi (C tests): Describe gcc.dg/compat tests.
+
 2003-05-05  Zack Weinberg  <zack@codesourcery.com>
 
        * rtl.h (STRING_POOL_ADDRESS_P): Rename to DEFERRED_CONSTANT_P.
index 70df3ea..b4abda7 100644 (file)
@@ -3266,12 +3266,16 @@ site.exp: ./config.status Makefile
        fi
        echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
        @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
+       @if [ "X$(ALT_CC_UNDER_TEST)" != "X" ] ; then \
+         echo "set ALT_CC_UNDER_TEST \"$(ALT_CC_UNDER_TEST)\"" >> ./tmp0; \
+       else true; \
+       fi
        @if [ "X$(ALT_CXX_UNDER_TEST)" != "X" ] ; then \
-         echo "set ALT_CXX_UNDER_TEST $(ALT_CXX_UNDER_TEST)" >> ./tmp0; \
+         echo "set ALT_CXX_UNDER_TEST \"$(ALT_CXX_UNDER_TEST)\"" >> ./tmp0; \
        else true; \
        fi
        @if [ "X$(COMPAT_OPTIONS)" != "X" ] ; then \
-         echo "set COMPAT_OPTIONS $(COMPAT_OPTIONS)" >> ./tmp0; \
+         echo "set COMPAT_OPTIONS \"$(COMPAT_OPTIONS)\"" >> ./tmp0; \
        else true; \
        fi
        @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
index d1e1e41..9e0b1f2 100644 (file)
@@ -855,6 +855,10 @@ message texts are compared against expected texts or regular expressions
 given in comments.  These tests are run with the options @samp{-ansi -pedantic}
 unless other options are given in the test.  Except as noted below they
 are not run with multiple optimization options.
+@item gcc.dg/compat
+This subdirectory contains tests for binary compatibility using
+@file{compat.exp}, which in turn uses the language-independent support
+(@pxref{compat Testing, , Support for testing binary compatibility}).
 @item gcc.dg/cpp
 This subdirectory contains tests of the preprocessor.
 @item gcc.dg/debug
index 05b06a0..d684d49 100644 (file)
@@ -1,3 +1,16 @@
+2003-05-05  Janis Johnson  <janis187@us.ibm.com>
+
+       * lib/compat.exp (compat-execute): New argument.
+       * g++.dg/compat/compat.exp: Pass new argument to compat-execute.
+       * gcc.dg/compat: New test directory.
+       * gcc.dg/compat/compat.exp: New expect script.
+       * gcc.dg/compat/scalar-by-value-1_main.c: New test file.
+       * gcc.dg/compat/scalar-by-value-1_x.c: New test file.
+       * gcc.dg/compat/scalar-by-value-1_y.c: New test file.
+       * gcc.dg/compat/scalar-by-value-2_main.c: New test file.
+       * gcc.dg/compat/scalar-by-value-2_x.c: New test file.
+       * gcc.dg/compat/scalar-by-value-2_y.c: New test file.
+
 2003-05-05  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.dg/const-elim-1.c, gcc.dg/const-elim-2.c: New testcases.
index 1e13c10..f6c1bbd 100644 (file)
@@ -105,6 +105,10 @@ set save_cxxflags $CXXFLAGS
 set save_always_cxxflags $ALWAYS_CXXFLAGS
 set save_ld_library_path $ld_library_path
 
+# Define an identifier for use with this suite to avoid name conflicts
+# with other compat tests running at the same time.
+set sid "cp_compat"
+
 # Find out whether there is an alternate compiler to test.  If the
 # variable is defined but is set to "same", that means we use the same
 # compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS
@@ -130,7 +134,7 @@ foreach src [lsort [find $srcdir/$subdir *_main.C]] {
        continue
     }
 
-    compat-execute $src $use_alt
+    compat-execute $src $sid $use_alt
 }
 
 # Restore the original compiler under test.
diff --git a/gcc/testsuite/gcc.dg/compat/compat.exp b/gcc/testsuite/gcc.dg/compat/compat.exp
new file mode 100644 (file)
index 0000000..3d8b796
--- /dev/null
@@ -0,0 +1,105 @@
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This file was written by Janis Johnson, <janis187@us.ibm.com>
+
+
+# Test interoperability of two compilers that follow the same ABI.
+#
+# Break simple tests into two pieces and see that they work when linked
+# together.  If an alternate compiler is specified then the two main
+# pieces of each test are compiled with different compilers.  The
+# alternate compiler must be installed, and is specified by defining
+# ALT_CC_UNDER_TEST in the environment.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+global GCC_UNDER_TEST
+
+# Load procedures from common libraries. 
+load_lib standard.exp
+load_lib gcc.exp
+
+#
+# compat-use-alt-compiler -- make the alternate compiler the default
+# 
+proc compat-use-alt-compiler { } {
+    global GCC_UNDER_TEST ALT_CC_UNDER_TEST
+    global same_alt
+
+    # We don't need to do this if the alternate compiler is actually
+    # the same as the compiler under test.
+    if { $same_alt == 0 } then {
+       set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
+    }
+}
+
+#
+# compat-use-tst-compiler -- make compiler under test the default
+#
+proc compat-use-tst-compiler { } {
+    global GCC_UNDER_TEST save_gcc_under_test
+    global same_alt
+
+    # We don't need to do this if the alternate compiler is actually
+    # the same as the compiler under test.
+
+    if { $same_alt == 0 } then {
+       set GCC_UNDER_TEST $save_gcc_under_test
+    }
+}
+
+# Load the language-independent compabibility support procedures.
+# This must be done after the compat-use-*-compiler definitions.
+load_lib compat.exp
+
+gcc_init
+
+# Save variables for the C compiler under test, which each test will
+# change a couple of times.  This must be done after calling gcc-init.
+set save_gcc_under_test $GCC_UNDER_TEST
+
+# Define an identifier for use with this suite to avoid name conflicts
+# with other compat tests running at the same time.
+set sid "c_compat"
+
+# Find out whether there is an alternate compiler to test.  If the
+# variable is defined but is set to "same", that means we use the same
+# compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS
+# are different.
+set use_alt 0
+set same_alt 0
+if [info exists ALT_CC_UNDER_TEST] then {
+    set use_alt 1
+    if [string match "same" $ALT_CC_UNDER_TEST] then {
+       set same_alt 1
+    }
+}
+
+# Main loop.
+foreach src [lsort [find $srcdir/$subdir *_main.c]] {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $src] then {
+       continue
+    }
+
+    compat-execute $src $sid $use_alt
+}
+
+# Restore the original compiler under test.
+compat-use-tst-compiler
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_main.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_main.c
new file mode 100644 (file)
index 0000000..9e8a8f1
--- /dev/null
@@ -0,0 +1,12 @@
+/* Test passing scalars by value.  This test includes scalar types that
+   are supported by va_arg.  */
+
+extern void scalar_by_value_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+  scalar_by_value_1_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_x.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_x.c
new file mode 100644 (file)
index 0000000..9ce16a0
--- /dev/null
@@ -0,0 +1,164 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL)                                         \
+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 void                                                    \
+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)                                   \
+{                                                              \
+  if (x != v + INITVAL)                                                \
+    {                                                          \
+      DEBUG_NL;                                                        \
+      abort ();                                                        \
+    }                                                          \
+}                                                              \
+                                                               \
+void                                                           \
+test2_##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04,          \
+             TYPE x05, TYPE x06, TYPE x07, TYPE x08)           \
+{                                                              \
+  test##NAME (x01, g02##NAME, x02, g04##NAME,                  \
+             x03, g06##NAME, x04, g08##NAME,                   \
+             x05, g10##NAME, x06, g12##NAME,                   \
+             x07, g14##NAME, x08, g16##NAME);                  \
+}                                                              \
+                                                               \
+void                                                           \
+testit##NAME (void)                                            \
+{                                                              \
+  DEBUG_FPUTS (#NAME);                                         \
+  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_FPUTS (" test");                                       \
+  test##NAME (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_FPUTS (" testva");                                     \
+  testva##NAME (1,                                             \
+               g01##NAME);                                     \
+  testva##NAME (2,                                             \
+               g01##NAME, g02##NAME);                          \
+  testva##NAME (3,                                             \
+               g01##NAME, g02##NAME, g03##NAME);               \
+  testva##NAME (4,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME);    \
+  testva##NAME (5,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME);                                     \
+  testva##NAME (6,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME, g06##NAME);                          \
+  testva##NAME (7,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME, g06##NAME, g07##NAME);               \
+  testva##NAME (8,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME, g06##NAME, g07##NAME, g08##NAME);    \
+  testva##NAME (9,                                             \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME, g06##NAME, g07##NAME, g08##NAME,     \
+               g09##NAME);                                     \
+  testva##NAME (10,                                            \
+               g01##NAME, g02##NAME, g03##NAME, g04##NAME,     \
+               g05##NAME, g06##NAME, g07##NAME, g08##NAME,     \
+               g09##NAME, g10##NAME);                          \
+  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);               \
+  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);    \
+  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);                                     \
+  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);                          \
+  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);               \
+  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_FPUTS (" test2");                                      \
+  test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME,    \
+               g09##NAME, g11##NAME, g13##NAME, g15##NAME);    \
+  DEBUG_NL;                                                    \
+}
+
+extern void abort (void);
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
+
+#undef T
+
+void
+scalar_by_value_1_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(ui)
+T(si)
+T(ul)
+T(sl)
+T(ull)
+T(sll)
+T(d)
+T(ld)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_y.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-1_y.c
new file mode 100644 (file)
index 0000000..2bc0244
--- /dev/null
@@ -0,0 +1,105 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA.  */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(NAME, TYPE, INITVAL)                                 \
+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);                      \
+                                                               \
+void                                                           \
+init##NAME (TYPE *p, TYPE v)                                   \
+{                                                              \
+  *p = v + INITVAL;                                            \
+}                                                              \
+                                                               \
+void                                                           \
+checkg##NAME (void)                                            \
+{                                                              \
+  check##NAME (g01##NAME,  1);                                 \
+  check##NAME (g02##NAME,  2);                                 \
+  check##NAME (g03##NAME,  3);                                 \
+  check##NAME (g04##NAME,  4);                                 \
+  check##NAME (g05##NAME,  5);                                 \
+  check##NAME (g06##NAME,  6);                                 \
+  check##NAME (g07##NAME,  7);                                 \
+  check##NAME (g08##NAME,  8);                                 \
+  check##NAME (g09##NAME,  9);                                 \
+  check##NAME (g10##NAME, 10);                                 \
+  check##NAME (g11##NAME, 11);                                 \
+  check##NAME (g12##NAME, 12);                                 \
+  check##NAME (g13##NAME, 13);                                 \
+  check##NAME (g14##NAME, 14);                                 \
+  check##NAME (g15##NAME, 15);                                 \
+  check##NAME (g16##NAME, 16);                                 \
+}                                                              \
+                                                               \
+void                                                           \
+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)            \
+{                                                              \
+  check##NAME (x01,  1);                                       \
+  check##NAME (x02,  2);                                       \
+  check##NAME (x03,  3);                                       \
+  check##NAME (x04,  4);                                       \
+  check##NAME (x05,  5);                                       \
+  check##NAME (x06,  6);                                       \
+  check##NAME (x07,  7);                                       \
+  check##NAME (x08,  8);                                       \
+  check##NAME (x09,  9);                                       \
+  check##NAME (x10, 10);                                       \
+  check##NAME (x11, 11);                                       \
+  check##NAME (x12, 12);                                       \
+  check##NAME (x13, 13);                                       \
+  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);                           \
+         DEBUG_DOT;                                            \
+         check##NAME (t, i+1);                                 \
+       }                                                       \
+      va_end (ap);                                             \
+    }                                                          \
+}
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_main.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_main.c
new file mode 100644 (file)
index 0000000..93b64df
--- /dev/null
@@ -0,0 +1,14 @@
+/* Test passing scalars by value.  This test includes scalar types that
+   are not supported by va_arg; since they require casts to pass to a
+   function with a variable argument list, testing them with variable
+   arguments is not interesting.  */
+
+extern void scalar_by_value_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+  scalar_by_value_2_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_x.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_x.c
new file mode 100644 (file)
index 0000000..0b20f5f
--- /dev/null
@@ -0,0 +1,102 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL)                                         \
+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 void                                                    \
+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);           \
+                                                               \
+void                                                           \
+check##NAME (TYPE x, TYPE v)                                   \
+{                                                              \
+  if (x != v + INITVAL)                                                \
+    {                                                          \
+      DEBUG_NL;                                                        \
+      abort ();                                                        \
+    }                                                          \
+}                                                              \
+                                                               \
+void                                                           \
+test2_##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04,          \
+             TYPE x05, TYPE x06, TYPE x07, TYPE x08)           \
+{                                                              \
+  test##NAME (x01, g02##NAME, x02, g04##NAME,                  \
+             x03, g06##NAME, x04, g08##NAME,                   \
+             x05, g10##NAME, x06, g12##NAME,                   \
+             x07, g14##NAME, x08, g16##NAME);                  \
+}                                                              \
+                                                               \
+void                                                           \
+testit##NAME (void)                                            \
+{                                                              \
+  DEBUG_FPUTS (#NAME);                                         \
+  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_FPUTS (" test");                                       \
+  test##NAME (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_FPUTS (" test2");                                      \
+  test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME,    \
+               g09##NAME, g11##NAME, g13##NAME, g15##NAME);    \
+  DEBUG_NL;                                                    \
+}
+
+extern void abort (void);
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
+
+#undef T
+
+void
+scalar_by_value_2_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(c)
+T(uc)
+T(sc)
+T(us)
+T(ss)
+T(f)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_y.c b/gcc/testsuite/gcc.dg/compat/scalar-by-value-2_y.c
new file mode 100644 (file)
index 0000000..5b79334
--- /dev/null
@@ -0,0 +1,78 @@
+#include <stdarg.h>
+
+#ifndef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL)                                 \
+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);                      \
+                                                               \
+void                                                           \
+init##NAME (TYPE *p, TYPE v)                                   \
+{                                                              \
+  *p = v + INITVAL;                                            \
+}                                                              \
+                                                               \
+void                                                           \
+checkg##NAME (void)                                            \
+{                                                              \
+  check##NAME (g01##NAME,  1);                                 \
+  check##NAME (g02##NAME,  2);                                 \
+  check##NAME (g03##NAME,  3);                                 \
+  check##NAME (g04##NAME,  4);                                 \
+  check##NAME (g05##NAME,  5);                                 \
+  check##NAME (g06##NAME,  6);                                 \
+  check##NAME (g07##NAME,  7);                                 \
+  check##NAME (g08##NAME,  8);                                 \
+  check##NAME (g09##NAME,  9);                                 \
+  check##NAME (g10##NAME, 10);                                 \
+  check##NAME (g11##NAME, 11);                                 \
+  check##NAME (g12##NAME, 12);                                 \
+  check##NAME (g13##NAME, 13);                                 \
+  check##NAME (g14##NAME, 14);                                 \
+  check##NAME (g15##NAME, 15);                                 \
+  check##NAME (g16##NAME, 16);                                 \
+}                                                              \
+                                                               \
+void                                                           \
+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)            \
+{                                                              \
+  check##NAME (x01,  1);                                       \
+  check##NAME (x02,  2);                                       \
+  check##NAME (x03,  3);                                       \
+  check##NAME (x04,  4);                                       \
+  check##NAME (x05,  5);                                       \
+  check##NAME (x06,  6);                                       \
+  check##NAME (x07,  7);                                       \
+  check##NAME (x08,  8);                                       \
+  check##NAME (x09,  9);                                       \
+  check##NAME (x10, 10);                                       \
+  check##NAME (x11, 11);                                       \
+  check##NAME (x12, 12);                                       \
+  check##NAME (x13, 13);                                       \
+  check##NAME (x14, 14);                                       \
+  check##NAME (x15, 15);                                       \
+  check##NAME (x16, 16);                                       \
+}
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
index 89cf5ae..67d60ec 100644 (file)
@@ -111,10 +111,11 @@ proc compat-run { testname objlist dest options optstr } {
 # compat-execute -- compile with compatible compilers
 #
 # SRC1 is the full pathname of the main file of the testcase.
+# SID identifies a test suite in the names of temporary files.
 # USE_ALT is nonzero if we're using an alternate compiler as well as
 #   the compiler under test.
 #
-proc compat-execute { src1 use_alt } {
+proc compat-execute { src1 sid use_alt } {
     global srcdir tmpdir
     global option_list
     global tool
@@ -144,11 +145,11 @@ proc compat-execute { src1 use_alt } {
     regsub "_main" $src1 "_y" src3
 
     # Define the names of the object files.
-    set obj1 "main_tst.o"
-    set obj2_tst "x_tst.o"
-    set obj2_alt "x_alt.o"
-    set obj3_tst "y_tst.o"
-    set obj3_alt "y_alt.o"
+    regsub "sid" "sid_main_tst.o" $sid obj1
+    regsub "sid" "sid_x_tst.o" $sid obj2_tst
+    regsub "sid" "sid_x_alt.o" $sid obj2_alt
+    regsub "sid" "sid_y_tst.o" $sid obj3_tst
+    regsub "sid" "sid_y_alt.o" $sid obj3_alt
 
     # Get the base name of this test, for use in messages.
     regsub "^$srcdir/?" $src1 "" testcase
@@ -181,10 +182,8 @@ proc compat-execute { src1 use_alt } {
 
        set tst_options ""
        set alt_options ""
-       if ![string match $extra_tool_flags ""] then {
-           lappend tst_options "additional_flags=$extra_tool_flags $tst_option"
-           lappend alt_options "additional_flags=$extra_tool_flags $alt_option"
-       }
+       lappend tst_options "additional_flags=$extra_tool_flags $tst_option"
+       lappend alt_options "additional_flags=$extra_tool_flags $alt_option"
 
        # There's a unique name for each executable we generate, based on
        # the set of options and how the pieces of the tests are compiled.
@@ -228,7 +227,7 @@ proc compat-execute { src1 use_alt } {
        }
 
        # Clean up object files.
-       set files [glob -nocomplain *.o]
+       set files [glob -nocomplain ${sid}_*.o]
        if { $files != "" } {
            foreach objfile $files {
                if { ![info exists gluefile] || $objfile != $gluefile } {