aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2020-06-06 05:06:04 -0700
committerMax Filippov <jcmvbkbc@gmail.com>2020-06-08 18:30:07 -0700
commit1d9921cbdc732e1a7fc66b9c24a6dfa9625bd4c0 (patch)
tree60b219c10241be1e2f0c7bc32e7154074cc2074a /gcc
parentdf2c0060e5d1e0a37001b93f36e9245bb75ef33b (diff)
downloadgcc-1d9921cbdc732e1a7fc66b9c24a6dfa9625bd4c0.zip
gcc-1d9921cbdc732e1a7fc66b9c24a6dfa9625bd4c0.tar.gz
gcc-1d9921cbdc732e1a7fc66b9c24a6dfa9625bd4c0.tar.bz2
xtensa: libgcc: fix PR target/95571
Rewrite uw_install_context without function calls to avoid register spilling in _Unwind_RaiseException during return context installation. 2020-06-08 Max Filippov <jcmvbkbc@gmail.com> gcc/testsuite/ * g++.target/xtensa/pr95571.C: New test. * g++.target/xtensa/xtensa.exp: New testsuite. libgcc/ * config/xtensa/unwind-dw2-xtensa.c (uw_install_context): Merge with uw_install_context_1.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.target/xtensa/pr95571.C43
-rw-r--r--gcc/testsuite/g++.target/xtensa/xtensa.exp43
2 files changed, 86 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.target/xtensa/pr95571.C b/gcc/testsuite/g++.target/xtensa/pr95571.C
new file mode 100644
index 0000000..59fe285
--- /dev/null
+++ b/gcc/testsuite/g++.target/xtensa/pr95571.C
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+
+extern "C" void abort(void);
+extern "C" void __xtensa_libgcc_window_spill(void);
+
+static int call;
+static int cnt;
+
+extern "C" void *memcpy(void *dst, const void *src, unsigned int sz)
+{
+ char *a = (char *)dst;
+ const char *b = (const char *)src;
+
+ if (call++ == cnt)
+ __xtensa_libgcc_window_spill();
+
+ while (sz--)
+ *a++ = *b++;
+
+ return dst;
+}
+
+int main()
+{
+ int i;
+
+ for (i = 0; i < 100; ++i)
+ {
+ call = 0;
+ cnt = i;
+
+ try
+ {
+ throw 1;
+ }
+ catch (int v)
+ {
+ if (v != 1)
+ abort ();
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.target/xtensa/xtensa.exp b/gcc/testsuite/g++.target/xtensa/xtensa.exp
new file mode 100644
index 0000000..f419120
--- /dev/null
+++ b/gcc/testsuite/g++.target/xtensa/xtensa.exp
@@ -0,0 +1,43 @@
+# Specific regression driver for Xtensa.
+# Copyright (C) 2020 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC 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 3, or (at your option)
+# any later version.
+#
+# GCC 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>. */
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an Xtensa target.
+if {![istarget xtensa*-*-*] } then {
+ return
+}
+
+# Load support procs.
+load_lib g++-dg.exp
+
+global DEFAULT_CXXFLAGS
+if ![info exists DEFAULT_CXXFLAGS] then {
+ set DEFAULT_CXXFLAGS " -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
+ "" $DEFAULT_CXXFLAGS
+
+# All done.
+dg-finish