Merge "Revise docs"
diff --git a/build/core/ndk-common.sh b/build/core/ndk-common.sh
index 974f934..77cca66 100644
--- a/build/core/ndk-common.sh
+++ b/build/core/ndk-common.sh
@@ -272,6 +272,7 @@
     # reporting anomoly here.
     if [ "$HOST_OS" = darwin ] ; then
         if ! echo __LP64__ | (CCOPTS= gcc -E - 2>/dev/null) | grep -q __LP64__ ; then
+        # or if gcc -dM -E - < /dev/null | grep -q __LP64__; then
             HOST_ARCH=x86_64
         fi
     fi
@@ -708,6 +709,8 @@
             else
                 run tar j$TARFLAGS "$ARCHIVE" -C $DIR
             fi
+            # remove ._* files by MacOSX to preserve resource forks we don't need
+            find $DIR -name "\._*" -exec rm {} \;
             ;;
         *)
             panic "Cannot unpack archive with unknown extension: $ARCHIVE"
diff --git a/tests/build/issue39824-__BYTE_ORDER/jni/Android.mk b/tests/build/issue39824-__BYTE_ORDER/jni/Android.mk
index 9bd21ad..b483c02 100644
--- a/tests/build/issue39824-__BYTE_ORDER/jni/Android.mk
+++ b/tests/build/issue39824-__BYTE_ORDER/jni/Android.mk
@@ -5,3 +5,8 @@
 LOCAL_SRC_FILES := issue39824-__BYTE_ORDER.c
 include $(BUILD_EXECUTABLE)
 
+include $(CLEAR_VARS)
+LOCAL_MODULE := issue39824-_BYTE_ORDER
+LOCAL_SRC_FILES := issue39824-_BYTE_ORDER.c
+include $(BUILD_EXECUTABLE)
+
diff --git a/tests/build/issue39824-__BYTE_ORDER/jni/issue39824-_BYTE_ORDER.c b/tests/build/issue39824-__BYTE_ORDER/jni/issue39824-_BYTE_ORDER.c
new file mode 100644
index 0000000..444f23b
--- /dev/null
+++ b/tests/build/issue39824-__BYTE_ORDER/jni/issue39824-_BYTE_ORDER.c
@@ -0,0 +1,6 @@
+#include <endian.h>
+
+int main()
+{
+  return 0 * _BYTE_ORDER * __BYTE_ORDER;
+}
diff --git a/tests/device/test-stlport_shared-exception/BROKEN_RUN b/tests/device/test-stlport_shared-exception/BROKEN_RUN
new file mode 100644
index 0000000..0d9c9e4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/BROKEN_RUN
@@ -0,0 +1 @@
+elide2 new3 terminate1 weak1 badalloc1
\ No newline at end of file
diff --git a/tests/device/test-stlport_shared-exception/COPYING b/tests/device/test-stlport_shared-exception/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/tests/device/test-stlport_shared-exception/jni/Android.mk b/tests/device/test-stlport_shared-exception/jni/Android.mk
new file mode 100644
index 0000000..0336b7a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/Android.mk
@@ -0,0 +1,1202 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := variadic73
+LOCAL_SRC_FILES := variadic73.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := alias1
+LOCAL_SRC_FILES := alias1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cond1
+LOCAL_SRC_FILES := cond1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := crossjump1
+LOCAL_SRC_FILES := crossjump1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor1
+LOCAL_SRC_FILES := ctor1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor2
+LOCAL_SRC_FILES := ctor2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delayslot1
+LOCAL_SRC_FILES := delayslot1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dtor1
+LOCAL_SRC_FILES := dtor1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ehopt1
+LOCAL_SRC_FILES := ehopt1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := elide1
+LOCAL_SRC_FILES := elide1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := elide2
+LOCAL_SRC_FILES := elide2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := filter1
+LOCAL_SRC_FILES := filter1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := filter2
+LOCAL_SRC_FILES := filter2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fp-regs
+LOCAL_SRC_FILES := fp-regs.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := gcsec1
+LOCAL_SRC_FILES := gcsec1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ia64-2
+LOCAL_SRC_FILES := ia64-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := loop1
+LOCAL_SRC_FILES := loop1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := loop2
+LOCAL_SRC_FILES := loop2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+#include $(CLEAR_VARS)
+#LOCAL_MODULE := new1
+#LOCAL_SRC_FILES := new1.cpp
+#LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := omit-frame-pointer2
+LOCAL_SRC_FILES := omit-frame-pointer2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr29166
+LOCAL_SRC_FILES := pr29166.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := registers1
+LOCAL_SRC_FILES := registers1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spbp
+LOCAL_SRC_FILES := spbp.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec3
+LOCAL_SRC_FILES := spec3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec5
+LOCAL_SRC_FILES := spec5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec7
+LOCAL_SRC_FILES := spec7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec9
+LOCAL_SRC_FILES := spec9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := synth2
+LOCAL_SRC_FILES := synth2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := template1
+LOCAL_SRC_FILES := template1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unexpected1
+LOCAL_SRC_FILES := unexpected1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := weak1
+LOCAL_SRC_FILES := weak1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_assign
+LOCAL_SRC_FILES := has_nothrow_assign.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_assign_odr
+LOCAL_SRC_FILES := has_nothrow_assign_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_constructor
+LOCAL_SRC_FILES := has_nothrow_constructor.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_constructor_odr
+LOCAL_SRC_FILES := has_nothrow_constructor_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-1
+LOCAL_SRC_FILES := has_nothrow_copy-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-2
+LOCAL_SRC_FILES := has_nothrow_copy-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-3
+LOCAL_SRC_FILES := has_nothrow_copy-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-4
+LOCAL_SRC_FILES := has_nothrow_copy-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-5
+LOCAL_SRC_FILES := has_nothrow_copy-5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-6
+LOCAL_SRC_FILES := has_nothrow_copy-6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-7
+LOCAL_SRC_FILES := has_nothrow_copy-7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++0x
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy_odr
+LOCAL_SRC_FILES := has_nothrow_copy_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := label3
+LOCAL_SRC_FILES := label3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pretty2
+LOCAL_SRC_FILES := pretty2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := array5
+LOCAL_SRC_FILES := array5.cpp
+LOCAL_CFLAGS := -DPRINT
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor1_1
+LOCAL_SRC_FILES := ctor1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete2
+LOCAL_SRC_FILES := delete2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new11
+LOCAL_SRC_FILES := new11.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new16
+LOCAL_SRC_FILES := new16.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new23
+LOCAL_SRC_FILES := new23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new5
+LOCAL_SRC_FILES := new5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := placement2
+LOCAL_SRC_FILES := placement2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ref9
+LOCAL_SRC_FILES := ref9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := alias2
+LOCAL_SRC_FILES := alias2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh2
+LOCAL_SRC_FILES := eh2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3
+LOCAL_SRC_FILES := eh3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr17697-1
+LOCAL_SRC_FILES := pr17697-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr17697-2
+LOCAL_SRC_FILES := pr17697-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr22167
+LOCAL_SRC_FILES := pr22167.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr23299
+LOCAL_SRC_FILES := pr23299.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr36449
+LOCAL_SRC_FILES := pr36449.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := reg-stack
+LOCAL_SRC_FILES := reg-stack.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unroll1
+LOCAL_SRC_FILES := unroll1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-alloca-1
+LOCAL_SRC_FILES := eh-alloca-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-global-1
+LOCAL_SRC_FILES := eh-global-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-inline-1
+LOCAL_SRC_FILES := eh-inline-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-inline-2
+LOCAL_SRC_FILES := eh-inline-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-vararg-1
+LOCAL_SRC_FILES := eh-vararg-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-vararg-2
+LOCAL_SRC_FILES := eh-vararg-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-1
+LOCAL_SRC_FILES := throw-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-2
+LOCAL_SRC_FILES := throw-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-3
+LOCAL_SRC_FILES := throw-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-4
+LOCAL_SRC_FILES := throw-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := arraynew
+LOCAL_SRC_FILES := arraynew.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vtable2
+LOCAL_SRC_FILES := vtable2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete1
+LOCAL_SRC_FILES := delete1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh1
+LOCAL_SRC_FILES := eh1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := badalloc1
+LOCAL_SRC_FILES := badalloc1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch11
+LOCAL_SRC_FILES := catch11.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch12
+LOCAL_SRC_FILES := catch12.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch3
+LOCAL_SRC_FILES := catch3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch3p
+LOCAL_SRC_FILES := catch3p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch4
+LOCAL_SRC_FILES := catch4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch4p
+LOCAL_SRC_FILES := catch4p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch5
+LOCAL_SRC_FILES := catch5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch5p
+LOCAL_SRC_FILES := catch5p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch6
+LOCAL_SRC_FILES := catch6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch6p
+LOCAL_SRC_FILES := catch6p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch7
+LOCAL_SRC_FILES := catch7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch7p
+LOCAL_SRC_FILES := catch7p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch8
+LOCAL_SRC_FILES := catch8.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch8p
+LOCAL_SRC_FILES := catch8p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch9
+LOCAL_SRC_FILES := catch9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch9p
+LOCAL_SRC_FILES := catch9p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catchptr1
+LOCAL_SRC_FILES := catchptr1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cleanup1_1
+LOCAL_SRC_FILES := cleanup1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cleanup2
+LOCAL_SRC_FILES := cleanup2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := flow1
+LOCAL_SRC_FILES := flow1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fntry1
+LOCAL_SRC_FILES := fntry1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := inline2
+LOCAL_SRC_FILES := inline2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_2
+LOCAL_SRC_FILES := new1_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new2_1
+LOCAL_SRC_FILES := new2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pdel1
+LOCAL_SRC_FILES := pdel1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pdel2
+LOCAL_SRC_FILES := pdel2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ptr1
+LOCAL_SRC_FILES := ptr1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ptrmem1_1
+LOCAL_SRC_FILES := ptrmem1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow1
+LOCAL_SRC_FILES := rethrow1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow2
+LOCAL_SRC_FILES := rethrow2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow3
+LOCAL_SRC_FILES := rethrow3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow4
+LOCAL_SRC_FILES := rethrow4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow5
+LOCAL_SRC_FILES := rethrow5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow6
+LOCAL_SRC_FILES := rethrow6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec1
+LOCAL_SRC_FILES := spec1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec2
+LOCAL_SRC_FILES := spec2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec3_1
+LOCAL_SRC_FILES := spec3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec4
+LOCAL_SRC_FILES := spec4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec7_1
+LOCAL_SRC_FILES := spec7_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := terminate1
+LOCAL_SRC_FILES := terminate1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := terminate2
+LOCAL_SRC_FILES := terminate2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := tmpl1
+LOCAL_SRC_FILES := tmpl1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unwind1
+LOCAL_SRC_FILES := unwind1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase1_1
+LOCAL_SRC_FILES := vbase1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase2_1
+LOCAL_SRC_FILES := vbase2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase4_1
+LOCAL_SRC_FILES := vbase4_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := const
+LOCAL_SRC_FILES := const.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new3
+LOCAL_SRC_FILES := new3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rvalue1
+LOCAL_SRC_FILES := rvalue1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := operators23
+LOCAL_SRC_FILES := operators23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := operators27
+LOCAL_SRC_FILES := operators27.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_3
+LOCAL_SRC_FILES := new1_3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast1
+LOCAL_SRC_FILES := dyncast1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast2_1
+LOCAL_SRC_FILES := dyncast2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast7
+LOCAL_SRC_FILES := dyncast7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh10
+LOCAL_SRC_FILES := eh10.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh12
+LOCAL_SRC_FILES := eh12.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh14
+LOCAL_SRC_FILES := eh14.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh16
+LOCAL_SRC_FILES := eh16.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh17
+LOCAL_SRC_FILES := eh17.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh18
+LOCAL_SRC_FILES := eh18.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh21
+LOCAL_SRC_FILES := eh21.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh23
+LOCAL_SRC_FILES := eh23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh24
+LOCAL_SRC_FILES := eh24.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh25
+LOCAL_SRC_FILES := eh25.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh26
+LOCAL_SRC_FILES := eh26.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh27
+LOCAL_SRC_FILES := eh27.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh28
+LOCAL_SRC_FILES := eh28.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh29
+LOCAL_SRC_FILES := eh29.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3_1
+LOCAL_SRC_FILES := eh3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh31
+LOCAL_SRC_FILES := eh31.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh33
+LOCAL_SRC_FILES := eh33.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh34
+LOCAL_SRC_FILES := eh34.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh35
+LOCAL_SRC_FILES := eh35.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh36
+LOCAL_SRC_FILES := eh36.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh37
+LOCAL_SRC_FILES := eh37.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh38
+LOCAL_SRC_FILES := eh38.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh39
+LOCAL_SRC_FILES := eh39.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh40
+LOCAL_SRC_FILES := eh40.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh41
+LOCAL_SRC_FILES := eh41.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh42
+LOCAL_SRC_FILES := eh42.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh44
+LOCAL_SRC_FILES := eh44.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh47
+LOCAL_SRC_FILES := eh47.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh48
+LOCAL_SRC_FILES := eh48.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh49
+LOCAL_SRC_FILES := eh49.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh5
+LOCAL_SRC_FILES := eh5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh50
+LOCAL_SRC_FILES := eh50.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh51
+LOCAL_SRC_FILES := eh51.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh53
+LOCAL_SRC_FILES := eh53.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh55
+LOCAL_SRC_FILES := eh55.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh6
+LOCAL_SRC_FILES := eh6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh7
+LOCAL_SRC_FILES := eh7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh8
+LOCAL_SRC_FILES := eh8.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh9
+LOCAL_SRC_FILES := eh9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p11667
+LOCAL_SRC_FILES := p11667.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p755
+LOCAL_SRC_FILES := p755.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p755a
+LOCAL_SRC_FILES := p755a.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p7912
+LOCAL_SRC_FILES := p7912.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p8155
+LOCAL_SRC_FILES := p8155.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p9706
+LOCAL_SRC_FILES := p9706.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete3
+LOCAL_SRC_FILES := delete3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_4
+LOCAL_SRC_FILES := new1_4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := array1_2
+LOCAL_SRC_FILES := array1_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete3_1
+LOCAL_SRC_FILES := delete3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3_2
+LOCAL_SRC_FILES := eh3_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := init7
+LOCAL_SRC_FILES := init7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new6
+LOCAL_SRC_FILES := new6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new7
+LOCAL_SRC_FILES := new7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := singleton
+LOCAL_SRC_FILES := singleton.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase2_2
+LOCAL_SRC_FILES := vbase2_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := explarg1
+LOCAL_SRC_FILES := explarg1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fntry1_1
+LOCAL_SRC_FILES := fntry1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := overload12_1
+LOCAL_SRC_FILES := overload12_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eb50
+LOCAL_SRC_FILES := eb50.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eb88
+LOCAL_SRC_FILES := eb88.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-1
+LOCAL_SRC_FILES := eh990323-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-2
+LOCAL_SRC_FILES := eh990323-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-3
+LOCAL_SRC_FILES := eh990323-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-4
+LOCAL_SRC_FILES := eh990323-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-5
+LOCAL_SRC_FILES := eh990323-5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ice990323-2
+LOCAL_SRC_FILES := ice990323-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
diff --git a/tests/device/test-stlport_shared-exception/jni/Application.mk b/tests/device/test-stlport_shared-exception/jni/Application.mk
new file mode 100644
index 0000000..b93171a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/Application.mk
@@ -0,0 +1,2 @@
+APP_ABI := all
+APP_STL := stlport_shared
\ No newline at end of file
diff --git a/tests/build/issue39824-__BYTE_ORDER/BROKEN_BUILD b/tests/device/test-stlport_shared-exception/jni/MODULE_LICENSE_GPL
similarity index 100%
rename from tests/build/issue39824-__BYTE_ORDER/BROKEN_BUILD
rename to tests/device/test-stlport_shared-exception/jni/MODULE_LICENSE_GPL
diff --git a/tests/device/test-stlport_shared-exception/jni/alias1.cpp b/tests/device/test-stlport_shared-exception/jni/alias1.cpp
new file mode 100644
index 0000000..e526082
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/alias1.cpp
@@ -0,0 +1,42 @@
+// { dg-do run }
+// { dg-options "-O3" }
+/* PR c++/28139: disjoint alias sets for the store from
+   expand_start_catch_block than for loading P result in P being loaded
+   before it is initialized for sh-elf.  */
+
+extern "C" {
+void exit (int) __attribute__ ((noreturn));
+}
+
+int i_glob = 42;
+int *p0 = &i_glob;
+typedef int **ipp;
+
+void
+g (int i)
+{
+  if (!i_glob)
+    exit ((__SIZE_TYPE__) & i);
+}
+
+static void
+h ()
+{
+  throw &p0;
+}
+
+int
+main()
+{
+  g (42);
+  try
+    {
+      h ();
+    }
+  catch (const ipp &p)
+    {
+      if (**p != 42)
+        exit (1);
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/alias2.cpp b/tests/device/test-stlport_shared-exception/jni/alias2.cpp
new file mode 100644
index 0000000..0b41224
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/alias2.cpp
@@ -0,0 +1,74 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int printf (const char*, ...);
+
+struct _Deque_iterator {
+  int _M_cur;
+  int x[2];
+  int* _M_node;
+
+  _Deque_iterator() : _M_cur(0), _M_node(0) {}
+  _Deque_iterator(const _Deque_iterator& __x)
+    : _M_cur(__x._M_cur),
+      _M_node(__x._M_node) {}
+};
+
+class _Deque_base
+{
+public:
+  int yy;
+
+  _Deque_base()
+    : _M_start()
+    { _M_initialize_map(); }
+  ~_Deque_base();   
+
+  void _M_initialize_map();
+  _Deque_iterator _M_start;
+};
+
+
+_Deque_base::~_Deque_base() {
+  printf ("bb %x %x\n", this, *_M_start._M_node);
+}
+
+void
+_Deque_base::_M_initialize_map()
+{
+  yy = 0x123;
+  printf ("aa %x %x\n", this, yy);
+
+  _M_start._M_node = &yy;
+  _M_start._M_cur = yy;
+}
+
+
+class deque : protected _Deque_base
+{
+public:
+  deque () {}
+  deque(const deque& __x) {}
+  ~deque() {
+    _Deque_iterator i = _M_start;
+  }
+};
+
+
+
+class GeometryAddress {
+public:
+  GeometryAddress(deque addressStack) {}
+};
+
+void yyy (const GeometryAddress& gb)
+{
+}
+
+deque temp1;
+
+int main()
+{
+  yyy (GeometryAddress (temp1));
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/array1_2.cpp b/tests/device/test-stlport_shared-exception/jni/array1_2.cpp
new file mode 100644
index 0000000..5aa5b1e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/array1_2.cpp
@@ -0,0 +1,27 @@
+// { dg-do run  }
+int i;
+
+struct S {
+  S (int) {
+    ++i;
+    if (i == 3)
+      throw 3;
+  }
+
+  S () {}
+
+  ~S() {
+    --i;
+  }
+};
+
+int main()
+{
+  try {
+    S s[5] = { 0, 1, 2, 3, 4 };
+  } catch (...) {
+  }
+
+  if (i != 1)
+    return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/array5.cpp b/tests/device/test-stlport_shared-exception/jni/array5.cpp
new file mode 100644
index 0000000..aeacb31
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/array5.cpp
@@ -0,0 +1,52 @@
+// { dg-do run }
+// Copyright (C) 2002 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Incorrect construction and destruction of multi-dimensional
+// array of class.
+
+extern "C" void abort();
+extern "C" int printf(const char *, ...);
+
+int count;
+int num;
+
+struct A
+{
+	A()
+	{
+		if (count == num)
+			throw "";
+		count++;
+#ifdef PRINT
+		printf("ctor %p\n", static_cast<void *>(this));
+#endif
+	}
+
+	~A()
+	{
+		count--;
+#ifdef PRINT
+		printf("dtor %p\n", static_cast<void *>(this));
+#endif
+	}
+};
+
+struct Array
+{
+	A array[2][2][2];
+};
+
+int main()
+{
+	for (num = 0; num <= 8; ++num) {
+		count = 0;
+		try {
+			Array A;
+		}
+		catch (...) {
+		}
+		if (count != 0)
+			abort();
+	}
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/arraynew.cpp b/tests/device/test-stlport_shared-exception/jni/arraynew.cpp
new file mode 100644
index 0000000..ff19c7e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/arraynew.cpp
@@ -0,0 +1,152 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+
+#include <cstdlib>
+#include <new>
+
+void* p;
+
+void* operator new[](size_t s) throw (std::bad_alloc)
+{
+  // Record the base of the last array allocated.
+  p = malloc (s);
+  return p;
+}
+
+template <typename T>
+void check_no_cookie (int i)
+{
+  void* a = new T[7];
+  if (p != a)
+    exit (i);
+}
+
+template <typename T>
+void check_no_placement_cookie (int i)
+{
+  p = malloc (13 * sizeof (T));
+  void* a = new (p) T[13];
+  if (p != a)
+    exit (i);
+}
+
+template <typename T>
+void check_cookie (int i)
+{
+  void* a = new T[11];
+  size_t x;
+  
+  // Compute the cookie location manually.
+#ifdef __ARM_EABI__
+  x = 8;
+#else
+  x = __alignof__ (T);
+  if (x < sizeof (size_t))
+    x = sizeof (size_t);
+#endif
+  if ((char *) a - x != (char *) p)
+    exit (i);
+
+  // Check the cookie value.
+  size_t *sp = ((size_t *) a) - 1;
+  if (*sp != 11)
+    exit (i);
+
+#ifdef __ARM_EABI__
+  sp = ((size_t *) a) - 2;
+  if (*sp != sizeof (T))
+    exit (i);
+#endif
+}
+
+template <typename T>
+void check_placement_cookie (int i)
+{
+  p = malloc (sizeof (T) * 11 + 100);
+  void* a = new (p) T[11];
+  size_t x;
+  
+  // Compute the cookie location manually.
+#ifdef __ARM_EABI__
+  x = 8;
+#else
+  x = __alignof__ (T);
+  if (x < sizeof (size_t))
+    x = sizeof (size_t);
+#endif
+  if ((char *) a - x != (char *) p)
+    exit (i);
+
+  // Check the cookie value.
+  size_t *sp = ((size_t *) a) - 1;
+  if (*sp != 11)
+    exit (i);
+
+#ifdef __ARM_EABI__
+  sp = ((size_t *) a) - 2;
+  if (*sp != sizeof (T))
+    exit (i);
+#endif
+}
+
+struct X {};
+
+template <typename T>
+struct Y { int i; virtual void f () {} };
+
+// A class with a non-trivial destructor -- it needs a cookie.
+struct Z { ~Z () {} };
+// Likewise, but this class needs a bigger cookie so that the array
+// elements are correctly aligned.
+struct Z2 { ~Z2 () {} long double d; };
+  
+struct W1 { void operator delete[] (void *, size_t) {} };
+struct W2 { void operator delete[] (void *) {}
+            void operator delete[] (void *, size_t) {} };
+struct W3 { void operator delete[] (void *, size_t) {}
+            void operator delete[] (void *) {} };
+struct W4 : public W1 {};
+
+struct V { void *operator new[] (size_t s, void *p) 
+             { return p; }
+           ~V () {}
+         };
+   
+int main ()
+{
+  // There should be no cookies for types with trivial destructors.
+  check_no_cookie<int> (1);
+  check_no_cookie<X> (2);
+  check_no_cookie<Y<double> > (3);
+
+  // There should be no cookies for allocations using global placement
+  // new.
+  check_no_placement_cookie<int> (4);
+  check_no_placement_cookie<X> (5);
+  check_no_placement_cookie<Z> (6);
+
+  // There should be a cookie when using a non-trivial destructor.
+  check_cookie<Z> (7);
+  check_cookie<Z2> (8);
+  
+  // There should be a cookie when using the two-argument array delete
+  // operator.
+  check_cookie<W1> (9);
+  check_cookie<W4> (10);
+  // But not when the one-argument version is also available.
+  check_no_cookie<W2> (11);
+  check_no_cookie<W3> (12);
+
+  // There should be a cookie when using a non-global placement new.
+  check_placement_cookie<V> (13);
+}
+
+#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
+
+int main () 
+{
+}
+
+#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
diff --git a/tests/device/test-stlport_shared-exception/jni/badalloc1.cpp b/tests/device/test-stlport_shared-exception/jni/badalloc1.cpp
new file mode 100644
index 0000000..28eb36c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/badalloc1.cpp
@@ -0,0 +1,133 @@
+// This fails for VxWorks RTPs because the initialization of
+// __cxa_allocate_exception's emergency buffer mutex will
+// itself call malloc(), and will fail if there is no more
+// memory available.
+// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } }
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
+
+// Check we can throw a bad_alloc exception when malloc dies.
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void abort();
+extern "C" void *memcpy(void *, const void *, size_t);
+
+// Assume that STACK_SIZE defined implies a system that does not have a
+// large data space either, and additionally that we're not linking against
+// a shared libstdc++ (which requires quite a bit more initialization space).
+#ifdef STACK_SIZE
+const int arena_size = 256;
+#else
+#if defined(__FreeBSD__) || defined(__sun__) || defined(__hpux__)
+// FreeBSD, Solaris and HP-UX with threads require even more
+// space at initialization time.  FreeBSD 5 now requires over 131072 bytes.
+const int arena_size = 262144;
+#else
+const int arena_size = 32768;
+#endif
+#endif
+
+struct object
+{
+  size_t size __attribute__((aligned));
+};
+
+static char arena[arena_size] __attribute__((aligned));
+static size_t pos;
+
+// So we can force a failure when needed.
+static int fail;
+
+extern "C" void *malloc (size_t size)
+{
+  object *p = reinterpret_cast<object *>(&arena[pos]);
+
+  if (fail)
+    return 0;
+
+  p->size = size;
+  size = (size + __alignof__(object) - 1) & - __alignof__(object);
+  pos += size + sizeof(object);
+
+  // Verify that we didn't run out of memory before getting initialized.
+  if (pos > arena_size)
+    abort ();
+
+  return p + 1;
+}
+
+extern "C" void free (void *)
+{
+}
+
+extern "C" void *realloc (void *p, size_t size)
+{
+  void *r;
+
+  if (p)
+    {
+      object *o = reinterpret_cast<object *>(p) - 1;
+      size_t old_size = o->size;
+
+      if (old_size >= size)
+	{
+	  r = p;
+	  o->size = size;
+	}
+      else
+	{
+	  r = malloc (size);
+	  memcpy (r, p, old_size);
+	  free (p);
+	}
+    }
+  else
+    r = malloc (size);
+
+  return r;
+}
+
+void fn_throw() throw(int)
+{
+  throw 1;
+}
+
+void fn_rethrow() throw(int)
+{
+  try{fn_throw();}
+  catch(int a){
+    throw;}
+}
+
+void fn_catchthrow() throw(int)
+{
+  try{fn_throw();}
+  catch(int a){
+    throw a + 1;}
+}
+
+int main()
+{
+  /* On some systems (including FreeBSD and Solaris 2.10),
+     __cxa_get_globals will try to call "malloc" when threads are in
+     use.  Therefore, we throw one exception up front so that
+     __cxa_get_globals is all set up.  Ideally, this would not be
+     necessary, but it is a well-known idiom, and using this technique
+     means that we can still validate the fact that exceptions can be
+     thrown when malloc fails.  */
+  try{fn_throw();}
+  catch(int a){}
+
+  fail = 1;
+
+  try{fn_throw();}
+  catch(int a){}
+
+  try{fn_rethrow();}
+  catch(int a){}
+
+  try{fn_catchthrow();}
+  catch(int a){}
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch11.cpp b/tests/device/test-stlport_shared-exception/jni/catch11.cpp
new file mode 100644
index 0000000..9f32f35
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch11.cpp
@@ -0,0 +1,70 @@
+// { dg-do run  }
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E<<B==A
+// +--C==A
+// +<<D==A
+
+struct A {};
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : virtual A {};
+struct E : private B, public C, private D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) {
+    caught = 1;
+    if (p != e) abort();
+  }
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) {
+    caught = 1;
+    if (p != e) abort();
+  }
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch12.cpp b/tests/device/test-stlport_shared-exception/jni/catch12.cpp
new file mode 100644
index 0000000..ae3b47c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch12.cpp
@@ -0,0 +1,64 @@
+// { dg-do run  }
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E--B<<==A
+// +--C--==A
+// +--D<<==A
+
+struct A {};
+struct B : private virtual A {};
+struct C : virtual A {};
+struct D : private virtual A {};
+struct E : public B, public C, public D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { caught = 1; if (p != e) abort ();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch3.cpp b/tests/device/test-stlport_shared-exception/jni/catch3.cpp
new file mode 100644
index 0000000..1a00ad1
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch3.cpp
@@ -0,0 +1,123 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a non-virtual public
+// DAG.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C--A
+
+#include <cstdio>
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  //fprintf(stderr, "D: %p\n", d);
+  //fprintf(stderr, "B: %p\n", (B*)d);
+  //fprintf(stderr, "A: %p\n", (A*)(B*)d);
+  //fprintf(stderr, "C: %p\n", (C*)d);
+  //fprintf(stderr, "A: %p\n", (A*)(C*)d);
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch3p.cpp b/tests/device/test-stlport_shared-exception/jni/catch3p.cpp
new file mode 100644
index 0000000..c1332b3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch3p.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a non-virtual
+// polymorphic public DAG.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch4.cpp b/tests/device/test-stlport_shared-exception/jni/catch4.cpp
new file mode 100644
index 0000000..1da91d0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch4.cpp
@@ -0,0 +1,114 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a virtual public
+// DAG.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch4p.cpp b/tests/device/test-stlport_shared-exception/jni/catch4p.cpp
new file mode 100644
index 0000000..6700a52
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch4p.cpp
@@ -0,0 +1,114 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a virtual 
+// polymorphic public DAG.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch5.cpp b/tests/device/test-stlport_shared-exception/jni/catch5.cpp
new file mode 100644
index 0000000..1fae7f5
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch5.cpp
@@ -0,0 +1,154 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+// +--AA-A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)d); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch5p.cpp b/tests/device/test-stlport_shared-exception/jni/catch5p.cpp
new file mode 100644
index 0000000..8ae8d65
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch5p.cpp
@@ -0,0 +1,154 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+// +--AA-A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)d); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch6.cpp b/tests/device/test-stlport_shared-exception/jni/catch6.cpp
new file mode 100644
index 0000000..d60d43e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch6.cpp
@@ -0,0 +1,185 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// E==D--B==A
+//    +--C==A
+//    +--AA-A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+struct E : virtual D { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(E *e)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D oject
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)e); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)e); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)e); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  E e;
+  check (&e); // try with an object
+  check ((E *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch6p.cpp b/tests/device/test-stlport_shared-exception/jni/catch6p.cpp
new file mode 100644
index 0000000..c73ac2c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch6p.cpp
@@ -0,0 +1,185 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// E==D--B==A
+//    +--C==A
+//    +--AA-A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+struct E : virtual D { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(E *e)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D oject
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)e); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)e); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)e); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  E e;
+  check (&e); // try with an object
+  check ((E *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch7.cpp b/tests/device/test-stlport_shared-exception/jni/catch7.cpp
new file mode 100644
index 0000000..d38d2a3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch7.cpp
@@ -0,0 +1,197 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// different levels
+// F--D--B--A
+//    +--C--A
+// +--E--A
+
+#include <stdio.h>
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+struct E : A { int m; };
+struct F : D, E { int m; };
+
+void fna(A *obj) {
+  throw obj;
+}
+void fnb(B *obj) {
+  throw obj;
+}
+void fnc(C *obj) {
+  throw obj;
+}
+void fnd(D *obj) {
+  throw obj;
+}
+void fne(E *obj) {
+  throw obj;
+}
+void fnf(F *obj) {
+  throw obj;
+}
+
+extern "C" void abort();
+
+void check(F *f)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(F *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D object
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with E object
+  caught = 0;
+  try { fne(f); }
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(F *p) { abort(); }
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)f); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)f); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((E *)f); }
+  catch(E *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  F f;
+  check (&f); // try with an object
+  check ((F *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch7p.cpp b/tests/device/test-stlport_shared-exception/jni/catch7p.cpp
new file mode 100644
index 0000000..5f15a48
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch7p.cpp
@@ -0,0 +1,184 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// different levels
+// F--D--B--A
+//    +--C--A
+// +--E--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+struct E : A { int m; };
+struct F : D, E { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+void fnf(F *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(F *f)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(F *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D object
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with E object
+  caught = 0;
+  try { fne(f); }
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(F *p) { abort(); }
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)f); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)f); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((E *)f); }
+  catch(E *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  F f;
+  check (&f); // try with an object
+  check ((F *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch8.cpp b/tests/device/test-stlport_shared-exception/jni/catch8.cpp
new file mode 100644
index 0000000..1947c1c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch8.cpp
@@ -0,0 +1,110 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C<<A
+
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : private A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((A *)(C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (A *)(C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { abort();}
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch8p.cpp b/tests/device/test-stlport_shared-exception/jni/catch8p.cpp
new file mode 100644
index 0000000..56fafcf
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch8p.cpp
@@ -0,0 +1,111 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C<<A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : private A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((A *)(C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (A *)(C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { abort();}
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch9.cpp b/tests/device/test-stlport_shared-exception/jni/catch9.cpp
new file mode 100644
index 0000000..f4938a3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch9.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D==B--A
+// +==C--A
+
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : virtual B, virtual C { int m; };
+
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catch9p.cpp b/tests/device/test-stlport_shared-exception/jni/catch9p.cpp
new file mode 100644
index 0000000..9cec7e7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catch9p.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D==B--A
+// +==C--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : virtual B, virtual C { int m; };
+
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/catchptr1.cpp b/tests/device/test-stlport_shared-exception/jni/catchptr1.cpp
new file mode 100644
index 0000000..c56652c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/catchptr1.cpp
@@ -0,0 +1,269 @@
+// { dg-do run  }
+// Test pointer chain catching
+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 9 Apr 2000 <nathan@nathan@codesourcery.com>
+
+#include <stdio.h>
+
+void fn () {}
+struct A {void fn () {}};
+static int var = 1;
+static const int const_var = 2;
+
+struct B;
+struct C;
+
+int test0 ()
+{
+  try
+  {
+    throw &fn;
+  }
+  catch (void *)
+  {
+    // should not decay to void *
+    fprintf(stderr, "25\n");
+    return 1;
+  }
+  catch (...)
+  {
+    return 0;
+  }
+  return -1;
+}
+
+int test1 ()
+{
+  try
+  {
+    throw &A::fn;
+  }
+  catch (void *)
+  {
+    // should not decay to void *
+    fprintf(stderr, "44\n");
+    return 1;
+  }
+  catch (...)
+  {
+    return 0;
+  }
+  return -1;
+}
+
+int test2 ()
+{
+  try
+  {
+    throw &var;
+  }
+  catch (void *)
+  {
+    // should decay to void *
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "67\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test3 ()
+{
+  try
+  {
+    throw &var;
+  }
+  catch (void const *)
+  {
+    // should decay to const void *
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "86\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test4 ()
+{
+  try
+  {
+    throw &const_var;
+  }
+  catch (void *)
+  {
+    fprintf(stderr, "100\n");
+    // should not decay to void *
+    return 1;
+  }
+  catch (void const *)
+  {
+    // should decay to const void *
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+int test5 ()
+{
+  try
+  {
+    throw (void ***)0;
+  }
+  catch (void ***)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "128\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test6 ()
+{
+  try
+  {
+    throw (void const* const* const*)0;
+  }
+  catch (void ***)
+  {
+    fprintf(stderr, "142\n");
+    return 1;
+  }
+  catch (void * const* const*)
+  {
+    return 2;
+  }
+  catch (void const* * const*)
+  {
+    return 3;
+  }
+  catch (void const* const* *)
+  {
+    return 4;
+  }
+  catch (void const* const* const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 1;
+  }
+  return -1;
+}
+
+int test7 ()
+{
+  try
+  {
+    throw (void ***)0;
+  }
+  catch (void const* const**)
+  {
+    return 1;
+  }
+  catch (void const** const *)
+  {
+    return 2;
+  }
+  catch (void * const* const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 3;
+  }
+  return -1;
+}
+
+int test8 ()
+{
+  try
+  {
+    throw (B **)0;
+  }
+  catch (C **)
+  {
+    return 1;
+  }
+  catch (B **)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+int test9 ()
+{
+  try
+  {
+    throw (B **)0;
+  }
+  catch (C const *const *)
+  {
+    return 1;
+  }
+  catch (B const *const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+static int (*tests[])() =
+{
+  test0,
+  test1,
+  test2,
+  test3,
+  test4,
+
+  test5,
+  test6,
+  test7,
+
+  test8,
+  test9,
+
+  NULL
+};
+
+int main ()
+{
+  int ix;
+  int errors = 0;
+
+  for (ix = 0; tests[ix]; ix++)
+  {
+    int n = tests[ix] ();
+
+    if (n)
+    {
+      printf ("test %d failed %d\n", ix, n);
+      errors++;
+    }
+  }
+  return errors;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/check.h b/tests/device/test-stlport_shared-exception/jni/check.h
new file mode 100644
index 0000000..af19885
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef  __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+  *i = 20;
+  if ((((ptrdiff_t) i) & (align - 1)) != 0)
+    {
+#ifdef DEBUG
+      printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+      abort ();
+    }
+  return *i;
+}
+
+void
+check (void *p, int align)
+{
+  if ((((ptrdiff_t) p) & (align - 1)) != 0)
+    {
+#ifdef DEBUG
+      printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+      abort ();
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/cleanup1_1.cpp b/tests/device/test-stlport_shared-exception/jni/cleanup1_1.cpp
new file mode 100644
index 0000000..1664643
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/cleanup1_1.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// Bug: obj gets destroyed twice because the fixups for the return are
+// inside its cleanup region.
+
+extern "C" int printf (const char *, ...);
+
+int d;
+
+struct myExc { };
+
+struct myExcRaiser {
+  ~myExcRaiser() { throw myExc(); }
+};
+
+struct stackObj {
+  ~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); }
+};
+
+int test()
+{
+  myExcRaiser rais;
+  stackObj obj;
+  return 0;
+}
+
+int main()
+{
+  try {
+    test();
+  }
+  catch (myExc &) {
+    return d != 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/cleanup2.cpp b/tests/device/test-stlport_shared-exception/jni/cleanup2.cpp
new file mode 100644
index 0000000..9538de9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/cleanup2.cpp
@@ -0,0 +1,53 @@
+// { dg-do run  }
+//  Copyright (C) 1999 Free Software Foundation, Inc.
+//  Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
+
+// make sure we don't call base dtors, if we failed to call the
+// base ctor due to exception throwing
+
+#include <stdio.h>
+
+static bool bad = false;
+
+static int thrower ()
+{
+  printf ("in %s\n", __PRETTY_FUNCTION__);
+  throw 0;
+  return 0;
+}
+
+struct X
+{
+  X (int) throw (int);
+  ~X () throw ();
+};
+
+X::X (int) throw (int)
+  {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;}
+X::~X () throw ()
+  {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;}
+
+struct X1 {};
+struct Y : X
+{
+  Y() throw (int);
+  ~Y() throw ();
+};
+Y::Y() throw (int)
+  : X(thrower ())   // throws, so X::X is never called
+  {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
+Y::~Y() throw ()
+  {printf ("in dtor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
+
+int main ()
+{
+  try
+    {
+      Y y;
+    }
+  catch (...)
+    {
+      printf ("caught\n");
+    }
+  return bad;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/cond1.cpp b/tests/device/test-stlport_shared-exception/jni/cond1.cpp
new file mode 100644
index 0000000..4f49426
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/cond1.cpp
@@ -0,0 +1,64 @@
+// PR c++/7050
+// { dg-do run }
+
+extern "C" void abort(void);
+
+#define CI(stmt) try { stmt; abort(); } catch (int) { }
+
+struct has_destructor
+{
+    ~has_destructor() { }
+};
+
+struct no_destructor
+{
+};
+
+int PI(int& i) { return i++; }
+
+int main(int argc, char *argv[])
+{
+    (argc+1 ? has_destructor() : throw 0);
+    CI((argc+1 ? throw 0 : has_destructor()));
+    CI((0 ? has_destructor() : throw 0));
+    CI((1 ? throw 0 : has_destructor()));
+    (0 ? throw 0 : has_destructor());
+    (1 ? has_destructor() : throw 0);
+
+    (argc+1 ? no_destructor() : throw 0);
+    CI((argc+1 ? throw 0 : no_destructor()));
+    CI((0 ? no_destructor() : throw 0));
+    CI((1 ? throw 0 : no_destructor()));
+    (0 ? throw 0 : no_destructor());
+    (1 ? no_destructor() : throw 0);
+
+    int i = 1;
+    CI(throw PI(i));
+    if (i != 2) abort();
+
+    (1 ? 0 : throw PI(i));
+    if (i != 2) abort();
+
+    CI(0 ? 0 : throw PI(i));
+    if (i != 3) abort();
+
+    CI(0 ? has_destructor() : throw PI(i));
+    if (i != 4) abort();
+    (argc+1 ? has_destructor() : throw PI(i));
+    if (i != 4) abort();
+
+    i = 1;
+    CI(throw i++);
+    if (i != 2) abort();
+
+    (1 ? 0 : throw i++);
+    if (i != 2) abort();
+
+    CI(0 ? 0 : throw i++);
+    if (i != 3) abort();
+
+    CI(0 ? has_destructor() : throw i++);
+    if (i != 4) abort();
+    (argc+1 ? has_destructor() : throw i++);
+    if (i != 4) abort();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/const.cpp b/tests/device/test-stlport_shared-exception/jni/const.cpp
new file mode 100644
index 0000000..7c497ee
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/const.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+// Bug: a ends up in the text segment, so trying to initialize it causes
+// a seg fault.
+
+struct A {
+  int i;
+  A(): i(0) {}
+  A(int j): i(j) {}
+};
+
+const A a;
+const A b(1);
+
+int main ()
+{
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/crossjump1.cpp b/tests/device/test-stlport_shared-exception/jni/crossjump1.cpp
new file mode 100644
index 0000000..ccb0ffb
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/crossjump1.cpp
@@ -0,0 +1,31 @@
+// This testcase failed on s390, because cross-jumping merged 2 calls,
+// one with REG_EH_REGION note with no handlers (ie. termination)
+// and one without REG_EH_REGION note.
+// { dg-do run }
+// { dg-options "-O2" }
+
+#include <exception>
+#include <string>
+
+struct E : public std::exception
+{
+  std::string m;
+  E () : m ("test") { }
+  ~E () throw() { }
+};
+
+struct C : public E { };
+
+void foo ()
+{
+  throw C ();
+}
+
+int main ()
+{
+  try
+    {
+      foo ();
+    }
+  catch (...) { }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ctor1.cpp b/tests/device/test-stlport_shared-exception/jni/ctor1.cpp
new file mode 100644
index 0000000..43b735f
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ctor1.cpp
@@ -0,0 +1,42 @@
+// { dg-do run }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
+
+// PR 411
+
+bool was_f_in_Bar_destroyed=false;
+
+struct Foo
+{
+  ~Foo()
+  {
+    was_f_in_Bar_destroyed=true;
+  }
+};
+
+struct Bar
+{
+  ~Bar()
+  {
+    throw 1;
+  }
+  
+  Foo f;
+};
+
+int main()
+{
+  try
+    {
+      Bar f; 
+    }
+  catch(int i)
+    {
+      if(was_f_in_Bar_destroyed)
+	{
+	  return 0;
+	}
+    }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ctor1_1.cpp b/tests/device/test-stlport_shared-exception/jni/ctor1_1.cpp
new file mode 100644
index 0000000..aeb509b
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ctor1_1.cpp
@@ -0,0 +1,57 @@
+// { dg-do run }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Oct 2002 <nathan@codesourcery.com>
+
+// From WindRiver SPR 80797
+// We were inadvertently SAVE_EXPRing volatile arrays during delete[]
+
+struct A
+{
+  A *ptr;
+  static int ok;
+  
+  A () {ptr = this;}
+  ~A () {ok = ptr == this;}
+};
+int A::ok = -1;
+
+struct B
+{
+  B *ptr;
+  static int ok;
+  
+  B () {ptr = this;}
+  ~B () {ok = ptr == this;}
+};
+int B::ok = -1;
+
+struct C
+{
+  A volatile a;
+  B volatile b[1];
+
+  C ();
+};
+
+C::C ()
+{
+  throw 1;
+}
+
+int main ()
+{
+  try
+    {
+      C c;
+    }
+  catch (...)
+    {
+      if (A::ok != 1)
+	return 1;
+      if (B::ok != 1)
+	return 2;
+      return 0;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ctor2.cpp b/tests/device/test-stlport_shared-exception/jni/ctor2.cpp
new file mode 100644
index 0000000..e2ebad7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ctor2.cpp
@@ -0,0 +1,42 @@
+// PR c++/4460
+// Test that the cleanup for fully-constructed subobjects when a
+// constructor throws gets the right address for a virtual base.
+
+// { dg-do run }
+
+int r;
+void *p;
+
+struct VBase
+{
+  virtual void f () {}
+  VBase() { p = this; }
+  ~VBase() { if (p != this) r = 1; }
+};
+
+struct  StreamBase 
+{
+  virtual ~StreamBase() {}
+};
+
+struct  Stream : public virtual VBase, public StreamBase
+{
+  Stream() {}
+  virtual ~Stream() {} 
+};
+
+struct DerivedStream : public Stream
+{
+  DerivedStream() { throw 1; }
+};
+
+int main() {
+
+  try
+    { 
+      DerivedStream str;
+    }
+  catch (...) { }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/delayslot1.cpp b/tests/device/test-stlport_shared-exception/jni/delayslot1.cpp
new file mode 100644
index 0000000..ddc960e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/delayslot1.cpp
@@ -0,0 +1,47 @@
+// PR target/12301
+// Origin: Colin Hirsch <gcc@cohi.at>
+// Testcase by Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+// This used to fail on SPARC because the reorg pass moved an insn
+// across a function call that can throw internally, in order to put
+// it in a delay slot.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+struct S{
+  char *c;
+  char data[100];
+  S () : c (data) {};
+  S (const S& s) {
+    c = data;
+    data[0] = s.c[0];
+  }
+};
+
+S real_cast ()
+{
+  throw 3;  
+}
+
+S cast_helper(S& debug)
+{
+  try {
+    return real_cast();
+  }
+  catch (int e) {
+    throw debug;
+  }
+}
+
+int main()
+{
+  S tmp;
+
+  try {
+    cast_helper (tmp);
+  }                                        
+  catch (S& e) {}
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/delete1.cpp b/tests/device/test-stlport_shared-exception/jni/delete1.cpp
new file mode 100644
index 0000000..9de2a22
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/delete1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// prms-id: 7330
+#include <stddef.h>
+int size = 0; 
+
+struct X {
+    int x;
+    void *operator new[](size_t sz) throw()  {
+         size = sz;
+         return 0;  
+    }
+    void operator delete[] (void *vp) { ::operator delete(vp); }  
+};
+int main()
+{
+     X (*px) [10];
+
+     px = new X[5][10];
+
+     delete [] px;
+
+     return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/delete2.cpp b/tests/device/test-stlport_shared-exception/jni/delete2.cpp
new file mode 100644
index 0000000..8a486be
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/delete2.cpp
@@ -0,0 +1,55 @@
+// PR c++/15097
+// { dg-do run }
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" void * malloc (size_t);
+extern "C" void free (void *);
+extern "C" void abort(void);
+
+void *saved;
+
+void * operator new (size_t size)
+{
+  void *p = malloc (size);
+  saved = p;
+  return p;
+}
+
+void operator delete (void *p)
+{
+  if (p != saved)
+    abort ();
+  free (p);
+}
+
+struct B1
+{
+    virtual ~B1 () throw() {}
+    B1 (){}
+    int x;
+};
+struct B2
+{
+    virtual ~B2 () throw() {}
+    B2 (){}
+    int x;
+};
+struct D : B1, B2
+{
+    D (){}
+    ~D () throw() {}
+    int y;
+};
+void f1 (D*);
+void f2 (B2*);
+void f3 (B1*);
+int main (void)
+{
+    f1 (::new D);
+    f2 (::new D);     
+    f3 (::new D);
+}
+void f1 ( D* p) { ::delete p; }
+void f2 (B2* p) { ::delete p; }  
+void f3 (B1* p) { ::delete p; }
diff --git a/tests/device/test-stlport_shared-exception/jni/delete3.cpp b/tests/device/test-stlport_shared-exception/jni/delete3.cpp
new file mode 100644
index 0000000..39b6fbe
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/delete3.cpp
@@ -0,0 +1,38 @@
+// { dg-do run  }
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+// Test whether dtors of vbases are called on throw within new[].
+// Variant of delete2.C.
+
+extern "C" void abort();
+extern "C" void exit(int);
+
+struct Foo {
+  static bool first;
+
+  Foo() {
+    if (first)
+      first = false;
+    else
+      throw first;
+  }
+
+  ~Foo() {
+    exit(0);
+  }
+};
+
+bool Foo::first = true;
+
+struct Bar : virtual Foo {
+};
+
+int main() {
+  try {
+    delete [] new Bar[2];
+  } catch (...) {
+  }
+  abort();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/delete3_1.cpp b/tests/device/test-stlport_shared-exception/jni/delete3_1.cpp
new file mode 100644
index 0000000..7d43485
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/delete3_1.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+#include <new>
+#include <stddef.h>
+
+int i;
+
+extern "C" int printf (const char *, ...);
+
+template <class T, class U> 
+struct map {
+  ~map ();
+};
+
+template <class T, class U>
+map<T, U>::~map ()
+{}
+
+struct SomeClass { };
+
+void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
+{
+  return operator new(numBytes, std::nothrow);
+}
+
+void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw()
+{
+  i = 7;
+  return operator delete(pMemory);
+}
+
+int
+main()
+{
+  map< int, int>* pMap = new map< int, int>;
+  
+  delete pMap;
+  
+  if (i == 7)
+    return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/dtor1.cpp b/tests/device/test-stlport_shared-exception/jni/dtor1.cpp
new file mode 100644
index 0000000..4fafdde
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/dtor1.cpp
@@ -0,0 +1,35 @@
+// PR c++/411
+
+// Test that a fully-constructed base is destroyed before transferring
+// control to the handler of a function-try-block.
+
+// { dg-do run }
+
+int ad;
+int r;
+
+struct A {
+  ~A() { ++ad; }
+};
+
+struct B: public A {
+  ~B();
+};
+
+B::~B ()
+try
+  {
+    throw 1;
+  }
+catch (...)
+  {
+    if (!ad)
+      r = 1;
+    return;
+  }
+
+int main ()
+{
+  { B b; }
+  return r;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/dyncast1.cpp b/tests/device/test-stlport_shared-exception/jni/dyncast1.cpp
new file mode 100644
index 0000000..c53617e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/dyncast1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
+
+#include <typeinfo>
+
+struct B {
+  virtual int f() { }
+};
+
+struct D {
+  virtual int f() { }
+};
+
+int main() {
+  B b;
+  try {
+    (void)dynamic_cast<D&>(b);
+  } catch (std::bad_cast) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/dyncast2_1.cpp b/tests/device/test-stlport_shared-exception/jni/dyncast2_1.cpp
new file mode 100644
index 0000000..91432b9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/dyncast2_1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
+
+// Ensure reference handling works.
+
+#include <typeinfo>
+
+struct B {
+  virtual int f() { }
+} ob;
+
+struct D : public B {
+  virtual int f() { }
+} od;
+
+int main() {
+  B *b=&ob;
+  try {
+    void *vp = &dynamic_cast<D&>(*b);
+    return 1;
+  } catch (std::bad_cast) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/dyncast7.cpp b/tests/device/test-stlport_shared-exception/jni/dyncast7.cpp
new file mode 100644
index 0000000..33e3fa7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/dyncast7.cpp
@@ -0,0 +1,29 @@
+// { dg-do run  }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+#include <stdexcept>
+
+class A {
+public:
+  virtual void j () {}
+};
+
+class B : public A { };
+     
+void x (A& a) {
+  // These should all work.
+  const B& b2 = dynamic_cast<B&>(a);
+  const B& b3 = dynamic_cast<const B&>((const A&)a);
+  const B& b4 = dynamic_cast<const B&>(a);
+}
+
+int main() {
+  try {
+    B b;
+    x (b);
+  } catch (std::exception& e) {
+    // If we get a bad_cast, it is wrong.
+    return 1;
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eb50.cpp b/tests/device/test-stlport_shared-exception/jni/eb50.cpp
new file mode 100644
index 0000000..8d2c403
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eb50.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+struct foo { };
+int f(int a, int b)
+{
+        if (b == 0)
+                throw foo();
+        return a / b;
+}
+int main()
+{
+        try {
+                f(0, 0);
+                return 1;
+        } catch (foo x) {
+                return 0;
+        }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eb88.cpp b/tests/device/test-stlport_shared-exception/jni/eb88.cpp
new file mode 100644
index 0000000..cb604bc
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eb88.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Another magic NULL problem.
+
+#include <stddef.h>
+
+int main()
+{
+  try
+    {
+      throw(NULL);
+    }
+  catch (...)
+    {
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-alloca-1.cpp b/tests/device/test-stlport_shared-exception/jni/eh-alloca-1.cpp
new file mode 100644
index 0000000..a20f074
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-alloca-1.cpp
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (int size) throw (B,A)
+{
+  char *p = (char*) __builtin_alloca (size + 1);
+  aligned i;
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (5); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-global-1.cpp b/tests/device/test-stlport_shared-exception/jni/eh-global-1.cpp
new file mode 100644
index 0000000..2692f94
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-global-1.cpp
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (void) throw (B,A)
+{
+  aligned i;
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-inline-1.cpp b/tests/device/test-stlport_shared-exception/jni/eh-inline-1.cpp
new file mode 100644
index 0000000..72ac7fd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-inline-1.cpp
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (void) throw (B,A)
+{
+  aligned i;
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-inline-2.cpp b/tests/device/test-stlport_shared-exception/jni/eh-inline-2.cpp
new file mode 100644
index 0000000..4feb3f0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-inline-2.cpp
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (int size) throw (B,A)
+{
+  char *p = (char *) __builtin_alloca (size + 1);
+  aligned i;
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (5); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-vararg-1.cpp b/tests/device/test-stlport_shared-exception/jni/eh-vararg-1.cpp
new file mode 100644
index 0000000..74b48fa
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-vararg-1.cpp
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (const char *fmt, ...) throw (B,A)
+{
+  va_list arg;
+  char *p;
+  aligned i;
+  int size;
+  double x;
+
+  va_start (arg, fmt);
+  size = va_arg (arg, int);
+  if (size != 5)
+    abort ();
+  p = (char *) __builtin_alloca (size + 1);
+
+  x = va_arg (arg, double);
+  if (x != 5.0)
+    abort ();
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+
+  va_end (arg);
+}
+
+int
+main()
+{
+  try {	foo ("foo", 5, 5.0); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh-vararg-2.cpp b/tests/device/test-stlport_shared-exception/jni/eh-vararg-2.cpp
new file mode 100644
index 0000000..719c839
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh-vararg-2.cpp
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+test (va_list arg) throw (B,A)
+{
+  char *p;
+  aligned i;
+  int size;
+  double x;
+
+  size = va_arg (arg, int);
+  if (size != 5)
+    abort ();
+
+  p = (char *) __builtin_alloca (size + 1);
+
+  x = va_arg (arg, double);
+  if (x != 5.0)
+    abort ();
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+void
+foo (const char *fmt, ...)
+{
+  va_list arg;
+  va_start (arg, fmt);
+  test (arg);
+  va_end (arg);
+}
+int
+main()
+{
+  try {	foo ("foo", 5, 5.0); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh1.cpp b/tests/device/test-stlport_shared-exception/jni/eh1.cpp
new file mode 100644
index 0000000..939312a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh1.cpp
@@ -0,0 +1,63 @@
+// { dg-do run  }
+// { dg-options "-O" }
+// PRMS Id: 10776
+
+extern "C" int printf (const char *, ...);
+
+class Foo 
+{
+  public:
+    Foo(int n) : n_(n) { }
+    int f() { return n_; }
+    
+    int badTest();
+    int goodTest();
+    
+  private:
+
+    int n_;
+};
+
+int Foo::badTest()
+{
+    try {
+	throw int(99);
+    }
+
+    catch (int &i) {
+	n_ = 16;
+    }
+
+    return n_;
+        // On the sparc, the return will use a ld [%l0],%i0 instruction.
+        // However %l0 was clobbered at the end of the catch block.  It was
+        // used to do an indirect call.
+}
+
+
+int Foo::goodTest()
+{
+    int	n;
+
+    try {
+	throw int(99);
+    }
+
+    catch (int &i) {
+	n = 16;
+    }
+
+    return n_;
+        // The return will use a ld [%l2],%i0 instruction.  Since %l2
+        // contains the "this" pointer this works.
+}
+
+int main() 
+{
+    Foo foo(5);
+    foo.goodTest();
+    foo.badTest();
+
+    // the badTest will have failed
+    printf ("PASS\n");
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh10.cpp b/tests/device/test-stlport_shared-exception/jni/eh10.cpp
new file mode 100644
index 0000000..556b3b2
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh10.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+void foo() {
+  int i;
+  i = 42;
+  throw i;
+}
+
+void ee(int *);
+
+void bar() {
+  int i = 2;
+  ee(&i);
+}
+
+void ee(int *) { }
+
+int main() {
+  try {
+    foo();
+    return 3;
+  } catch (int& i) {
+    bar();
+    return i != 42;
+  }
+  return 2;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh12.cpp b/tests/device/test-stlport_shared-exception/jni/eh12.cpp
new file mode 100644
index 0000000..8ec2998
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh12.cpp
@@ -0,0 +1,14 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class MyError { };
+
+int main (int argc, char **argv) {
+  try {
+    throw MyError();
+  }
+  catch (MyError x) {
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh14.cpp b/tests/device/test-stlport_shared-exception/jni/eh14.cpp
new file mode 100644
index 0000000..2e788fa
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh14.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class arghh {
+public:
+  int n;
+  arghh (int v) { n = v; }
+};
+
+int main () {
+  try {
+    throw arghh (11);
+  }
+  catch (arghh& a) {
+    if (a.n != 11)
+      return 1;
+  }
+  try {
+    throw arghh (22);
+  }
+  catch (arghh& a) {
+    if (a.n != 22)
+      return 2;
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh16.cpp b/tests/device/test-stlport_shared-exception/jni/eh16.cpp
new file mode 100644
index 0000000..ff5aad8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh16.cpp
@@ -0,0 +1,26 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int err = 1;
+
+struct A {
+  ~A() {
+    --err;
+  }
+};
+
+struct B {
+  A a;
+  B() {
+    throw 1;
+  }
+};
+
+int main() {
+  try {
+    B b;
+  } catch (...) {
+    return err;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh17.cpp b/tests/device/test-stlport_shared-exception/jni/eh17.cpp
new file mode 100644
index 0000000..18ee228
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh17.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int err = 1;
+
+struct A {
+  ~A() {
+    --err;
+  }
+};
+
+struct B : public A {
+  B() {
+    throw 1;
+  }
+};
+
+int main() {
+  try {
+    B b;
+  } catch (...) {
+    return err;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh18.cpp b/tests/device/test-stlport_shared-exception/jni/eh18.cpp
new file mode 100644
index 0000000..02e6545
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh18.cpp
@@ -0,0 +1,63 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class VB {
+public:
+  int n;
+  VB (int v) { n = v; }
+  VB (const VB& o) {
+    n = o.n;
+//    printf("copying VB from %d to %d\n", &o, this);
+  }
+};
+
+class D : public virtual VB {
+  int j;
+public:
+  D(int i1, int i2) : VB(i2) { j = i1; }
+  VB& vb() { return *(VB*)this; }
+  const VB& vb() const { return *(const VB*)this; }
+};
+
+class pD : private virtual VB {
+  int j;
+public:
+  pD(int i1, int i2) : VB(i2) { j = i1; }
+  VB& vb() { return *(VB*)this; }
+  const VB& vb() const { return *(const VB*)this; }
+};
+
+
+int main () {
+  D d(1943, 4279);
+  pD pd(3621, 9527);
+  VB *vb = &d.vb();
+  VB *pvb = &pd.vb();
+
+  // A catch of a public virtual base.
+  try {
+//    printf("Throwing D at %d (VB at %d)\n", &d, vb);
+    throw d;
+  }
+  catch (VB& vb) {
+//    printf("Catching VB at %d\n", &vb);
+    if (vb.n != 4279)
+      return 1;
+  }
+  catch (...) {
+    return 1;
+  }
+
+  // A catch of a private virtual base.
+  try {
+//    printf("Throwing D at %d (VB at %d)\n", &pd, pvb);
+    throw pd;
+  }
+  catch (VB& vb) {
+//    printf("Catching VB at %d\n", &vb);
+    // This was a private base of the throw object, don't catch it.
+    return 1;
+  }
+  catch (...) {
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh2.cpp b/tests/device/test-stlport_shared-exception/jni/eh2.cpp
new file mode 100644
index 0000000..7cb49f0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh2.cpp
@@ -0,0 +1,34 @@
+// PR 6764
+// { dg-do run }
+// { dg-options "-O -fomit-frame-pointer" }
+
+extern "C" void abort ();
+
+class test
+{
+ public:
+  test * const me;
+  test () : me(this) { }
+  ~test () { if (me != this) abort (); }
+};
+
+void x1 ()
+{
+  test w1;
+  throw 1;
+}
+
+void x2 ()
+{
+  test w2;
+  x1 ();
+}
+
+int main (void)
+{
+  try {
+    x2 ();
+  } catch (...) {
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh21.cpp b/tests/device/test-stlport_shared-exception/jni/eh21.cpp
new file mode 100644
index 0000000..ac74fa3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh21.cpp
@@ -0,0 +1,14 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main () {
+  try {
+    try {
+      throw 1;
+    } catch ( char * ) {
+    }
+  } catch ( int ) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh23.cpp b/tests/device/test-stlport_shared-exception/jni/eh23.cpp
new file mode 100644
index 0000000..250f2cd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh23.cpp
@@ -0,0 +1,47 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+struct double_fault { };
+int fault_now;
+
+class E {
+public:
+  E() { }
+  E(const E&) {
+    if (fault_now)
+      throw double_fault();
+  }
+};
+
+void foo() {
+  try {
+    throw E();
+  } catch (...) {
+    fault_now = 1;
+    throw;
+  }
+}
+
+void bar() {
+  try {
+    foo();
+  } catch (E e) {	// double fault here
+  }
+}
+
+void my_terminate() {
+  exit (0);		// double faults should call terminate
+}
+
+int main() {
+  std::set_terminate (my_terminate);
+  try {
+    bar();
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh24.cpp b/tests/device/test-stlport_shared-exception/jni/eh24.cpp
new file mode 100644
index 0000000..215c435
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh24.cpp
@@ -0,0 +1,33 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 0;
+
+struct A {
+  int ok;
+  A() {
+    ok = 1;
+  }
+  ~A() {
+    if (! ok)
+      fail = 1;
+    ok = 0;
+  }
+};
+
+int main() {
+  try {
+    try {
+      A  a;
+      throw 1.0;
+    } catch (double i) {
+      A a1;
+      throw 1;    // make sure both a1 and a2 are not destroyed when we throw!
+    } catch (int i) {
+      A a2;
+      throw 1.0;
+    }
+  } catch (int i) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh25.cpp b/tests/device/test-stlport_shared-exception/jni/eh25.cpp
new file mode 100644
index 0000000..f66fa08
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh25.cpp
@@ -0,0 +1,31 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_terminate() {
+  exit (0);		// Double faults should call terminate
+}
+
+struct A {
+  A() { }
+  ~A() {
+    std::set_terminate (my_terminate);
+    throw 1;		// This throws from EH dtor, should call my_terminate
+  }
+};
+
+int main() {
+  try {
+    try {
+      throw 1;
+    } catch (int i) {
+      A a;		// A hit on this EH dtor went to the wrong place
+      throw 1;
+    }
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh26.cpp b/tests/device/test-stlport_shared-exception/jni/eh26.cpp
new file mode 100644
index 0000000..2560325
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh26.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class MyExceptionHandler { };
+
+int main() {
+  try {
+    throw MyExceptionHandler();
+  } catch(const MyExceptionHandler& eh) {
+    return 0;
+  } catch(...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh27.cpp b/tests/device/test-stlport_shared-exception/jni/eh27.cpp
new file mode 100644
index 0000000..0d8fee7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh27.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class MyExceptionHandler { };
+
+int main() {
+  try {
+    throw MyExceptionHandler();
+  } catch(const MyExceptionHandler& eh) {
+    return 0;
+  } catch(...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh28.cpp b/tests/device/test-stlport_shared-exception/jni/eh28.cpp
new file mode 100644
index 0000000..96e31f7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh28.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+int fail = 1;
+
+class X            { public: virtual void p() { } };
+class Y : public X { public: virtual void p() { fail = 0; } };
+
+int main()
+{
+  try          { Y y; throw y; }
+  catch (X& x) { x.p();  }
+  catch (...)  { }
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh29.cpp b/tests/device/test-stlport_shared-exception/jni/eh29.cpp
new file mode 100644
index 0000000..2f3e7d0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh29.cpp
@@ -0,0 +1,27 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int count;
+
+class A {
+public:
+  A() {
+//    printf("ctor %x\n", (int)this);
+    if (count==3)
+      throw 1;
+    ++count;
+    }
+  ~A() {
+    --count;
+//    printf("dtor %x\n", (int)this);
+  }
+};
+
+int main() {
+  try {
+    A a[5];
+  } catch (...) {
+    return count;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh3.cpp b/tests/device/test-stlport_shared-exception/jni/eh3.cpp
new file mode 100644
index 0000000..0cd9cac
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh3.cpp
@@ -0,0 +1,33 @@
+// PR target/18841
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
+
+struct S
+{
+  ~S() { r = i1 + i2 + i3 + i4 + i5; }
+};
+
+void foo()
+{
+  S s;
+  throw 1;
+}
+
+void bar()
+{
+  try {
+    foo();
+  } catch (...) {
+  }
+}
+
+int main()
+{
+  bar();
+  if (r != 1 + 2 + 3 + 4 + 5)
+    abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh31.cpp b/tests/device/test-stlport_shared-exception/jni/eh31.cpp
new file mode 100644
index 0000000..40ef080
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh31.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int count;
+
+class Foo {
+public:
+  Foo() { ++count; }
+  Foo(const Foo&) { ++count; }
+  ~Foo() { --count; }
+};
+
+
+int main() {
+  try {
+    throw Foo();
+  }
+  catch (Foo& object) {
+    if (count == 1)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh33.cpp b/tests/device/test-stlport_shared-exception/jni/eh33.cpp
new file mode 100644
index 0000000..b679991
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh33.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+void foo() throw (int) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo();
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh34.cpp b/tests/device/test-stlport_shared-exception/jni/eh34.cpp
new file mode 100644
index 0000000..68fa673
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh34.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_unexpected() {
+  exit (0);
+}
+
+void foo() throw () { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  foo();
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh35.cpp b/tests/device/test-stlport_shared-exception/jni/eh35.cpp
new file mode 100644
index 0000000..40c41ed
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh35.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() {
+  try {  
+    throw 'a';
+  } catch (char a) {
+    try {
+      throw 'a';
+    } catch (int i) {
+      return 1;
+    } catch (char c) {
+      return 0;
+    }
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh36.cpp b/tests/device/test-stlport_shared-exception/jni/eh36.cpp
new file mode 100644
index 0000000..ba497b7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh36.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class A {
+  int space;
+};
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+};
+class D : public A, public B {
+public:
+  D(int i) : B(i) {
+  }
+} d(42);
+
+int main() {
+  try {
+    throw &d;
+  } catch (B* b) {
+    if (b->data == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh37.cpp b/tests/device/test-stlport_shared-exception/jni/eh37.cpp
new file mode 100644
index 0000000..ad65692
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh37.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+} b(42);
+
+int main() {
+  try {
+    throw &b;
+  } catch (B* b) {
+    if (b->data == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh38.cpp b/tests/device/test-stlport_shared-exception/jni/eh38.cpp
new file mode 100644
index 0000000..bdeada8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh38.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+} b(42);
+
+int main() {
+  try {
+    throw &b;
+  } catch (const B* bptr) {
+    if (bptr->data == 42)
+    {
+      try {
+        throw &b;
+      } catch (void *bptr) {
+        if (((B*)bptr)->data == 42)
+          return 0;
+      }
+    }
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh39.cpp b/tests/device/test-stlport_shared-exception/jni/eh39.cpp
new file mode 100644
index 0000000..5fe2192
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh39.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 1;
+class B {
+public:
+  B() { throw 1; }
+};
+class D : public B {
+public:
+  D();
+};
+
+D::D() try : B() {
+  fail = 1;
+} catch (...) {
+  fail = 0;
+  throw;
+}
+
+int main() {
+  try {
+    D d;
+    fail = 1;
+  } catch (...) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh3_1.cpp b/tests/device/test-stlport_shared-exception/jni/eh3_1.cpp
new file mode 100644
index 0000000..8c9ddb4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh3_1.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class foo {
+public:
+  class error {};
+
+  void cause_error(void) { throw error(); }
+};
+
+int main(void)
+{
+  foo f;
+  try {
+    f.cause_error();
+  }
+  catch (foo::error&) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh3_2.cpp b/tests/device/test-stlport_shared-exception/jni/eh3_2.cpp
new file mode 100644
index 0000000..4e61892
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh3_2.cpp
@@ -0,0 +1,33 @@
+// { dg-do run  }
+// { dg-options "-O" }
+typedef struct { } e;
+
+char *p;
+
+void _Jv_throw ();
+
+int barf (int len)
+{
+  char a[len];
+
+  p = a;
+  _Jv_throw ();
+  return 0;
+}
+
+void _Jv_throw ()
+{
+  e ex;
+  throw ex;
+}  
+
+int main ()
+{
+  try  {
+    barf (2);
+  }
+  catch (...) {
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh40.cpp b/tests/device/test-stlport_shared-exception/jni/eh40.cpp
new file mode 100644
index 0000000..62d92b5
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh40.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 1;
+class B {
+public:
+  B() { throw 1; }
+};
+class D : public B {
+public:
+  D() try : B() {
+    fail = 1;
+  } catch (char c) {
+    fail = 1;
+    throw;
+  } catch (...) {
+    fail = 0;
+    throw;
+  }
+};
+
+int main() {
+  try {
+    D d;
+    fail = 1;
+  } catch (...) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh41.cpp b/tests/device/test-stlport_shared-exception/jni/eh41.cpp
new file mode 100644
index 0000000..831d75d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh41.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 0;
+
+struct A {
+   A () { a = 'a'; b = 'b'; c = 'c'; }
+   ~ A () {
+      if ( a != 'a' ) fail = 1;
+      if ( b != 'b' ) fail = 1;
+      if ( c != 'c' ) fail = 1;
+   }
+   char a, b, c;
+};
+
+void some_init () { throw 1; }
+
+struct C : A {
+   C () { some_init (); }
+};
+
+int main () {
+  try {
+    C c;
+  } catch (int i) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh42.cpp b/tests/device/test-stlport_shared-exception/jni/eh42.cpp
new file mode 100644
index 0000000..ab69c3c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh42.cpp
@@ -0,0 +1,18 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+struct none { int i[50]; };
+
+class my_ex { } a;
+
+none throw_it() {
+  throw 1;
+}
+
+int main() {
+    try {
+      none n = throw_it();
+    } catch (int ex) {
+      return 0;
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh44.cpp b/tests/device/test-stlport_shared-exception/jni/eh44.cpp
new file mode 100644
index 0000000..27afd3f
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh44.cpp
@@ -0,0 +1,36 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 9159
+
+static unsigned int iCounter = 0;
+static unsigned int iMax;
+int fail = 0;
+
+class ca {
+public:
+  ca(int) {
+    if (iCounter++ == iMax)
+      throw (const char*)"iCounter";
+  }
+  virtual ~ca() {
+  }
+};
+
+class cc {
+public:
+  cc(const ca &rca1, const ca &rca2) {
+  }
+  virtual ~cc() {
+    fail = 1;
+  }
+};
+
+
+int main(int argc, char **argv) {
+  iMax = 1;
+  try {
+    cc sc(ca(1), ca(1));
+  } catch (const char *pMsg) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh47.cpp b/tests/device/test-stlport_shared-exception/jni/eh47.cpp
new file mode 100644
index 0000000..9d70b10
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh47.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <cstdlib>
+#include <exception>
+
+void myterm() {
+  exit (0);
+}
+
+int main() {
+  try {
+    throw "";
+  } catch (...) {
+  }
+  try {
+    std::set_terminate (myterm);
+    throw;
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh48.cpp b/tests/device/test-stlport_shared-exception/jni/eh48.cpp
new file mode 100644
index 0000000..d9caf61
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh48.cpp
@@ -0,0 +1,34 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+using std::uncaught_exception;
+class A {
+public:
+  ~A() {
+    if (uncaught_exception ())
+      exit (0);
+  }
+};
+
+int main() {
+  if (uncaught_exception ())
+    return 1;
+  try {
+    throw "";
+  } catch (...) {
+    if (uncaught_exception ())
+      return 1;
+  }
+  if (uncaught_exception ())
+    return 1;
+  try {
+    A a;
+    throw "";
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh49.cpp b/tests/device/test-stlport_shared-exception/jni/eh49.cpp
new file mode 100644
index 0000000..19084fb
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh49.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -O9" }
+
+void main1() {
+  throw 1;
+}
+
+int main() {
+  try {
+    int main1();
+  } catch (...) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh5.cpp b/tests/device/test-stlport_shared-exception/jni/eh5.cpp
new file mode 100644
index 0000000..4ece588
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh5.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class foo {
+public:
+  class error {};
+
+  void cause_error(void) { throw "Hello World!"; }
+};
+
+int main(void)
+{
+  foo f;
+  try {
+    f.cause_error();
+  }
+  catch (const char cp[]) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh50.cpp b/tests/device/test-stlport_shared-exception/jni/eh50.cpp
new file mode 100644
index 0000000..530fc49
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh50.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+template <class T> void foo(T) throw (int) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo(1);
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh51.cpp b/tests/device/test-stlport_shared-exception/jni/eh51.cpp
new file mode 100644
index 0000000..b3ef514
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh51.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+template <class T> void foo(T) throw (T) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo(1);
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh53.cpp b/tests/device/test-stlport_shared-exception/jni/eh53.cpp
new file mode 100644
index 0000000..5f2ff57
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh53.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -g" }
+
+class zeroset {
+public:
+  ~zeroset () { }
+};
+
+int main () {
+  zeroset a;
+  try {
+    ;
+  } catch( zeroset ) {
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh55.cpp b/tests/device/test-stlport_shared-exception/jni/eh55.cpp
new file mode 100644
index 0000000..1482680
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh55.cpp
@@ -0,0 +1,19 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_terminate_handler() {
+  exit(0);
+}
+
+void throw_an_unexpected_exception() throw() {
+  throw 1;
+}
+
+int main() {
+  std::set_terminate(my_terminate_handler);
+  throw_an_unexpected_exception();
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh6.cpp b/tests/device/test-stlport_shared-exception/jni/eh6.cpp
new file mode 100644
index 0000000..c7e0d91
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh6.cpp
@@ -0,0 +1,19 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+extern "C" int printf(const char *, ...);
+
+void main1() {
+  throw 1;
+}
+
+
+int main() {
+  try {
+    int main1();
+  } catch (...) {
+    printf("Unwind works!\n");
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh7.cpp b/tests/device/test-stlport_shared-exception/jni/eh7.cpp
new file mode 100644
index 0000000..6b72048
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh7.cpp
@@ -0,0 +1,7 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() {
+  if (0)
+    throw 1 | 2;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh8.cpp b/tests/device/test-stlport_shared-exception/jni/eh8.cpp
new file mode 100644
index 0000000..26f3419
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh8.cpp
@@ -0,0 +1,20 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+extern "C" int printf(const char *, ...);
+
+int i;
+
+int main() {
+  try {
+    try {
+      throw i;
+    } catch (char *) {
+      return 1;
+    }
+    return 1;
+  } catch (int i) {
+    return 0;
+  }    
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh9.cpp b/tests/device/test-stlport_shared-exception/jni/eh9.cpp
new file mode 100644
index 0000000..cf521b8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh9.cpp
@@ -0,0 +1,4 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() throw () { }
diff --git a/tests/device/test-stlport_shared-exception/jni/eh990323-1.cpp b/tests/device/test-stlport_shared-exception/jni/eh990323-1.cpp
new file mode 100644
index 0000000..221a6d7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh990323-1.cpp
@@ -0,0 +1,77 @@
+// { dg-do run  }
+// check cleanup of template temporaries
+extern "C" void abort ();
+extern "C" void exit (int);
+
+int ctor = 0;
+int dtor = 0;
+
+template <class T> struct A {
+	A() {ctor++;}
+	A(int) {ctor++;}
+	A(const A&) {ctor++;}
+	~A() {dtor++;}
+	operator int() {return 0;}
+};
+
+template <class T> void ff(T);
+
+template <class T> void ff(T)
+{
+}
+
+void g(int)
+{
+}
+
+void f()
+{
+	int x;
+
+	A<int> a1;
+	A<double> a2(37);
+	A<long> a3 = A<long>(47);
+	A<short> a4 = 97;
+
+	g(A<char*>());
+
+	A<char**>();
+
+	x ? A<char*>() : A<char*>();
+
+	x = 47, A<double*>(), A<int>(39), A<void>(23), -17;
+
+	while (A<short>())
+		;
+	for (;A<unsigned>(3);)
+		;
+	if (A<A<double> >())
+		;
+
+	ff(A<double>());
+
+	throw 59;
+}
+
+int 
+main()
+{
+	int flag = 0;
+
+	try {
+		A<unsigned long>();
+		f();
+	}
+	catch (int) {
+		A<float>(34);
+		flag = 1;
+	}
+
+	if (!flag)
+		abort();
+
+	if (!ctor || ctor != dtor)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh990323-2.cpp b/tests/device/test-stlport_shared-exception/jni/eh990323-2.cpp
new file mode 100644
index 0000000..24666dd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh990323-2.cpp
@@ -0,0 +1,103 @@
+// { dg-do run  }
+// check MI and VBC offsets on throw
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {
+    int x[23];
+};
+
+struct B : virtual public A {
+    int y[33];
+};
+
+struct C : virtual public A, public B {
+    int z[43];
+};
+
+struct D {
+    int xx[53];
+};
+
+struct E : public D, public A {
+    int yy[63];
+};
+
+C c;
+
+E e;
+
+void f1()
+{
+    throw (C*)0;
+}
+
+void f2()
+{
+    throw &c;
+}
+
+void f3()
+{
+    throw (E*)0;
+}
+
+void f4()
+{
+    throw &e;
+}
+
+int main()
+{
+    int flag;
+
+    flag = 0;
+    try {
+        f1();
+    }
+    catch (A* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f2();
+    }
+    catch (A* p) {
+        if (!p || (void*)p == (void*)&c)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f3();
+    }
+    catch (A* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f4();
+    }
+    catch (A* p) {
+        if (!p || (void*)p == (void*)&e)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    exit(0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh990323-3.cpp b/tests/device/test-stlport_shared-exception/jni/eh990323-3.cpp
new file mode 100644
index 0000000..e8369ca
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh990323-3.cpp
@@ -0,0 +1,30 @@
+// { dg-do run  }
+// try throwing 0 cast to a class object
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {};
+
+void f()
+{
+	throw (A*)0;
+}
+
+int
+main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f();
+	}
+	catch (A*) {
+		flag = 1;
+	}
+
+	if (!flag)
+		abort();
+
+	exit (0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh990323-4.cpp b/tests/device/test-stlport_shared-exception/jni/eh990323-4.cpp
new file mode 100644
index 0000000..7f95ed3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh990323-4.cpp
@@ -0,0 +1,104 @@
+// { dg-do run  }
+// check MI and VBC offsets on throw
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {
+    int x[23];
+};
+
+struct B : virtual public A {
+    int y[33];
+};
+
+struct C : virtual public A, public B {
+    int z[43];
+};
+
+struct D {
+    int xx[53];
+};
+
+struct E : public D, public A {
+    int yy[63];
+};
+
+C c;
+
+E e;
+
+void f1()
+{
+    throw (C*)0;
+}
+
+void f2()
+{
+    throw &c;
+}
+
+void f3()
+{
+    throw (E*)0;
+}
+
+void f4()
+{
+    throw &e;
+}
+
+int
+main()
+{
+    int flag;
+
+    flag = 0;
+    try {
+        f1();
+    }
+    catch (void* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f2();
+    }
+    catch (void* p) {
+        if (!p || (void*)p != (void*)&c)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f3();
+    }
+    catch (void* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f4();
+    }
+    catch (void* p) {
+        if (!p || (void*)p != (void*)&e)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    exit(0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/eh990323-5.cpp b/tests/device/test-stlport_shared-exception/jni/eh990323-5.cpp
new file mode 100644
index 0000000..7913c09
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/eh990323-5.cpp
@@ -0,0 +1,68 @@
+// { dg-do run  }
+// check cleanup of partial array objects
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+int ctor = 0;
+int dtor = 0;
+
+int cnt = 1;
+
+struct A {
+	int x;
+	A();
+	A(const A&);
+	~A();
+};
+
+A::A()
+{
+	if (cnt == 10)
+		throw 57;
+	x = cnt++;
+	ctor++;
+}
+
+A::A(const A&)
+{
+	if (cnt == 10)
+		throw 57;
+	x = cnt++;
+	ctor++;
+}
+
+A::~A()
+{
+	if (x + 1 != cnt--)
+		abort();
+	dtor++;
+}
+
+void f()
+{
+	A a[] = {A(), A(), A(), A(), A(), A(), A(), A(), A(), A(), A(), A()};
+
+	throw -1066;
+}
+
+int
+main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f();
+	}
+	catch (int) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+	if (ctor != 9)
+		abort();
+	if (dtor != 9)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ehopt1.cpp b/tests/device/test-stlport_shared-exception/jni/ehopt1.cpp
new file mode 100644
index 0000000..163d76e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ehopt1.cpp
@@ -0,0 +1,44 @@
+// ehopt was only copying one statement from the cleanup of the B temporary
+// into the following try block, so we lost its destructor call.
+
+// { dg-do run }
+
+template <class T, class U>
+class A;
+
+bool b;
+int count;
+
+template <>
+class A<int, int>
+{
+public:
+  A(int) { ++count; if (b) throw 1; }
+  A(const A&) { ++count; if (b) throw 1; }
+  ~A() { --count; if (b) throw 1; }
+};
+
+typedef A<int, int> B;
+
+template <>
+class A<void *, void *>
+{
+public:
+  A() { if (b) throw 1; }
+  A(const B&) { if (b) throw 1; }
+  ~A() { if (b) throw 1; }
+};
+
+typedef A<void *, void *> C;
+
+void f() { if (b) throw 1; }
+
+int
+main (void)
+{
+  {
+    C a(1);
+    f();
+  }
+  return count;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/elide1.cpp b/tests/device/test-stlport_shared-exception/jni/elide1.cpp
new file mode 100644
index 0000000..94d2a69
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/elide1.cpp
@@ -0,0 +1,30 @@
+// PR c++/13944
+
+// Bug: When eliding the copy from the A temporary into the exception
+// object, we extended the throw prohibition to the constructor for the
+// temporary.  This is wrong; the throw from A() should propagate normally
+// regardless of the elision of the temporary.
+
+// { dg-do run }
+
+struct A
+{
+  A() { throw 0; }
+};
+
+int main()
+{
+  try
+    {
+      throw A();
+    }
+  catch(int i)
+    {
+      return i;
+    }
+  catch (...)
+    {
+      return 2;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/elide2.cpp b/tests/device/test-stlport_shared-exception/jni/elide2.cpp
new file mode 100644
index 0000000..618ee6f
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/elide2.cpp
@@ -0,0 +1,34 @@
+// PR c++/13944
+
+// Verify that we still call terminate() if we do run the copy constructor,
+// and it throws.
+
+// { dg-do run }
+
+#include <cstdlib>
+#include <exception>
+
+struct A
+{
+  A() { }
+  A(const A&) { throw 1; }
+};
+
+A a;
+
+void
+good_terminate() { std::exit (0); }
+
+int main()
+{
+  std::set_terminate (good_terminate);
+  try
+    {
+      throw a;
+    }
+  catch (...)
+    {
+      return 2;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/explarg1.cpp b/tests/device/test-stlport_shared-exception/jni/explarg1.cpp
new file mode 100644
index 0000000..b78b483
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/explarg1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run  }
+// Bug: g++ generates an error trying to generate the first foo<int>, when
+// it should silently fail and go on to the next one.
+
+template<class T, typename U> class A { };
+
+template<class T> void
+foo(const A<T,typename T::N>&);
+
+template<typename T>
+class B { };
+
+template<typename T> void
+foo(B<T> const &) { }
+
+int
+main(void)
+{
+  B<int> sa;
+
+  foo<int> (sa);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/filter1.cpp b/tests/device/test-stlport_shared-exception/jni/filter1.cpp
new file mode 100644
index 0000000..6ff0574
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/filter1.cpp
@@ -0,0 +1,43 @@
+// Test that cleanups get run when a catch filter fails to match.
+// { dg-do run }
+
+extern "C" void exit(int);
+extern "C" void abort();
+
+struct a
+{
+  a();
+  ~a();
+};
+
+struct e1 {};
+struct e2 {};
+
+void
+ex_test ()
+{
+  a aa;
+  try
+    {
+      throw e1 ();
+    }
+  catch (e2 &)
+    {
+    }
+}
+
+int
+main ()
+{
+  try
+    {
+      ex_test ();
+    }
+  catch (...)
+    {
+    }
+  abort ();
+}
+
+a::a() { }
+a::~a() { exit (0); }
diff --git a/tests/device/test-stlport_shared-exception/jni/filter2.cpp b/tests/device/test-stlport_shared-exception/jni/filter2.cpp
new file mode 100644
index 0000000..fe87cc9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/filter2.cpp
@@ -0,0 +1,59 @@
+// Test that terminate gets run when a catch filter fails to match while
+// running destructors.  Original bug depended on a::~a being inlined.
+// { dg-do run }
+// { dg-options -O }
+
+#include <exception>
+#include <cstdlib>
+
+struct e1 {};
+struct e2 {};
+
+struct a
+{
+  a () { }
+
+  ~a ()
+    {
+      try
+	{
+	  throw e1();
+	}
+      catch (e2 &)
+	{
+        }
+    }
+};
+
+void
+ex_test ()
+{
+  a aa;
+  try
+    {
+      throw e1 ();
+    }
+  catch (e2 &)
+    {
+    }
+}
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+int
+main ()
+{
+  std::set_terminate (my_terminate);
+
+  try
+    {
+      ex_test ();
+    }
+  catch (...)
+    {
+    }
+  abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/flow1.cpp b/tests/device/test-stlport_shared-exception/jni/flow1.cpp
new file mode 100644
index 0000000..d48a896
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/flow1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+#include <stdio.h>
+
+int bar ()
+{
+  throw 100;
+  return 0;
+}
+
+int main ()
+{
+  int i = 0;			// this gets deleted after flow analysis
+  try
+    {
+      i = bar ();
+    }
+  catch (...)
+    {
+    }
+
+  printf ("i = %d\n", i);
+  return i;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/fntry1.cpp b/tests/device/test-stlport_shared-exception/jni/fntry1.cpp
new file mode 100644
index 0000000..9b14f01
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/fntry1.cpp
@@ -0,0 +1,32 @@
+// { dg-do run  }
+// Bug: g++ fails to treat function-try-blocks in ctors specially.
+// Submitted by Jason Merrill <jason@cygnus.com>
+
+int c;
+int r;
+
+struct A {
+  int i;
+  A(int j) { i = j; }
+  ~A() { c += i; }
+};
+
+struct B: public A {
+  A a;
+  B() try : A(1), a(2)
+    { throw 1; }
+  catch (...)
+    { if (c != 3) r |= 1; }
+};
+
+int main ()
+{
+  try
+    { B b; }
+  catch (...)
+    { c = 0; }
+
+  if (c != 0) r |= 2;
+
+  return r;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/fntry1_1.cpp b/tests/device/test-stlport_shared-exception/jni/fntry1_1.cpp
new file mode 100644
index 0000000..9a5d993
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/fntry1_1.cpp
@@ -0,0 +1,10 @@
+// { dg-do run  }
+// Bug: g++ silently ignores function-try-blocks in templates.
+// Submitted by Jason Merrill <jason@cygnus.com>
+
+template <class T> void f (T) try { throw 1; } catch (...) { }
+
+int main ()
+{
+  f (1);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/fp-regs.cpp b/tests/device/test-stlport_shared-exception/jni/fp-regs.cpp
new file mode 100644
index 0000000..b91c0f9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/fp-regs.cpp
@@ -0,0 +1,94 @@
+// PR 20670: f29 corrupted when unwind stack.  This tries to test that FP
+// registers are properly saved and restored by defining 20 different FP
+// local variables.
+// { dg-do run }
+// { dg-options "-O" }
+#include <stdlib.h>
+ 
+double zero = 0.0;
+double another_zero = 0.0;
+ 
+int
+sub (void)
+{
+  throw (0);
+}
+ 
+int
+main (void)
+{
+  double a, b, c, d, e, f, g, h, i, j;
+  double a1, b1, c1, d1, e1, f1, g1, h1, i1, j1;
+ 
+  a = zero;
+  b = a + 1;
+  c = b + 1;
+  d = c + 1;
+  e = d + 1;
+  f = e + 1;
+  g = f + 1;
+  h = g + 1;
+  i = h + 1;
+  j = i + 1;
+   
+  a1 = another_zero;
+  b1 = a1 + 1;
+  c1 = b1 + 1;
+  d1 = c1 + 1;
+  e1 = d1 + 1;
+  f1 = e1 + 1;
+  g1 = f1 + 1;
+  h1 = g1 + 1;
+  i1 = h1 + 1;
+  j1 = i1 + 1;
+   
+  try
+    {
+      sub ();
+    }
+  catch (...)
+    {
+      if (a != 0.0)
+        abort ();
+      if (b != 1.0)
+        abort ();
+      if (c != 2.0)
+        abort ();
+      if (d != 3.0)
+        abort ();
+      if (e != 4.0)
+        abort ();
+      if (f != 5.0)
+        abort ();
+      if (g != 6.0)
+        abort ();
+      if (h != 7.0)
+        abort ();
+      if (i != 8.0)
+        abort ();
+      if (j != 9.0)
+        abort ();
+ 
+      if (a1 != 0.0)
+        abort ();
+      if (b1 != 1.0)
+        abort ();
+      if (c1 != 2.0)
+        abort ();
+      if (d1 != 3.0)
+        abort ();
+      if (e1 != 4.0)
+        abort ();
+      if (f1 != 5.0)
+        abort ();
+      if (g1 != 6.0)
+        abort ();
+      if (h1 != 7.0)
+        abort ();
+      if (i1 != 8.0)
+        abort ();
+      if (j1 != 9.0)
+        abort ();
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/gcsec1.cpp b/tests/device/test-stlport_shared-exception/jni/gcsec1.cpp
new file mode 100644
index 0000000..5dfe02a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/gcsec1.cpp
@@ -0,0 +1,45 @@
+/* PR other/29639 */
+/* AIX gld supports garbage collection. But AIX gcc does not support 
+   -ffunction-sections or -fdata-sections.  */
+/* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */
+/* { dg-require-gc-sections "" } */
+/* { dg-options "-ffunction-sections -Wl,--gc-sections" } */
+
+extern "C" void abort (void);
+
+int g = 0;
+
+void raise_exception()
+{
+  throw 1;
+}
+
+void used()
+{
+  try {
+    raise_exception ();
+  }
+  catch (int) {
+    g = 1;
+  }
+}
+
+void unused()
+{
+  try {
+    raise_exception ();
+  }
+  catch (int) {
+    g = 1;
+  }
+}
+
+int main()
+{
+  used ();
+
+  if (g != 1)
+    abort ();
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign.cpp
new file mode 100644
index 0000000..73a904e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign.cpp
@@ -0,0 +1,152 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C
+: public A { };
+
+struct D
+{
+  D& operator=(const D&) throw() { return *this; }
+};
+
+struct E
+{
+  E& operator=(const E&) throw(int) { return *this; }
+};
+
+struct E1
+{
+  E1& operator=(const E1&) throw(int) { throw int(); return *this; }
+};
+
+struct F
+{
+  F() throw(int) { }
+};
+
+struct G
+{
+  G() throw(int) { throw int(); }
+};
+
+struct H
+{
+  H& operator=(H&) throw(int) { return *this; }
+};
+
+struct H1
+{
+  H1& operator=(H1&) throw(int) { throw int(); return *this; }
+};
+
+struct I
+{
+  I& operator=(I&) throw(int) { return *this; }
+  I& operator=(const I&) throw() { return *this; }
+};
+
+struct I1
+{
+  I1& operator=(I1&) throw(int) { throw int(); return *this; }
+  I1& operator=(const I1&) throw() { return *this; }
+};
+
+struct J
+{
+  J& operator=(J&) throw() { return *this; }
+  J& operator=(const J&) throw() { return *this; }
+  J& operator=(volatile J&) throw() { return *this; }
+  J& operator=(const volatile J&) throw() { return *this; }
+};
+
+struct K
+{
+  K& operator=(K&) throw() { return *this; }
+};
+
+struct L
+{
+  L& operator=(const L&) throw() { return *this; }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_assign(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_assign(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_assign(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+template<typename T, bool b = __has_nothrow_assign(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_assign(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_assign(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (NTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (PTEST (F));
+  assert (PTEST (G));
+  assert (NTEST (H));
+  assert (NTEST (H1));
+  assert (NTEST (I));
+  assert (NTEST (I1));
+  assert (PTEST (J));
+  assert (NTEST (const K));
+  assert (NTEST (const L));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign_odr.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign_odr.cpp
new file mode 100644
index 0000000..c38d76d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_assign_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { const S& operator= (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_assign (S) == f ());
+}
+
+const S& S::operator= (const S&) { }
+
+bool f () { return __has_nothrow_assign (S); }
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor.cpp
new file mode 100644
index 0000000..60e9be8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor.cpp
@@ -0,0 +1,106 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C 
+: public A { };
+
+struct D
+{
+  D() throw() { }
+};
+
+struct E
+{
+  E() throw(int) { }
+};
+
+struct E1
+{
+  E1() throw(int) { throw int(); }
+};
+
+struct F
+{
+  F(const F&) throw() { }
+};
+
+struct G
+{
+  G(const G&) throw(int) { throw int(); }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_constructor(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_constructor(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_constructor(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+
+template<typename T, bool b = __has_nothrow_constructor(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_constructor(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_constructor(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (PTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (NTEST (F));
+  assert (NTEST (G));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor_odr.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor_odr.cpp
new file mode 100644
index 0000000..775e74a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_constructor_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_constructor (S) == f ());
+}
+
+S::S () { }
+
+bool f () { return __has_nothrow_constructor (S); }
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-1.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-1.cpp
new file mode 100644
index 0000000..e8507cf
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-1.cpp
@@ -0,0 +1,140 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C
+: public A { };
+
+struct D
+{
+  D(const D&) throw() { }
+};
+
+struct E
+{
+  E(const E&) throw(int) { }
+};
+
+struct E1
+{
+  E1(const E1&) throw(int) { throw int(); }
+};
+
+struct F
+{
+  F() throw() { }
+};
+
+struct G
+{
+  G() throw(int) { throw int(); }
+};
+
+struct H
+{
+  H(H&) throw(int) { }
+};
+
+struct H1
+{
+  H1(H1&) throw(int) { throw int(); }
+};
+
+struct I
+{
+  I(I&) throw(int) { }
+  I(const I&) throw() { }
+};
+
+struct I1
+{
+  I1(I1&) throw(int) { throw int(); }
+  I1(const I1&) throw() { }
+};
+
+struct J
+{
+  J(J&) throw() { }
+  J(const J&) throw() { }
+  J(volatile J&) throw() { }
+  J(const volatile J&) throw() { }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_copy(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_copy(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_copy(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+template<typename T, bool b = __has_nothrow_copy(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_copy(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_copy(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (NTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (PTEST (F));
+  assert (PTEST (G));
+  assert (NTEST (H));
+  assert (NTEST (H1));
+  assert (NTEST (I));
+  assert (NTEST (I1));  
+  assert (PTEST (J));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-2.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-2.cpp
new file mode 100644
index 0000000..276b11d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-2.cpp
@@ -0,0 +1,12 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct A { template <class T> A (T) throw (int); };
+struct B { B (B&) throw (); template <class T> B (T) throw (int); };
+
+int main ()
+{
+  assert (__has_nothrow_copy (A));
+  assert (__has_nothrow_copy (B));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-3.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-3.cpp
new file mode 100644
index 0000000..2fbcf8c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-3.cpp
@@ -0,0 +1,13 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct F {
+    F (const F&) throw () { }
+    template <class T> F (T) throw () { }
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (F));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-4.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-4.cpp
new file mode 100644
index 0000000..4bd7475
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-4.cpp
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (...) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-5.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-5.cpp
new file mode 100644
index 0000000..051675c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-5.cpp
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (int) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-6.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-6.cpp
new file mode 100644
index 0000000..4330edd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-6.cpp
@@ -0,0 +1,12 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (S&) throw ();
+    S (const S&, int) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-7.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-7.cpp
new file mode 100644
index 0000000..a85224c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy-7.cpp
@@ -0,0 +1,13 @@
+// { dg-do "run" }
+// { dg-options "-std=c++0x" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (S&&) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy_odr.cpp b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy_odr.cpp
new file mode 100644
index 0000000..499a11e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/has_nothrow_copy_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_copy (S) == f ());
+}
+
+S::S (const S&) { }
+
+bool f () { return __has_nothrow_copy (S); }
diff --git a/tests/device/test-stlport_shared-exception/jni/ia64-2.cpp b/tests/device/test-stlport_shared-exception/jni/ia64-2.cpp
new file mode 100644
index 0000000..aa005d8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ia64-2.cpp
@@ -0,0 +1,58 @@
+// PR target/30230
+// This testcase failed on IA-64, where end of an EH region ended
+// in the middle of a bundle (with br.call insn in first or second
+// slot of .bbb/.mbb bundles and EH region end right after it).
+// But br.call returns to the start of the next bundlem so during
+// unwinding the call was considered to be outside of the EH region
+// while it should have been inside.
+// { dg-do run }
+// { dg-require-weak "" }
+// { dg-options "-O2" }
+
+struct A {};
+struct B { virtual ~B(); };
+B::~B () {}
+struct C { void foo (short &, B &); };
+struct D { void *d1; C *d2; virtual void virt (void) {} };
+struct E { D *e1; B *e2; };
+struct F { void bar (void *, B &); };
+F *p __attribute__((weak));
+volatile int r;
+
+void C::foo (short &x, B &)
+{
+  if (r)
+    throw A ();
+  x = 1;
+}
+
+void F::bar (void *, B &)
+{
+  throw A ();
+}
+
+void baz (E &x)
+{
+  short g = 0;
+  B b = *x.e2;
+  x.e1->d2->foo (g, b);
+  if (g)
+    p->bar(x.e1->d1, b);
+}
+
+int main ()
+{
+  F g;
+  D s;
+  E h;
+  p = &g;
+  h.e1 = &s;
+  try
+    {
+      baz (h);
+    }
+  catch (A &)
+    {
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ice990323-2.cpp b/tests/device/test-stlport_shared-exception/jni/ice990323-2.cpp
new file mode 100644
index 0000000..cefef77
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ice990323-2.cpp
@@ -0,0 +1,88 @@
+// { dg-do run  }
+// check EH with templates
+extern "C" void abort ();
+extern "C" void exit (int);
+
+template <class T, int n, class U> struct A {
+	A() {}
+	A(const char*) {}
+};
+
+void f1()
+{
+	throw *(new A<double, 47, A<int, 37, short> >);
+}
+
+void f2()
+{
+	throw *(new A<double, 47, A<int, 36, short> >);
+}
+
+void f3()
+{
+	throw A<double, 47, A<int, 37, short> > ("howdy");
+}
+
+void f4()
+{
+	throw A<double, 47, A<int, 36, short> > ("hi michey");
+}
+
+int main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f1();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 37, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f2();
+	}
+	catch (A<double, 47, A<int, 36, short&> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f3();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 37, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f4();
+	}
+	catch (A<double, 47, A<int, 36, short&> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/init7.cpp b/tests/device/test-stlport_shared-exception/jni/init7.cpp
new file mode 100644
index 0000000..e6c7dc1
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/init7.cpp
@@ -0,0 +1,31 @@
+// { dg-do run  }
+// simplified from testcase in Windows Developer Journal,
+// submitted by eyal.ben-david@aks.com
+
+// The initialization of a static local variable must be retried if a
+// previous try finished by throwing an exception [stmt.dcl]/4
+
+extern "C" void abort ();
+
+struct foo {
+  foo() { throw true; }
+};
+
+void bar() {
+  static foo baz;
+}
+
+int main() {
+  try {
+    bar(); // must throw
+  }
+  catch (bool) {
+    try {
+      bar(); // must throw again!
+    }
+    catch (bool) {
+      return 0;
+    }
+  }
+  abort();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/inline2.cpp b/tests/device/test-stlport_shared-exception/jni/inline2.cpp
new file mode 100644
index 0000000..356c85a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/inline2.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// { dg-options "-O" }
+// Test that inlining a destructor with a catch block doesn't confuse the
+// enclosing try block.
+
+struct A {
+  ~A()
+  {
+    try { throw 1; }
+    catch (...) { }
+  }
+};
+
+int main ()
+{
+  try
+    {
+      A a;
+      throw 42;
+    }
+  catch (int i)
+    {
+      return (i != 42);
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/label3.cpp b/tests/device/test-stlport_shared-exception/jni/label3.cpp
new file mode 100644
index 0000000..604bfdc
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/label3.cpp
@@ -0,0 +1,39 @@
+// Bug: we were removing the p = q assignment in dce, and then reinserting
+// it *after* the try/catch in out-of-ssa.  Oops.
+
+// testcase reduced from libjava/interpret.cc.
+
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int printf (const char *, ...);
+
+bool b;
+
+int main()
+{
+  __label__ one, two, done;
+  void *labs[] = { &&one, &&two, &&done };
+  const void **q = (const void **)labs;
+  const void **p = q;
+
+  try
+    {
+    one:
+      printf ("one!\n");
+      if (b)
+	throw 42;
+      goto **p++;
+
+    two:
+      printf ("two!\n");
+      goto **p++;
+
+    done:
+      printf ("done!\n");
+    }
+  catch (int)
+    {
+      printf ("caught!\n");
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/loop1.cpp b/tests/device/test-stlport_shared-exception/jni/loop1.cpp
new file mode 100644
index 0000000..b9b230e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/loop1.cpp
@@ -0,0 +1,30 @@
+// Verify that loop optimization takes into account the exception edge
+// and does not increment I before the call.
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+static void bar(char *);
+
+static void foo(unsigned long element_count, char *ptr)
+{
+  unsigned long i;
+  try {
+    for (i = 0; i != element_count; i++, ptr += 8)
+      bar (ptr);
+  }
+  catch (...) {
+    if (i)
+      abort ();
+  }
+}
+
+static void bar(char *)
+{
+  throw 1;
+}
+
+int main()
+{
+  foo(2, 0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/loop2.cpp b/tests/device/test-stlport_shared-exception/jni/loop2.cpp
new file mode 100644
index 0000000..1e85fa1
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/loop2.cpp
@@ -0,0 +1,11 @@
+// Test that breaking out of a handler works.
+// { dg-do run }
+
+int main ()
+{
+  while (1)
+    {
+      try { throw 1; }
+      catch (...) { break; }
+    }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new1.cpp b/tests/device/test-stlport_shared-exception/jni/new1.cpp
new file mode 100644
index 0000000..2dfd267
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new1.cpp
@@ -0,0 +1,41 @@
+// PR c++/5757
+// Test that when a constructor throws in a new-expression, we pass the
+// right pointer to operator delete.
+
+// { dg-do run }
+
+#include <new>
+#include <stddef.h>
+
+int ret = 1;
+
+void *ptr;
+void * operator new[] (size_t s) throw (std::bad_alloc)
+{
+  ptr = operator new (s);
+  return ptr;
+}
+
+void operator delete[] (void *p) throw ()
+{
+  if (p == ptr)
+    ret = 0;
+  operator delete (p);
+}
+
+struct A
+{
+  A() { throw 1; }
+  ~A() {}
+};
+
+int
+main ()
+{
+  try
+    {
+      A *p = new A[4];
+    }
+  catch (...) {}
+  return ret;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new11.cpp b/tests/device/test-stlport_shared-exception/jni/new11.cpp
new file mode 100644
index 0000000..b273e58
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new11.cpp
@@ -0,0 +1,21 @@
+// PR c++/17670
+// { dg-do run }
+
+#include <cstdlib>
+#include <new>
+
+bool abort_new;
+void *operator new[](size_t bytes) throw (std::bad_alloc) { 
+  if (abort_new)
+    abort(); 
+  return operator new (bytes);
+}
+
+
+struct X {};  
+int main () {
+  // Do not abort until int main is running in case startup code uses
+  // operator new[].
+  abort_new = true;
+  new (X);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new16.cpp b/tests/device/test-stlport_shared-exception/jni/new16.cpp
new file mode 100644
index 0000000..c49f13f
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new16.cpp
@@ -0,0 +1,38 @@
+// { dg-do run }
+// { dg-options "-O2 -fstrict-aliasing" }
+
+// Test that we don't let TBAA reorder an assignment across a
+// placement new.
+// See PR 29286.
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+
+void __attribute__((noinline)) bar() {}
+
+long __attribute__((noinline)) foo(double *p, int n)
+{
+  long *f;
+  for (int i=0; i<n; ++i)
+  {
+    int *l = (int *)p;
+    *l = 0;
+    f = new (p) long;
+    *f = -1;
+  }
+  bar ();
+  return *f;
+}
+
+extern "C" void abort(void);
+int main()
+{
+  union {
+    int i;
+    long l;
+  } u;
+  if (foo((double *)&u, 1) != -1)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new1_2.cpp b/tests/device/test-stlport_shared-exception/jni/new1_2.cpp
new file mode 100644
index 0000000..4c52cf4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new1_2.cpp
@@ -0,0 +1,49 @@
+// { dg-do run  }
+// Test that a throw in foo destroys the A, but does not free the memory.
+
+#include <cstddef>
+#include <cstdlib>
+#include <new>
+
+struct A {
+  A();
+  ~A();
+};
+
+struct B {
+  B (A);
+};
+
+void foo (B*);
+
+int newed, created;
+
+int main ()
+{
+  try {
+    foo (new B (A ()));
+  } catch (...) { }
+
+  return !(newed && !created);
+}
+
+A::A() { created = 1; }
+A::~A() { created = 0; }
+B::B(A) { }
+void foo (B*) { throw 1; }
+
+void* operator new (size_t size) throw (std::bad_alloc)
+{
+  ++newed;
+  return (void *) std::malloc (size);
+}
+
+void operator delete (void *p) throw ()
+{
+  --newed;
+  std::free (p);
+}
+
+
+
+
diff --git a/tests/device/test-stlport_shared-exception/jni/new1_3.cpp b/tests/device/test-stlport_shared-exception/jni/new1_3.cpp
new file mode 100644
index 0000000..502c4f4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new1_3.cpp
@@ -0,0 +1,122 @@
+// { dg-do run  }
+//Lifetime of temporaries: 
+//egcs 2.92 performs cleanup for temporaries inside new expressions
+//after the new is complete, not at the end of the full expression.
+
+#include <new>
+#include <cstdlib>
+#include <cstdio>
+
+bool new_throws;
+bool ctor_throws;
+
+int new_done;
+int ctor_done;
+int func_done;
+int dtor_done;
+int delete_done;
+
+int count;
+
+void init()
+{
+  new_throws = ctor_throws = false;
+  new_done = ctor_done = func_done = dtor_done = delete_done = count = 0;
+}
+
+struct line_error{
+  int line;
+  line_error(int i):line(i){}
+};
+
+#define CHECK(cond)  if(!(cond))throw line_error(__LINE__);
+
+struct A{
+  A(int){
+    ctor_done = ++count;
+    if(ctor_throws)
+      throw 1;
+  }
+  A(const A&){
+    CHECK(false); //no copy constructors in this code
+  }
+  ~A(){
+    dtor_done = ++count;
+  }
+  A* addr(){return this;}
+};
+
+struct B{
+  B(A*){}
+  void* operator new(size_t s){
+    new_done = ++count;
+    if(new_throws)
+      throw 1;
+    return malloc(s);
+  }
+  void operator delete(void *){
+    delete_done = ++count;
+  }
+};
+
+void func(B* )
+{
+  func_done = ++count;
+}
+
+void test1()
+{
+  init();
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(ctor_done==1);
+  CHECK(new_done==2);
+  CHECK(func_done==3);
+  CHECK(dtor_done==4);
+  CHECK(delete_done==0);
+}
+
+void test2()
+{
+  init();
+  new_throws = true;
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(ctor_done==1);
+  CHECK(new_done==2);
+  CHECK(func_done==0);
+  CHECK(dtor_done==3);
+  CHECK(delete_done==0);
+}
+
+void test3()
+{
+  init();
+  ctor_throws = true;
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(new_done==0);
+  CHECK(ctor_done==1);
+  CHECK(func_done==0);
+  CHECK(dtor_done==0);
+  CHECK(delete_done==0);
+}
+
+int main()
+{
+  try{
+    test1();
+    test2();
+    test3();
+  }catch(line_error e){
+    printf("Got error in line %d\n",e.line);
+    return 1;
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new1_4.cpp b/tests/device/test-stlport_shared-exception/jni/new1_4.cpp
new file mode 100644
index 0000000..86d25f8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new1_4.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+// based on comp.std.c++ post by Alexander Schiemann <aschiem@math.uni-sb.de>
+
+// execution test
+
+#include <new>
+#include <stdlib.h>
+
+struct A {
+  A() { throw 0; }
+  void* operator new(size_t size, double = 0.0) { return ::operator new(size);}
+  void operator delete(void* p, double) { exit(0); }
+  void operator delete(void* p) { abort(); }
+};
+
+int main() { try { new A; } catch(...) {} }
diff --git a/tests/device/test-stlport_shared-exception/jni/new23.cpp b/tests/device/test-stlport_shared-exception/jni/new23.cpp
new file mode 100644
index 0000000..cedd898
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new23.cpp
@@ -0,0 +1,20 @@
+// PR c++/33025
+// { dg-do run }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+inline void *operator new (size_t, void *p) throw () { return p; }
+extern "C" void abort ();
+
+int
+main()
+{
+  const unsigned num = 10;
+  unsigned *data = new unsigned[2 * num];
+  unsigned *ptr = data;
+  for (unsigned i = 0; i < 2 * num; ++i)
+    (i % 2 == 0) ? new (ptr) unsigned (2) : new (ptr++) unsigned (1);
+  if (ptr - data != num)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new2_1.cpp b/tests/device/test-stlport_shared-exception/jni/new2_1.cpp
new file mode 100644
index 0000000..0002a2a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new2_1.cpp
@@ -0,0 +1,47 @@
+// { dg-do run  }
+// Test that a throw in B's constructor destroys the A and frees the memory.
+
+#include <cstddef>
+#include <cstdlib>
+#include <new>
+
+struct A {
+  A();
+  ~A();
+};
+
+struct B {
+  B (A);
+};
+
+void foo (B*);
+
+int newed, created;
+
+int main ()
+{
+  newed = 0; // The libraries might call new before int main starts.
+  try {
+    foo (new B (A ()));
+  } catch (...) { }
+
+  return !(!newed && !created);
+}
+
+A::A() { created = 1; }
+A::~A() { created = 0; }
+B::B(A) { throw 1; }
+void foo (B*) { }
+
+void* operator new (size_t size) throw (std::bad_alloc)
+{
+  ++newed;
+  return (void *) std::malloc (size);
+}
+
+void operator delete (void *p) throw ()
+{
+  --newed;
+  free (p);
+}
+
diff --git a/tests/device/test-stlport_shared-exception/jni/new3.cpp b/tests/device/test-stlport_shared-exception/jni/new3.cpp
new file mode 100644
index 0000000..d950259
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new3.cpp
@@ -0,0 +1,38 @@
+// { dg-do run  }
+// { dg-options "-fcheck-new -pedantic -Wno-long-long" }
+// PRMS Id: 6037
+
+extern "C" void * malloc (__SIZE_TYPE__);
+
+int ena = 0;
+
+struct A {
+  int i;
+  A () { i = 2; }
+  void * operator new (__SIZE_TYPE__ s)
+  {
+    if (ena)
+      return 0;
+    return malloc (s);
+  }
+};
+
+struct B {
+  int i;
+  B () { i = 2; }
+  void * operator new (__SIZE_TYPE__ s) throw()
+  {
+    if (ena)
+      return 0;
+    return malloc (s);
+  }
+};
+
+int main ()
+{
+  ena = 1;
+  A *ap = new A;
+  B *bp = new B;
+  
+  return ap || bp ;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new5.cpp b/tests/device/test-stlport_shared-exception/jni/new5.cpp
new file mode 100644
index 0000000..45335ff
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new5.cpp
@@ -0,0 +1,20 @@
+// { dg-do run }
+
+#include <new>
+#include <stddef.h>
+#include <stdio.h>
+    
+void * operator new[](size_t, std::nothrow_t const &) throw()
+{ return NULL; }
+
+struct X {
+    struct Inner { ~Inner() {} };
+
+    X() {
+      Inner * ic = new (std::nothrow) Inner[1]; // SegFault here
+    }
+};
+
+int main() {
+   X table;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new6.cpp b/tests/device/test-stlport_shared-exception/jni/new6.cpp
new file mode 100644
index 0000000..3afb2b7
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new6.cpp
@@ -0,0 +1,24 @@
+// { dg-do run  }
+// Test that we properly default-initialize the new int when () is given.
+
+#include <new>
+using namespace std;
+extern "C" void *malloc (size_t);
+
+int special;
+int space = 0xdeadbeef;
+
+void *operator new (size_t size) throw (bad_alloc)
+{
+  if (special)
+    return &space;
+  return malloc (size);
+}
+
+int main ()
+{
+  special = 1;
+  int *p = new int();
+  special = 0;
+  return *p != 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/new7.cpp b/tests/device/test-stlport_shared-exception/jni/new7.cpp
new file mode 100644
index 0000000..0c0643e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/new7.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+// Origin: philip_martin@ntlworld.com
+
+#include <new>
+
+extern "C" void abort();
+
+bool new_flag = false;
+bool delete_flag = false;
+
+struct X {
+  X()
+  {
+    throw 1;
+  }
+  void* operator new ( std::size_t n ) throw ( std::bad_alloc )
+  {
+    new_flag = true;
+    return ::operator new( n );
+  }
+  void operator delete( void* p, std::size_t n ) throw()
+  {
+    delete_flag = true;
+    ::operator delete( p );
+  }
+};
+
+int
+main()
+{
+  try
+    {
+      X* x = new X; // gcc 3.0 fails to call operator delete when X::X throws
+    }
+  catch ( ... )
+    {
+    }
+  if ( ! new_flag || ! delete_flag )
+    ::abort();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/omit-frame-pointer2.cpp b/tests/device/test-stlport_shared-exception/jni/omit-frame-pointer2.cpp
new file mode 100644
index 0000000..78026b5
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/omit-frame-pointer2.cpp
@@ -0,0 +1,34 @@
+// Reduced from PR c++/5246, PR c++/2447
+// { dg-options "-O -fomit-frame-pointer" }
+// { dg-do run }
+
+void step (int)
+{
+  void *sp = __builtin_alloca (0);
+}
+
+void f2 (void)
+{
+  step (2);
+  throw int();
+}
+
+void f1 (void)
+{
+  try
+    {
+      step (1);
+      f2 ();
+      step (-1);
+    }
+  catch (int)
+    {
+      step (3);
+    }
+}
+
+int main ()
+{
+  f1 ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/operators23.cpp b/tests/device/test-stlport_shared-exception/jni/operators23.cpp
new file mode 100644
index 0000000..38ef1b1
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/operators23.cpp
@@ -0,0 +1,36 @@
+// { dg-do run  }
+// GROUPS passed operators
+// opr-new file
+// From: (The Crossjammer) <xjam@cork.cs.berkeley.edu>
+// Date:     Mon, 23 Nov 92 23:35:26 PST
+// Subject:  g++-2.3.1 : Incorrectly calls overloaded operator new
+// Message-ID: <9211240735.AA06872@cork.CS.Berkeley.EDU>
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+class blah {
+     int j;
+   public:
+     blah();
+     void *operator new(size_t size) throw();
+};
+
+inline blah::blah() : j(0) {
+	  
+}
+
+
+void *blah::operator new(size_t size) throw(){
+     printf ("FAIL\n");
+     exit (1);
+     return NULL;
+}
+
+int main(int arg, char** argv) {
+     blah* blahPtr;
+
+     blahPtr = new blah[100];
+     printf ("PASS\n");
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/operators27.cpp b/tests/device/test-stlport_shared-exception/jni/operators27.cpp
new file mode 100644
index 0000000..7d9e811
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/operators27.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// GROUPS passed operators
+// opr-new file
+// From: David Binderman 3841 <dcb@us-es.sel.de>
+// Date:     Mon, 21 Jun 93 11:42:11 +0200
+// Subject:  G++ 2.4.3 and operator new
+// Message-ID: <9306210942.AA10276@slsvitt.us-es.sel.de>
+
+int FLAG=0;
+
+#include <new>
+#include <stddef.h>
+
+extern "C" int printf( const char *, ...);
+
+void * operator new(size_t, const std::nothrow_t&) throw()         { FLAG=1; return 0; }
+
+class K {
+private:
+        int i;
+public:
+        K( int j) {
+                i = j;
+        }
+};
+
+int main(void)
+{
+    K * pK = new (std::nothrow) K( 10);
+    if ( FLAG != 1 )
+	{ printf ("FAIL\n"); return 1; }
+    else
+	printf ("PASS\n");
+    return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/overload12_1.cpp b/tests/device/test-stlport_shared-exception/jni/overload12_1.cpp
new file mode 100644
index 0000000..9da3d32
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/overload12_1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run  }
+// Testcase for not trying a candidate that would generate an ill-formed
+// instantiation.
+
+template <int N> struct A {
+  int ar[N];
+};
+
+template <int N> struct B {
+  B () { }
+  B (const A<N> &) { }
+  B (const A<N-1> &, int);
+};
+
+int
+main ()
+{
+  A<1> a;
+  B<1> b1;
+  B<1> b2 (a);
+}
+
diff --git a/tests/device/test-stlport_shared-exception/jni/p11667.cpp b/tests/device/test-stlport_shared-exception/jni/p11667.cpp
new file mode 100644
index 0000000..802c0cf
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p11667.cpp
@@ -0,0 +1,62 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 11667
+
+extern "C" int printf(const char *,...);
+
+template < class T >
+class LIST {
+public:
+
+  LIST() { nitems = 16; items = new T[nitems]; };
+
+  LIST(int u) { nitems = u; items = new T[nitems]; };
+
+  T& operator[](int i) const {
+    return items[i];
+  }
+
+  void grow(int n) {
+    T* newlist = new T[n];
+    T* src = items;
+    T* dst = newlist;
+    int i = nitems;
+
+    try {
+      while (i--) *dst++ = *src++;
+    } catch (...) {
+      delete[]  newlist;
+      throw;
+    }
+
+    if (items) delete[] items;
+    nitems = n;
+    items = newlist;
+  }
+
+private:
+  int nitems;
+  T *items;
+};
+
+int main(int argc, char **argv) {
+  int i;
+  LIST<int> mylist(10);
+
+  printf("Start dumping initial 10 item list\n");
+  for (i = 0; i < 10 ; i++) {
+    mylist[i] = i;
+    printf("%d\n", mylist[i]);
+  }
+
+  printf("Growing list to 20\n");
+  mylist.grow(20);
+
+  printf("Start dumping grown 20 item list\n");
+  for (i = 0; i < 20; i++) {
+    mylist[i] = i;
+    printf("%d\n", mylist[i]);
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/p755.cpp b/tests/device/test-stlport_shared-exception/jni/p755.cpp
new file mode 100644
index 0000000..3979e72
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p755.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// It checks to see if you can define your own global new operator.
+// prms-id: 755
+
+#include <stddef.h>
+#include <new>
+
+extern "C" void _exit(int);
+
+void* operator new(size_t sz) throw (std::bad_alloc) {
+  void* p = 0;
+  _exit(0);
+  return p;
+}
+
+int main () {
+  int* i = new int;
+  delete i;
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/p755a.cpp b/tests/device/test-stlport_shared-exception/jni/p755a.cpp
new file mode 100644
index 0000000..bc23d57
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p755a.cpp
@@ -0,0 +1,15 @@
+// { dg-do run  }
+// It checks to see if you can define your own global delete operator.
+// prms-id: 755
+
+extern "C" void _exit(int);
+
+void operator delete(void *p) throw() {
+  _exit(0);
+}
+
+int main () {
+  int* i = new int;
+  delete i;
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/p7912.cpp b/tests/device/test-stlport_shared-exception/jni/p7912.cpp
new file mode 100644
index 0000000..079b4c4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p7912.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 7912
+
+int count = 0;
+
+class Foo {
+public:
+  Foo() { ++count; };
+  Foo(const Foo&) { ++count; };
+  ~Foo() { --count; };
+};
+
+
+int main()
+{
+  try {
+    throw Foo();
+  }
+  catch (Foo object) {
+  }
+  return count;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/p8155.cpp b/tests/device/test-stlport_shared-exception/jni/p8155.cpp
new file mode 100644
index 0000000..7938471
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p8155.cpp
@@ -0,0 +1,148 @@
+// { dg-do run  }
+// prms-id: 8155
+
+int fail = 1;
+
+class CMainWindow;
+class CFrameWnd;
+class CWnd;
+class CCmdTarget;
+ 
+typedef void (CCmdTarget::*AFX_PMSG)( void);
+typedef void (CWnd::*AFX_PMSGW)( void);
+
+struct AFX_MSGMAP_ENTRY {
+  unsigned int  nMessage;    
+  AFX_PMSG pfn;
+};
+
+struct AFX_MSGMAP {
+  const AFX_MSGMAP* pBaseMap;
+  const AFX_MSGMAP_ENTRY* lpEntries;
+};
+
+class CCmdTarget {
+public:
+  CCmdTarget();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+const   AFX_MSGMAP CCmdTarget::messageMap = {
+  0, &CCmdTarget::_messageEntries[0]
+};
+
+const AFX_MSGMAP* CCmdTarget::GetMessageMap() const {
+  return &CCmdTarget::messageMap;
+}
+
+AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] =
+{
+  { 0, 0 }
+};
+
+CCmdTarget :: CCmdTarget() { }
+ 
+class CWnd : public CCmdTarget {
+public:
+  CWnd();
+
+protected:
+  void OnPaint();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CWnd :: CWnd() {
+}
+
+void CWnd :: OnPaint() {
+}
+
+const AFX_MSGMAP*   CWnd ::GetMessageMap() const {
+  return &  CWnd ::messageMap;
+}
+const AFX_MSGMAP   CWnd ::messageMap = {
+  &  CCmdTarget ::messageMap, &  CWnd ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CWnd ::_messageEntries[] = { 
+  {0, (AFX_PMSG)0 } }; 
+
+class CFrameWnd : public CWnd {
+public:
+  CFrameWnd();
+protected:
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CFrameWnd :: CFrameWnd() { }
+
+const AFX_MSGMAP*   CFrameWnd ::GetMessageMap() const {
+  return &  CFrameWnd ::messageMap;
+}
+const AFX_MSGMAP   CFrameWnd ::messageMap = {
+  &  CWnd ::messageMap, &  CFrameWnd ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CFrameWnd ::_messageEntries[] = { 
+  {0, (AFX_PMSG)0 } }; 
+
+class CMainWindow : public CFrameWnd {
+public:
+  CMainWindow();
+  void OnPaint();
+  void callProc();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CMainWindow :: CMainWindow()
+{
+}
+void CMainWindow :: OnPaint()
+{
+  fail = 0;
+}
+
+void CMainWindow :: callProc()
+{
+  const AFX_MSGMAP* pMessageMap;
+  const AFX_MSGMAP_ENTRY *lpEntry;
+
+  pMessageMap = GetMessageMap();
+  lpEntry = pMessageMap->lpEntries;
+
+  if( lpEntry->nMessage == 100) {
+    (this->*lpEntry->pfn)();
+  }
+}
+
+const AFX_MSGMAP*   CMainWindow ::GetMessageMap() const {
+  return &  CMainWindow ::messageMap;
+}
+const AFX_MSGMAP   CMainWindow ::messageMap = {
+  &  CFrameWnd ::messageMap, &  CMainWindow ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CMainWindow ::_messageEntries[] = { 
+  { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint },
+  {0, (AFX_PMSG)0 }
+}; 
+
+int main( int argc, char **argv) {
+  CMainWindow     myWindow;
+
+  myWindow.callProc();
+  return fail;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/p9706.cpp b/tests/device/test-stlport_shared-exception/jni/p9706.cpp
new file mode 100644
index 0000000..0ed15e4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/p9706.cpp
@@ -0,0 +1,37 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 9706
+
+#include <stdlib.h>
+
+int count, acount;
+
+void *operator new(size_t sz) { ++count; return malloc (sz); }
+void operator delete(void *p) throw() { --count; free (p); }
+
+class A {
+public:
+  A() { ++acount; }
+  A(const A&) { ++acount; }
+  ~A() { --acount; }
+};
+
+int main() {
+  int i;
+
+  // The standard library may have called new and/or delete during
+  // startup, so we have to reset the counter here.
+  count = 0;
+
+  for( i = 0; i < 10; i++ ) {
+    try {
+      throw A();
+    }
+    catch (A& a) {
+    }
+  }
+  if (acount)
+    return 1;
+  if (count)
+    return 2;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pdel1.cpp b/tests/device/test-stlport_shared-exception/jni/pdel1.cpp
new file mode 100644
index 0000000..fd7ecff
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pdel1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// Test for calling placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 1;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, int) { r = 0; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+int main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pdel2.cpp b/tests/device/test-stlport_shared-exception/jni/pdel2.cpp
new file mode 100644
index 0000000..9bad6ee
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pdel2.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// Test for not calling mismatched placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 0;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, long) { r = 1; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+int main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/placement2.cpp b/tests/device/test-stlport_shared-exception/jni/placement2.cpp
new file mode 100644
index 0000000..7a9d6d0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/placement2.cpp
@@ -0,0 +1,22 @@
+// Bug: We were calling f() twice, for both the placement new and placement
+// delete calls.
+
+// { dg-do run }
+
+void* operator new    (__SIZE_TYPE__ sz, void*) { return operator new (sz); }
+void  operator delete (void* p, void*)         { operator delete (p); }
+
+struct A { A() { throw 1; } };
+
+int c;
+void *f() { ++c; return 0; }
+
+int main()
+{
+  try
+    {
+      new (f()) A;
+    }
+  catch (...) {}
+  return c != 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr17697-1.cpp b/tests/device/test-stlport_shared-exception/jni/pr17697-1.cpp
new file mode 100644
index 0000000..50a75b8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr17697-1.cpp
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+  extern int strcmp (const char *s, const char *t) throw ()
+    __attribute__ ((pure));
+}
+
+namespace A
+{
+  extern int strcmp (const char *s, const char *t);
+}
+
+inline int
+A::strcmp (const char *s, const char *t)
+{
+  return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+  return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+  return foo ("") != 0 || foo ("a") == 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr17697-2.cpp b/tests/device/test-stlport_shared-exception/jni/pr17697-2.cpp
new file mode 100644
index 0000000..4a746be
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr17697-2.cpp
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+  extern int strcmp (const char *s, const char *t) throw ()
+    __attribute__ ((pure));
+}
+
+namespace A
+{
+  extern int strcmp (const char *s, const char *t) throw ();
+}
+
+inline int
+A::strcmp (const char *s, const char *t) throw ()
+{
+  return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+  return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+  return foo ("") != 0 || foo ("a") == 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr22167.cpp b/tests/device/test-stlport_shared-exception/jni/pr22167.cpp
new file mode 100644
index 0000000..07af744
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr22167.cpp
@@ -0,0 +1,32 @@
+// Derived from PR22167, which failed on some RISC targets.  The call to
+// foo() has two successors, one normal and one exceptional, and both
+// successors use &a[0] and x.  Expressions involving &a[0] can be hoisted
+// before the call but those involving x cannot.
+// { dg-options "-Os" }
+// { dg-do run }
+
+int a[4];
+
+struct S {
+  S() : x (0) {}
+  ~S() { a[0] = x; }
+  int x;
+};
+
+void
+foo (int *x)
+{
+  if (*x == 1)
+    throw 1;
+  *x = 1;
+}
+
+int
+main()
+{
+  S s;
+  foo (&s.x);
+  if (a[0] == s.x)
+    a[0]++;
+  return a[0];
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr23299.cpp b/tests/device/test-stlport_shared-exception/jni/pr23299.cpp
new file mode 100644
index 0000000..94a414a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr23299.cpp
@@ -0,0 +1,63 @@
+// PR rtl-optimization/23299
+// { dg-do run }
+// { dg-options "-Os" }
+
+extern "C" void abort ();
+
+struct A
+{
+  virtual int a () {}
+};
+struct B : public A
+{
+  virtual int b () {}
+};
+struct C : public A
+{
+  virtual int c () {}
+};
+struct D
+{
+  D () { d = 64; }
+  ~D ();
+  int d;
+};
+
+int x;
+D::~D ()
+{
+  x |= 1;
+  if (d != 64)
+    abort ();
+}
+
+struct E : public B, public C
+{
+  E () {}
+  virtual int c ();
+  ~E ();
+  D dv;
+};
+
+E::~E ()
+{
+  int r = c ();
+}
+
+int
+E::c ()
+{
+  if (x > 10)
+    throw 1;
+  x |= 2;
+}
+
+int
+main (void)
+{
+  {
+    E e;
+  }
+  if (x != 3)
+    abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr29166.cpp b/tests/device/test-stlport_shared-exception/jni/pr29166.cpp
new file mode 100644
index 0000000..432b64e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr29166.cpp
@@ -0,0 +1,197 @@
+// PR 29166: r4-r7 corrupted when unwinding.
+// { dg-do run }
+
+class Ex 
+{ 
+public: 
+  int val; 
+
+  Ex( int v )
+   : val( v ) 
+   { }
+
+};
+
+void doIt() 
+{
+  int OFF( 1000 ); 
+  register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10;
+  register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20;
+  register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30;
+  register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40;
+  register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50;
+  register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60;
+  register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70;
+  register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80;
+  register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90;
+  register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100;
+  register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110;
+  register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120;
+  register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130;
+  register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140;
+  register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150;
+  register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160;
+  register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170;
+  register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180;
+  register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190;
+  register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200;
+  register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210;
+  register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220;
+  register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240;
+  register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250;
+  register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260;
+  register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270;
+  register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280;
+  register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290;
+  register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300;
+
+  register int sum = 0;
+  sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+  sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+  sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+  sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+  sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+  sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+  sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+  sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+  sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+  sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+  sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+  sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+  sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+  sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+  sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+  sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+  sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+  sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+  sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+  sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+  sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+  sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+  sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+  sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+  sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+  sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+  sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+  sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+  sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+  throw Ex( sum );  
+}
+
+void test() 
+{
+  try {
+    doIt(); 
+  } catch( Ex& ) { } 
+}
+
+int main(int argc, char** argv) 
+{
+  int OFF(0); 
+  register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10;
+  register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20;
+  register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30;
+  register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40;
+  register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50;
+  register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60;
+  register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70;
+  register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80;
+  register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90;
+  register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100;
+  register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110;
+  register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120;
+  register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130;
+  register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140;
+  register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150;
+  register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160;
+  register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170;
+  register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180;
+  register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190;
+  register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200;
+  register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210;
+  register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220;
+  register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240;
+  register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250;
+  register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260;
+  register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270;
+  register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280;
+  register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290;
+  register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300;
+
+  int sum_before, sum_after; 
+
+  {
+    int sum( 0 );
+    sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+    sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+    sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+    sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+    sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+    sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+    sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+    sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+    sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+    sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+    sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+    sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+    sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+    sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+    sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+    sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+    sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+    sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+    sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+    sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+    sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+    sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+    sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+    sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+    sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+    sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+    sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+    sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+    sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+    sum_before = sum;
+  }
+
+ test(); 
+
+ {
+   int sum( 0 );
+   sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+   sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+   sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+   sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+   sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+   sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+   sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+   sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+   sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+   sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+   sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+   sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+   sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+   sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+   sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+   sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+   sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+   sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+   sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+   sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+   sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+   sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+   sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+   sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+   sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+   sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+   sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+   sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+   sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+   sum_after = sum; 
+ }
+
+  return sum_before != sum_after;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pr36449.cpp b/tests/device/test-stlport_shared-exception/jni/pr36449.cpp
new file mode 100644
index 0000000..f665980
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pr36449.cpp
@@ -0,0 +1,70 @@
+// PR middle-end/36449
+// { dg-do run }
+// { dg-options "-O3" }
+
+extern "C" void exit (int);
+extern "C" void abort ();
+
+struct R
+{
+  short a;
+  short b;
+};
+
+struct S
+{
+  R e;
+  long f;
+  long g;
+};
+
+struct T
+{
+  short c;
+  short d;
+};
+
+struct U
+{
+  long h[0x1ffffff + 1];
+  T i;
+};
+
+U *j;
+
+void __attribute__((noinline))
+bar ()
+{
+  exit (0);
+}
+
+void __attribute__((noinline))
+foo ()
+{
+  S s;
+
+  s.e.a = 36;
+  s.e.b = 38;
+  if (s.e.a == j->i.c && s.e.b == j->i.d)
+    bar ();
+}
+
+int
+main ()
+{
+  try
+    {
+      j = new U;
+    }
+  catch (...)
+    {
+      return 0;
+    }
+  j->i.c = 36;
+  j->i.d = 38;
+  j->h[0] = 1;
+  j->h[1] = 2;
+  j->h[2] = 3;
+  foo ();
+  abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/pretty2.cpp b/tests/device/test-stlport_shared-exception/jni/pretty2.cpp
new file mode 100644
index 0000000..0c05da9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/pretty2.cpp
@@ -0,0 +1,61 @@
+// PR c++/6794
+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
+// in initializers at global scope
+// { dg-do run }
+// { dg-options "" }
+
+extern "C" void __assert_fail (const char *, const char *,
+			       unsigned int, const char *)
+  throw() __attribute__((noreturn));
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+#define str(expr) #expr
+#define assert(expr)						\
+  ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__,	\
+				__PRETTY_FUNCTION__), 0))
+
+int __attribute__((noinline))
+foo (void)
+{
+  return 1;
+}
+
+template<class T> int
+bar (T)
+{
+  return (assert (foo ()), 1);
+}
+
+template<> int
+bar<int> (int)
+{
+  return (assert (foo ()), 2);
+}
+
+int a = (assert (foo ()), 1);
+int b = (assert (foo ()), 2);
+
+int
+main ()
+{
+  double c = 1.0;
+  unsigned char *d = 0;
+  int e = (assert (foo ()), 3);
+
+  bar (c);
+  bar (d);
+  bar (e);
+}
+
+namespace N
+{
+  int f = (assert (foo ()), 4);
+}
+
+void __attribute__((noinline))
+__assert_fail (const char *cond, const char *file, unsigned int line,
+	       const char *pretty) throw ()
+{
+  abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ptr1.cpp b/tests/device/test-stlport_shared-exception/jni/ptr1.cpp
new file mode 100644
index 0000000..e4b3100
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ptr1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Bug: catching pointers by reference doesn't work right.
+
+extern "C" int printf (const char *, ...);
+
+struct E {
+  int x;
+  E(int i) { x = i; }
+};
+
+int main()
+{
+  try {
+    E *p = new E(5);
+    throw p;
+  }
+
+  catch (E *&e) {
+    printf ("address of e is 0x%lx\n", (__SIZE_TYPE__)e);
+    printf ("(__SIZE_TYPE__)e: %d ( != 5 ?)\n", (__SIZE_TYPE__)e);
+    printf ("            e->x: %d ( == 5 ?)\n", e->x);
+    return !((__SIZE_TYPE__)e != 5 && e->x == 5);
+  }
+  return 2;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ptrmem1_1.cpp b/tests/device/test-stlport_shared-exception/jni/ptrmem1_1.cpp
new file mode 100644
index 0000000..299dc4a
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ptrmem1_1.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+extern "C" void exit (int);
+extern "C" void abort (void);
+struct A { int i; };
+int main ()
+{
+  try { throw &A::i; }
+  catch (int A::*p)
+    {
+      if (p == &A::i)
+	exit (0);
+      else
+	abort ();
+    }
+  abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/ref9.cpp b/tests/device/test-stlport_shared-exception/jni/ref9.cpp
new file mode 100644
index 0000000..127b7d8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/ref9.cpp
@@ -0,0 +1,36 @@
+// { dg-do run }
+
+struct ex;
+struct basic {
+  int refcount;
+  ex eval() const;
+  basic() : refcount(0) {}
+};
+
+struct ex {
+  basic *bp;
+  ex() : bp(0) { }
+  ex(const basic &);
+  virtual ~ex();
+  void construct_from_basic(const basic &);
+};
+
+ex basic::eval() const {
+  throw 1;
+}
+
+inline ex::ex(const basic &b) { construct_from_basic (b); }
+inline ex::~ex() { if (--bp->refcount == 0) delete bp; }
+void ex::construct_from_basic(const basic &b) {
+  const ex & tmpex = b.eval();
+  bp = tmpex.bp;
+  bp->refcount++;
+}
+
+ex pow() { return basic(); }
+
+int main()
+{
+  try { pow (); } catch (int) {}
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/reg-stack.cpp b/tests/device/test-stlport_shared-exception/jni/reg-stack.cpp
new file mode 100644
index 0000000..76d3cee
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/reg-stack.cpp
@@ -0,0 +1,47 @@
+// PR target/6087
+// The code that moves around insns emitted by reg-stack to cope with
+// exception edges lost the REG_DEAD note indicating a pop.  Which
+// eventually fills up the register stack resulting in Z == NaN.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort ();
+
+struct Base
+{
+  virtual ~Base() {}
+};
+
+struct Foo : public Base
+{
+  Foo ();
+};
+
+double x = 3;
+double y = 4;
+
+double bar ()
+{
+  double z = x*x+y*y;
+  if (z != 25.0)
+    throw 1;
+  return z;
+}
+
+Foo::Foo ()
+{
+  bar ();
+}
+
+int main ()
+{
+  try {
+    int i;
+    for (i = 0; i < 10; ++i)
+      new Foo;
+  } catch (...) {
+    abort ();
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/registers1.cpp b/tests/device/test-stlport_shared-exception/jni/registers1.cpp
new file mode 100644
index 0000000..35b1c9d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/registers1.cpp
@@ -0,0 +1,138 @@
+// Try to check that registers are preserved when the stack is unwound.
+// { dg-do run }
+// { dg-options -O2 }
+
+extern "C" void exit(int);
+extern "C" void abort();
+
+// This test case triggers up to DEPTH recursive calls to function
+// foo(), These calls are numbered so that 0 is the innermost, 1 the
+// second innermost, and so on.  Each call caches NUM_VARS elements of
+// both DOUBLE_SRC and INT_SRC and applies a trivial operation to each
+// cached value.  The innermost foo() call will throw an integer call
+// number.  The specified call should store its cached values in
+// DOUBLE_DEST and INT_DEST, which int main() will check.
+const int num_vars = 16;
+const int depth = 3;
+
+float float_src[num_vars * depth];
+float float_dest[num_vars];
+
+int int_src[num_vars * depth];
+int int_dest[num_vars];
+
+void foo (int level, int throw_to)
+{
+  float *fsrc = &float_src[level * num_vars];
+  float f00 = *fsrc++ + 1.0f;
+  float f01 = *fsrc++ + 1.0f;
+  float f02 = *fsrc++ + 1.0f;
+  float f03 = *fsrc++ + 1.0f;
+  float f04 = *fsrc++ + 1.0f;
+  float f05 = *fsrc++ + 1.0f;
+  float f06 = *fsrc++ + 1.0f;
+  float f07 = *fsrc++ + 1.0f;
+  float f08 = *fsrc++ + 1.0f;
+  float f09 = *fsrc++ + 1.0f;
+  float f10 = *fsrc++ + 1.0f;
+  float f11 = *fsrc++ + 1.0f;
+  float f12 = *fsrc++ + 1.0f;
+  float f13 = *fsrc++ + 1.0f;
+  float f14 = *fsrc++ + 1.0f;
+  float f15 = *fsrc++ + 1.0f;
+
+  int *isrc = &int_src[level * num_vars];
+  int i00 = *isrc++ + 1;
+  int i01 = *isrc++ + 1;
+  int i02 = *isrc++ + 1;
+  int i03 = *isrc++ + 1;
+  int i04 = *isrc++ + 1;
+  int i05 = *isrc++ + 1;
+  int i06 = *isrc++ + 1;
+  int i07 = *isrc++ + 1;
+  int i08 = *isrc++ + 1;
+  int i09 = *isrc++ + 1;
+  int i10 = *isrc++ + 1;
+  int i11 = *isrc++ + 1;
+  int i12 = *isrc++ + 1;
+  int i13 = *isrc++ + 1;
+  int i14 = *isrc++ + 1;
+  int i15 = *isrc++ + 1;
+
+  try
+    {
+      if (level == 0)
+	throw throw_to;
+      else
+	foo (level - 1, throw_to);
+    }
+  catch (int i)
+    {
+      if (i == level)
+	{
+	  float *fdest = float_dest;
+	  *fdest++ = f00;
+	  *fdest++ = f01;
+	  *fdest++ = f02;
+	  *fdest++ = f03;
+	  *fdest++ = f04;
+	  *fdest++ = f05;
+	  *fdest++ = f06;
+	  *fdest++ = f07;
+	  *fdest++ = f08;
+	  *fdest++ = f09;
+	  *fdest++ = f10;
+	  *fdest++ = f11;
+	  *fdest++ = f12;
+	  *fdest++ = f13;
+	  *fdest++ = f14;
+	  *fdest++ = f15;
+
+	  int *idest = int_dest;
+	  *idest++ = i00;
+	  *idest++ = i01;
+	  *idest++ = i02;
+	  *idest++ = i03;
+	  *idest++ = i04;
+	  *idest++ = i05;
+	  *idest++ = i06;
+	  *idest++ = i07;
+	  *idest++ = i08;
+	  *idest++ = i09;
+	  *idest++ = i10;
+	  *idest++ = i11;
+	  *idest++ = i12;
+	  *idest++ = i13;
+	  *idest++ = i14;
+	  *idest++ = i15;
+	}
+      else
+	{
+	  throw;
+	}
+    }
+}
+
+int main ()
+{
+  for (int i = 0; i < depth * num_vars; i++)
+    {
+      int_src[i] = i * i;
+      float_src[i] = i * 2.0f;
+    }
+  for (int level = 0; level < depth; level++)
+    for (int throw_to = 0; throw_to <= level; throw_to++)
+      {
+	foo (level, throw_to);
+	float *fsrc = &float_src[throw_to * num_vars];
+	int *isrc = &int_src[throw_to * num_vars];
+	for (int i = 0; i < num_vars; i++)
+	  {
+	    if (int_dest[i] != isrc[i] + 1)
+	      abort ();
+	    if (float_dest[i] != fsrc[i] + 1.0f)
+	      abort ();
+	  }
+      }
+  exit (0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow1.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow1.cpp
new file mode 100644
index 0000000..286f1bd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow1.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw A();
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw;
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow2.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow2.cpp
new file mode 100644
index 0000000..cd2dd7e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow2.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw;
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow3.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow3.cpp
new file mode 100644
index 0000000..952318b
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow3.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+#include <stdio.h>
+#include <stdlib.h>
+#include <exception>
+
+static void
+eh_terminate ()
+{
+  printf ("CALLING TERMINATE\n");
+  exit (1);
+}
+
+void
+eh_test (int level)
+{
+  try
+    {
+      if (level < 2)
+	eh_test (level + 1);
+      else
+	{
+	  printf ("%d: Throwing\n", level);
+	  throw (level);
+	}
+    }
+  catch (int &x)
+    {
+      printf ("%d: Got level %d\n",
+	      level, x);
+
+      if (level > 0)
+	throw;
+    }
+}
+
+int main ()
+{
+  std::set_terminate (&eh_terminate);
+  eh_test (0);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow4.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow4.cpp
new file mode 100644
index 0000000..df54e49
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow4.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw A();
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow5.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow5.cpp
new file mode 100644
index 0000000..34a56e4
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow5.cpp
@@ -0,0 +1,45 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Falling out...\n");
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rethrow6.cpp b/tests/device/test-stlport_shared-exception/jni/rethrow6.cpp
new file mode 100644
index 0000000..ce99626
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rethrow6.cpp
@@ -0,0 +1,76 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+int wrong;
+
+struct A
+{
+  int i;
+  A () { i = c++; printf ("A() %d\n", i); }
+  A (const A&) { i = c++; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+struct B
+{
+  ~B () {
+    try
+      {
+	printf ("Rethrowing III...\n");
+	throw;
+      }
+    catch (A& a)
+      {
+	printf ("Caught III %d...\n", a.i);
+	if (a.i != 1)
+	  {
+	    printf ("** rethrew uncaught exception **\n");
+	    wrong = 1;
+	  }
+      }
+    printf ("continuing to unwind II...\n");
+  }
+};
+
+int
+main ()
+{
+  {
+    A a;
+
+    try
+      {
+	try
+	  {
+	    printf ("Throwing I...\n");
+	    throw a;
+	  }
+	catch (A& a)
+	  {
+	    printf ("Caught I %d...\n", a.i);
+	    try
+	      {
+		B b;
+		printf ("Throwing II...\n");
+		throw a;
+	      }
+	    catch (A& a)
+	      {
+		printf ("Caught II %d...\n", a.i);
+		printf ("Throwing IV...\n");
+		throw;
+	      }
+	  }
+      }
+    catch (A& a)
+      {
+	printf ("Caught IV %d.\n", a.i);
+      }
+  }
+
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d || wrong;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/rvalue1.cpp b/tests/device/test-stlport_shared-exception/jni/rvalue1.cpp
new file mode 100644
index 0000000..277d594
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/rvalue1.cpp
@@ -0,0 +1,52 @@
+// { dg-do run  }
+// PRMS Id: 6000
+// Bug: g++ gets confused trying to build up a reference to a cast.
+
+class String {
+protected:
+  char *cp;
+public:
+  String(char *incp);
+  String(const String &constStringRef);
+  virtual void virtualFn1(void) const {;}
+};
+
+String::String(char *incp)
+{
+  cp = incp;
+}
+
+String::String(const String &constStringRef)
+{
+// Right here, do an 'info args', and look at the virtual function table
+// pointer: typically junk! Calling the function through that table could
+// do anything, since we're really leaping off into the void. This example
+// goes down with 'SIGBUS', but I've seen 'SIGSEGV' too, and 'SIGILL' is
+// possible.
+
+  cp = constStringRef.cp;
+  constStringRef.virtualFn1();
+}
+
+void foofun(String string)
+{
+  ;
+}
+
+class Class1 {
+public:
+  Class1(const String & constStringRef);
+};
+
+Class1 :: Class1 (const String & constStringRef)
+{
+// If instead of calling the function 'foofun()' here, we just assign
+// 'constStringRef' to a local variable, then the vptr is typically == 0!
+
+  foofun(String(constStringRef));
+}
+
+int main(void)
+{
+  Class1 *class1 = new Class1((char*) "Hi!");
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/singleton.cpp b/tests/device/test-stlport_shared-exception/jni/singleton.cpp
new file mode 100644
index 0000000..2a27ca3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/singleton.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// This tests two things:
+// 1. there is an annoying warning.
+// singleton.C:26: warning: `class singleton' only defines private constructors and has no friends
+// egcs fails to see that there is a public static accessor function.
+// 2. the program crashes, because apparently the static variable s in
+// singleton::instance() is considered constructed although the ctor
+// exited via an exception. (crash changed to nonzero return here)
+
+class singleton {
+public:
+       static singleton& instance() {
+               static singleton s;
+               return s;
+       }
+       int check() {return initialized;}
+
+private:
+       singleton() : initialized(1) {
+               if ( counter++ == 0 ) throw "just for the heck of it";
+               initialized = 2;
+       }
+       singleton( const singleton& rhs );
+       void operator=( const singleton& rhs );
+       int initialized;
+       static int counter;
+};  
+
+int singleton::counter;
+
+int main()
+{
+       while (1) {
+               try {
+                       return singleton::instance().check()-2;
+               } catch (...) { }
+       }
+}
+
diff --git a/tests/device/test-stlport_shared-exception/jni/spbp.cpp b/tests/device/test-stlport_shared-exception/jni/spbp.cpp
new file mode 100644
index 0000000..181e65d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spbp.cpp
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-gdwarf-2" } */
+/* { dg-skip-if "No Dwarf" { { *-*-aix* hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */
+
+/* This was a bug on x86-darwin, where the register numbering for SP
+   and BP was swapped (it's easy to do because on that port it's
+   different for eh_frame and debug_frame).  */
+
+#include <stdlib.h>
+
+void f1(int t)
+{
+  char u[t];
+  throw 1;
+}
+
+int main()
+{
+  bool b = true;
+  try {
+    f1(100);
+  } catch (int x) {
+    if (b)
+      exit (0);
+  }
+  abort ();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec1.cpp b/tests/device/test-stlport_shared-exception/jni/spec1.cpp
new file mode 100644
index 0000000..0ff8883
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec1.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 1: the original exception succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (char, int, std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 0;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec2.cpp b/tests/device/test-stlport_shared-exception/jni/spec2.cpp
new file mode 100644
index 0000000..5c7a913
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec2.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 2: the second throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (int, std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 0;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec3.cpp b/tests/device/test-stlport_shared-exception/jni/spec3.cpp
new file mode 100644
index 0000000..20bcfc3
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec3.cpp
@@ -0,0 +1,24 @@
+// PR c++/4381
+// Test that exception-specs work properly for classes with virtual bases.
+
+// { dg-do run }
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void func() throw (B,A)
+{
+  throw A();
+}
+
+int main(void)
+{
+  try {	func(); }
+  catch (A& a) { }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec3_1.cpp b/tests/device/test-stlport_shared-exception/jni/spec3_1.cpp
new file mode 100644
index 0000000..6239270
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec3_1.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 3: the bad_exception throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 0;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec4.cpp b/tests/device/test-stlport_shared-exception/jni/spec4.cpp
new file mode 100644
index 0000000..e1f702e
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec4.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 4: all throws fail, call terminate.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (0); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (short)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec5.cpp b/tests/device/test-stlport_shared-exception/jni/spec5.cpp
new file mode 100644
index 0000000..be8f327
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec5.cpp
@@ -0,0 +1,22 @@
+// Test for extension to allow incomplete types in an
+// exception-specification for a declaration.
+
+// { dg-do run }
+// { dg-options "-fpermissive -w" }
+
+struct A;
+
+struct B
+{
+  void f () throw (A);
+};
+
+struct A {};
+
+void B::f () throw (A) {}
+
+int main ()
+{
+  B b;
+  b.f();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec7.cpp b/tests/device/test-stlport_shared-exception/jni/spec7.cpp
new file mode 100644
index 0000000..e013ba9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec7.cpp
@@ -0,0 +1,35 @@
+// PR 14535
+// { dg-do run }
+// { dg-options "-O -finline" }
+//
+// Original test case failure required that Raiser constructor be inlined.
+
+extern "C" void abort(); 
+bool destructor_called = false; 
+
+struct B { 
+  virtual void Run(){}; 
+}; 
+
+  struct D : public B { 
+    virtual void Run() 
+    { 
+      struct O { 
+        ~O() { destructor_called = true; }; 
+      } o; 
+
+      struct Raiser { 
+        Raiser()  throw( int ) {throw 1;}; 
+      } raiser; 
+    }; 
+  }; 
+
+int main() { 
+  try { 
+    D d; 
+    static_cast<B&>(d).Run(); 
+  } catch (...) {} 
+
+  if (!destructor_called)
+    abort (); 
+} 
diff --git a/tests/device/test-stlport_shared-exception/jni/spec7_1.cpp b/tests/device/test-stlport_shared-exception/jni/spec7_1.cpp
new file mode 100644
index 0000000..2ef88a2
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec7_1.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// Test that we allow simple throw specs on pointers.
+
+void f() throw () { }
+void (*pf)() throw () = f;
+
+struct A
+{
+  void g() throw () { }
+  static void (A::*pmf)() throw ();
+};
+
+void (A::* A::pmf)() = &A::g;
+
+int main()
+{
+  pf ();
+  A a;
+  (a.*A::pmf)();
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/spec9.cpp b/tests/device/test-stlport_shared-exception/jni/spec9.cpp
new file mode 100644
index 0000000..9e00d1c
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/spec9.cpp
@@ -0,0 +1,19 @@
+// PR c++/15745
+// { dg-do run }
+
+typedef int IntArray[10];
+IntArray i;
+
+void test_array() throw (IntArray)
+{
+  throw i;
+}
+
+int main ()
+{
+  try
+    {
+      test_array();
+    }
+  catch (IntArray) {}
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/synth2.cpp b/tests/device/test-stlport_shared-exception/jni/synth2.cpp
new file mode 100644
index 0000000..2da814d
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/synth2.cpp
@@ -0,0 +1,24 @@
+// PR c++/24580
+// { dg-do run }
+
+struct vbase {};
+
+struct foo : virtual vbase
+{
+  foo()
+  {
+    throw "exception in foo ctor";
+  }
+};
+
+struct bar :  public foo {};
+
+int main()
+{
+  try
+    {
+      bar a;
+    }
+  catch ( ... ) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/template1.cpp b/tests/device/test-stlport_shared-exception/jni/template1.cpp
new file mode 100644
index 0000000..2cbf9c6
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/template1.cpp
@@ -0,0 +1,38 @@
+// Test whether exception specifier dependent on template parameter
+// is accepted during template decl processing.
+// { dg-do run }
+
+extern "C" void abort();
+
+class A {};
+
+template <class T>
+struct B
+{
+  typedef A E;
+};
+
+template <class T>
+struct C
+{
+  typedef B<T> D;
+  typedef typename D::E E;
+  void f() throw(E) { throw E(); }
+};
+
+int main()
+{
+  int caught = 0;
+  try
+    {
+      C<int> x;
+      x.f();
+    }
+  catch (A)
+    {
+      ++caught;
+    }
+  if (caught != 1)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/terminate1.cpp b/tests/device/test-stlport_shared-exception/jni/terminate1.cpp
new file mode 100644
index 0000000..09dd84f
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/terminate1.cpp
@@ -0,0 +1,28 @@
+// { dg-do run  }
+// Test that an exception thrown out of the constructor for the exception
+// object (i.e. "after completing evaluation of the expression to be thrown
+// but before the exception is caught") causes us to call terminate.
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+struct A
+{
+  A () {}
+  A (const A&) { throw 1; }
+};
+
+int main (void)
+{
+  std::set_terminate (my_terminate);
+
+  A a;
+  try { throw a; }
+  catch (...) {}
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/terminate2.cpp b/tests/device/test-stlport_shared-exception/jni/terminate2.cpp
new file mode 100644
index 0000000..3a31158
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/terminate2.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+// Test that an unhandled exception causes us to call terminate.
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+int main (void)
+{
+  std::set_terminate (my_terminate);
+  throw 1;
+  return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/throw-1.cpp b/tests/device/test-stlport_shared-exception/jni/throw-1.cpp
new file mode 100644
index 0000000..b1d2e27
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/throw-1.cpp
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k,l,m,n;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+	  for (k=0; k < j; k++)
+	  for (l=0; l < k; l++)
+	  for (m=0; m < l; m++)
+	  for (n=0; n < m; n++)
+     		global2 = k;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+	throw 0;
+}
+
+void foo()
+{
+	bar();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  foo();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/throw-2.cpp b/tests/device/test-stlport_shared-exception/jni/throw-2.cpp
new file mode 100644
index 0000000..5f3f1dc
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/throw-2.cpp
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+     		global2 = k;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+	throw 0;
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/throw-3.cpp b/tests/device/test-stlport_shared-exception/jni/throw-3.cpp
new file mode 100644
index 0000000..d3e53b8
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/throw-3.cpp
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+     		global2 = k;
+	throw 0;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/throw-4.cpp b/tests/device/test-stlport_shared-exception/jni/throw-4.cpp
new file mode 100644
index 0000000..a9c15bd
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/throw-4.cpp
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+	    {
+	      global2 = k;
+	      throw 0;
+	    }
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/tmpl1.cpp b/tests/device/test-stlport_shared-exception/jni/tmpl1.cpp
new file mode 100644
index 0000000..985fcae
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/tmpl1.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+template <class T>
+void f() throw (T)
+{
+  throw 7;
+}
+
+
+int main()
+{
+  try {
+    f<int>();
+  } catch (...) {
+    return 0;
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/unexpected1.cpp b/tests/device/test-stlport_shared-exception/jni/unexpected1.cpp
new file mode 100644
index 0000000..e5982ff
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/unexpected1.cpp
@@ -0,0 +1,46 @@
+// PR 3719
+// Test that an unexpected handler can rethrow to categorize.
+// { dg-do run }
+
+#include <exception>
+
+extern "C" void abort ();
+
+struct One { };
+struct Two { };
+
+static void
+handle_unexpected ()
+{
+  try
+  {
+    throw;
+  }
+  catch (One &)
+  {
+    throw Two ();
+  }
+}
+
+static void
+doit () throw (Two)
+{
+  throw One ();
+}
+
+int main ()
+{
+  std::set_unexpected (handle_unexpected);
+
+  try
+  {
+    doit ();
+  }
+  catch (Two &)
+  {
+  }
+  catch (...)
+  {
+    abort ();
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/unroll1.cpp b/tests/device/test-stlport_shared-exception/jni/unroll1.cpp
new file mode 100644
index 0000000..94705d9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/unroll1.cpp
@@ -0,0 +1,420 @@
+// PR optimization/12340
+// Origin: Richard Guenther <richard.guenther@uni-tuebingen.de>
+// Testcase by Eric Botcazou <ebotcazou@libertysurf.fr>
+
+// This used to segfault on x86 because the loop optimizer wrongly
+// interpreted a double assignment to a biv as a double increment,
+// which subsequently fooled the unroller.
+
+// { dg-do run }
+// { dg-options "-O2 -fno-exceptions -funroll-loops" }
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void operator delete (void*, void*) throw() { };
+
+class Loc;
+class Interval;
+
+template<class DT>
+class DomainBase
+{
+public:
+  typedef typename DT::Domain_t Domain_t;
+  typedef typename DT::Storage_t Storage_t;
+
+  Domain_t &unwrap() { return *static_cast<Domain_t *>(this); }
+
+  const Domain_t &unwrap() const {
+    return *static_cast<Domain_t *>(const_cast<DomainBase<DT> *>(this));
+  }
+
+protected:
+  Storage_t domain_m;
+};
+
+template<class DT>
+class Domain : public DomainBase<DT>
+{
+  typedef DomainBase<DT> Base_t;
+
+public:
+  typedef typename DT::Size_t Size_t;
+  typedef typename DT::Element_t Element_t;
+  typedef typename Base_t::Domain_t Domain_t;
+  typedef typename Base_t::Storage_t Storage_t;
+
+  Domain_t &operator[](int) { return this->unwrap(); }
+
+  const Domain_t &operator[](int) const { return this->unwrap(); }
+
+  template<class T>
+  void setDomain(const T &newdom) {
+    DT::setDomain(this->domain_m, newdom);
+  }
+
+  Element_t first() const { return DT::first(this->domain_m); }
+
+  Size_t length() const { return DT::length(this->domain_m); }
+
+  Size_t size() const { return length(); }
+};
+
+template<class T>
+struct DomainTraits;
+
+template<>
+struct DomainTraits<Interval>
+{
+  typedef int Size_t;
+  typedef int Element_t;
+  typedef Interval Domain_t;
+  typedef Interval OneDomain_t;
+  typedef Loc AskDomain_t;
+  typedef int Storage_t[2];
+  enum { dimensions = 1 };
+  enum { wildcard = false };
+
+  static int first(const Storage_t &d) { return d[0]; }
+
+  static int length(const Storage_t &d) { return d[1]; }
+
+  static OneDomain_t &getDomain(Domain_t &d, int) { return d; }
+
+  static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; }
+
+  template<class T>
+  static void setDomain(Storage_t &dom, const T &newdom) {
+    dom[0] = newdom.first();  
+    dom[1] = newdom.length();
+  }
+
+  template<class T1, class T2>
+  static void setDomain(Storage_t &dom, const T1 &begval, const T2 &endval) {
+    dom[0] = begval;
+    dom[1] = (endval - begval + 1);
+  }
+
+};
+
+class Interval : public Domain<DomainTraits<Interval> >
+{
+public:
+  Interval(const Interval &a) : Domain<DomainTraits<Interval> >() {    
+    for (int i=0; i < DomainTraits<Interval>::dimensions; ++i)
+      DomainTraits<Interval>::getDomain(*this, i).setDomain(
+                                DomainTraits<Interval>::getDomain(a, i));
+  }
+
+  Interval(int a) : Domain<DomainTraits<Interval> >()
+  {
+    DomainTraits<Interval>::setDomain(domain_m, 0, a - 1);
+  }
+};
+
+template<>
+struct DomainTraits<Loc>
+{
+  typedef int Size_t;
+  typedef int Element_t;
+  typedef Loc Domain_t;
+  typedef Loc AskDomain_t;
+  typedef Loc MultResult_t;
+  typedef int Storage_t;
+
+  static int first(int d) { return d; }
+
+  template<class T>
+  static void setDomain(int &dom, const T &newdom) {
+    dom = DomainTraits<T>::getFirst(newdom);
+  }
+};
+
+template<>
+struct DomainTraits<int>
+ {
+  enum { dimensions = 1 };
+  enum { wildcard = false };
+
+  static int getPointDomain(int d, int) { return d; }
+
+  static int getFirst(const int &d) { return d; }
+};
+
+class Loc : public Domain<DomainTraits<Loc> >
+{
+public:
+  explicit Loc(const int &a) : Domain<DomainTraits<Loc> >() {
+    for (int i=0; i < 1; ++i)
+      (*this)[i].setDomain(DomainTraits<int>::getPointDomain(a, 0));
+  }
+};
+
+struct ElementProperties
+{
+  enum { hasTrivialDefaultConstructor = false };
+  enum { hasTrivialDestructor = false };
+
+  static void construct(double* addr)
+  {
+    new (addr) double();
+  }
+
+  static void construct(double* addr, const double& model)
+  {
+    new (addr) double(model);
+  }
+
+  static void destruct(double *addr) {}
+};
+
+class RefCounted
+{
+public:
+  RefCounted() : count_m(0) {}
+
+  void addReference() { ++count_m; }
+  bool removeRefAndCheckGarbage()
+  {
+    return (--count_m == 0);
+  }
+
+private:
+  int count_m;
+};
+
+class RefBlockController : public RefCounted
+{
+public:
+  explicit RefBlockController(unsigned int size)
+    : pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0), dealloc_m(false)
+  {
+    reallocateStorage(size, false);
+
+    if (!ElementProperties::hasTrivialDefaultConstructor)
+      {
+        for (double * pt = begin(); pt != end(); ++pt)
+          ElementProperties::construct(pt);
+      }
+  }
+  
+  ~RefBlockController()
+  {
+    deleteStorage();
+  }
+
+  double *begin() const
+  {
+    return pBegin_m;
+  }
+
+  double *end() const
+  {
+    return pEnd_m;
+  }
+
+  bool isMine() const
+  {
+    return dealloc_m;
+  }
+
+private:
+  void deleteStorage()
+  {
+    if (isMine() && pBegin_m != 0)
+      {
+        if (!ElementProperties::hasTrivialDestructor)
+          for (double *pt = begin(); pt != end(); ++pt)
+            ElementProperties::destruct(pt);
+
+        char *tmp = reinterpret_cast<char *>(pBegin_m);
+        delete [] tmp;
+      }
+  }
+
+  void reallocateStorage(unsigned int newsize, bool copyold = false)
+  {
+    double *pBeginNew = 0;
+    double *pEndNew = 0;
+    double *pEndOfStorageNew = 0;
+
+    if (newsize > 0)
+      {
+        int nsize = newsize * sizeof(double);
+        char *tmp = new char[nsize];
+        pBeginNew = reinterpret_cast<double *>(tmp);
+        pEndNew = pBeginNew + newsize;
+        pEndOfStorageNew = pBeginNew + (nsize / sizeof(double));
+
+        if (copyold)
+          {
+            double * pOld = begin();
+            double * pNew = pBeginNew;
+            while (pOld != end() && pNew != pEndNew)
+              ElementProperties::construct(pNew++,*pOld++);
+          }
+      }
+
+    deleteStorage();
+
+    pBegin_m = pBeginNew;
+    pEnd_m = pEndNew;
+    pEndOfStorage_m = pEndOfStorageNew;
+    dealloc_m = true;
+  }
+
+  double *pBegin_m;
+  double *pEnd_m;
+  double *pEndOfStorage_m;
+  bool dealloc_m;
+};
+
+class DataBlockController : public RefBlockController
+{
+public:
+  explicit
+  DataBlockController(unsigned int size)
+    : RefBlockController(size), dataObjectPtr_m(new char), owned_m(true) {}
+
+  ~DataBlockController()
+  {
+    if (owned_m) delete dataObjectPtr_m;
+  }
+
+private:
+  mutable char *dataObjectPtr_m;
+  bool owned_m;
+};
+
+class RefCountedPtr
+{
+public:
+  RefCountedPtr(DataBlockController * const pT) : ptr_m(pT)
+    { if (isValid()) ptr_m->addReference(); }
+
+  ~RefCountedPtr() { invalidate(); }
+
+  DataBlockController* operator->() const { return ptr_m; }
+  void invalidate();
+  bool isValid() const { return ptr_m != 0; }
+
+private:
+  friend class RefCountedBlockPtr;
+  DataBlockController * ptr_m;
+};
+
+inline void RefCountedPtr::invalidate()
+{
+  if ( isValid() && ptr_m->removeRefAndCheckGarbage() )
+    delete ptr_m;
+  ptr_m = 0;
+}
+
+class RefCountedBlockPtr
+{
+public:
+  explicit RefCountedBlockPtr(unsigned int size)
+    : offset_m(0),
+      blockControllerPtr_m(new DataBlockController(size)) {}
+
+  int offset() const
+  {
+    return offset_m;
+  }
+
+  double *beginPointer() const
+  {
+    return blockControllerPtr_m->begin();
+  }
+
+  double *currentPointer() const
+  {
+    return beginPointer() + offset();
+  }
+
+protected:
+  int offset_m;
+  RefCountedPtr blockControllerPtr_m;
+};
+
+class DataBlockPtr : public RefCountedBlockPtr
+{
+public:
+  explicit DataBlockPtr(unsigned int size) : RefCountedBlockPtr(size) {}
+};
+
+class Node
+{
+public:
+  Node(const Interval &owned, const Interval &allocated)
+    : domain_m(owned), allocated_m(allocated) {}
+
+  const Interval &allocated() const { return allocated_m; }
+
+private:
+  Interval domain_m;
+  Interval allocated_m;
+};
+
+class DomainLayout
+{
+public:
+  explicit DomainLayout(const Interval &dom) : node_m(0, dom) {}
+
+  const Interval &domain() const
+  {
+    return node_m.allocated();
+  }
+
+private:
+  Node node_m;
+};
+
+class BrickBase
+{
+public:
+  explicit BrickBase(const Interval &domain);
+
+  int offset(const Loc &dom) const { return off_m + dom[0].first(); }
+
+protected:
+  DomainLayout layout_m;
+  int firsts_m;
+  int off_m;
+};
+
+BrickBase::BrickBase(const Interval &dom)
+  : layout_m(dom)
+{
+  firsts_m = layout_m.domain()[0].first();
+  off_m = -firsts_m;
+}
+
+class Engine : public BrickBase
+{
+public:
+  explicit Engine(const Interval &dom)
+  : BrickBase(dom), dataBlock_m(dom.size()), data_m(dataBlock_m.currentPointer()) {}
+
+  double& operator()(const Loc &loc) const
+  {
+    return data_m[this->offset(loc)];
+  }
+
+private:
+  DataBlockPtr dataBlock_m;
+  double *data_m;
+};
+
+int
+main()
+{
+  Interval I(10);
+  Engine A(I);
+
+  for (int i = 0; i < 10; i++)
+    A(Loc(i)) = 2.0 + i - i*i;
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/unwind1.cpp b/tests/device/test-stlport_shared-exception/jni/unwind1.cpp
new file mode 100644
index 0000000..076b550
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/unwind1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Test that unwinding properly restores SP.
+// Contributed by Jason Merrill <jason@cygnus.com>
+
+void f (int i)
+{
+  throw i;
+}
+
+int main ()
+{  
+  void *sp1 = __builtin_alloca (0);
+
+  try
+    {
+      f (0);
+    }
+  catch (int)
+    {
+    }
+
+  void *sp2 = __builtin_alloca (0);
+
+  return (sp1 != sp2);
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/variadic73.cpp b/tests/device/test-stlport_shared-exception/jni/variadic73.cpp
new file mode 100644
index 0000000..7bff85b
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/variadic73.cpp
@@ -0,0 +1,33 @@
+// { dg-do "run" }
+// { dg-options "-std=gnu++0x" }
+struct A {};
+struct B {};
+struct C {};
+
+template<typename... Exceptions> void f(int idx) throw(Exceptions...) {
+  if (idx == 0) throw A();
+  else if (idx == 1) throw B();
+  else if (idx == 2) throw C();
+}
+
+extern "C" void abort();
+
+int main()
+{
+  try {
+    f<A, B, C>(0);
+    abort();
+  } catch (A) {
+  }
+  try {
+    f<A, B, C>(1);
+    abort();
+  } catch (B) {
+  }
+  try {
+    f<A, B, C>(2);
+    abort();
+  } catch (C) {
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/vbase1_1.cpp b/tests/device/test-stlport_shared-exception/jni/vbase1_1.cpp
new file mode 100644
index 0000000..96766d6
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/vbase1_1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+int j;
+
+struct B
+{
+  B() { i = 1; }
+  ~B() { j = 7; }
+};
+
+struct D : virtual public B {
+  D () { throw 3; }
+};
+
+int main ()
+{
+  try {
+    D d;
+  } catch (int) {
+    if (i != 1 || j != 7)
+      return 1;
+  }
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/vbase2_1.cpp b/tests/device/test-stlport_shared-exception/jni/vbase2_1.cpp
new file mode 100644
index 0000000..eaae9d9
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/vbase2_1.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+
+struct A
+{
+  A () { i++; }
+  ~A () { i--; }
+};
+
+struct B : public virtual A
+{
+  B () { throw 1; }
+};
+
+struct D: public B, virtual public A
+{
+};
+
+void f()
+{
+  D d;
+}
+
+int main ()
+{
+  try {
+    f();
+  } catch (int) {
+  }
+
+  return i;
+}
+
diff --git a/tests/device/test-stlport_shared-exception/jni/vbase2_2.cpp b/tests/device/test-stlport_shared-exception/jni/vbase2_2.cpp
new file mode 100644
index 0000000..812b547
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/vbase2_2.cpp
@@ -0,0 +1,37 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+
+struct A
+{
+  ~A ();
+};
+
+A::~A () {
+  i = 1;
+}
+
+struct B : virtual public A {
+};
+
+struct C {
+  C ();
+
+  B b;
+};
+
+C::C () {
+  throw 3;
+}
+
+int main () 
+{
+  try { 
+    C c;
+  } catch (...) {
+  }
+
+  if (i != 1)
+    return 1;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/vbase4_1.cpp b/tests/device/test-stlport_shared-exception/jni/vbase4_1.cpp
new file mode 100644
index 0000000..f151ed0
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/vbase4_1.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
+
+// Derived from PR#7
+
+// We need to destroy the thrown object when exiting the catch
+// clause. That needs to destroy the original thrown object, not
+// the caught one (which might be a base).
+
+static int ok = 0;
+
+struct A
+{
+  A (){}
+  virtual ~A () {}
+};
+
+struct B : virtual A
+{
+  int value;
+  B ()
+    :value(10)
+    {}
+  ~B()
+  {
+    if (value == 10)
+      ok = 1;
+  }
+};
+
+int main()
+{
+  try {
+    throw B ();
+  } catch (A & e) {
+  }
+  return !ok;
+}
diff --git a/tests/device/test-stlport_shared-exception/jni/vtable2.cpp b/tests/device/test-stlport_shared-exception/jni/vtable2.cpp
new file mode 100644
index 0000000..008cfe5
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/vtable2.cpp
@@ -0,0 +1,213 @@
+// { dg-do run  }
+// { dg-options "-fno-strict-aliasing" }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+
+#include <stddef.h>
+
+struct S0
+{
+  virtual void s0 ();
+};
+
+struct S1 : virtual public S0
+{
+  virtual void s1 ();
+};
+
+struct S2 : virtual public S1
+{
+  virtual void s1 ();
+  virtual void s0 ();
+};
+
+struct S3
+{
+  virtual void s3 ();
+};
+
+struct S4 : public S3, virtual public S2
+{
+  virtual void s1 ();
+};
+
+void S0::s0 ()
+{
+}
+
+void S1::s1 ()
+{
+}
+
+void S2::s1 ()
+{
+}
+
+void S2::s0 ()
+{
+}
+
+void S3::s3 ()
+{
+}
+
+void S4::s1 ()
+{
+}
+
+/* The vtables should look like:
+
+   S0 primary vtable
+   
+     S0 offset to top
+     S0 RTTI
+     S0::s0
+
+   =================
+
+   S1 primary vtable
+
+     S0::s0 vcall offset
+     S0 vbase offset
+     S1 offset to top
+     S1 RTTI
+     S0::s0
+     S1::s1
+
+   =================
+
+   S2 primary vtable
+   
+     S2::s1 vcall offset
+     S1 vbase offset
+     S2::s0 vcall offset
+     S0 vbase offset
+     S2 offset to top
+     S2 RTTI
+     S2::s0
+     S2::s1
+
+   =================
+
+   S3 primary vtable
+
+     S3 offset to top
+     S3 RTTI
+     S3::s3
+
+   =================
+
+   S4 primary vtable
+
+     vbase offset for S0
+     vbase offset for S1
+     vbase offset for S2
+     S4 offset to top
+     S4 RTTI
+     S3::s3
+     S4::s1
+
+   S2-in-S4 secondary vtable
+
+     S1 vbase offset
+     S4::s1 vcall offset
+     S0 vbase offset
+     S2:s0 vcall offset
+     S2 offset to top
+     S4 RTTI
+     S2::s0
+     S4::s1
+
+*/
+
+// These are tricks to allow us to get raw function pointers for
+// member functions.
+extern "C" {
+  /* We can use weakref here without dg-require-weak, because we know
+     the symbols are defined, so we don't actually issue the .weak
+     directives.  */
+  static void S3_s3 () __attribute__((__weakref__ ("_ZN2S32s3Ev")));
+  static void S4_s1 () __attribute__((__weakref__ ("_ZN2S42s1Ev")));
+}
+
+// IA-64 uses function descriptors not function pointers in its vtables.
+#if defined __ia64__
+#define CMP_VPTR(A, B)	(*(void **)(A) == *(void **)(B))
+#ifdef _LP64
+#define INC_VPTR(A)	((A) += 2)
+#define INC_VDATA(A,N)	((A) += (N))
+#else
+#define INC_VPTR(A)	((A) += 4)
+#define INC_VDATA(A,N)	((A) += 2*(N))
+#endif
+#else
+#define CMP_VPTR(A, B)	(*(A) == (ptrdiff_t)(B))
+#define INC_VPTR(A)	((A) += 1)
+#define INC_VDATA(A,N)	((A) += (N))
+#endif
+
+int main ()
+{
+  S4 s4;
+  ptrdiff_t **vptr;
+  ptrdiff_t *vtbl;
+
+  // Set vtbl to point at the beginning of S4's primary vtable.
+  vptr = (ptrdiff_t **) &s4;
+  vtbl = *vptr;
+  INC_VDATA (vtbl, -5);
+
+  if (*vtbl != ((char*) (S0*) &s4) - (char*) &s4)
+    return 1;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != ((char*) (S1*) &s4) - (char*) &s4)
+    return 2;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != ((char*) (S2*) &s4) - (char*) &s4)
+    return 3;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 4;
+  INC_VDATA (vtbl, 1);
+  // Skip the RTTI entry.
+  INC_VDATA (vtbl, 1);
+  if (! CMP_VPTR (vtbl, &S3_s3))
+    return 5;
+  INC_VPTR (vtbl);
+  if (! CMP_VPTR (vtbl, &S4_s1))
+    return 6;
+  INC_VPTR (vtbl);
+  // The S1 vbase offset.
+  if (*vtbl != 0)
+    return 7;
+  INC_VDATA (vtbl, 1);
+  // The S4::s1 vcall offset is negative; once you convert to S2, you
+  // have to convert to S4 to find the final overrider.
+  if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4))
+    return 8;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 9;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 10;
+  INC_VDATA (vtbl, 1);
+  // Now we're at the S2 offset to top entry.
+  if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4))
+    return 11;
+  INC_VDATA (vtbl, 1);
+  // Skip the RTTI entry.
+  INC_VDATA (vtbl, 1);
+  // Skip the reint maining virtual functions -- they are thunks.
+  INC_VPTR (vtbl);
+  INC_VPTR (vtbl);
+}
+
+#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
+
+int main ()
+{
+}
+
+#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
diff --git a/tests/device/test-stlport_shared-exception/jni/weak1.cpp b/tests/device/test-stlport_shared-exception/jni/weak1.cpp
new file mode 100644
index 0000000..f78d195
--- /dev/null
+++ b/tests/device/test-stlport_shared-exception/jni/weak1.cpp
@@ -0,0 +1,23 @@
+// PR target/29487
+// { dg-do run { xfail { hppa*-*-hpux* && { ! hppa*64*-*-* } } } }
+// { dg-require-weak-override "" }
+// { dg-additional-sources "weak1-a.cc" }
+// { dg-options "-O2" }
+
+extern __attribute__((weak)) 
+void f() {
+}
+
+int main () {
+  try {
+    f();
+    return 1;
+  } catch (int i) {
+    /* Although the implementation of f in this file does not throw
+       any exceptions, it is weak, and may therefore be replaced at
+       link time.  Therefore, the compiler must not optimize away this
+       catch clause.  */
+    if (i != 7)
+      return 2;
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/BROKEN_RUN b/tests/device/test-stlport_static-exception/BROKEN_RUN
new file mode 100644
index 0000000..0d9c9e4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/BROKEN_RUN
@@ -0,0 +1 @@
+elide2 new3 terminate1 weak1 badalloc1
\ No newline at end of file
diff --git a/tests/device/test-stlport_static-exception/COPYING b/tests/device/test-stlport_static-exception/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/tests/device/test-stlport_static-exception/jni/Android.mk b/tests/device/test-stlport_static-exception/jni/Android.mk
new file mode 100644
index 0000000..0336b7a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/Android.mk
@@ -0,0 +1,1202 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := variadic73
+LOCAL_SRC_FILES := variadic73.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := alias1
+LOCAL_SRC_FILES := alias1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cond1
+LOCAL_SRC_FILES := cond1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := crossjump1
+LOCAL_SRC_FILES := crossjump1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor1
+LOCAL_SRC_FILES := ctor1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor2
+LOCAL_SRC_FILES := ctor2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delayslot1
+LOCAL_SRC_FILES := delayslot1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dtor1
+LOCAL_SRC_FILES := dtor1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ehopt1
+LOCAL_SRC_FILES := ehopt1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := elide1
+LOCAL_SRC_FILES := elide1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := elide2
+LOCAL_SRC_FILES := elide2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := filter1
+LOCAL_SRC_FILES := filter1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := filter2
+LOCAL_SRC_FILES := filter2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fp-regs
+LOCAL_SRC_FILES := fp-regs.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := gcsec1
+LOCAL_SRC_FILES := gcsec1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ia64-2
+LOCAL_SRC_FILES := ia64-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := loop1
+LOCAL_SRC_FILES := loop1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := loop2
+LOCAL_SRC_FILES := loop2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+#include $(CLEAR_VARS)
+#LOCAL_MODULE := new1
+#LOCAL_SRC_FILES := new1.cpp
+#LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := omit-frame-pointer2
+LOCAL_SRC_FILES := omit-frame-pointer2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr29166
+LOCAL_SRC_FILES := pr29166.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := registers1
+LOCAL_SRC_FILES := registers1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spbp
+LOCAL_SRC_FILES := spbp.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec3
+LOCAL_SRC_FILES := spec3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec5
+LOCAL_SRC_FILES := spec5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec7
+LOCAL_SRC_FILES := spec7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec9
+LOCAL_SRC_FILES := spec9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := synth2
+LOCAL_SRC_FILES := synth2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := template1
+LOCAL_SRC_FILES := template1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unexpected1
+LOCAL_SRC_FILES := unexpected1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := weak1
+LOCAL_SRC_FILES := weak1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_assign
+LOCAL_SRC_FILES := has_nothrow_assign.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_assign_odr
+LOCAL_SRC_FILES := has_nothrow_assign_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_constructor
+LOCAL_SRC_FILES := has_nothrow_constructor.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_constructor_odr
+LOCAL_SRC_FILES := has_nothrow_constructor_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-1
+LOCAL_SRC_FILES := has_nothrow_copy-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-2
+LOCAL_SRC_FILES := has_nothrow_copy-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-3
+LOCAL_SRC_FILES := has_nothrow_copy-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-4
+LOCAL_SRC_FILES := has_nothrow_copy-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-5
+LOCAL_SRC_FILES := has_nothrow_copy-5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-6
+LOCAL_SRC_FILES := has_nothrow_copy-6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy-7
+LOCAL_SRC_FILES := has_nothrow_copy-7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++0x
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := has_nothrow_copy_odr
+LOCAL_SRC_FILES := has_nothrow_copy_odr.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := label3
+LOCAL_SRC_FILES := label3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pretty2
+LOCAL_SRC_FILES := pretty2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := array5
+LOCAL_SRC_FILES := array5.cpp
+LOCAL_CFLAGS := -DPRINT
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ctor1_1
+LOCAL_SRC_FILES := ctor1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete2
+LOCAL_SRC_FILES := delete2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new11
+LOCAL_SRC_FILES := new11.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new16
+LOCAL_SRC_FILES := new16.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new23
+LOCAL_SRC_FILES := new23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new5
+LOCAL_SRC_FILES := new5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := placement2
+LOCAL_SRC_FILES := placement2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ref9
+LOCAL_SRC_FILES := ref9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := alias2
+LOCAL_SRC_FILES := alias2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh2
+LOCAL_SRC_FILES := eh2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3
+LOCAL_SRC_FILES := eh3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr17697-1
+LOCAL_SRC_FILES := pr17697-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr17697-2
+LOCAL_SRC_FILES := pr17697-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr22167
+LOCAL_SRC_FILES := pr22167.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr23299
+LOCAL_SRC_FILES := pr23299.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pr36449
+LOCAL_SRC_FILES := pr36449.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := reg-stack
+LOCAL_SRC_FILES := reg-stack.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unroll1
+LOCAL_SRC_FILES := unroll1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-alloca-1
+LOCAL_SRC_FILES := eh-alloca-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-global-1
+LOCAL_SRC_FILES := eh-global-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-inline-1
+LOCAL_SRC_FILES := eh-inline-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-inline-2
+LOCAL_SRC_FILES := eh-inline-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-vararg-1
+LOCAL_SRC_FILES := eh-vararg-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh-vararg-2
+LOCAL_SRC_FILES := eh-vararg-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-1
+LOCAL_SRC_FILES := throw-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-2
+LOCAL_SRC_FILES := throw-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-3
+LOCAL_SRC_FILES := throw-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := throw-4
+LOCAL_SRC_FILES := throw-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := arraynew
+LOCAL_SRC_FILES := arraynew.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vtable2
+LOCAL_SRC_FILES := vtable2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete1
+LOCAL_SRC_FILES := delete1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh1
+LOCAL_SRC_FILES := eh1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := badalloc1
+LOCAL_SRC_FILES := badalloc1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch11
+LOCAL_SRC_FILES := catch11.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch12
+LOCAL_SRC_FILES := catch12.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch3
+LOCAL_SRC_FILES := catch3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch3p
+LOCAL_SRC_FILES := catch3p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch4
+LOCAL_SRC_FILES := catch4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch4p
+LOCAL_SRC_FILES := catch4p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch5
+LOCAL_SRC_FILES := catch5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch5p
+LOCAL_SRC_FILES := catch5p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch6
+LOCAL_SRC_FILES := catch6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch6p
+LOCAL_SRC_FILES := catch6p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch7
+LOCAL_SRC_FILES := catch7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch7p
+LOCAL_SRC_FILES := catch7p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch8
+LOCAL_SRC_FILES := catch8.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch8p
+LOCAL_SRC_FILES := catch8p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch9
+LOCAL_SRC_FILES := catch9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catch9p
+LOCAL_SRC_FILES := catch9p.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := catchptr1
+LOCAL_SRC_FILES := catchptr1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cleanup1_1
+LOCAL_SRC_FILES := cleanup1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := cleanup2
+LOCAL_SRC_FILES := cleanup2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := flow1
+LOCAL_SRC_FILES := flow1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fntry1
+LOCAL_SRC_FILES := fntry1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := inline2
+LOCAL_SRC_FILES := inline2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_2
+LOCAL_SRC_FILES := new1_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new2_1
+LOCAL_SRC_FILES := new2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pdel1
+LOCAL_SRC_FILES := pdel1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := pdel2
+LOCAL_SRC_FILES := pdel2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ptr1
+LOCAL_SRC_FILES := ptr1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ptrmem1_1
+LOCAL_SRC_FILES := ptrmem1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow1
+LOCAL_SRC_FILES := rethrow1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow2
+LOCAL_SRC_FILES := rethrow2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow3
+LOCAL_SRC_FILES := rethrow3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow4
+LOCAL_SRC_FILES := rethrow4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow5
+LOCAL_SRC_FILES := rethrow5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rethrow6
+LOCAL_SRC_FILES := rethrow6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec1
+LOCAL_SRC_FILES := spec1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec2
+LOCAL_SRC_FILES := spec2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec3_1
+LOCAL_SRC_FILES := spec3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec4
+LOCAL_SRC_FILES := spec4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := spec7_1
+LOCAL_SRC_FILES := spec7_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := terminate1
+LOCAL_SRC_FILES := terminate1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := terminate2
+LOCAL_SRC_FILES := terminate2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := tmpl1
+LOCAL_SRC_FILES := tmpl1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := unwind1
+LOCAL_SRC_FILES := unwind1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase1_1
+LOCAL_SRC_FILES := vbase1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase2_1
+LOCAL_SRC_FILES := vbase2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase4_1
+LOCAL_SRC_FILES := vbase4_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := const
+LOCAL_SRC_FILES := const.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new3
+LOCAL_SRC_FILES := new3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := rvalue1
+LOCAL_SRC_FILES := rvalue1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := operators23
+LOCAL_SRC_FILES := operators23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := operators27
+LOCAL_SRC_FILES := operators27.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_3
+LOCAL_SRC_FILES := new1_3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast1
+LOCAL_SRC_FILES := dyncast1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast2_1
+LOCAL_SRC_FILES := dyncast2_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := dyncast7
+LOCAL_SRC_FILES := dyncast7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh10
+LOCAL_SRC_FILES := eh10.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh12
+LOCAL_SRC_FILES := eh12.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh14
+LOCAL_SRC_FILES := eh14.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh16
+LOCAL_SRC_FILES := eh16.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh17
+LOCAL_SRC_FILES := eh17.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh18
+LOCAL_SRC_FILES := eh18.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh21
+LOCAL_SRC_FILES := eh21.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh23
+LOCAL_SRC_FILES := eh23.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh24
+LOCAL_SRC_FILES := eh24.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh25
+LOCAL_SRC_FILES := eh25.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh26
+LOCAL_SRC_FILES := eh26.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh27
+LOCAL_SRC_FILES := eh27.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh28
+LOCAL_SRC_FILES := eh28.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh29
+LOCAL_SRC_FILES := eh29.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3_1
+LOCAL_SRC_FILES := eh3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh31
+LOCAL_SRC_FILES := eh31.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh33
+LOCAL_SRC_FILES := eh33.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh34
+LOCAL_SRC_FILES := eh34.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh35
+LOCAL_SRC_FILES := eh35.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh36
+LOCAL_SRC_FILES := eh36.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh37
+LOCAL_SRC_FILES := eh37.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh38
+LOCAL_SRC_FILES := eh38.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh39
+LOCAL_SRC_FILES := eh39.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh40
+LOCAL_SRC_FILES := eh40.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh41
+LOCAL_SRC_FILES := eh41.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh42
+LOCAL_SRC_FILES := eh42.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh44
+LOCAL_SRC_FILES := eh44.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh47
+LOCAL_SRC_FILES := eh47.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh48
+LOCAL_SRC_FILES := eh48.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh49
+LOCAL_SRC_FILES := eh49.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh5
+LOCAL_SRC_FILES := eh5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh50
+LOCAL_SRC_FILES := eh50.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh51
+LOCAL_SRC_FILES := eh51.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh53
+LOCAL_SRC_FILES := eh53.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh55
+LOCAL_SRC_FILES := eh55.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh6
+LOCAL_SRC_FILES := eh6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+#include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh7
+LOCAL_SRC_FILES := eh7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh8
+LOCAL_SRC_FILES := eh8.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh9
+LOCAL_SRC_FILES := eh9.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p11667
+LOCAL_SRC_FILES := p11667.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p755
+LOCAL_SRC_FILES := p755.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p755a
+LOCAL_SRC_FILES := p755a.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p7912
+LOCAL_SRC_FILES := p7912.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p8155
+LOCAL_SRC_FILES := p8155.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := p9706
+LOCAL_SRC_FILES := p9706.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete3
+LOCAL_SRC_FILES := delete3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new1_4
+LOCAL_SRC_FILES := new1_4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := array1_2
+LOCAL_SRC_FILES := array1_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := delete3_1
+LOCAL_SRC_FILES := delete3_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh3_2
+LOCAL_SRC_FILES := eh3_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := init7
+LOCAL_SRC_FILES := init7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new6
+LOCAL_SRC_FILES := new6.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := new7
+LOCAL_SRC_FILES := new7.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := singleton
+LOCAL_SRC_FILES := singleton.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := vbase2_2
+LOCAL_SRC_FILES := vbase2_2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := explarg1
+LOCAL_SRC_FILES := explarg1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := fntry1_1
+LOCAL_SRC_FILES := fntry1_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := overload12_1
+LOCAL_SRC_FILES := overload12_1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eb50
+LOCAL_SRC_FILES := eb50.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eb88
+LOCAL_SRC_FILES := eb88.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-1
+LOCAL_SRC_FILES := eh990323-1.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-2
+LOCAL_SRC_FILES := eh990323-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-3
+LOCAL_SRC_FILES := eh990323-3.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-4
+LOCAL_SRC_FILES := eh990323-4.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := eh990323-5
+LOCAL_SRC_FILES := eh990323-5.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
+ 
+include $(CLEAR_VARS)
+LOCAL_MODULE := ice990323-2
+LOCAL_SRC_FILES := ice990323-2.cpp
+LOCAL_CPPFLAGS := -frtti -fexceptions -std=gnu++98
+include $(BUILD_EXECUTABLE)
diff --git a/tests/device/test-stlport_static-exception/jni/Application.mk b/tests/device/test-stlport_static-exception/jni/Application.mk
new file mode 100644
index 0000000..1cf91a0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/Application.mk
@@ -0,0 +1,2 @@
+APP_ABI := all
+APP_STL := stlport_static
\ No newline at end of file
diff --git a/tests/build/issue39824-__BYTE_ORDER/BROKEN_BUILD b/tests/device/test-stlport_static-exception/jni/MODULE_LICENSE_GPL
similarity index 100%
copy from tests/build/issue39824-__BYTE_ORDER/BROKEN_BUILD
copy to tests/device/test-stlport_static-exception/jni/MODULE_LICENSE_GPL
diff --git a/tests/device/test-stlport_static-exception/jni/alias1.cpp b/tests/device/test-stlport_static-exception/jni/alias1.cpp
new file mode 100644
index 0000000..e526082
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/alias1.cpp
@@ -0,0 +1,42 @@
+// { dg-do run }
+// { dg-options "-O3" }
+/* PR c++/28139: disjoint alias sets for the store from
+   expand_start_catch_block than for loading P result in P being loaded
+   before it is initialized for sh-elf.  */
+
+extern "C" {
+void exit (int) __attribute__ ((noreturn));
+}
+
+int i_glob = 42;
+int *p0 = &i_glob;
+typedef int **ipp;
+
+void
+g (int i)
+{
+  if (!i_glob)
+    exit ((__SIZE_TYPE__) & i);
+}
+
+static void
+h ()
+{
+  throw &p0;
+}
+
+int
+main()
+{
+  g (42);
+  try
+    {
+      h ();
+    }
+  catch (const ipp &p)
+    {
+      if (**p != 42)
+        exit (1);
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/alias2.cpp b/tests/device/test-stlport_static-exception/jni/alias2.cpp
new file mode 100644
index 0000000..0b41224
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/alias2.cpp
@@ -0,0 +1,74 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int printf (const char*, ...);
+
+struct _Deque_iterator {
+  int _M_cur;
+  int x[2];
+  int* _M_node;
+
+  _Deque_iterator() : _M_cur(0), _M_node(0) {}
+  _Deque_iterator(const _Deque_iterator& __x)
+    : _M_cur(__x._M_cur),
+      _M_node(__x._M_node) {}
+};
+
+class _Deque_base
+{
+public:
+  int yy;
+
+  _Deque_base()
+    : _M_start()
+    { _M_initialize_map(); }
+  ~_Deque_base();   
+
+  void _M_initialize_map();
+  _Deque_iterator _M_start;
+};
+
+
+_Deque_base::~_Deque_base() {
+  printf ("bb %x %x\n", this, *_M_start._M_node);
+}
+
+void
+_Deque_base::_M_initialize_map()
+{
+  yy = 0x123;
+  printf ("aa %x %x\n", this, yy);
+
+  _M_start._M_node = &yy;
+  _M_start._M_cur = yy;
+}
+
+
+class deque : protected _Deque_base
+{
+public:
+  deque () {}
+  deque(const deque& __x) {}
+  ~deque() {
+    _Deque_iterator i = _M_start;
+  }
+};
+
+
+
+class GeometryAddress {
+public:
+  GeometryAddress(deque addressStack) {}
+};
+
+void yyy (const GeometryAddress& gb)
+{
+}
+
+deque temp1;
+
+int main()
+{
+  yyy (GeometryAddress (temp1));
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/array1_2.cpp b/tests/device/test-stlport_static-exception/jni/array1_2.cpp
new file mode 100644
index 0000000..5aa5b1e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/array1_2.cpp
@@ -0,0 +1,27 @@
+// { dg-do run  }
+int i;
+
+struct S {
+  S (int) {
+    ++i;
+    if (i == 3)
+      throw 3;
+  }
+
+  S () {}
+
+  ~S() {
+    --i;
+  }
+};
+
+int main()
+{
+  try {
+    S s[5] = { 0, 1, 2, 3, 4 };
+  } catch (...) {
+  }
+
+  if (i != 1)
+    return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/array5.cpp b/tests/device/test-stlport_static-exception/jni/array5.cpp
new file mode 100644
index 0000000..aeacb31
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/array5.cpp
@@ -0,0 +1,52 @@
+// { dg-do run }
+// Copyright (C) 2002 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Incorrect construction and destruction of multi-dimensional
+// array of class.
+
+extern "C" void abort();
+extern "C" int printf(const char *, ...);
+
+int count;
+int num;
+
+struct A
+{
+	A()
+	{
+		if (count == num)
+			throw "";
+		count++;
+#ifdef PRINT
+		printf("ctor %p\n", static_cast<void *>(this));
+#endif
+	}
+
+	~A()
+	{
+		count--;
+#ifdef PRINT
+		printf("dtor %p\n", static_cast<void *>(this));
+#endif
+	}
+};
+
+struct Array
+{
+	A array[2][2][2];
+};
+
+int main()
+{
+	for (num = 0; num <= 8; ++num) {
+		count = 0;
+		try {
+			Array A;
+		}
+		catch (...) {
+		}
+		if (count != 0)
+			abort();
+	}
+}
diff --git a/tests/device/test-stlport_static-exception/jni/arraynew.cpp b/tests/device/test-stlport_static-exception/jni/arraynew.cpp
new file mode 100644
index 0000000..ff19c7e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/arraynew.cpp
@@ -0,0 +1,152 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+
+#include <cstdlib>
+#include <new>
+
+void* p;
+
+void* operator new[](size_t s) throw (std::bad_alloc)
+{
+  // Record the base of the last array allocated.
+  p = malloc (s);
+  return p;
+}
+
+template <typename T>
+void check_no_cookie (int i)
+{
+  void* a = new T[7];
+  if (p != a)
+    exit (i);
+}
+
+template <typename T>
+void check_no_placement_cookie (int i)
+{
+  p = malloc (13 * sizeof (T));
+  void* a = new (p) T[13];
+  if (p != a)
+    exit (i);
+}
+
+template <typename T>
+void check_cookie (int i)
+{
+  void* a = new T[11];
+  size_t x;
+  
+  // Compute the cookie location manually.
+#ifdef __ARM_EABI__
+  x = 8;
+#else
+  x = __alignof__ (T);
+  if (x < sizeof (size_t))
+    x = sizeof (size_t);
+#endif
+  if ((char *) a - x != (char *) p)
+    exit (i);
+
+  // Check the cookie value.
+  size_t *sp = ((size_t *) a) - 1;
+  if (*sp != 11)
+    exit (i);
+
+#ifdef __ARM_EABI__
+  sp = ((size_t *) a) - 2;
+  if (*sp != sizeof (T))
+    exit (i);
+#endif
+}
+
+template <typename T>
+void check_placement_cookie (int i)
+{
+  p = malloc (sizeof (T) * 11 + 100);
+  void* a = new (p) T[11];
+  size_t x;
+  
+  // Compute the cookie location manually.
+#ifdef __ARM_EABI__
+  x = 8;
+#else
+  x = __alignof__ (T);
+  if (x < sizeof (size_t))
+    x = sizeof (size_t);
+#endif
+  if ((char *) a - x != (char *) p)
+    exit (i);
+
+  // Check the cookie value.
+  size_t *sp = ((size_t *) a) - 1;
+  if (*sp != 11)
+    exit (i);
+
+#ifdef __ARM_EABI__
+  sp = ((size_t *) a) - 2;
+  if (*sp != sizeof (T))
+    exit (i);
+#endif
+}
+
+struct X {};
+
+template <typename T>
+struct Y { int i; virtual void f () {} };
+
+// A class with a non-trivial destructor -- it needs a cookie.
+struct Z { ~Z () {} };
+// Likewise, but this class needs a bigger cookie so that the array
+// elements are correctly aligned.
+struct Z2 { ~Z2 () {} long double d; };
+  
+struct W1 { void operator delete[] (void *, size_t) {} };
+struct W2 { void operator delete[] (void *) {}
+            void operator delete[] (void *, size_t) {} };
+struct W3 { void operator delete[] (void *, size_t) {}
+            void operator delete[] (void *) {} };
+struct W4 : public W1 {};
+
+struct V { void *operator new[] (size_t s, void *p) 
+             { return p; }
+           ~V () {}
+         };
+   
+int main ()
+{
+  // There should be no cookies for types with trivial destructors.
+  check_no_cookie<int> (1);
+  check_no_cookie<X> (2);
+  check_no_cookie<Y<double> > (3);
+
+  // There should be no cookies for allocations using global placement
+  // new.
+  check_no_placement_cookie<int> (4);
+  check_no_placement_cookie<X> (5);
+  check_no_placement_cookie<Z> (6);
+
+  // There should be a cookie when using a non-trivial destructor.
+  check_cookie<Z> (7);
+  check_cookie<Z2> (8);
+  
+  // There should be a cookie when using the two-argument array delete
+  // operator.
+  check_cookie<W1> (9);
+  check_cookie<W4> (10);
+  // But not when the one-argument version is also available.
+  check_no_cookie<W2> (11);
+  check_no_cookie<W3> (12);
+
+  // There should be a cookie when using a non-global placement new.
+  check_placement_cookie<V> (13);
+}
+
+#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
+
+int main () 
+{
+}
+
+#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
diff --git a/tests/device/test-stlport_static-exception/jni/badalloc1.cpp b/tests/device/test-stlport_static-exception/jni/badalloc1.cpp
new file mode 100644
index 0000000..28eb36c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/badalloc1.cpp
@@ -0,0 +1,133 @@
+// This fails for VxWorks RTPs because the initialization of
+// __cxa_allocate_exception's emergency buffer mutex will
+// itself call malloc(), and will fail if there is no more
+// memory available.
+// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } }
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
+
+// Check we can throw a bad_alloc exception when malloc dies.
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void abort();
+extern "C" void *memcpy(void *, const void *, size_t);
+
+// Assume that STACK_SIZE defined implies a system that does not have a
+// large data space either, and additionally that we're not linking against
+// a shared libstdc++ (which requires quite a bit more initialization space).
+#ifdef STACK_SIZE
+const int arena_size = 256;
+#else
+#if defined(__FreeBSD__) || defined(__sun__) || defined(__hpux__)
+// FreeBSD, Solaris and HP-UX with threads require even more
+// space at initialization time.  FreeBSD 5 now requires over 131072 bytes.
+const int arena_size = 262144;
+#else
+const int arena_size = 32768;
+#endif
+#endif
+
+struct object
+{
+  size_t size __attribute__((aligned));
+};
+
+static char arena[arena_size] __attribute__((aligned));
+static size_t pos;
+
+// So we can force a failure when needed.
+static int fail;
+
+extern "C" void *malloc (size_t size)
+{
+  object *p = reinterpret_cast<object *>(&arena[pos]);
+
+  if (fail)
+    return 0;
+
+  p->size = size;
+  size = (size + __alignof__(object) - 1) & - __alignof__(object);
+  pos += size + sizeof(object);
+
+  // Verify that we didn't run out of memory before getting initialized.
+  if (pos > arena_size)
+    abort ();
+
+  return p + 1;
+}
+
+extern "C" void free (void *)
+{
+}
+
+extern "C" void *realloc (void *p, size_t size)
+{
+  void *r;
+
+  if (p)
+    {
+      object *o = reinterpret_cast<object *>(p) - 1;
+      size_t old_size = o->size;
+
+      if (old_size >= size)
+	{
+	  r = p;
+	  o->size = size;
+	}
+      else
+	{
+	  r = malloc (size);
+	  memcpy (r, p, old_size);
+	  free (p);
+	}
+    }
+  else
+    r = malloc (size);
+
+  return r;
+}
+
+void fn_throw() throw(int)
+{
+  throw 1;
+}
+
+void fn_rethrow() throw(int)
+{
+  try{fn_throw();}
+  catch(int a){
+    throw;}
+}
+
+void fn_catchthrow() throw(int)
+{
+  try{fn_throw();}
+  catch(int a){
+    throw a + 1;}
+}
+
+int main()
+{
+  /* On some systems (including FreeBSD and Solaris 2.10),
+     __cxa_get_globals will try to call "malloc" when threads are in
+     use.  Therefore, we throw one exception up front so that
+     __cxa_get_globals is all set up.  Ideally, this would not be
+     necessary, but it is a well-known idiom, and using this technique
+     means that we can still validate the fact that exceptions can be
+     thrown when malloc fails.  */
+  try{fn_throw();}
+  catch(int a){}
+
+  fail = 1;
+
+  try{fn_throw();}
+  catch(int a){}
+
+  try{fn_rethrow();}
+  catch(int a){}
+
+  try{fn_catchthrow();}
+  catch(int a){}
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch11.cpp b/tests/device/test-stlport_static-exception/jni/catch11.cpp
new file mode 100644
index 0000000..9f32f35
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch11.cpp
@@ -0,0 +1,70 @@
+// { dg-do run  }
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E<<B==A
+// +--C==A
+// +<<D==A
+
+struct A {};
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : virtual A {};
+struct E : private B, public C, private D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) {
+    caught = 1;
+    if (p != e) abort();
+  }
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) {
+    caught = 1;
+    if (p != e) abort();
+  }
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { abort ();}
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch12.cpp b/tests/device/test-stlport_static-exception/jni/catch12.cpp
new file mode 100644
index 0000000..ae3b47c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch12.cpp
@@ -0,0 +1,64 @@
+// { dg-do run  }
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+
+// we should be able to catch a base a virtual, provided it is accessible by at
+// least one public path
+// -- public, << private, == virtual
+// E--B<<==A
+// +--C--==A
+// +--D<<==A
+
+struct A {};
+struct B : private virtual A {};
+struct C : virtual A {};
+struct D : private virtual A {};
+struct E : public B, public C, public D {};
+
+extern "C" void abort ();
+
+void fne (E *e)
+{
+  throw e;
+}
+
+void check(E *e)
+{
+  int caught;
+  
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(D *p) { caught = 1; if (p != e) abort ();}
+  catch(...) { abort (); }
+  if (!caught) abort();
+
+  return;
+}
+
+int main ()
+{
+  E e;
+  
+  check (&e);
+  check ((E *)0);
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch3.cpp b/tests/device/test-stlport_static-exception/jni/catch3.cpp
new file mode 100644
index 0000000..1a00ad1
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch3.cpp
@@ -0,0 +1,123 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a non-virtual public
+// DAG.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C--A
+
+#include <cstdio>
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  //fprintf(stderr, "D: %p\n", d);
+  //fprintf(stderr, "B: %p\n", (B*)d);
+  //fprintf(stderr, "A: %p\n", (A*)(B*)d);
+  //fprintf(stderr, "C: %p\n", (C*)d);
+  //fprintf(stderr, "A: %p\n", (A*)(C*)d);
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch3p.cpp b/tests/device/test-stlport_static-exception/jni/catch3p.cpp
new file mode 100644
index 0000000..c1332b3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch3p.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a non-virtual
+// polymorphic public DAG.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch4.cpp b/tests/device/test-stlport_static-exception/jni/catch4.cpp
new file mode 100644
index 0000000..1da91d0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch4.cpp
@@ -0,0 +1,114 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a virtual public
+// DAG.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch4p.cpp b/tests/device/test-stlport_static-exception/jni/catch4p.cpp
new file mode 100644
index 0000000..6700a52
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch4p.cpp
@@ -0,0 +1,114 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class. Check with a virtual 
+// polymorphic public DAG.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch5.cpp b/tests/device/test-stlport_static-exception/jni/catch5.cpp
new file mode 100644
index 0000000..1fae7f5
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch5.cpp
@@ -0,0 +1,154 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+// +--AA-A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)d); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch5p.cpp b/tests/device/test-stlport_static-exception/jni/catch5p.cpp
new file mode 100644
index 0000000..8ae8d65
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch5p.cpp
@@ -0,0 +1,154 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B==A
+// +--C==A
+// +--AA-A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)d); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(A *p) { caught = 1; if (p != (AA *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(AA *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)d); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch6.cpp b/tests/device/test-stlport_static-exception/jni/catch6.cpp
new file mode 100644
index 0000000..d60d43e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch6.cpp
@@ -0,0 +1,185 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// E==D--B==A
+//    +--C==A
+//    +--AA-A
+
+
+struct A { int m; };
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+struct E : virtual D { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(E *e)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D oject
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)e); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)e); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)e); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  E e;
+  check (&e); // try with an object
+  check ((E *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch6p.cpp b/tests/device/test-stlport_static-exception/jni/catch6p.cpp
new file mode 100644
index 0000000..c73ac2c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch6p.cpp
@@ -0,0 +1,185 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// E==D--B==A
+//    +--C==A
+//    +--AA-A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : virtual A { int m; };
+struct C : virtual A { int m; };
+struct AA : A { int m; };
+struct D : B, C, AA { int m; };
+struct E : virtual D { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fnaa(AA *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(E *e)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D oject
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd((D *)e); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)e); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)e); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((AA *)e); }
+  catch(AA *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(A *p) { caught = 1; if (p != (B *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(B *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)e); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(A *p) { caught = 1; if (p != (C *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(C *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)e); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with AA object
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(A *p) { caught = 1; if (p != (AA *)e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(AA *p) { caught = 1; if (p != e) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnaa((AA *)e); }
+  catch(C *p) { abort(); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  E e;
+  check (&e); // try with an object
+  check ((E *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch7.cpp b/tests/device/test-stlport_static-exception/jni/catch7.cpp
new file mode 100644
index 0000000..d38d2a3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch7.cpp
@@ -0,0 +1,197 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// different levels
+// F--D--B--A
+//    +--C--A
+// +--E--A
+
+#include <stdio.h>
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+struct E : A { int m; };
+struct F : D, E { int m; };
+
+void fna(A *obj) {
+  throw obj;
+}
+void fnb(B *obj) {
+  throw obj;
+}
+void fnc(C *obj) {
+  throw obj;
+}
+void fnd(D *obj) {
+  throw obj;
+}
+void fne(E *obj) {
+  throw obj;
+}
+void fnf(F *obj) {
+  throw obj;
+}
+
+extern "C" void abort();
+
+void check(F *f)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(F *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D object
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with E object
+  caught = 0;
+  try { fne(f); }
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(F *p) { abort(); }
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)f); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)f); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((E *)f); }
+  catch(E *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  F f;
+  check (&f); // try with an object
+  check ((F *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch7p.cpp b/tests/device/test-stlport_static-exception/jni/catch7p.cpp
new file mode 100644
index 0000000..5f15a48
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch7p.cpp
@@ -0,0 +1,184 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// different levels
+// F--D--B--A
+//    +--C--A
+// +--E--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : B, C { int m; };
+struct E : A { int m; };
+struct F : D, E { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+void fne(E *obj) { throw obj; }
+void fnf(F *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(F *f)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(F *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnf(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with D object
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(f); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with E object
+  caught = 0;
+  try { fne(f); }
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(E *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fne(f); }
+  catch(F *p) { abort(); }
+  catch(...) { caught = 1; }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)f); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)f); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((E *)f); }
+  catch(E *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (E *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(A *p) { caught = 1; if (p != (B *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(B *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)f); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(A *p) { caught = 1; if (p != (C *)f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(C *p) { caught = 1; if (p != f) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)f); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  return;
+}
+
+int main ()
+{
+  F f;
+  check (&f); // try with an object
+  check ((F *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch8.cpp b/tests/device/test-stlport_static-exception/jni/catch8.cpp
new file mode 100644
index 0000000..1947c1c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch8.cpp
@@ -0,0 +1,110 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C<<A
+
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : private A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((A *)(C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (A *)(C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { abort();}
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch8p.cpp b/tests/device/test-stlport_static-exception/jni/catch8p.cpp
new file mode 100644
index 0000000..56fafcf
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch8p.cpp
@@ -0,0 +1,111 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D--B--A
+// +--C<<A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : private A { int m; };
+struct D : B, C { int m; };
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((A *)(C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (A *)(C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { abort();}
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch9.cpp b/tests/device/test-stlport_static-exception/jni/catch9.cpp
new file mode 100644
index 0000000..f4938a3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch9.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D==B--A
+// +==C--A
+
+
+struct A { int m; };
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : virtual B, virtual C { int m; };
+
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catch9p.cpp b/tests/device/test-stlport_static-exception/jni/catch9p.cpp
new file mode 100644
index 0000000..9cec7e7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catch9p.cpp
@@ -0,0 +1,117 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
+
+// We cannot catch an ambiguous base class.
+// -- public, << private, == virtual
+
+// D==B--A
+// +==C--A
+
+
+struct A { int m; virtual ~A(){}};
+struct B : A { int m; };
+struct C : A { int m; };
+struct D : virtual B, virtual C { int m; };
+
+
+void fna(A *obj) { throw obj; }
+void fnb(B *obj) { throw obj; }
+void fnc(C *obj) { throw obj; }
+void fnd(D *obj) { throw obj; }
+
+extern "C" void abort();
+
+void check(D *d)
+{
+  int caught;
+  
+  // try with whole object
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(D *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  caught = 0;
+  try { fnd(d); }
+  catch(A *p) { abort(); } // A is ambiguous
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+
+  // try with an A object
+  caught = 0;
+  try { fna((B *)d); }
+  catch(B *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fna((C *)d); }
+  catch(C *p) { abort(); } // throw type is static type
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  // try with B object
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(A *p) { caught = 1; if (p != (B *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(B *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnb((B *)d); }
+  catch(C *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+  
+  // try with C object
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(A *p) { caught = 1; if (p != (C *)d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(C *p) { caught = 1; if (p != d) abort();}
+  catch(...) { abort(); }
+  if (!caught) abort();
+  
+  caught = 0;
+  try { fnc((C *)d); }
+  catch(B *p) { abort(); }
+  catch(D *p) { abort(); }
+  catch(...) { caught =1; }
+  if (!caught) abort();
+
+  return;
+}  
+
+int main ()
+{
+  D d;
+  check (&d); // try with an object
+  check ((D *)0); // try with no object
+  
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/catchptr1.cpp b/tests/device/test-stlport_static-exception/jni/catchptr1.cpp
new file mode 100644
index 0000000..c56652c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/catchptr1.cpp
@@ -0,0 +1,269 @@
+// { dg-do run  }
+// Test pointer chain catching
+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 9 Apr 2000 <nathan@nathan@codesourcery.com>
+
+#include <stdio.h>
+
+void fn () {}
+struct A {void fn () {}};
+static int var = 1;
+static const int const_var = 2;
+
+struct B;
+struct C;
+
+int test0 ()
+{
+  try
+  {
+    throw &fn;
+  }
+  catch (void *)
+  {
+    // should not decay to void *
+    fprintf(stderr, "25\n");
+    return 1;
+  }
+  catch (...)
+  {
+    return 0;
+  }
+  return -1;
+}
+
+int test1 ()
+{
+  try
+  {
+    throw &A::fn;
+  }
+  catch (void *)
+  {
+    // should not decay to void *
+    fprintf(stderr, "44\n");
+    return 1;
+  }
+  catch (...)
+  {
+    return 0;
+  }
+  return -1;
+}
+
+int test2 ()
+{
+  try
+  {
+    throw &var;
+  }
+  catch (void *)
+  {
+    // should decay to void *
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "67\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test3 ()
+{
+  try
+  {
+    throw &var;
+  }
+  catch (void const *)
+  {
+    // should decay to const void *
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "86\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test4 ()
+{
+  try
+  {
+    throw &const_var;
+  }
+  catch (void *)
+  {
+    fprintf(stderr, "100\n");
+    // should not decay to void *
+    return 1;
+  }
+  catch (void const *)
+  {
+    // should decay to const void *
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+int test5 ()
+{
+  try
+  {
+    throw (void ***)0;
+  }
+  catch (void ***)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    fprintf(stderr, "128\n");
+    return 1;
+  }
+  return -1;
+}
+
+int test6 ()
+{
+  try
+  {
+    throw (void const* const* const*)0;
+  }
+  catch (void ***)
+  {
+    fprintf(stderr, "142\n");
+    return 1;
+  }
+  catch (void * const* const*)
+  {
+    return 2;
+  }
+  catch (void const* * const*)
+  {
+    return 3;
+  }
+  catch (void const* const* *)
+  {
+    return 4;
+  }
+  catch (void const* const* const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 1;
+  }
+  return -1;
+}
+
+int test7 ()
+{
+  try
+  {
+    throw (void ***)0;
+  }
+  catch (void const* const**)
+  {
+    return 1;
+  }
+  catch (void const** const *)
+  {
+    return 2;
+  }
+  catch (void * const* const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 3;
+  }
+  return -1;
+}
+
+int test8 ()
+{
+  try
+  {
+    throw (B **)0;
+  }
+  catch (C **)
+  {
+    return 1;
+  }
+  catch (B **)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+int test9 ()
+{
+  try
+  {
+    throw (B **)0;
+  }
+  catch (C const *const *)
+  {
+    return 1;
+  }
+  catch (B const *const *)
+  {
+    return 0;
+  }
+  catch (...)
+  {
+    return 2;
+  }
+  return -1;
+}
+
+static int (*tests[])() =
+{
+  test0,
+  test1,
+  test2,
+  test3,
+  test4,
+
+  test5,
+  test6,
+  test7,
+
+  test8,
+  test9,
+
+  NULL
+};
+
+int main ()
+{
+  int ix;
+  int errors = 0;
+
+  for (ix = 0; tests[ix]; ix++)
+  {
+    int n = tests[ix] ();
+
+    if (n)
+    {
+      printf ("test %d failed %d\n", ix, n);
+      errors++;
+    }
+  }
+  return errors;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/check.h b/tests/device/test-stlport_static-exception/jni/check.h
new file mode 100644
index 0000000..af19885
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/check.h
@@ -0,0 +1,36 @@
+#include <stddef.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#ifdef  __cplusplus
+extern "C" void abort (void);
+#else
+extern void abort (void);
+#endif
+
+int
+check_int (int *i, int align)
+{
+  *i = 20;
+  if ((((ptrdiff_t) i) & (align - 1)) != 0)
+    {
+#ifdef DEBUG
+      printf ("\nUnalign address (%d): %p!\n", align, i);
+#endif
+      abort ();
+    }
+  return *i;
+}
+
+void
+check (void *p, int align)
+{
+  if ((((ptrdiff_t) p) & (align - 1)) != 0)
+    {
+#ifdef DEBUG
+      printf ("\nUnalign address (%d): %p!\n", align, p);
+#endif
+      abort ();
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/cleanup1_1.cpp b/tests/device/test-stlport_static-exception/jni/cleanup1_1.cpp
new file mode 100644
index 0000000..1664643
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/cleanup1_1.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// Bug: obj gets destroyed twice because the fixups for the return are
+// inside its cleanup region.
+
+extern "C" int printf (const char *, ...);
+
+int d;
+
+struct myExc { };
+
+struct myExcRaiser {
+  ~myExcRaiser() { throw myExc(); }
+};
+
+struct stackObj {
+  ~stackObj() { ++d; printf ("stackObj::~stackObj()\n"); }
+};
+
+int test()
+{
+  myExcRaiser rais;
+  stackObj obj;
+  return 0;
+}
+
+int main()
+{
+  try {
+    test();
+  }
+  catch (myExc &) {
+    return d != 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/cleanup2.cpp b/tests/device/test-stlport_static-exception/jni/cleanup2.cpp
new file mode 100644
index 0000000..9538de9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/cleanup2.cpp
@@ -0,0 +1,53 @@
+// { dg-do run  }
+//  Copyright (C) 1999 Free Software Foundation, Inc.
+//  Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
+
+// make sure we don't call base dtors, if we failed to call the
+// base ctor due to exception throwing
+
+#include <stdio.h>
+
+static bool bad = false;
+
+static int thrower ()
+{
+  printf ("in %s\n", __PRETTY_FUNCTION__);
+  throw 0;
+  return 0;
+}
+
+struct X
+{
+  X (int) throw (int);
+  ~X () throw ();
+};
+
+X::X (int) throw (int)
+  {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;}
+X::~X () throw ()
+  {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;}
+
+struct X1 {};
+struct Y : X
+{
+  Y() throw (int);
+  ~Y() throw ();
+};
+Y::Y() throw (int)
+  : X(thrower ())   // throws, so X::X is never called
+  {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
+Y::~Y() throw ()
+  {printf ("in dtor Y%s\n", __PRETTY_FUNCTION__); bad = true;}
+
+int main ()
+{
+  try
+    {
+      Y y;
+    }
+  catch (...)
+    {
+      printf ("caught\n");
+    }
+  return bad;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/cond1.cpp b/tests/device/test-stlport_static-exception/jni/cond1.cpp
new file mode 100644
index 0000000..4f49426
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/cond1.cpp
@@ -0,0 +1,64 @@
+// PR c++/7050
+// { dg-do run }
+
+extern "C" void abort(void);
+
+#define CI(stmt) try { stmt; abort(); } catch (int) { }
+
+struct has_destructor
+{
+    ~has_destructor() { }
+};
+
+struct no_destructor
+{
+};
+
+int PI(int& i) { return i++; }
+
+int main(int argc, char *argv[])
+{
+    (argc+1 ? has_destructor() : throw 0);
+    CI((argc+1 ? throw 0 : has_destructor()));
+    CI((0 ? has_destructor() : throw 0));
+    CI((1 ? throw 0 : has_destructor()));
+    (0 ? throw 0 : has_destructor());
+    (1 ? has_destructor() : throw 0);
+
+    (argc+1 ? no_destructor() : throw 0);
+    CI((argc+1 ? throw 0 : no_destructor()));
+    CI((0 ? no_destructor() : throw 0));
+    CI((1 ? throw 0 : no_destructor()));
+    (0 ? throw 0 : no_destructor());
+    (1 ? no_destructor() : throw 0);
+
+    int i = 1;
+    CI(throw PI(i));
+    if (i != 2) abort();
+
+    (1 ? 0 : throw PI(i));
+    if (i != 2) abort();
+
+    CI(0 ? 0 : throw PI(i));
+    if (i != 3) abort();
+
+    CI(0 ? has_destructor() : throw PI(i));
+    if (i != 4) abort();
+    (argc+1 ? has_destructor() : throw PI(i));
+    if (i != 4) abort();
+
+    i = 1;
+    CI(throw i++);
+    if (i != 2) abort();
+
+    (1 ? 0 : throw i++);
+    if (i != 2) abort();
+
+    CI(0 ? 0 : throw i++);
+    if (i != 3) abort();
+
+    CI(0 ? has_destructor() : throw i++);
+    if (i != 4) abort();
+    (argc+1 ? has_destructor() : throw i++);
+    if (i != 4) abort();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/const.cpp b/tests/device/test-stlport_static-exception/jni/const.cpp
new file mode 100644
index 0000000..7c497ee
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/const.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+// Bug: a ends up in the text segment, so trying to initialize it causes
+// a seg fault.
+
+struct A {
+  int i;
+  A(): i(0) {}
+  A(int j): i(j) {}
+};
+
+const A a;
+const A b(1);
+
+int main ()
+{
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/crossjump1.cpp b/tests/device/test-stlport_static-exception/jni/crossjump1.cpp
new file mode 100644
index 0000000..ccb0ffb
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/crossjump1.cpp
@@ -0,0 +1,31 @@
+// This testcase failed on s390, because cross-jumping merged 2 calls,
+// one with REG_EH_REGION note with no handlers (ie. termination)
+// and one without REG_EH_REGION note.
+// { dg-do run }
+// { dg-options "-O2" }
+
+#include <exception>
+#include <string>
+
+struct E : public std::exception
+{
+  std::string m;
+  E () : m ("test") { }
+  ~E () throw() { }
+};
+
+struct C : public E { };
+
+void foo ()
+{
+  throw C ();
+}
+
+int main ()
+{
+  try
+    {
+      foo ();
+    }
+  catch (...) { }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ctor1.cpp b/tests/device/test-stlport_static-exception/jni/ctor1.cpp
new file mode 100644
index 0000000..43b735f
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ctor1.cpp
@@ -0,0 +1,42 @@
+// { dg-do run }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
+
+// PR 411
+
+bool was_f_in_Bar_destroyed=false;
+
+struct Foo
+{
+  ~Foo()
+  {
+    was_f_in_Bar_destroyed=true;
+  }
+};
+
+struct Bar
+{
+  ~Bar()
+  {
+    throw 1;
+  }
+  
+  Foo f;
+};
+
+int main()
+{
+  try
+    {
+      Bar f; 
+    }
+  catch(int i)
+    {
+      if(was_f_in_Bar_destroyed)
+	{
+	  return 0;
+	}
+    }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ctor1_1.cpp b/tests/device/test-stlport_static-exception/jni/ctor1_1.cpp
new file mode 100644
index 0000000..aeb509b
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ctor1_1.cpp
@@ -0,0 +1,57 @@
+// { dg-do run }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 12 Oct 2002 <nathan@codesourcery.com>
+
+// From WindRiver SPR 80797
+// We were inadvertently SAVE_EXPRing volatile arrays during delete[]
+
+struct A
+{
+  A *ptr;
+  static int ok;
+  
+  A () {ptr = this;}
+  ~A () {ok = ptr == this;}
+};
+int A::ok = -1;
+
+struct B
+{
+  B *ptr;
+  static int ok;
+  
+  B () {ptr = this;}
+  ~B () {ok = ptr == this;}
+};
+int B::ok = -1;
+
+struct C
+{
+  A volatile a;
+  B volatile b[1];
+
+  C ();
+};
+
+C::C ()
+{
+  throw 1;
+}
+
+int main ()
+{
+  try
+    {
+      C c;
+    }
+  catch (...)
+    {
+      if (A::ok != 1)
+	return 1;
+      if (B::ok != 1)
+	return 2;
+      return 0;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ctor2.cpp b/tests/device/test-stlport_static-exception/jni/ctor2.cpp
new file mode 100644
index 0000000..e2ebad7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ctor2.cpp
@@ -0,0 +1,42 @@
+// PR c++/4460
+// Test that the cleanup for fully-constructed subobjects when a
+// constructor throws gets the right address for a virtual base.
+
+// { dg-do run }
+
+int r;
+void *p;
+
+struct VBase
+{
+  virtual void f () {}
+  VBase() { p = this; }
+  ~VBase() { if (p != this) r = 1; }
+};
+
+struct  StreamBase 
+{
+  virtual ~StreamBase() {}
+};
+
+struct  Stream : public virtual VBase, public StreamBase
+{
+  Stream() {}
+  virtual ~Stream() {} 
+};
+
+struct DerivedStream : public Stream
+{
+  DerivedStream() { throw 1; }
+};
+
+int main() {
+
+  try
+    { 
+      DerivedStream str;
+    }
+  catch (...) { }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/delayslot1.cpp b/tests/device/test-stlport_static-exception/jni/delayslot1.cpp
new file mode 100644
index 0000000..ddc960e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/delayslot1.cpp
@@ -0,0 +1,47 @@
+// PR target/12301
+// Origin: Colin Hirsch <gcc@cohi.at>
+// Testcase by Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
+
+// This used to fail on SPARC because the reorg pass moved an insn
+// across a function call that can throw internally, in order to put
+// it in a delay slot.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+struct S{
+  char *c;
+  char data[100];
+  S () : c (data) {};
+  S (const S& s) {
+    c = data;
+    data[0] = s.c[0];
+  }
+};
+
+S real_cast ()
+{
+  throw 3;  
+}
+
+S cast_helper(S& debug)
+{
+  try {
+    return real_cast();
+  }
+  catch (int e) {
+    throw debug;
+  }
+}
+
+int main()
+{
+  S tmp;
+
+  try {
+    cast_helper (tmp);
+  }                                        
+  catch (S& e) {}
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/delete1.cpp b/tests/device/test-stlport_static-exception/jni/delete1.cpp
new file mode 100644
index 0000000..9de2a22
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/delete1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// prms-id: 7330
+#include <stddef.h>
+int size = 0; 
+
+struct X {
+    int x;
+    void *operator new[](size_t sz) throw()  {
+         size = sz;
+         return 0;  
+    }
+    void operator delete[] (void *vp) { ::operator delete(vp); }  
+};
+int main()
+{
+     X (*px) [10];
+
+     px = new X[5][10];
+
+     delete [] px;
+
+     return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/delete2.cpp b/tests/device/test-stlport_static-exception/jni/delete2.cpp
new file mode 100644
index 0000000..8a486be
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/delete2.cpp
@@ -0,0 +1,55 @@
+// PR c++/15097
+// { dg-do run }
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" void * malloc (size_t);
+extern "C" void free (void *);
+extern "C" void abort(void);
+
+void *saved;
+
+void * operator new (size_t size)
+{
+  void *p = malloc (size);
+  saved = p;
+  return p;
+}
+
+void operator delete (void *p)
+{
+  if (p != saved)
+    abort ();
+  free (p);
+}
+
+struct B1
+{
+    virtual ~B1 () throw() {}
+    B1 (){}
+    int x;
+};
+struct B2
+{
+    virtual ~B2 () throw() {}
+    B2 (){}
+    int x;
+};
+struct D : B1, B2
+{
+    D (){}
+    ~D () throw() {}
+    int y;
+};
+void f1 (D*);
+void f2 (B2*);
+void f3 (B1*);
+int main (void)
+{
+    f1 (::new D);
+    f2 (::new D);     
+    f3 (::new D);
+}
+void f1 ( D* p) { ::delete p; }
+void f2 (B2* p) { ::delete p; }  
+void f3 (B1* p) { ::delete p; }
diff --git a/tests/device/test-stlport_static-exception/jni/delete3.cpp b/tests/device/test-stlport_static-exception/jni/delete3.cpp
new file mode 100644
index 0000000..39b6fbe
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/delete3.cpp
@@ -0,0 +1,38 @@
+// { dg-do run  }
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+
+// Test whether dtors of vbases are called on throw within new[].
+// Variant of delete2.C.
+
+extern "C" void abort();
+extern "C" void exit(int);
+
+struct Foo {
+  static bool first;
+
+  Foo() {
+    if (first)
+      first = false;
+    else
+      throw first;
+  }
+
+  ~Foo() {
+    exit(0);
+  }
+};
+
+bool Foo::first = true;
+
+struct Bar : virtual Foo {
+};
+
+int main() {
+  try {
+    delete [] new Bar[2];
+  } catch (...) {
+  }
+  abort();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/delete3_1.cpp b/tests/device/test-stlport_static-exception/jni/delete3_1.cpp
new file mode 100644
index 0000000..7d43485
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/delete3_1.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+#include <new>
+#include <stddef.h>
+
+int i;
+
+extern "C" int printf (const char *, ...);
+
+template <class T, class U> 
+struct map {
+  ~map ();
+};
+
+template <class T, class U>
+map<T, U>::~map ()
+{}
+
+struct SomeClass { };
+
+void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw()
+{
+  return operator new(numBytes, std::nothrow);
+}
+
+void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw()
+{
+  i = 7;
+  return operator delete(pMemory);
+}
+
+int
+main()
+{
+  map< int, int>* pMap = new map< int, int>;
+  
+  delete pMap;
+  
+  if (i == 7)
+    return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/dtor1.cpp b/tests/device/test-stlport_static-exception/jni/dtor1.cpp
new file mode 100644
index 0000000..4fafdde
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/dtor1.cpp
@@ -0,0 +1,35 @@
+// PR c++/411
+
+// Test that a fully-constructed base is destroyed before transferring
+// control to the handler of a function-try-block.
+
+// { dg-do run }
+
+int ad;
+int r;
+
+struct A {
+  ~A() { ++ad; }
+};
+
+struct B: public A {
+  ~B();
+};
+
+B::~B ()
+try
+  {
+    throw 1;
+  }
+catch (...)
+  {
+    if (!ad)
+      r = 1;
+    return;
+  }
+
+int main ()
+{
+  { B b; }
+  return r;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/dyncast1.cpp b/tests/device/test-stlport_static-exception/jni/dyncast1.cpp
new file mode 100644
index 0000000..c53617e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/dyncast1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
+
+#include <typeinfo>
+
+struct B {
+  virtual int f() { }
+};
+
+struct D {
+  virtual int f() { }
+};
+
+int main() {
+  B b;
+  try {
+    (void)dynamic_cast<D&>(b);
+  } catch (std::bad_cast) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/dyncast2_1.cpp b/tests/device/test-stlport_static-exception/jni/dyncast2_1.cpp
new file mode 100644
index 0000000..91432b9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/dyncast2_1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
+
+// Ensure reference handling works.
+
+#include <typeinfo>
+
+struct B {
+  virtual int f() { }
+} ob;
+
+struct D : public B {
+  virtual int f() { }
+} od;
+
+int main() {
+  B *b=&ob;
+  try {
+    void *vp = &dynamic_cast<D&>(*b);
+    return 1;
+  } catch (std::bad_cast) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/dyncast7.cpp b/tests/device/test-stlport_static-exception/jni/dyncast7.cpp
new file mode 100644
index 0000000..33e3fa7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/dyncast7.cpp
@@ -0,0 +1,29 @@
+// { dg-do run  }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+#include <stdexcept>
+
+class A {
+public:
+  virtual void j () {}
+};
+
+class B : public A { };
+     
+void x (A& a) {
+  // These should all work.
+  const B& b2 = dynamic_cast<B&>(a);
+  const B& b3 = dynamic_cast<const B&>((const A&)a);
+  const B& b4 = dynamic_cast<const B&>(a);
+}
+
+int main() {
+  try {
+    B b;
+    x (b);
+  } catch (std::exception& e) {
+    // If we get a bad_cast, it is wrong.
+    return 1;
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eb50.cpp b/tests/device/test-stlport_static-exception/jni/eb50.cpp
new file mode 100644
index 0000000..8d2c403
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eb50.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+struct foo { };
+int f(int a, int b)
+{
+        if (b == 0)
+                throw foo();
+        return a / b;
+}
+int main()
+{
+        try {
+                f(0, 0);
+                return 1;
+        } catch (foo x) {
+                return 0;
+        }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eb88.cpp b/tests/device/test-stlport_static-exception/jni/eb88.cpp
new file mode 100644
index 0000000..cb604bc
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eb88.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+// { dg-options "-w" }
+// Another magic NULL problem.
+
+#include <stddef.h>
+
+int main()
+{
+  try
+    {
+      throw(NULL);
+    }
+  catch (...)
+    {
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-alloca-1.cpp b/tests/device/test-stlport_static-exception/jni/eh-alloca-1.cpp
new file mode 100644
index 0000000..a20f074
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-alloca-1.cpp
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (int size) throw (B,A)
+{
+  char *p = (char*) __builtin_alloca (size + 1);
+  aligned i;
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (5); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-global-1.cpp b/tests/device/test-stlport_static-exception/jni/eh-global-1.cpp
new file mode 100644
index 0000000..2692f94
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-global-1.cpp
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (void) throw (B,A)
+{
+  aligned i;
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-inline-1.cpp b/tests/device/test-stlport_static-exception/jni/eh-inline-1.cpp
new file mode 100644
index 0000000..72ac7fd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-inline-1.cpp
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (void) throw (B,A)
+{
+  aligned i;
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-inline-2.cpp b/tests/device/test-stlport_static-exception/jni/eh-inline-2.cpp
new file mode 100644
index 0000000..4feb3f0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-inline-2.cpp
@@ -0,0 +1,57 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+static void
+inline __attribute__((always_inline))
+foo (int size) throw (B,A)
+{
+  char *p = (char *) __builtin_alloca (size + 1);
+  aligned i;
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+int
+main()
+{
+  try {	foo (5); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-vararg-1.cpp b/tests/device/test-stlport_static-exception/jni/eh-vararg-1.cpp
new file mode 100644
index 0000000..74b48fa
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-vararg-1.cpp
@@ -0,0 +1,72 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+foo (const char *fmt, ...) throw (B,A)
+{
+  va_list arg;
+  char *p;
+  aligned i;
+  int size;
+  double x;
+
+  va_start (arg, fmt);
+  size = va_arg (arg, int);
+  if (size != 5)
+    abort ();
+  p = (char *) __builtin_alloca (size + 1);
+
+  x = va_arg (arg, double);
+  if (x != 5.0)
+    abort ();
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+
+  va_end (arg);
+}
+
+int
+main()
+{
+  try {	foo ("foo", 5, 5.0); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh-vararg-2.cpp b/tests/device/test-stlport_static-exception/jni/eh-vararg-2.cpp
new file mode 100644
index 0000000..719c839
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh-vararg-2.cpp
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT	64
+#endif
+
+typedef int aligned __attribute__((aligned(ALIGNMENT)));
+
+int global;
+
+void
+bar (char *p, int size)
+{
+  __builtin_strncpy (p, "good", size);
+}
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void
+test (va_list arg) throw (B,A)
+{
+  char *p;
+  aligned i;
+  int size;
+  double x;
+
+  size = va_arg (arg, int);
+  if (size != 5)
+    abort ();
+
+  p = (char *) __builtin_alloca (size + 1);
+
+  x = va_arg (arg, double);
+  if (x != 5.0)
+    abort ();
+
+  bar (p, size);
+  if (__builtin_strncmp (p, "good", size) != 0)
+    {
+#ifdef DEBUG
+      p[size] = '\0';
+      printf ("Failed: %s != good\n", p);
+#endif
+      abort ();
+    }
+
+  if (check_int (&i,  __alignof__(i)) != i)
+    abort ();
+
+  throw A();
+}
+
+void
+foo (const char *fmt, ...)
+{
+  va_list arg;
+  va_start (arg, fmt);
+  test (arg);
+  va_end (arg);
+}
+int
+main()
+{
+  try {	foo ("foo", 5, 5.0); }
+  catch (A& a) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh1.cpp b/tests/device/test-stlport_static-exception/jni/eh1.cpp
new file mode 100644
index 0000000..939312a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh1.cpp
@@ -0,0 +1,63 @@
+// { dg-do run  }
+// { dg-options "-O" }
+// PRMS Id: 10776
+
+extern "C" int printf (const char *, ...);
+
+class Foo 
+{
+  public:
+    Foo(int n) : n_(n) { }
+    int f() { return n_; }
+    
+    int badTest();
+    int goodTest();
+    
+  private:
+
+    int n_;
+};
+
+int Foo::badTest()
+{
+    try {
+	throw int(99);
+    }
+
+    catch (int &i) {
+	n_ = 16;
+    }
+
+    return n_;
+        // On the sparc, the return will use a ld [%l0],%i0 instruction.
+        // However %l0 was clobbered at the end of the catch block.  It was
+        // used to do an indirect call.
+}
+
+
+int Foo::goodTest()
+{
+    int	n;
+
+    try {
+	throw int(99);
+    }
+
+    catch (int &i) {
+	n = 16;
+    }
+
+    return n_;
+        // The return will use a ld [%l2],%i0 instruction.  Since %l2
+        // contains the "this" pointer this works.
+}
+
+int main() 
+{
+    Foo foo(5);
+    foo.goodTest();
+    foo.badTest();
+
+    // the badTest will have failed
+    printf ("PASS\n");
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh10.cpp b/tests/device/test-stlport_static-exception/jni/eh10.cpp
new file mode 100644
index 0000000..556b3b2
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh10.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+void foo() {
+  int i;
+  i = 42;
+  throw i;
+}
+
+void ee(int *);
+
+void bar() {
+  int i = 2;
+  ee(&i);
+}
+
+void ee(int *) { }
+
+int main() {
+  try {
+    foo();
+    return 3;
+  } catch (int& i) {
+    bar();
+    return i != 42;
+  }
+  return 2;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh12.cpp b/tests/device/test-stlport_static-exception/jni/eh12.cpp
new file mode 100644
index 0000000..8ec2998
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh12.cpp
@@ -0,0 +1,14 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class MyError { };
+
+int main (int argc, char **argv) {
+  try {
+    throw MyError();
+  }
+  catch (MyError x) {
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh14.cpp b/tests/device/test-stlport_static-exception/jni/eh14.cpp
new file mode 100644
index 0000000..2e788fa
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh14.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class arghh {
+public:
+  int n;
+  arghh (int v) { n = v; }
+};
+
+int main () {
+  try {
+    throw arghh (11);
+  }
+  catch (arghh& a) {
+    if (a.n != 11)
+      return 1;
+  }
+  try {
+    throw arghh (22);
+  }
+  catch (arghh& a) {
+    if (a.n != 22)
+      return 2;
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh16.cpp b/tests/device/test-stlport_static-exception/jni/eh16.cpp
new file mode 100644
index 0000000..ff5aad8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh16.cpp
@@ -0,0 +1,26 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int err = 1;
+
+struct A {
+  ~A() {
+    --err;
+  }
+};
+
+struct B {
+  A a;
+  B() {
+    throw 1;
+  }
+};
+
+int main() {
+  try {
+    B b;
+  } catch (...) {
+    return err;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh17.cpp b/tests/device/test-stlport_static-exception/jni/eh17.cpp
new file mode 100644
index 0000000..18ee228
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh17.cpp
@@ -0,0 +1,25 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int err = 1;
+
+struct A {
+  ~A() {
+    --err;
+  }
+};
+
+struct B : public A {
+  B() {
+    throw 1;
+  }
+};
+
+int main() {
+  try {
+    B b;
+  } catch (...) {
+    return err;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh18.cpp b/tests/device/test-stlport_static-exception/jni/eh18.cpp
new file mode 100644
index 0000000..02e6545
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh18.cpp
@@ -0,0 +1,63 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class VB {
+public:
+  int n;
+  VB (int v) { n = v; }
+  VB (const VB& o) {
+    n = o.n;
+//    printf("copying VB from %d to %d\n", &o, this);
+  }
+};
+
+class D : public virtual VB {
+  int j;
+public:
+  D(int i1, int i2) : VB(i2) { j = i1; }
+  VB& vb() { return *(VB*)this; }
+  const VB& vb() const { return *(const VB*)this; }
+};
+
+class pD : private virtual VB {
+  int j;
+public:
+  pD(int i1, int i2) : VB(i2) { j = i1; }
+  VB& vb() { return *(VB*)this; }
+  const VB& vb() const { return *(const VB*)this; }
+};
+
+
+int main () {
+  D d(1943, 4279);
+  pD pd(3621, 9527);
+  VB *vb = &d.vb();
+  VB *pvb = &pd.vb();
+
+  // A catch of a public virtual base.
+  try {
+//    printf("Throwing D at %d (VB at %d)\n", &d, vb);
+    throw d;
+  }
+  catch (VB& vb) {
+//    printf("Catching VB at %d\n", &vb);
+    if (vb.n != 4279)
+      return 1;
+  }
+  catch (...) {
+    return 1;
+  }
+
+  // A catch of a private virtual base.
+  try {
+//    printf("Throwing D at %d (VB at %d)\n", &pd, pvb);
+    throw pd;
+  }
+  catch (VB& vb) {
+//    printf("Catching VB at %d\n", &vb);
+    // This was a private base of the throw object, don't catch it.
+    return 1;
+  }
+  catch (...) {
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh2.cpp b/tests/device/test-stlport_static-exception/jni/eh2.cpp
new file mode 100644
index 0000000..7cb49f0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh2.cpp
@@ -0,0 +1,34 @@
+// PR 6764
+// { dg-do run }
+// { dg-options "-O -fomit-frame-pointer" }
+
+extern "C" void abort ();
+
+class test
+{
+ public:
+  test * const me;
+  test () : me(this) { }
+  ~test () { if (me != this) abort (); }
+};
+
+void x1 ()
+{
+  test w1;
+  throw 1;
+}
+
+void x2 ()
+{
+  test w2;
+  x1 ();
+}
+
+int main (void)
+{
+  try {
+    x2 ();
+  } catch (...) {
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh21.cpp b/tests/device/test-stlport_static-exception/jni/eh21.cpp
new file mode 100644
index 0000000..ac74fa3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh21.cpp
@@ -0,0 +1,14 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main () {
+  try {
+    try {
+      throw 1;
+    } catch ( char * ) {
+    }
+  } catch ( int ) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh23.cpp b/tests/device/test-stlport_static-exception/jni/eh23.cpp
new file mode 100644
index 0000000..250f2cd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh23.cpp
@@ -0,0 +1,47 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+struct double_fault { };
+int fault_now;
+
+class E {
+public:
+  E() { }
+  E(const E&) {
+    if (fault_now)
+      throw double_fault();
+  }
+};
+
+void foo() {
+  try {
+    throw E();
+  } catch (...) {
+    fault_now = 1;
+    throw;
+  }
+}
+
+void bar() {
+  try {
+    foo();
+  } catch (E e) {	// double fault here
+  }
+}
+
+void my_terminate() {
+  exit (0);		// double faults should call terminate
+}
+
+int main() {
+  std::set_terminate (my_terminate);
+  try {
+    bar();
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh24.cpp b/tests/device/test-stlport_static-exception/jni/eh24.cpp
new file mode 100644
index 0000000..215c435
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh24.cpp
@@ -0,0 +1,33 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 0;
+
+struct A {
+  int ok;
+  A() {
+    ok = 1;
+  }
+  ~A() {
+    if (! ok)
+      fail = 1;
+    ok = 0;
+  }
+};
+
+int main() {
+  try {
+    try {
+      A  a;
+      throw 1.0;
+    } catch (double i) {
+      A a1;
+      throw 1;    // make sure both a1 and a2 are not destroyed when we throw!
+    } catch (int i) {
+      A a2;
+      throw 1.0;
+    }
+  } catch (int i) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh25.cpp b/tests/device/test-stlport_static-exception/jni/eh25.cpp
new file mode 100644
index 0000000..f66fa08
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh25.cpp
@@ -0,0 +1,31 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_terminate() {
+  exit (0);		// Double faults should call terminate
+}
+
+struct A {
+  A() { }
+  ~A() {
+    std::set_terminate (my_terminate);
+    throw 1;		// This throws from EH dtor, should call my_terminate
+  }
+};
+
+int main() {
+  try {
+    try {
+      throw 1;
+    } catch (int i) {
+      A a;		// A hit on this EH dtor went to the wrong place
+      throw 1;
+    }
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh26.cpp b/tests/device/test-stlport_static-exception/jni/eh26.cpp
new file mode 100644
index 0000000..2560325
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh26.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class MyExceptionHandler { };
+
+int main() {
+  try {
+    throw MyExceptionHandler();
+  } catch(const MyExceptionHandler& eh) {
+    return 0;
+  } catch(...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh27.cpp b/tests/device/test-stlport_static-exception/jni/eh27.cpp
new file mode 100644
index 0000000..0d8fee7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh27.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class MyExceptionHandler { };
+
+int main() {
+  try {
+    throw MyExceptionHandler();
+  } catch(const MyExceptionHandler& eh) {
+    return 0;
+  } catch(...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh28.cpp b/tests/device/test-stlport_static-exception/jni/eh28.cpp
new file mode 100644
index 0000000..96e31f7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh28.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+int fail = 1;
+
+class X            { public: virtual void p() { } };
+class Y : public X { public: virtual void p() { fail = 0; } };
+
+int main()
+{
+  try          { Y y; throw y; }
+  catch (X& x) { x.p();  }
+  catch (...)  { }
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh29.cpp b/tests/device/test-stlport_static-exception/jni/eh29.cpp
new file mode 100644
index 0000000..2f3e7d0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh29.cpp
@@ -0,0 +1,27 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int count;
+
+class A {
+public:
+  A() {
+//    printf("ctor %x\n", (int)this);
+    if (count==3)
+      throw 1;
+    ++count;
+    }
+  ~A() {
+    --count;
+//    printf("dtor %x\n", (int)this);
+  }
+};
+
+int main() {
+  try {
+    A a[5];
+  } catch (...) {
+    return count;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh3.cpp b/tests/device/test-stlport_static-exception/jni/eh3.cpp
new file mode 100644
index 0000000..0cd9cac
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh3.cpp
@@ -0,0 +1,33 @@
+// PR target/18841
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
+
+struct S
+{
+  ~S() { r = i1 + i2 + i3 + i4 + i5; }
+};
+
+void foo()
+{
+  S s;
+  throw 1;
+}
+
+void bar()
+{
+  try {
+    foo();
+  } catch (...) {
+  }
+}
+
+int main()
+{
+  bar();
+  if (r != 1 + 2 + 3 + 4 + 5)
+    abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh31.cpp b/tests/device/test-stlport_static-exception/jni/eh31.cpp
new file mode 100644
index 0000000..40ef080
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh31.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int count;
+
+class Foo {
+public:
+  Foo() { ++count; }
+  Foo(const Foo&) { ++count; }
+  ~Foo() { --count; }
+};
+
+
+int main() {
+  try {
+    throw Foo();
+  }
+  catch (Foo& object) {
+    if (count == 1)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh33.cpp b/tests/device/test-stlport_static-exception/jni/eh33.cpp
new file mode 100644
index 0000000..b679991
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh33.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+void foo() throw (int) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo();
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh34.cpp b/tests/device/test-stlport_static-exception/jni/eh34.cpp
new file mode 100644
index 0000000..68fa673
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh34.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_unexpected() {
+  exit (0);
+}
+
+void foo() throw () { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  foo();
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh35.cpp b/tests/device/test-stlport_static-exception/jni/eh35.cpp
new file mode 100644
index 0000000..40c41ed
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh35.cpp
@@ -0,0 +1,17 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() {
+  try {  
+    throw 'a';
+  } catch (char a) {
+    try {
+      throw 'a';
+    } catch (int i) {
+      return 1;
+    } catch (char c) {
+      return 0;
+    }
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh36.cpp b/tests/device/test-stlport_static-exception/jni/eh36.cpp
new file mode 100644
index 0000000..ba497b7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh36.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class A {
+  int space;
+};
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+};
+class D : public A, public B {
+public:
+  D(int i) : B(i) {
+  }
+} d(42);
+
+int main() {
+  try {
+    throw &d;
+  } catch (B* b) {
+    if (b->data == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh37.cpp b/tests/device/test-stlport_static-exception/jni/eh37.cpp
new file mode 100644
index 0000000..ad65692
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh37.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+} b(42);
+
+int main() {
+  try {
+    throw &b;
+  } catch (B* b) {
+    if (b->data == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh38.cpp b/tests/device/test-stlport_static-exception/jni/eh38.cpp
new file mode 100644
index 0000000..bdeada8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh38.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <typeinfo>
+
+class B {
+public:
+  int data;
+  B(int i) : data(i) {
+  }
+} b(42);
+
+int main() {
+  try {
+    throw &b;
+  } catch (const B* bptr) {
+    if (bptr->data == 42)
+    {
+      try {
+        throw &b;
+      } catch (void *bptr) {
+        if (((B*)bptr)->data == 42)
+          return 0;
+      }
+    }
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh39.cpp b/tests/device/test-stlport_static-exception/jni/eh39.cpp
new file mode 100644
index 0000000..5fe2192
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh39.cpp
@@ -0,0 +1,28 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 1;
+class B {
+public:
+  B() { throw 1; }
+};
+class D : public B {
+public:
+  D();
+};
+
+D::D() try : B() {
+  fail = 1;
+} catch (...) {
+  fail = 0;
+  throw;
+}
+
+int main() {
+  try {
+    D d;
+    fail = 1;
+  } catch (...) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh3_1.cpp b/tests/device/test-stlport_static-exception/jni/eh3_1.cpp
new file mode 100644
index 0000000..8c9ddb4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh3_1.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class foo {
+public:
+  class error {};
+
+  void cause_error(void) { throw error(); }
+};
+
+int main(void)
+{
+  foo f;
+  try {
+    f.cause_error();
+  }
+  catch (foo::error&) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh3_2.cpp b/tests/device/test-stlport_static-exception/jni/eh3_2.cpp
new file mode 100644
index 0000000..4e61892
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh3_2.cpp
@@ -0,0 +1,33 @@
+// { dg-do run  }
+// { dg-options "-O" }
+typedef struct { } e;
+
+char *p;
+
+void _Jv_throw ();
+
+int barf (int len)
+{
+  char a[len];
+
+  p = a;
+  _Jv_throw ();
+  return 0;
+}
+
+void _Jv_throw ()
+{
+  e ex;
+  throw ex;
+}  
+
+int main ()
+{
+  try  {
+    barf (2);
+  }
+  catch (...) {
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh40.cpp b/tests/device/test-stlport_static-exception/jni/eh40.cpp
new file mode 100644
index 0000000..62d92b5
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh40.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 1;
+class B {
+public:
+  B() { throw 1; }
+};
+class D : public B {
+public:
+  D() try : B() {
+    fail = 1;
+  } catch (char c) {
+    fail = 1;
+    throw;
+  } catch (...) {
+    fail = 0;
+    throw;
+  }
+};
+
+int main() {
+  try {
+    D d;
+    fail = 1;
+  } catch (...) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh41.cpp b/tests/device/test-stlport_static-exception/jni/eh41.cpp
new file mode 100644
index 0000000..831d75d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh41.cpp
@@ -0,0 +1,29 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int fail = 0;
+
+struct A {
+   A () { a = 'a'; b = 'b'; c = 'c'; }
+   ~ A () {
+      if ( a != 'a' ) fail = 1;
+      if ( b != 'b' ) fail = 1;
+      if ( c != 'c' ) fail = 1;
+   }
+   char a, b, c;
+};
+
+void some_init () { throw 1; }
+
+struct C : A {
+   C () { some_init (); }
+};
+
+int main () {
+  try {
+    C c;
+  } catch (int i) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh42.cpp b/tests/device/test-stlport_static-exception/jni/eh42.cpp
new file mode 100644
index 0000000..ab69c3c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh42.cpp
@@ -0,0 +1,18 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+struct none { int i[50]; };
+
+class my_ex { } a;
+
+none throw_it() {
+  throw 1;
+}
+
+int main() {
+    try {
+      none n = throw_it();
+    } catch (int ex) {
+      return 0;
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh44.cpp b/tests/device/test-stlport_static-exception/jni/eh44.cpp
new file mode 100644
index 0000000..27afd3f
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh44.cpp
@@ -0,0 +1,36 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 9159
+
+static unsigned int iCounter = 0;
+static unsigned int iMax;
+int fail = 0;
+
+class ca {
+public:
+  ca(int) {
+    if (iCounter++ == iMax)
+      throw (const char*)"iCounter";
+  }
+  virtual ~ca() {
+  }
+};
+
+class cc {
+public:
+  cc(const ca &rca1, const ca &rca2) {
+  }
+  virtual ~cc() {
+    fail = 1;
+  }
+};
+
+
+int main(int argc, char **argv) {
+  iMax = 1;
+  try {
+    cc sc(ca(1), ca(1));
+  } catch (const char *pMsg) {
+  }
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh47.cpp b/tests/device/test-stlport_static-exception/jni/eh47.cpp
new file mode 100644
index 0000000..9d70b10
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh47.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <cstdlib>
+#include <exception>
+
+void myterm() {
+  exit (0);
+}
+
+int main() {
+  try {
+    throw "";
+  } catch (...) {
+  }
+  try {
+    std::set_terminate (myterm);
+    throw;
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh48.cpp b/tests/device/test-stlport_static-exception/jni/eh48.cpp
new file mode 100644
index 0000000..d9caf61
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh48.cpp
@@ -0,0 +1,34 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+using std::uncaught_exception;
+class A {
+public:
+  ~A() {
+    if (uncaught_exception ())
+      exit (0);
+  }
+};
+
+int main() {
+  if (uncaught_exception ())
+    return 1;
+  try {
+    throw "";
+  } catch (...) {
+    if (uncaught_exception ())
+      return 1;
+  }
+  if (uncaught_exception ())
+    return 1;
+  try {
+    A a;
+    throw "";
+  } catch (...) {
+    return 1;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh49.cpp b/tests/device/test-stlport_static-exception/jni/eh49.cpp
new file mode 100644
index 0000000..19084fb
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh49.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -O9" }
+
+void main1() {
+  throw 1;
+}
+
+int main() {
+  try {
+    int main1();
+  } catch (...) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh5.cpp b/tests/device/test-stlport_static-exception/jni/eh5.cpp
new file mode 100644
index 0000000..4ece588
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh5.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+class foo {
+public:
+  class error {};
+
+  void cause_error(void) { throw "Hello World!"; }
+};
+
+int main(void)
+{
+  foo f;
+  try {
+    f.cause_error();
+  }
+  catch (const char cp[]) {
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh50.cpp b/tests/device/test-stlport_static-exception/jni/eh50.cpp
new file mode 100644
index 0000000..530fc49
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh50.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+template <class T> void foo(T) throw (int) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo(1);
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh51.cpp b/tests/device/test-stlport_static-exception/jni/eh51.cpp
new file mode 100644
index 0000000..b3ef514
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh51.cpp
@@ -0,0 +1,21 @@
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+
+void my_unexpected() {
+  throw 42;
+}
+
+template <class T> void foo(T) throw (T) { throw "Hi"; }
+
+int main() {
+  std::set_unexpected (my_unexpected);
+  try {
+    foo(1);
+  } catch (int i) {
+    if (i == 42)
+      return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh53.cpp b/tests/device/test-stlport_static-exception/jni/eh53.cpp
new file mode 100644
index 0000000..5f2ff57
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh53.cpp
@@ -0,0 +1,15 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -g" }
+
+class zeroset {
+public:
+  ~zeroset () { }
+};
+
+int main () {
+  zeroset a;
+  try {
+    ;
+  } catch( zeroset ) {
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh55.cpp b/tests/device/test-stlport_static-exception/jni/eh55.cpp
new file mode 100644
index 0000000..1482680
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh55.cpp
@@ -0,0 +1,19 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+#include <exception>
+#include <stdlib.h>
+
+void my_terminate_handler() {
+  exit(0);
+}
+
+void throw_an_unexpected_exception() throw() {
+  throw 1;
+}
+
+int main() {
+  std::set_terminate(my_terminate_handler);
+  throw_an_unexpected_exception();
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh6.cpp b/tests/device/test-stlport_static-exception/jni/eh6.cpp
new file mode 100644
index 0000000..c7e0d91
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh6.cpp
@@ -0,0 +1,19 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+extern "C" int printf(const char *, ...);
+
+void main1() {
+  throw 1;
+}
+
+
+int main() {
+  try {
+    int main1();
+  } catch (...) {
+    printf("Unwind works!\n");
+    return 0;
+  }
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh7.cpp b/tests/device/test-stlport_static-exception/jni/eh7.cpp
new file mode 100644
index 0000000..6b72048
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh7.cpp
@@ -0,0 +1,7 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() {
+  if (0)
+    throw 1 | 2;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh8.cpp b/tests/device/test-stlport_static-exception/jni/eh8.cpp
new file mode 100644
index 0000000..26f3419
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh8.cpp
@@ -0,0 +1,20 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+extern "C" int printf(const char *, ...);
+
+int i;
+
+int main() {
+  try {
+    try {
+      throw i;
+    } catch (char *) {
+      return 1;
+    }
+    return 1;
+  } catch (int i) {
+    return 0;
+  }    
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh9.cpp b/tests/device/test-stlport_static-exception/jni/eh9.cpp
new file mode 100644
index 0000000..cf521b8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh9.cpp
@@ -0,0 +1,4 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+
+int main() throw () { }
diff --git a/tests/device/test-stlport_static-exception/jni/eh990323-1.cpp b/tests/device/test-stlport_static-exception/jni/eh990323-1.cpp
new file mode 100644
index 0000000..221a6d7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh990323-1.cpp
@@ -0,0 +1,77 @@
+// { dg-do run  }
+// check cleanup of template temporaries
+extern "C" void abort ();
+extern "C" void exit (int);
+
+int ctor = 0;
+int dtor = 0;
+
+template <class T> struct A {
+	A() {ctor++;}
+	A(int) {ctor++;}
+	A(const A&) {ctor++;}
+	~A() {dtor++;}
+	operator int() {return 0;}
+};
+
+template <class T> void ff(T);
+
+template <class T> void ff(T)
+{
+}
+
+void g(int)
+{
+}
+
+void f()
+{
+	int x;
+
+	A<int> a1;
+	A<double> a2(37);
+	A<long> a3 = A<long>(47);
+	A<short> a4 = 97;
+
+	g(A<char*>());
+
+	A<char**>();
+
+	x ? A<char*>() : A<char*>();
+
+	x = 47, A<double*>(), A<int>(39), A<void>(23), -17;
+
+	while (A<short>())
+		;
+	for (;A<unsigned>(3);)
+		;
+	if (A<A<double> >())
+		;
+
+	ff(A<double>());
+
+	throw 59;
+}
+
+int 
+main()
+{
+	int flag = 0;
+
+	try {
+		A<unsigned long>();
+		f();
+	}
+	catch (int) {
+		A<float>(34);
+		flag = 1;
+	}
+
+	if (!flag)
+		abort();
+
+	if (!ctor || ctor != dtor)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh990323-2.cpp b/tests/device/test-stlport_static-exception/jni/eh990323-2.cpp
new file mode 100644
index 0000000..24666dd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh990323-2.cpp
@@ -0,0 +1,103 @@
+// { dg-do run  }
+// check MI and VBC offsets on throw
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {
+    int x[23];
+};
+
+struct B : virtual public A {
+    int y[33];
+};
+
+struct C : virtual public A, public B {
+    int z[43];
+};
+
+struct D {
+    int xx[53];
+};
+
+struct E : public D, public A {
+    int yy[63];
+};
+
+C c;
+
+E e;
+
+void f1()
+{
+    throw (C*)0;
+}
+
+void f2()
+{
+    throw &c;
+}
+
+void f3()
+{
+    throw (E*)0;
+}
+
+void f4()
+{
+    throw &e;
+}
+
+int main()
+{
+    int flag;
+
+    flag = 0;
+    try {
+        f1();
+    }
+    catch (A* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f2();
+    }
+    catch (A* p) {
+        if (!p || (void*)p == (void*)&c)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f3();
+    }
+    catch (A* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f4();
+    }
+    catch (A* p) {
+        if (!p || (void*)p == (void*)&e)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    exit(0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh990323-3.cpp b/tests/device/test-stlport_static-exception/jni/eh990323-3.cpp
new file mode 100644
index 0000000..e8369ca
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh990323-3.cpp
@@ -0,0 +1,30 @@
+// { dg-do run  }
+// try throwing 0 cast to a class object
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {};
+
+void f()
+{
+	throw (A*)0;
+}
+
+int
+main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f();
+	}
+	catch (A*) {
+		flag = 1;
+	}
+
+	if (!flag)
+		abort();
+
+	exit (0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh990323-4.cpp b/tests/device/test-stlport_static-exception/jni/eh990323-4.cpp
new file mode 100644
index 0000000..7f95ed3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh990323-4.cpp
@@ -0,0 +1,104 @@
+// { dg-do run  }
+// check MI and VBC offsets on throw
+extern "C" void abort ();
+extern "C" void exit (int);
+
+struct A {
+    int x[23];
+};
+
+struct B : virtual public A {
+    int y[33];
+};
+
+struct C : virtual public A, public B {
+    int z[43];
+};
+
+struct D {
+    int xx[53];
+};
+
+struct E : public D, public A {
+    int yy[63];
+};
+
+C c;
+
+E e;
+
+void f1()
+{
+    throw (C*)0;
+}
+
+void f2()
+{
+    throw &c;
+}
+
+void f3()
+{
+    throw (E*)0;
+}
+
+void f4()
+{
+    throw &e;
+}
+
+int
+main()
+{
+    int flag;
+
+    flag = 0;
+    try {
+        f1();
+    }
+    catch (void* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f2();
+    }
+    catch (void* p) {
+        if (!p || (void*)p != (void*)&c)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f3();
+    }
+    catch (void* p) {
+        if (p)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    flag = 0;
+    try {
+        f4();
+    }
+    catch (void* p) {
+        if (!p || (void*)p != (void*)&e)
+            abort();
+        flag = 1;
+    }
+    if (!flag)
+        abort();
+
+    exit(0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/eh990323-5.cpp b/tests/device/test-stlport_static-exception/jni/eh990323-5.cpp
new file mode 100644
index 0000000..7913c09
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/eh990323-5.cpp
@@ -0,0 +1,68 @@
+// { dg-do run  }
+// check cleanup of partial array objects
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+int ctor = 0;
+int dtor = 0;
+
+int cnt = 1;
+
+struct A {
+	int x;
+	A();
+	A(const A&);
+	~A();
+};
+
+A::A()
+{
+	if (cnt == 10)
+		throw 57;
+	x = cnt++;
+	ctor++;
+}
+
+A::A(const A&)
+{
+	if (cnt == 10)
+		throw 57;
+	x = cnt++;
+	ctor++;
+}
+
+A::~A()
+{
+	if (x + 1 != cnt--)
+		abort();
+	dtor++;
+}
+
+void f()
+{
+	A a[] = {A(), A(), A(), A(), A(), A(), A(), A(), A(), A(), A(), A()};
+
+	throw -1066;
+}
+
+int
+main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f();
+	}
+	catch (int) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+	if (ctor != 9)
+		abort();
+	if (dtor != 9)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ehopt1.cpp b/tests/device/test-stlport_static-exception/jni/ehopt1.cpp
new file mode 100644
index 0000000..163d76e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ehopt1.cpp
@@ -0,0 +1,44 @@
+// ehopt was only copying one statement from the cleanup of the B temporary
+// into the following try block, so we lost its destructor call.
+
+// { dg-do run }
+
+template <class T, class U>
+class A;
+
+bool b;
+int count;
+
+template <>
+class A<int, int>
+{
+public:
+  A(int) { ++count; if (b) throw 1; }
+  A(const A&) { ++count; if (b) throw 1; }
+  ~A() { --count; if (b) throw 1; }
+};
+
+typedef A<int, int> B;
+
+template <>
+class A<void *, void *>
+{
+public:
+  A() { if (b) throw 1; }
+  A(const B&) { if (b) throw 1; }
+  ~A() { if (b) throw 1; }
+};
+
+typedef A<void *, void *> C;
+
+void f() { if (b) throw 1; }
+
+int
+main (void)
+{
+  {
+    C a(1);
+    f();
+  }
+  return count;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/elide1.cpp b/tests/device/test-stlport_static-exception/jni/elide1.cpp
new file mode 100644
index 0000000..94d2a69
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/elide1.cpp
@@ -0,0 +1,30 @@
+// PR c++/13944
+
+// Bug: When eliding the copy from the A temporary into the exception
+// object, we extended the throw prohibition to the constructor for the
+// temporary.  This is wrong; the throw from A() should propagate normally
+// regardless of the elision of the temporary.
+
+// { dg-do run }
+
+struct A
+{
+  A() { throw 0; }
+};
+
+int main()
+{
+  try
+    {
+      throw A();
+    }
+  catch(int i)
+    {
+      return i;
+    }
+  catch (...)
+    {
+      return 2;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/elide2.cpp b/tests/device/test-stlport_static-exception/jni/elide2.cpp
new file mode 100644
index 0000000..618ee6f
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/elide2.cpp
@@ -0,0 +1,34 @@
+// PR c++/13944
+
+// Verify that we still call terminate() if we do run the copy constructor,
+// and it throws.
+
+// { dg-do run }
+
+#include <cstdlib>
+#include <exception>
+
+struct A
+{
+  A() { }
+  A(const A&) { throw 1; }
+};
+
+A a;
+
+void
+good_terminate() { std::exit (0); }
+
+int main()
+{
+  std::set_terminate (good_terminate);
+  try
+    {
+      throw a;
+    }
+  catch (...)
+    {
+      return 2;
+    }
+  return 3;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/explarg1.cpp b/tests/device/test-stlport_static-exception/jni/explarg1.cpp
new file mode 100644
index 0000000..b78b483
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/explarg1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run  }
+// Bug: g++ generates an error trying to generate the first foo<int>, when
+// it should silently fail and go on to the next one.
+
+template<class T, typename U> class A { };
+
+template<class T> void
+foo(const A<T,typename T::N>&);
+
+template<typename T>
+class B { };
+
+template<typename T> void
+foo(B<T> const &) { }
+
+int
+main(void)
+{
+  B<int> sa;
+
+  foo<int> (sa);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/filter1.cpp b/tests/device/test-stlport_static-exception/jni/filter1.cpp
new file mode 100644
index 0000000..6ff0574
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/filter1.cpp
@@ -0,0 +1,43 @@
+// Test that cleanups get run when a catch filter fails to match.
+// { dg-do run }
+
+extern "C" void exit(int);
+extern "C" void abort();
+
+struct a
+{
+  a();
+  ~a();
+};
+
+struct e1 {};
+struct e2 {};
+
+void
+ex_test ()
+{
+  a aa;
+  try
+    {
+      throw e1 ();
+    }
+  catch (e2 &)
+    {
+    }
+}
+
+int
+main ()
+{
+  try
+    {
+      ex_test ();
+    }
+  catch (...)
+    {
+    }
+  abort ();
+}
+
+a::a() { }
+a::~a() { exit (0); }
diff --git a/tests/device/test-stlport_static-exception/jni/filter2.cpp b/tests/device/test-stlport_static-exception/jni/filter2.cpp
new file mode 100644
index 0000000..fe87cc9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/filter2.cpp
@@ -0,0 +1,59 @@
+// Test that terminate gets run when a catch filter fails to match while
+// running destructors.  Original bug depended on a::~a being inlined.
+// { dg-do run }
+// { dg-options -O }
+
+#include <exception>
+#include <cstdlib>
+
+struct e1 {};
+struct e2 {};
+
+struct a
+{
+  a () { }
+
+  ~a ()
+    {
+      try
+	{
+	  throw e1();
+	}
+      catch (e2 &)
+	{
+        }
+    }
+};
+
+void
+ex_test ()
+{
+  a aa;
+  try
+    {
+      throw e1 ();
+    }
+  catch (e2 &)
+    {
+    }
+}
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+int
+main ()
+{
+  std::set_terminate (my_terminate);
+
+  try
+    {
+      ex_test ();
+    }
+  catch (...)
+    {
+    }
+  abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/flow1.cpp b/tests/device/test-stlport_static-exception/jni/flow1.cpp
new file mode 100644
index 0000000..d48a896
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/flow1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+#include <stdio.h>
+
+int bar ()
+{
+  throw 100;
+  return 0;
+}
+
+int main ()
+{
+  int i = 0;			// this gets deleted after flow analysis
+  try
+    {
+      i = bar ();
+    }
+  catch (...)
+    {
+    }
+
+  printf ("i = %d\n", i);
+  return i;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/fntry1.cpp b/tests/device/test-stlport_static-exception/jni/fntry1.cpp
new file mode 100644
index 0000000..9b14f01
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/fntry1.cpp
@@ -0,0 +1,32 @@
+// { dg-do run  }
+// Bug: g++ fails to treat function-try-blocks in ctors specially.
+// Submitted by Jason Merrill <jason@cygnus.com>
+
+int c;
+int r;
+
+struct A {
+  int i;
+  A(int j) { i = j; }
+  ~A() { c += i; }
+};
+
+struct B: public A {
+  A a;
+  B() try : A(1), a(2)
+    { throw 1; }
+  catch (...)
+    { if (c != 3) r |= 1; }
+};
+
+int main ()
+{
+  try
+    { B b; }
+  catch (...)
+    { c = 0; }
+
+  if (c != 0) r |= 2;
+
+  return r;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/fntry1_1.cpp b/tests/device/test-stlport_static-exception/jni/fntry1_1.cpp
new file mode 100644
index 0000000..9a5d993
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/fntry1_1.cpp
@@ -0,0 +1,10 @@
+// { dg-do run  }
+// Bug: g++ silently ignores function-try-blocks in templates.
+// Submitted by Jason Merrill <jason@cygnus.com>
+
+template <class T> void f (T) try { throw 1; } catch (...) { }
+
+int main ()
+{
+  f (1);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/fp-regs.cpp b/tests/device/test-stlport_static-exception/jni/fp-regs.cpp
new file mode 100644
index 0000000..b91c0f9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/fp-regs.cpp
@@ -0,0 +1,94 @@
+// PR 20670: f29 corrupted when unwind stack.  This tries to test that FP
+// registers are properly saved and restored by defining 20 different FP
+// local variables.
+// { dg-do run }
+// { dg-options "-O" }
+#include <stdlib.h>
+ 
+double zero = 0.0;
+double another_zero = 0.0;
+ 
+int
+sub (void)
+{
+  throw (0);
+}
+ 
+int
+main (void)
+{
+  double a, b, c, d, e, f, g, h, i, j;
+  double a1, b1, c1, d1, e1, f1, g1, h1, i1, j1;
+ 
+  a = zero;
+  b = a + 1;
+  c = b + 1;
+  d = c + 1;
+  e = d + 1;
+  f = e + 1;
+  g = f + 1;
+  h = g + 1;
+  i = h + 1;
+  j = i + 1;
+   
+  a1 = another_zero;
+  b1 = a1 + 1;
+  c1 = b1 + 1;
+  d1 = c1 + 1;
+  e1 = d1 + 1;
+  f1 = e1 + 1;
+  g1 = f1 + 1;
+  h1 = g1 + 1;
+  i1 = h1 + 1;
+  j1 = i1 + 1;
+   
+  try
+    {
+      sub ();
+    }
+  catch (...)
+    {
+      if (a != 0.0)
+        abort ();
+      if (b != 1.0)
+        abort ();
+      if (c != 2.0)
+        abort ();
+      if (d != 3.0)
+        abort ();
+      if (e != 4.0)
+        abort ();
+      if (f != 5.0)
+        abort ();
+      if (g != 6.0)
+        abort ();
+      if (h != 7.0)
+        abort ();
+      if (i != 8.0)
+        abort ();
+      if (j != 9.0)
+        abort ();
+ 
+      if (a1 != 0.0)
+        abort ();
+      if (b1 != 1.0)
+        abort ();
+      if (c1 != 2.0)
+        abort ();
+      if (d1 != 3.0)
+        abort ();
+      if (e1 != 4.0)
+        abort ();
+      if (f1 != 5.0)
+        abort ();
+      if (g1 != 6.0)
+        abort ();
+      if (h1 != 7.0)
+        abort ();
+      if (i1 != 8.0)
+        abort ();
+      if (j1 != 9.0)
+        abort ();
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/gcsec1.cpp b/tests/device/test-stlport_static-exception/jni/gcsec1.cpp
new file mode 100644
index 0000000..5dfe02a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/gcsec1.cpp
@@ -0,0 +1,45 @@
+/* PR other/29639 */
+/* AIX gld supports garbage collection. But AIX gcc does not support 
+   -ffunction-sections or -fdata-sections.  */
+/* { dg-do run { xfail rs6000-*-aix* powerpc*-*-aix* } } */
+/* { dg-require-gc-sections "" } */
+/* { dg-options "-ffunction-sections -Wl,--gc-sections" } */
+
+extern "C" void abort (void);
+
+int g = 0;
+
+void raise_exception()
+{
+  throw 1;
+}
+
+void used()
+{
+  try {
+    raise_exception ();
+  }
+  catch (int) {
+    g = 1;
+  }
+}
+
+void unused()
+{
+  try {
+    raise_exception ();
+  }
+  catch (int) {
+    g = 1;
+  }
+}
+
+int main()
+{
+  used ();
+
+  if (g != 1)
+    abort ();
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_assign.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign.cpp
new file mode 100644
index 0000000..73a904e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign.cpp
@@ -0,0 +1,152 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C
+: public A { };
+
+struct D
+{
+  D& operator=(const D&) throw() { return *this; }
+};
+
+struct E
+{
+  E& operator=(const E&) throw(int) { return *this; }
+};
+
+struct E1
+{
+  E1& operator=(const E1&) throw(int) { throw int(); return *this; }
+};
+
+struct F
+{
+  F() throw(int) { }
+};
+
+struct G
+{
+  G() throw(int) { throw int(); }
+};
+
+struct H
+{
+  H& operator=(H&) throw(int) { return *this; }
+};
+
+struct H1
+{
+  H1& operator=(H1&) throw(int) { throw int(); return *this; }
+};
+
+struct I
+{
+  I& operator=(I&) throw(int) { return *this; }
+  I& operator=(const I&) throw() { return *this; }
+};
+
+struct I1
+{
+  I1& operator=(I1&) throw(int) { throw int(); return *this; }
+  I1& operator=(const I1&) throw() { return *this; }
+};
+
+struct J
+{
+  J& operator=(J&) throw() { return *this; }
+  J& operator=(const J&) throw() { return *this; }
+  J& operator=(volatile J&) throw() { return *this; }
+  J& operator=(const volatile J&) throw() { return *this; }
+};
+
+struct K
+{
+  K& operator=(K&) throw() { return *this; }
+};
+
+struct L
+{
+  L& operator=(const L&) throw() { return *this; }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_assign(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_assign(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_assign(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+template<typename T, bool b = __has_nothrow_assign(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_assign(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_assign(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (NTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (PTEST (F));
+  assert (PTEST (G));
+  assert (NTEST (H));
+  assert (NTEST (H1));
+  assert (NTEST (I));
+  assert (NTEST (I1));
+  assert (PTEST (J));
+  assert (NTEST (const K));
+  assert (NTEST (const L));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_assign_odr.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign_odr.cpp
new file mode 100644
index 0000000..c38d76d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_assign_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { const S& operator= (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_assign (S) == f ());
+}
+
+const S& S::operator= (const S&) { }
+
+bool f () { return __has_nothrow_assign (S); }
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor.cpp
new file mode 100644
index 0000000..60e9be8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor.cpp
@@ -0,0 +1,106 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C 
+: public A { };
+
+struct D
+{
+  D() throw() { }
+};
+
+struct E
+{
+  E() throw(int) { }
+};
+
+struct E1
+{
+  E1() throw(int) { throw int(); }
+};
+
+struct F
+{
+  F(const F&) throw() { }
+};
+
+struct G
+{
+  G(const G&) throw(int) { throw int(); }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_constructor(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_constructor(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_constructor(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+
+template<typename T, bool b = __has_nothrow_constructor(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_constructor(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_constructor(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (PTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (NTEST (F));
+  assert (NTEST (G));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor_odr.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor_odr.cpp
new file mode 100644
index 0000000..775e74a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_constructor_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_constructor (S) == f ());
+}
+
+S::S () { }
+
+bool f () { return __has_nothrow_constructor (S); }
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-1.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-1.cpp
new file mode 100644
index 0000000..e8507cf
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-1.cpp
@@ -0,0 +1,140 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct A
+{
+  double a;
+  double b;
+};
+
+struct B
+{
+  A a;
+};
+
+struct C
+: public A { };
+
+struct D
+{
+  D(const D&) throw() { }
+};
+
+struct E
+{
+  E(const E&) throw(int) { }
+};
+
+struct E1
+{
+  E1(const E1&) throw(int) { throw int(); }
+};
+
+struct F
+{
+  F() throw() { }
+};
+
+struct G
+{
+  G() throw(int) { throw int(); }
+};
+
+struct H
+{
+  H(H&) throw(int) { }
+};
+
+struct H1
+{
+  H1(H1&) throw(int) { throw int(); }
+};
+
+struct I
+{
+  I(I&) throw(int) { }
+  I(const I&) throw() { }
+};
+
+struct I1
+{
+  I1(I1&) throw(int) { throw int(); }
+  I1(const I1&) throw() { }
+};
+
+struct J
+{
+  J(J&) throw() { }
+  J(const J&) throw() { }
+  J(volatile J&) throw() { }
+  J(const volatile J&) throw() { }
+};
+
+template<typename T>
+  bool
+  f()
+  { return __has_nothrow_copy(T); } 
+
+template<typename T>
+  class My
+  {
+  public:
+    bool
+    f()
+    { return !!__has_nothrow_copy(T); }
+  };
+
+template<typename T>
+  class My2
+  {
+  public:
+    static const bool trait = __has_nothrow_copy(T);
+  };
+
+template<typename T>
+  const bool My2<T>::trait;
+
+template<typename T, bool b = __has_nothrow_copy(T)>
+  struct My3_help
+  { static const bool trait = b; };
+
+template<typename T, bool b>
+  const bool My3_help<T, b>::trait;
+
+template<typename T>
+  class My3
+  {
+  public:
+    bool
+    f()
+    { return My3_help<T>::trait; }
+  };
+
+#define PTEST(T) (__has_nothrow_copy(T) && f<T>() \
+                  && My<T>().f() && My2<T>::trait && My3<T>().f())
+
+#define NTEST(T) (!__has_nothrow_copy(T) && !f<T>() \
+                  && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
+
+int main()
+{
+  assert (PTEST (int));
+  assert (NTEST (int (int)));
+  assert (NTEST (void));
+  assert (PTEST (A));
+  assert (PTEST (B));
+  assert (PTEST (C));
+  assert (NTEST (C[]));
+  assert (PTEST (D));
+  assert (NTEST (E));
+  assert (NTEST (E1));
+  assert (PTEST (F));
+  assert (PTEST (G));
+  assert (NTEST (H));
+  assert (NTEST (H1));
+  assert (NTEST (I));
+  assert (NTEST (I1));  
+  assert (PTEST (J));
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-2.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-2.cpp
new file mode 100644
index 0000000..276b11d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-2.cpp
@@ -0,0 +1,12 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct A { template <class T> A (T) throw (int); };
+struct B { B (B&) throw (); template <class T> B (T) throw (int); };
+
+int main ()
+{
+  assert (__has_nothrow_copy (A));
+  assert (__has_nothrow_copy (B));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-3.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-3.cpp
new file mode 100644
index 0000000..2fbcf8c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-3.cpp
@@ -0,0 +1,13 @@
+// PR c++/36871
+// { dg-do "run" }
+#include <cassert>
+
+struct F {
+    F (const F&) throw () { }
+    template <class T> F (T) throw () { }
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (F));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-4.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-4.cpp
new file mode 100644
index 0000000..4bd7475
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-4.cpp
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (...) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-5.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-5.cpp
new file mode 100644
index 0000000..051675c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-5.cpp
@@ -0,0 +1,13 @@
+// PR c++/36872
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (int) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-6.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-6.cpp
new file mode 100644
index 0000000..4330edd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-6.cpp
@@ -0,0 +1,12 @@
+// { dg-do "run" }
+#include <cassert>
+
+struct S {
+    S (S&) throw ();
+    S (const S&, int) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-7.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-7.cpp
new file mode 100644
index 0000000..a85224c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy-7.cpp
@@ -0,0 +1,13 @@
+// { dg-do "run" }
+// { dg-options "-std=c++0x" }
+#include <cassert>
+
+struct S {
+    S (const S&) throw ();
+    S (S&&) throw (int);
+};
+
+int main ()
+{
+  assert (__has_nothrow_copy (S));
+}
diff --git a/tests/device/test-stlport_static-exception/jni/has_nothrow_copy_odr.cpp b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy_odr.cpp
new file mode 100644
index 0000000..499a11e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/has_nothrow_copy_odr.cpp
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_copy (S) == f ());
+}
+
+S::S (const S&) { }
+
+bool f () { return __has_nothrow_copy (S); }
diff --git a/tests/device/test-stlport_static-exception/jni/ia64-2.cpp b/tests/device/test-stlport_static-exception/jni/ia64-2.cpp
new file mode 100644
index 0000000..aa005d8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ia64-2.cpp
@@ -0,0 +1,58 @@
+// PR target/30230
+// This testcase failed on IA-64, where end of an EH region ended
+// in the middle of a bundle (with br.call insn in first or second
+// slot of .bbb/.mbb bundles and EH region end right after it).
+// But br.call returns to the start of the next bundlem so during
+// unwinding the call was considered to be outside of the EH region
+// while it should have been inside.
+// { dg-do run }
+// { dg-require-weak "" }
+// { dg-options "-O2" }
+
+struct A {};
+struct B { virtual ~B(); };
+B::~B () {}
+struct C { void foo (short &, B &); };
+struct D { void *d1; C *d2; virtual void virt (void) {} };
+struct E { D *e1; B *e2; };
+struct F { void bar (void *, B &); };
+F *p __attribute__((weak));
+volatile int r;
+
+void C::foo (short &x, B &)
+{
+  if (r)
+    throw A ();
+  x = 1;
+}
+
+void F::bar (void *, B &)
+{
+  throw A ();
+}
+
+void baz (E &x)
+{
+  short g = 0;
+  B b = *x.e2;
+  x.e1->d2->foo (g, b);
+  if (g)
+    p->bar(x.e1->d1, b);
+}
+
+int main ()
+{
+  F g;
+  D s;
+  E h;
+  p = &g;
+  h.e1 = &s;
+  try
+    {
+      baz (h);
+    }
+  catch (A &)
+    {
+    }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ice990323-2.cpp b/tests/device/test-stlport_static-exception/jni/ice990323-2.cpp
new file mode 100644
index 0000000..cefef77
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ice990323-2.cpp
@@ -0,0 +1,88 @@
+// { dg-do run  }
+// check EH with templates
+extern "C" void abort ();
+extern "C" void exit (int);
+
+template <class T, int n, class U> struct A {
+	A() {}
+	A(const char*) {}
+};
+
+void f1()
+{
+	throw *(new A<double, 47, A<int, 37, short> >);
+}
+
+void f2()
+{
+	throw *(new A<double, 47, A<int, 36, short> >);
+}
+
+void f3()
+{
+	throw A<double, 47, A<int, 37, short> > ("howdy");
+}
+
+void f4()
+{
+	throw A<double, 47, A<int, 36, short> > ("hi michey");
+}
+
+int main()
+{
+	int flag;
+
+	flag = 0;
+	try {
+		f1();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 37, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f2();
+	}
+	catch (A<double, 47, A<int, 36, short&> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f3();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 37, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	flag = 0;
+	try {
+		f4();
+	}
+	catch (A<double, 47, A<int, 36, short&> >) {
+		abort();
+	}
+	catch (A<double, 47, A<int, 36, short> >) {
+		flag = 1;
+	}
+	if (!flag)
+		abort();
+
+	exit(0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/init7.cpp b/tests/device/test-stlport_static-exception/jni/init7.cpp
new file mode 100644
index 0000000..e6c7dc1
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/init7.cpp
@@ -0,0 +1,31 @@
+// { dg-do run  }
+// simplified from testcase in Windows Developer Journal,
+// submitted by eyal.ben-david@aks.com
+
+// The initialization of a static local variable must be retried if a
+// previous try finished by throwing an exception [stmt.dcl]/4
+
+extern "C" void abort ();
+
+struct foo {
+  foo() { throw true; }
+};
+
+void bar() {
+  static foo baz;
+}
+
+int main() {
+  try {
+    bar(); // must throw
+  }
+  catch (bool) {
+    try {
+      bar(); // must throw again!
+    }
+    catch (bool) {
+      return 0;
+    }
+  }
+  abort();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/inline2.cpp b/tests/device/test-stlport_static-exception/jni/inline2.cpp
new file mode 100644
index 0000000..356c85a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/inline2.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// { dg-options "-O" }
+// Test that inlining a destructor with a catch block doesn't confuse the
+// enclosing try block.
+
+struct A {
+  ~A()
+  {
+    try { throw 1; }
+    catch (...) { }
+  }
+};
+
+int main ()
+{
+  try
+    {
+      A a;
+      throw 42;
+    }
+  catch (int i)
+    {
+      return (i != 42);
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/label3.cpp b/tests/device/test-stlport_static-exception/jni/label3.cpp
new file mode 100644
index 0000000..604bfdc
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/label3.cpp
@@ -0,0 +1,39 @@
+// Bug: we were removing the p = q assignment in dce, and then reinserting
+// it *after* the try/catch in out-of-ssa.  Oops.
+
+// testcase reduced from libjava/interpret.cc.
+
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int printf (const char *, ...);
+
+bool b;
+
+int main()
+{
+  __label__ one, two, done;
+  void *labs[] = { &&one, &&two, &&done };
+  const void **q = (const void **)labs;
+  const void **p = q;
+
+  try
+    {
+    one:
+      printf ("one!\n");
+      if (b)
+	throw 42;
+      goto **p++;
+
+    two:
+      printf ("two!\n");
+      goto **p++;
+
+    done:
+      printf ("done!\n");
+    }
+  catch (int)
+    {
+      printf ("caught!\n");
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/loop1.cpp b/tests/device/test-stlport_static-exception/jni/loop1.cpp
new file mode 100644
index 0000000..b9b230e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/loop1.cpp
@@ -0,0 +1,30 @@
+// Verify that loop optimization takes into account the exception edge
+// and does not increment I before the call.
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+static void bar(char *);
+
+static void foo(unsigned long element_count, char *ptr)
+{
+  unsigned long i;
+  try {
+    for (i = 0; i != element_count; i++, ptr += 8)
+      bar (ptr);
+  }
+  catch (...) {
+    if (i)
+      abort ();
+  }
+}
+
+static void bar(char *)
+{
+  throw 1;
+}
+
+int main()
+{
+  foo(2, 0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/loop2.cpp b/tests/device/test-stlport_static-exception/jni/loop2.cpp
new file mode 100644
index 0000000..1e85fa1
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/loop2.cpp
@@ -0,0 +1,11 @@
+// Test that breaking out of a handler works.
+// { dg-do run }
+
+int main ()
+{
+  while (1)
+    {
+      try { throw 1; }
+      catch (...) { break; }
+    }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new1.cpp b/tests/device/test-stlport_static-exception/jni/new1.cpp
new file mode 100644
index 0000000..2dfd267
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new1.cpp
@@ -0,0 +1,41 @@
+// PR c++/5757
+// Test that when a constructor throws in a new-expression, we pass the
+// right pointer to operator delete.
+
+// { dg-do run }
+
+#include <new>
+#include <stddef.h>
+
+int ret = 1;
+
+void *ptr;
+void * operator new[] (size_t s) throw (std::bad_alloc)
+{
+  ptr = operator new (s);
+  return ptr;
+}
+
+void operator delete[] (void *p) throw ()
+{
+  if (p == ptr)
+    ret = 0;
+  operator delete (p);
+}
+
+struct A
+{
+  A() { throw 1; }
+  ~A() {}
+};
+
+int
+main ()
+{
+  try
+    {
+      A *p = new A[4];
+    }
+  catch (...) {}
+  return ret;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new11.cpp b/tests/device/test-stlport_static-exception/jni/new11.cpp
new file mode 100644
index 0000000..b273e58
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new11.cpp
@@ -0,0 +1,21 @@
+// PR c++/17670
+// { dg-do run }
+
+#include <cstdlib>
+#include <new>
+
+bool abort_new;
+void *operator new[](size_t bytes) throw (std::bad_alloc) { 
+  if (abort_new)
+    abort(); 
+  return operator new (bytes);
+}
+
+
+struct X {};  
+int main () {
+  // Do not abort until int main is running in case startup code uses
+  // operator new[].
+  abort_new = true;
+  new (X);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new16.cpp b/tests/device/test-stlport_static-exception/jni/new16.cpp
new file mode 100644
index 0000000..c49f13f
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new16.cpp
@@ -0,0 +1,38 @@
+// { dg-do run }
+// { dg-options "-O2 -fstrict-aliasing" }
+
+// Test that we don't let TBAA reorder an assignment across a
+// placement new.
+// See PR 29286.
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+
+void __attribute__((noinline)) bar() {}
+
+long __attribute__((noinline)) foo(double *p, int n)
+{
+  long *f;
+  for (int i=0; i<n; ++i)
+  {
+    int *l = (int *)p;
+    *l = 0;
+    f = new (p) long;
+    *f = -1;
+  }
+  bar ();
+  return *f;
+}
+
+extern "C" void abort(void);
+int main()
+{
+  union {
+    int i;
+    long l;
+  } u;
+  if (foo((double *)&u, 1) != -1)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new1_2.cpp b/tests/device/test-stlport_static-exception/jni/new1_2.cpp
new file mode 100644
index 0000000..4c52cf4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new1_2.cpp
@@ -0,0 +1,49 @@
+// { dg-do run  }
+// Test that a throw in foo destroys the A, but does not free the memory.
+
+#include <cstddef>
+#include <cstdlib>
+#include <new>
+
+struct A {
+  A();
+  ~A();
+};
+
+struct B {
+  B (A);
+};
+
+void foo (B*);
+
+int newed, created;
+
+int main ()
+{
+  try {
+    foo (new B (A ()));
+  } catch (...) { }
+
+  return !(newed && !created);
+}
+
+A::A() { created = 1; }
+A::~A() { created = 0; }
+B::B(A) { }
+void foo (B*) { throw 1; }
+
+void* operator new (size_t size) throw (std::bad_alloc)
+{
+  ++newed;
+  return (void *) std::malloc (size);
+}
+
+void operator delete (void *p) throw ()
+{
+  --newed;
+  std::free (p);
+}
+
+
+
+
diff --git a/tests/device/test-stlport_static-exception/jni/new1_3.cpp b/tests/device/test-stlport_static-exception/jni/new1_3.cpp
new file mode 100644
index 0000000..502c4f4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new1_3.cpp
@@ -0,0 +1,122 @@
+// { dg-do run  }
+//Lifetime of temporaries: 
+//egcs 2.92 performs cleanup for temporaries inside new expressions
+//after the new is complete, not at the end of the full expression.
+
+#include <new>
+#include <cstdlib>
+#include <cstdio>
+
+bool new_throws;
+bool ctor_throws;
+
+int new_done;
+int ctor_done;
+int func_done;
+int dtor_done;
+int delete_done;
+
+int count;
+
+void init()
+{
+  new_throws = ctor_throws = false;
+  new_done = ctor_done = func_done = dtor_done = delete_done = count = 0;
+}
+
+struct line_error{
+  int line;
+  line_error(int i):line(i){}
+};
+
+#define CHECK(cond)  if(!(cond))throw line_error(__LINE__);
+
+struct A{
+  A(int){
+    ctor_done = ++count;
+    if(ctor_throws)
+      throw 1;
+  }
+  A(const A&){
+    CHECK(false); //no copy constructors in this code
+  }
+  ~A(){
+    dtor_done = ++count;
+  }
+  A* addr(){return this;}
+};
+
+struct B{
+  B(A*){}
+  void* operator new(size_t s){
+    new_done = ++count;
+    if(new_throws)
+      throw 1;
+    return malloc(s);
+  }
+  void operator delete(void *){
+    delete_done = ++count;
+  }
+};
+
+void func(B* )
+{
+  func_done = ++count;
+}
+
+void test1()
+{
+  init();
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(ctor_done==1);
+  CHECK(new_done==2);
+  CHECK(func_done==3);
+  CHECK(dtor_done==4);
+  CHECK(delete_done==0);
+}
+
+void test2()
+{
+  init();
+  new_throws = true;
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(ctor_done==1);
+  CHECK(new_done==2);
+  CHECK(func_done==0);
+  CHECK(dtor_done==3);
+  CHECK(delete_done==0);
+}
+
+void test3()
+{
+  init();
+  ctor_throws = true;
+  try{
+    func(new B(A(10).addr()));
+  }catch(int){
+  }
+  CHECK(new_done==0);
+  CHECK(ctor_done==1);
+  CHECK(func_done==0);
+  CHECK(dtor_done==0);
+  CHECK(delete_done==0);
+}
+
+int main()
+{
+  try{
+    test1();
+    test2();
+    test3();
+  }catch(line_error e){
+    printf("Got error in line %d\n",e.line);
+    return 1;
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new1_4.cpp b/tests/device/test-stlport_static-exception/jni/new1_4.cpp
new file mode 100644
index 0000000..86d25f8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new1_4.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// Copyright (C) 1999 Free Software Foundation
+
+// by Alexandre Oliva <oliva@dcc.unicamp.br>
+
+// based on comp.std.c++ post by Alexander Schiemann <aschiem@math.uni-sb.de>
+
+// execution test
+
+#include <new>
+#include <stdlib.h>
+
+struct A {
+  A() { throw 0; }
+  void* operator new(size_t size, double = 0.0) { return ::operator new(size);}
+  void operator delete(void* p, double) { exit(0); }
+  void operator delete(void* p) { abort(); }
+};
+
+int main() { try { new A; } catch(...) {} }
diff --git a/tests/device/test-stlport_static-exception/jni/new23.cpp b/tests/device/test-stlport_static-exception/jni/new23.cpp
new file mode 100644
index 0000000..cedd898
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new23.cpp
@@ -0,0 +1,20 @@
+// PR c++/33025
+// { dg-do run }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+inline void *operator new (size_t, void *p) throw () { return p; }
+extern "C" void abort ();
+
+int
+main()
+{
+  const unsigned num = 10;
+  unsigned *data = new unsigned[2 * num];
+  unsigned *ptr = data;
+  for (unsigned i = 0; i < 2 * num; ++i)
+    (i % 2 == 0) ? new (ptr) unsigned (2) : new (ptr++) unsigned (1);
+  if (ptr - data != num)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new2_1.cpp b/tests/device/test-stlport_static-exception/jni/new2_1.cpp
new file mode 100644
index 0000000..0002a2a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new2_1.cpp
@@ -0,0 +1,47 @@
+// { dg-do run  }
+// Test that a throw in B's constructor destroys the A and frees the memory.
+
+#include <cstddef>
+#include <cstdlib>
+#include <new>
+
+struct A {
+  A();
+  ~A();
+};
+
+struct B {
+  B (A);
+};
+
+void foo (B*);
+
+int newed, created;
+
+int main ()
+{
+  newed = 0; // The libraries might call new before int main starts.
+  try {
+    foo (new B (A ()));
+  } catch (...) { }
+
+  return !(!newed && !created);
+}
+
+A::A() { created = 1; }
+A::~A() { created = 0; }
+B::B(A) { throw 1; }
+void foo (B*) { }
+
+void* operator new (size_t size) throw (std::bad_alloc)
+{
+  ++newed;
+  return (void *) std::malloc (size);
+}
+
+void operator delete (void *p) throw ()
+{
+  --newed;
+  free (p);
+}
+
diff --git a/tests/device/test-stlport_static-exception/jni/new3.cpp b/tests/device/test-stlport_static-exception/jni/new3.cpp
new file mode 100644
index 0000000..d950259
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new3.cpp
@@ -0,0 +1,38 @@
+// { dg-do run  }
+// { dg-options "-fcheck-new -pedantic -Wno-long-long" }
+// PRMS Id: 6037
+
+extern "C" void * malloc (__SIZE_TYPE__);
+
+int ena = 0;
+
+struct A {
+  int i;
+  A () { i = 2; }
+  void * operator new (__SIZE_TYPE__ s)
+  {
+    if (ena)
+      return 0;
+    return malloc (s);
+  }
+};
+
+struct B {
+  int i;
+  B () { i = 2; }
+  void * operator new (__SIZE_TYPE__ s) throw()
+  {
+    if (ena)
+      return 0;
+    return malloc (s);
+  }
+};
+
+int main ()
+{
+  ena = 1;
+  A *ap = new A;
+  B *bp = new B;
+  
+  return ap || bp ;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new5.cpp b/tests/device/test-stlport_static-exception/jni/new5.cpp
new file mode 100644
index 0000000..45335ff
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new5.cpp
@@ -0,0 +1,20 @@
+// { dg-do run }
+
+#include <new>
+#include <stddef.h>
+#include <stdio.h>
+    
+void * operator new[](size_t, std::nothrow_t const &) throw()
+{ return NULL; }
+
+struct X {
+    struct Inner { ~Inner() {} };
+
+    X() {
+      Inner * ic = new (std::nothrow) Inner[1]; // SegFault here
+    }
+};
+
+int main() {
+   X table;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new6.cpp b/tests/device/test-stlport_static-exception/jni/new6.cpp
new file mode 100644
index 0000000..3afb2b7
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new6.cpp
@@ -0,0 +1,24 @@
+// { dg-do run  }
+// Test that we properly default-initialize the new int when () is given.
+
+#include <new>
+using namespace std;
+extern "C" void *malloc (size_t);
+
+int special;
+int space = 0xdeadbeef;
+
+void *operator new (size_t size) throw (bad_alloc)
+{
+  if (special)
+    return &space;
+  return malloc (size);
+}
+
+int main ()
+{
+  special = 1;
+  int *p = new int();
+  special = 0;
+  return *p != 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/new7.cpp b/tests/device/test-stlport_static-exception/jni/new7.cpp
new file mode 100644
index 0000000..0c0643e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/new7.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+// Origin: philip_martin@ntlworld.com
+
+#include <new>
+
+extern "C" void abort();
+
+bool new_flag = false;
+bool delete_flag = false;
+
+struct X {
+  X()
+  {
+    throw 1;
+  }
+  void* operator new ( std::size_t n ) throw ( std::bad_alloc )
+  {
+    new_flag = true;
+    return ::operator new( n );
+  }
+  void operator delete( void* p, std::size_t n ) throw()
+  {
+    delete_flag = true;
+    ::operator delete( p );
+  }
+};
+
+int
+main()
+{
+  try
+    {
+      X* x = new X; // gcc 3.0 fails to call operator delete when X::X throws
+    }
+  catch ( ... )
+    {
+    }
+  if ( ! new_flag || ! delete_flag )
+    ::abort();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/omit-frame-pointer2.cpp b/tests/device/test-stlport_static-exception/jni/omit-frame-pointer2.cpp
new file mode 100644
index 0000000..78026b5
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/omit-frame-pointer2.cpp
@@ -0,0 +1,34 @@
+// Reduced from PR c++/5246, PR c++/2447
+// { dg-options "-O -fomit-frame-pointer" }
+// { dg-do run }
+
+void step (int)
+{
+  void *sp = __builtin_alloca (0);
+}
+
+void f2 (void)
+{
+  step (2);
+  throw int();
+}
+
+void f1 (void)
+{
+  try
+    {
+      step (1);
+      f2 ();
+      step (-1);
+    }
+  catch (int)
+    {
+      step (3);
+    }
+}
+
+int main ()
+{
+  f1 ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/operators23.cpp b/tests/device/test-stlport_static-exception/jni/operators23.cpp
new file mode 100644
index 0000000..38ef1b1
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/operators23.cpp
@@ -0,0 +1,36 @@
+// { dg-do run  }
+// GROUPS passed operators
+// opr-new file
+// From: (The Crossjammer) <xjam@cork.cs.berkeley.edu>
+// Date:     Mon, 23 Nov 92 23:35:26 PST
+// Subject:  g++-2.3.1 : Incorrectly calls overloaded operator new
+// Message-ID: <9211240735.AA06872@cork.CS.Berkeley.EDU>
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+class blah {
+     int j;
+   public:
+     blah();
+     void *operator new(size_t size) throw();
+};
+
+inline blah::blah() : j(0) {
+	  
+}
+
+
+void *blah::operator new(size_t size) throw(){
+     printf ("FAIL\n");
+     exit (1);
+     return NULL;
+}
+
+int main(int arg, char** argv) {
+     blah* blahPtr;
+
+     blahPtr = new blah[100];
+     printf ("PASS\n");
+}
diff --git a/tests/device/test-stlport_static-exception/jni/operators27.cpp b/tests/device/test-stlport_static-exception/jni/operators27.cpp
new file mode 100644
index 0000000..7d9e811
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/operators27.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// GROUPS passed operators
+// opr-new file
+// From: David Binderman 3841 <dcb@us-es.sel.de>
+// Date:     Mon, 21 Jun 93 11:42:11 +0200
+// Subject:  G++ 2.4.3 and operator new
+// Message-ID: <9306210942.AA10276@slsvitt.us-es.sel.de>
+
+int FLAG=0;
+
+#include <new>
+#include <stddef.h>
+
+extern "C" int printf( const char *, ...);
+
+void * operator new(size_t, const std::nothrow_t&) throw()         { FLAG=1; return 0; }
+
+class K {
+private:
+        int i;
+public:
+        K( int j) {
+                i = j;
+        }
+};
+
+int main(void)
+{
+    K * pK = new (std::nothrow) K( 10);
+    if ( FLAG != 1 )
+	{ printf ("FAIL\n"); return 1; }
+    else
+	printf ("PASS\n");
+    return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/overload12_1.cpp b/tests/device/test-stlport_static-exception/jni/overload12_1.cpp
new file mode 100644
index 0000000..9da3d32
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/overload12_1.cpp
@@ -0,0 +1,22 @@
+// { dg-do run  }
+// Testcase for not trying a candidate that would generate an ill-formed
+// instantiation.
+
+template <int N> struct A {
+  int ar[N];
+};
+
+template <int N> struct B {
+  B () { }
+  B (const A<N> &) { }
+  B (const A<N-1> &, int);
+};
+
+int
+main ()
+{
+  A<1> a;
+  B<1> b1;
+  B<1> b2 (a);
+}
+
diff --git a/tests/device/test-stlport_static-exception/jni/p11667.cpp b/tests/device/test-stlport_static-exception/jni/p11667.cpp
new file mode 100644
index 0000000..802c0cf
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p11667.cpp
@@ -0,0 +1,62 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 11667
+
+extern "C" int printf(const char *,...);
+
+template < class T >
+class LIST {
+public:
+
+  LIST() { nitems = 16; items = new T[nitems]; };
+
+  LIST(int u) { nitems = u; items = new T[nitems]; };
+
+  T& operator[](int i) const {
+    return items[i];
+  }
+
+  void grow(int n) {
+    T* newlist = new T[n];
+    T* src = items;
+    T* dst = newlist;
+    int i = nitems;
+
+    try {
+      while (i--) *dst++ = *src++;
+    } catch (...) {
+      delete[]  newlist;
+      throw;
+    }
+
+    if (items) delete[] items;
+    nitems = n;
+    items = newlist;
+  }
+
+private:
+  int nitems;
+  T *items;
+};
+
+int main(int argc, char **argv) {
+  int i;
+  LIST<int> mylist(10);
+
+  printf("Start dumping initial 10 item list\n");
+  for (i = 0; i < 10 ; i++) {
+    mylist[i] = i;
+    printf("%d\n", mylist[i]);
+  }
+
+  printf("Growing list to 20\n");
+  mylist.grow(20);
+
+  printf("Start dumping grown 20 item list\n");
+  for (i = 0; i < 20; i++) {
+    mylist[i] = i;
+    printf("%d\n", mylist[i]);
+  }
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/p755.cpp b/tests/device/test-stlport_static-exception/jni/p755.cpp
new file mode 100644
index 0000000..3979e72
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p755.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// It checks to see if you can define your own global new operator.
+// prms-id: 755
+
+#include <stddef.h>
+#include <new>
+
+extern "C" void _exit(int);
+
+void* operator new(size_t sz) throw (std::bad_alloc) {
+  void* p = 0;
+  _exit(0);
+  return p;
+}
+
+int main () {
+  int* i = new int;
+  delete i;
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/p755a.cpp b/tests/device/test-stlport_static-exception/jni/p755a.cpp
new file mode 100644
index 0000000..bc23d57
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p755a.cpp
@@ -0,0 +1,15 @@
+// { dg-do run  }
+// It checks to see if you can define your own global delete operator.
+// prms-id: 755
+
+extern "C" void _exit(int);
+
+void operator delete(void *p) throw() {
+  _exit(0);
+}
+
+int main () {
+  int* i = new int;
+  delete i;
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/p7912.cpp b/tests/device/test-stlport_static-exception/jni/p7912.cpp
new file mode 100644
index 0000000..079b4c4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p7912.cpp
@@ -0,0 +1,23 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 7912
+
+int count = 0;
+
+class Foo {
+public:
+  Foo() { ++count; };
+  Foo(const Foo&) { ++count; };
+  ~Foo() { --count; };
+};
+
+
+int main()
+{
+  try {
+    throw Foo();
+  }
+  catch (Foo object) {
+  }
+  return count;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/p8155.cpp b/tests/device/test-stlport_static-exception/jni/p8155.cpp
new file mode 100644
index 0000000..7938471
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p8155.cpp
@@ -0,0 +1,148 @@
+// { dg-do run  }
+// prms-id: 8155
+
+int fail = 1;
+
+class CMainWindow;
+class CFrameWnd;
+class CWnd;
+class CCmdTarget;
+ 
+typedef void (CCmdTarget::*AFX_PMSG)( void);
+typedef void (CWnd::*AFX_PMSGW)( void);
+
+struct AFX_MSGMAP_ENTRY {
+  unsigned int  nMessage;    
+  AFX_PMSG pfn;
+};
+
+struct AFX_MSGMAP {
+  const AFX_MSGMAP* pBaseMap;
+  const AFX_MSGMAP_ENTRY* lpEntries;
+};
+
+class CCmdTarget {
+public:
+  CCmdTarget();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+const   AFX_MSGMAP CCmdTarget::messageMap = {
+  0, &CCmdTarget::_messageEntries[0]
+};
+
+const AFX_MSGMAP* CCmdTarget::GetMessageMap() const {
+  return &CCmdTarget::messageMap;
+}
+
+AFX_MSGMAP_ENTRY CCmdTarget::_messageEntries[] =
+{
+  { 0, 0 }
+};
+
+CCmdTarget :: CCmdTarget() { }
+ 
+class CWnd : public CCmdTarget {
+public:
+  CWnd();
+
+protected:
+  void OnPaint();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CWnd :: CWnd() {
+}
+
+void CWnd :: OnPaint() {
+}
+
+const AFX_MSGMAP*   CWnd ::GetMessageMap() const {
+  return &  CWnd ::messageMap;
+}
+const AFX_MSGMAP   CWnd ::messageMap = {
+  &  CCmdTarget ::messageMap, &  CWnd ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CWnd ::_messageEntries[] = { 
+  {0, (AFX_PMSG)0 } }; 
+
+class CFrameWnd : public CWnd {
+public:
+  CFrameWnd();
+protected:
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CFrameWnd :: CFrameWnd() { }
+
+const AFX_MSGMAP*   CFrameWnd ::GetMessageMap() const {
+  return &  CFrameWnd ::messageMap;
+}
+const AFX_MSGMAP   CFrameWnd ::messageMap = {
+  &  CWnd ::messageMap, &  CFrameWnd ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CFrameWnd ::_messageEntries[] = { 
+  {0, (AFX_PMSG)0 } }; 
+
+class CMainWindow : public CFrameWnd {
+public:
+  CMainWindow();
+  void OnPaint();
+  void callProc();
+private:
+  static AFX_MSGMAP_ENTRY _messageEntries[];
+protected:
+  static   const AFX_MSGMAP messageMap;
+  virtual const AFX_MSGMAP* GetMessageMap() const; 
+};
+
+CMainWindow :: CMainWindow()
+{
+}
+void CMainWindow :: OnPaint()
+{
+  fail = 0;
+}
+
+void CMainWindow :: callProc()
+{
+  const AFX_MSGMAP* pMessageMap;
+  const AFX_MSGMAP_ENTRY *lpEntry;
+
+  pMessageMap = GetMessageMap();
+  lpEntry = pMessageMap->lpEntries;
+
+  if( lpEntry->nMessage == 100) {
+    (this->*lpEntry->pfn)();
+  }
+}
+
+const AFX_MSGMAP*   CMainWindow ::GetMessageMap() const {
+  return &  CMainWindow ::messageMap;
+}
+const AFX_MSGMAP   CMainWindow ::messageMap = {
+  &  CFrameWnd ::messageMap, &  CMainWindow ::_messageEntries[0]
+  };
+AFX_MSGMAP_ENTRY   CMainWindow ::_messageEntries[] = { 
+  { 100, (AFX_PMSG)(AFX_PMSGW)(void (CWnd::*)(void))&CMainWindow::OnPaint },
+  {0, (AFX_PMSG)0 }
+}; 
+
+int main( int argc, char **argv) {
+  CMainWindow     myWindow;
+
+  myWindow.callProc();
+  return fail;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/p9706.cpp b/tests/device/test-stlport_static-exception/jni/p9706.cpp
new file mode 100644
index 0000000..0ed15e4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/p9706.cpp
@@ -0,0 +1,37 @@
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
+// prms-id: 9706
+
+#include <stdlib.h>
+
+int count, acount;
+
+void *operator new(size_t sz) { ++count; return malloc (sz); }
+void operator delete(void *p) throw() { --count; free (p); }
+
+class A {
+public:
+  A() { ++acount; }
+  A(const A&) { ++acount; }
+  ~A() { --acount; }
+};
+
+int main() {
+  int i;
+
+  // The standard library may have called new and/or delete during
+  // startup, so we have to reset the counter here.
+  count = 0;
+
+  for( i = 0; i < 10; i++ ) {
+    try {
+      throw A();
+    }
+    catch (A& a) {
+    }
+  }
+  if (acount)
+    return 1;
+  if (count)
+    return 2;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pdel1.cpp b/tests/device/test-stlport_static-exception/jni/pdel1.cpp
new file mode 100644
index 0000000..fd7ecff
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pdel1.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// Test for calling placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 1;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, int) { r = 0; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+int main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pdel2.cpp b/tests/device/test-stlport_static-exception/jni/pdel2.cpp
new file mode 100644
index 0000000..9bad6ee
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pdel2.cpp
@@ -0,0 +1,23 @@
+// { dg-do run  }
+// Test for not calling mismatched placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 0;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, long) { r = 1; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+int main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/placement2.cpp b/tests/device/test-stlport_static-exception/jni/placement2.cpp
new file mode 100644
index 0000000..7a9d6d0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/placement2.cpp
@@ -0,0 +1,22 @@
+// Bug: We were calling f() twice, for both the placement new and placement
+// delete calls.
+
+// { dg-do run }
+
+void* operator new    (__SIZE_TYPE__ sz, void*) { return operator new (sz); }
+void  operator delete (void* p, void*)         { operator delete (p); }
+
+struct A { A() { throw 1; } };
+
+int c;
+void *f() { ++c; return 0; }
+
+int main()
+{
+  try
+    {
+      new (f()) A;
+    }
+  catch (...) {}
+  return c != 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr17697-1.cpp b/tests/device/test-stlport_static-exception/jni/pr17697-1.cpp
new file mode 100644
index 0000000..50a75b8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr17697-1.cpp
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+  extern int strcmp (const char *s, const char *t) throw ()
+    __attribute__ ((pure));
+}
+
+namespace A
+{
+  extern int strcmp (const char *s, const char *t);
+}
+
+inline int
+A::strcmp (const char *s, const char *t)
+{
+  return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+  return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+  return foo ("") != 0 || foo ("a") == 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr17697-2.cpp b/tests/device/test-stlport_static-exception/jni/pr17697-2.cpp
new file mode 100644
index 0000000..4a746be
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr17697-2.cpp
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+  extern int strcmp (const char *s, const char *t) throw ()
+    __attribute__ ((pure));
+}
+
+namespace A
+{
+  extern int strcmp (const char *s, const char *t) throw ();
+}
+
+inline int
+A::strcmp (const char *s, const char *t) throw ()
+{
+  return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+  return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+  return foo ("") != 0 || foo ("a") == 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr22167.cpp b/tests/device/test-stlport_static-exception/jni/pr22167.cpp
new file mode 100644
index 0000000..07af744
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr22167.cpp
@@ -0,0 +1,32 @@
+// Derived from PR22167, which failed on some RISC targets.  The call to
+// foo() has two successors, one normal and one exceptional, and both
+// successors use &a[0] and x.  Expressions involving &a[0] can be hoisted
+// before the call but those involving x cannot.
+// { dg-options "-Os" }
+// { dg-do run }
+
+int a[4];
+
+struct S {
+  S() : x (0) {}
+  ~S() { a[0] = x; }
+  int x;
+};
+
+void
+foo (int *x)
+{
+  if (*x == 1)
+    throw 1;
+  *x = 1;
+}
+
+int
+main()
+{
+  S s;
+  foo (&s.x);
+  if (a[0] == s.x)
+    a[0]++;
+  return a[0];
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr23299.cpp b/tests/device/test-stlport_static-exception/jni/pr23299.cpp
new file mode 100644
index 0000000..94a414a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr23299.cpp
@@ -0,0 +1,63 @@
+// PR rtl-optimization/23299
+// { dg-do run }
+// { dg-options "-Os" }
+
+extern "C" void abort ();
+
+struct A
+{
+  virtual int a () {}
+};
+struct B : public A
+{
+  virtual int b () {}
+};
+struct C : public A
+{
+  virtual int c () {}
+};
+struct D
+{
+  D () { d = 64; }
+  ~D ();
+  int d;
+};
+
+int x;
+D::~D ()
+{
+  x |= 1;
+  if (d != 64)
+    abort ();
+}
+
+struct E : public B, public C
+{
+  E () {}
+  virtual int c ();
+  ~E ();
+  D dv;
+};
+
+E::~E ()
+{
+  int r = c ();
+}
+
+int
+E::c ()
+{
+  if (x > 10)
+    throw 1;
+  x |= 2;
+}
+
+int
+main (void)
+{
+  {
+    E e;
+  }
+  if (x != 3)
+    abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr29166.cpp b/tests/device/test-stlport_static-exception/jni/pr29166.cpp
new file mode 100644
index 0000000..432b64e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr29166.cpp
@@ -0,0 +1,197 @@
+// PR 29166: r4-r7 corrupted when unwinding.
+// { dg-do run }
+
+class Ex 
+{ 
+public: 
+  int val; 
+
+  Ex( int v )
+   : val( v ) 
+   { }
+
+};
+
+void doIt() 
+{
+  int OFF( 1000 ); 
+  register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10;
+  register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20;
+  register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30;
+  register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40;
+  register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50;
+  register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60;
+  register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70;
+  register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80;
+  register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90;
+  register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100;
+  register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110;
+  register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120;
+  register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130;
+  register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140;
+  register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150;
+  register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160;
+  register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170;
+  register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180;
+  register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190;
+  register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200;
+  register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210;
+  register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220;
+  register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240;
+  register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250;
+  register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260;
+  register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270;
+  register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280;
+  register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290;
+  register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300;
+
+  register int sum = 0;
+  sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+  sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+  sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+  sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+  sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+  sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+  sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+  sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+  sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+  sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+  sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+  sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+  sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+  sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+  sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+  sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+  sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+  sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+  sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+  sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+  sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+  sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+  sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+  sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+  sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+  sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+  sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+  sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+  sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+  throw Ex( sum );  
+}
+
+void test() 
+{
+  try {
+    doIt(); 
+  } catch( Ex& ) { } 
+}
+
+int main(int argc, char** argv) 
+{
+  int OFF(0); 
+  register int v1=OFF+1,v2=OFF+2,v3=OFF+3,v4=OFF+4,v5=OFF+5,v6=OFF+6,v7=OFF+7,v8=OFF+8,v9=OFF+9,v10=OFF+10;
+  register int v11=OFF+11,v12=OFF+12,v13=OFF+13,v14=OFF+14,v15=OFF+15,v16=OFF+16,v17=OFF+17,v18=OFF+18,v19=OFF+19,v20=OFF+20;
+  register int v21=OFF+21,v22=OFF+22,v23=OFF+23,v24=OFF+24,v25=OFF+25,v26=OFF+26,v27=OFF+27,v28=OFF+28,v29=OFF+29,v30=OFF+30;
+  register int v31=OFF+31,v32=OFF+32,v33=OFF+33,v34=OFF+34,v35=OFF+35,v36=OFF+36,v37=OFF+37,v38=OFF+38,v39=OFF+39,v40=OFF+40;
+  register int v41=OFF+41,v42=OFF+42,v43=OFF+43,v44=OFF+44,v45=OFF+45,v46=OFF+46,v47=OFF+47,v48=OFF+48,v49=OFF+49,v50=OFF+50;
+  register int v51=OFF+51,v52=OFF+52,v53=OFF+53,v54=OFF+54,v55=OFF+55,v56=OFF+56,v57=OFF+57,v58=OFF+58,v59=OFF+59,v60=OFF+60;
+  register int v61=OFF+61,v62=OFF+62,v63=OFF+63,v64=OFF+64,v65=OFF+65,v66=OFF+66,v67=OFF+67,v68=OFF+68,v69=OFF+69,v70=OFF+70;
+  register int v71=OFF+71,v72=OFF+72,v73=OFF+73,v74=OFF+74,v75=OFF+75,v76=OFF+76,v77=OFF+77,v78=OFF+78,v79=OFF+79,v80=OFF+80;
+  register int v81=OFF+81,v82=OFF+82,v83=OFF+83,v84=OFF+84,v85=OFF+85,v86=OFF+86,v87=OFF+87,v88=OFF+88,v89=OFF+89,v90=OFF+90;
+  register int v91=OFF+91,v92=OFF+92,v93=OFF+93,v94=OFF+94,v95=OFF+95,v96=OFF+96,v97=OFF+97,v98=OFF+98,v99=OFF+99,v100=OFF+100;
+  register int v101=OFF+101,v102=OFF+102,v103=OFF+103,v104=OFF+104,v105=OFF+105,v106=OFF+106,v107=OFF+107,v108=OFF+108,v109=OFF+109,v110=OFF+110;
+  register int v111=OFF+111,v112=OFF+112,v113=OFF+113,v114=OFF+114,v115=OFF+115,v116=OFF+116,v117=OFF+117,v118=OFF+118,v119=OFF+119,v120=OFF+120;
+  register int v121=OFF+121,v122=OFF+122,v123=OFF+123,v124=OFF+124,v125=OFF+125,v126=OFF+126,v127=OFF+127,v128=OFF+128,v129=OFF+129,v130=OFF+130;
+  register int v131=OFF+131,v132=OFF+132,v133=OFF+133,v134=OFF+134,v135=OFF+135,v136=OFF+136,v137=OFF+137,v138=OFF+138,v139=OFF+139,v140=OFF+140;
+  register int v141=OFF+141,v142=OFF+142,v143=OFF+143,v144=OFF+144,v145=OFF+145,v146=OFF+146,v147=OFF+147,v148=OFF+148,v149=OFF+149,v150=OFF+150;
+  register int v151=OFF+151,v152=OFF+152,v153=OFF+153,v154=OFF+154,v155=OFF+155,v156=OFF+156,v157=OFF+157,v158=OFF+158,v159=OFF+159,v160=OFF+160;
+  register int v161=OFF+161,v162=OFF+162,v163=OFF+163,v164=OFF+164,v165=OFF+165,v166=OFF+166,v167=OFF+167,v168=OFF+168,v169=OFF+169,v170=OFF+170;
+  register int v171=OFF+171,v172=OFF+172,v173=OFF+173,v174=OFF+174,v175=OFF+175,v176=OFF+176,v177=OFF+177,v178=OFF+178,v179=OFF+179,v180=OFF+180;
+  register int v181=OFF+181,v182=OFF+182,v183=OFF+183,v184=OFF+184,v185=OFF+185,v186=OFF+186,v187=OFF+187,v188=OFF+188,v189=OFF+189,v190=OFF+190;
+  register int v191=OFF+191,v192=OFF+192,v193=OFF+193,v194=OFF+194,v195=OFF+195,v196=OFF+196,v197=OFF+197,v198=OFF+198,v199=OFF+199,v200=OFF+200;
+  register int v201=OFF+201,v202=OFF+202,v203=OFF+203,v204=OFF+204,v205=OFF+205,v206=OFF+206,v207=OFF+207,v208=OFF+208,v209=OFF+209,v210=OFF+210;
+  register int v211=OFF+211,v212=OFF+212,v213=OFF+213,v214=OFF+214,v215=OFF+215,v216=OFF+216,v217=OFF+217,v218=OFF+218,v219=OFF+219,v220=OFF+220;
+  register int v231=OFF+231,v232=OFF+232,v233=OFF+233,v234=OFF+234,v235=OFF+235,v236=OFF+236,v237=OFF+237,v238=OFF+238,v239=OFF+239,v240=OFF+240;
+  register int v241=OFF+241,v242=OFF+242,v243=OFF+243,v244=OFF+244,v245=OFF+245,v246=OFF+246,v247=OFF+247,v248=OFF+248,v249=OFF+249,v250=OFF+250;
+  register int v251=OFF+251,v252=OFF+252,v253=OFF+253,v254=OFF+254,v255=OFF+255,v256=OFF+256,v257=OFF+257,v258=OFF+258,v259=OFF+259,v260=OFF+260;
+  register int v261=OFF+261,v262=OFF+262,v263=OFF+263,v264=OFF+264,v265=OFF+265,v266=OFF+266,v267=OFF+267,v268=OFF+268,v269=OFF+269,v270=OFF+270;
+  register int v271=OFF+271,v272=OFF+272,v273=OFF+273,v274=OFF+274,v275=OFF+275,v276=OFF+276,v277=OFF+277,v278=OFF+278,v279=OFF+279,v280=OFF+280;
+  register int v281=OFF+281,v282=OFF+282,v283=OFF+283,v284=OFF+284,v285=OFF+285,v286=OFF+286,v287=OFF+287,v288=OFF+288,v289=OFF+289,v290=OFF+290;
+  register int v291=OFF+291,v292=OFF+292,v293=OFF+293,v294=OFF+294,v295=OFF+295,v296=OFF+296,v297=OFF+297,v298=OFF+298,v299=OFF+299,v300=OFF+300;
+
+  int sum_before, sum_after; 
+
+  {
+    int sum( 0 );
+    sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+    sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+    sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+    sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+    sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+    sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+    sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+    sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+    sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+    sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+    sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+    sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+    sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+    sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+    sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+    sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+    sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+    sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+    sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+    sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+    sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+    sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+    sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+    sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+    sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+    sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+    sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+    sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+    sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+    sum_before = sum;
+  }
+
+ test(); 
+
+ {
+   int sum( 0 );
+   sum +=v1+v2+v3+v4+v5+v6+v7+v8+v9+v10;
+   sum +=v11+v12+v13+v14+v15+v16+v17+v18+v19+v20;
+   sum +=v21+v22+v23+v24+v25+v26+v27+v28+v29+v30;
+   sum +=v31+v32+v33+v34+v35+v36+v37+v38+v39+v40;
+   sum +=v41+v42+v43+v44+v45+v46+v47+v48+v49+v50;
+   sum +=v51+v52+v53+v54+v55+v56+v57+v58+v59+v60;
+   sum +=v61+v62+v63+v64+v65+v66+v67+v68+v69+v70;
+   sum +=v71+v72+v73+v74+v75+v76+v77+v78+v79+v80;
+   sum +=v81+v82+v83+v84+v85+v86+v87+v88+v89+v90;
+   sum +=v91+v92+v93+v94+v95+v96+v97+v98+v99+v100;
+   sum +=v101+v102+v103+v104+v105+v106+v107+v108+v109+v110;
+   sum +=v111+v112+v113+v114+v115+v116+v117+v118+v119+v120;
+   sum +=v121+v122+v123+v124+v125+v126+v127+v128+v129+v130;
+   sum +=v131+v132+v133+v134+v135+v136+v137+v138+v139+v140;
+   sum +=v141+v142+v143+v144+v145+v146+v147+v148+v149+v150;
+   sum +=v151+v152+v153+v154+v155+v156+v157+v158+v159+v160;
+   sum +=v161+v162+v163+v164+v165+v166+v167+v168+v169+v170;
+   sum +=v171+v172+v173+v174+v175+v176+v177+v178+v179+v180;
+   sum +=v181+v182+v183+v184+v185+v186+v187+v188+v189+v190;
+   sum +=v191+v192+v193+v194+v195+v196+v197+v198+v199+v200;
+   sum +=v201+v202+v203+v204+v205+v206+v207+v208+v209+v210;
+   sum +=v211+v212+v213+v214+v215+v216+v217+v218+v219+v220;
+   sum +=v231+v232+v233+v234+v235+v236+v237+v238+v239+v240;
+   sum +=v241+v242+v243+v244+v245+v246+v247+v248+v249+v250;
+   sum +=v251+v252+v253+v254+v255+v256+v257+v258+v259+v260;
+   sum +=v261+v262+v263+v264+v265+v266+v267+v268+v269+v270;
+   sum +=v271+v272+v273+v274+v275+v276+v277+v278+v279+v280;
+   sum +=v281+v282+v283+v284+v285+v286+v287+v288+v289+v290;
+   sum +=v291+v292+v293+v294+v295+v296+v297+v298+v299+v300;
+
+   sum_after = sum; 
+ }
+
+  return sum_before != sum_after;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pr36449.cpp b/tests/device/test-stlport_static-exception/jni/pr36449.cpp
new file mode 100644
index 0000000..f665980
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pr36449.cpp
@@ -0,0 +1,70 @@
+// PR middle-end/36449
+// { dg-do run }
+// { dg-options "-O3" }
+
+extern "C" void exit (int);
+extern "C" void abort ();
+
+struct R
+{
+  short a;
+  short b;
+};
+
+struct S
+{
+  R e;
+  long f;
+  long g;
+};
+
+struct T
+{
+  short c;
+  short d;
+};
+
+struct U
+{
+  long h[0x1ffffff + 1];
+  T i;
+};
+
+U *j;
+
+void __attribute__((noinline))
+bar ()
+{
+  exit (0);
+}
+
+void __attribute__((noinline))
+foo ()
+{
+  S s;
+
+  s.e.a = 36;
+  s.e.b = 38;
+  if (s.e.a == j->i.c && s.e.b == j->i.d)
+    bar ();
+}
+
+int
+main ()
+{
+  try
+    {
+      j = new U;
+    }
+  catch (...)
+    {
+      return 0;
+    }
+  j->i.c = 36;
+  j->i.d = 38;
+  j->h[0] = 1;
+  j->h[1] = 2;
+  j->h[2] = 3;
+  foo ();
+  abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/pretty2.cpp b/tests/device/test-stlport_static-exception/jni/pretty2.cpp
new file mode 100644
index 0000000..0c05da9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/pretty2.cpp
@@ -0,0 +1,61 @@
+// PR c++/6794
+// Test whether __PRETTY_FUNCTION__ works in templates, functions and
+// in initializers at global scope
+// { dg-do run }
+// { dg-options "" }
+
+extern "C" void __assert_fail (const char *, const char *,
+			       unsigned int, const char *)
+  throw() __attribute__((noreturn));
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+#define str(expr) #expr
+#define assert(expr)						\
+  ((expr) ? 0 : (__assert_fail (str(expr), __FILE__, __LINE__,	\
+				__PRETTY_FUNCTION__), 0))
+
+int __attribute__((noinline))
+foo (void)
+{
+  return 1;
+}
+
+template<class T> int
+bar (T)
+{
+  return (assert (foo ()), 1);
+}
+
+template<> int
+bar<int> (int)
+{
+  return (assert (foo ()), 2);
+}
+
+int a = (assert (foo ()), 1);
+int b = (assert (foo ()), 2);
+
+int
+main ()
+{
+  double c = 1.0;
+  unsigned char *d = 0;
+  int e = (assert (foo ()), 3);
+
+  bar (c);
+  bar (d);
+  bar (e);
+}
+
+namespace N
+{
+  int f = (assert (foo ()), 4);
+}
+
+void __attribute__((noinline))
+__assert_fail (const char *cond, const char *file, unsigned int line,
+	       const char *pretty) throw ()
+{
+  abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ptr1.cpp b/tests/device/test-stlport_static-exception/jni/ptr1.cpp
new file mode 100644
index 0000000..e4b3100
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ptr1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Bug: catching pointers by reference doesn't work right.
+
+extern "C" int printf (const char *, ...);
+
+struct E {
+  int x;
+  E(int i) { x = i; }
+};
+
+int main()
+{
+  try {
+    E *p = new E(5);
+    throw p;
+  }
+
+  catch (E *&e) {
+    printf ("address of e is 0x%lx\n", (__SIZE_TYPE__)e);
+    printf ("(__SIZE_TYPE__)e: %d ( != 5 ?)\n", (__SIZE_TYPE__)e);
+    printf ("            e->x: %d ( == 5 ?)\n", e->x);
+    return !((__SIZE_TYPE__)e != 5 && e->x == 5);
+  }
+  return 2;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ptrmem1_1.cpp b/tests/device/test-stlport_static-exception/jni/ptrmem1_1.cpp
new file mode 100644
index 0000000..299dc4a
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ptrmem1_1.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+extern "C" void exit (int);
+extern "C" void abort (void);
+struct A { int i; };
+int main ()
+{
+  try { throw &A::i; }
+  catch (int A::*p)
+    {
+      if (p == &A::i)
+	exit (0);
+      else
+	abort ();
+    }
+  abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/ref9.cpp b/tests/device/test-stlport_static-exception/jni/ref9.cpp
new file mode 100644
index 0000000..127b7d8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/ref9.cpp
@@ -0,0 +1,36 @@
+// { dg-do run }
+
+struct ex;
+struct basic {
+  int refcount;
+  ex eval() const;
+  basic() : refcount(0) {}
+};
+
+struct ex {
+  basic *bp;
+  ex() : bp(0) { }
+  ex(const basic &);
+  virtual ~ex();
+  void construct_from_basic(const basic &);
+};
+
+ex basic::eval() const {
+  throw 1;
+}
+
+inline ex::ex(const basic &b) { construct_from_basic (b); }
+inline ex::~ex() { if (--bp->refcount == 0) delete bp; }
+void ex::construct_from_basic(const basic &b) {
+  const ex & tmpex = b.eval();
+  bp = tmpex.bp;
+  bp->refcount++;
+}
+
+ex pow() { return basic(); }
+
+int main()
+{
+  try { pow (); } catch (int) {}
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/reg-stack.cpp b/tests/device/test-stlport_static-exception/jni/reg-stack.cpp
new file mode 100644
index 0000000..76d3cee
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/reg-stack.cpp
@@ -0,0 +1,47 @@
+// PR target/6087
+// The code that moves around insns emitted by reg-stack to cope with
+// exception edges lost the REG_DEAD note indicating a pop.  Which
+// eventually fills up the register stack resulting in Z == NaN.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort ();
+
+struct Base
+{
+  virtual ~Base() {}
+};
+
+struct Foo : public Base
+{
+  Foo ();
+};
+
+double x = 3;
+double y = 4;
+
+double bar ()
+{
+  double z = x*x+y*y;
+  if (z != 25.0)
+    throw 1;
+  return z;
+}
+
+Foo::Foo ()
+{
+  bar ();
+}
+
+int main ()
+{
+  try {
+    int i;
+    for (i = 0; i < 10; ++i)
+      new Foo;
+  } catch (...) {
+    abort ();
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/registers1.cpp b/tests/device/test-stlport_static-exception/jni/registers1.cpp
new file mode 100644
index 0000000..35b1c9d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/registers1.cpp
@@ -0,0 +1,138 @@
+// Try to check that registers are preserved when the stack is unwound.
+// { dg-do run }
+// { dg-options -O2 }
+
+extern "C" void exit(int);
+extern "C" void abort();
+
+// This test case triggers up to DEPTH recursive calls to function
+// foo(), These calls are numbered so that 0 is the innermost, 1 the
+// second innermost, and so on.  Each call caches NUM_VARS elements of
+// both DOUBLE_SRC and INT_SRC and applies a trivial operation to each
+// cached value.  The innermost foo() call will throw an integer call
+// number.  The specified call should store its cached values in
+// DOUBLE_DEST and INT_DEST, which int main() will check.
+const int num_vars = 16;
+const int depth = 3;
+
+float float_src[num_vars * depth];
+float float_dest[num_vars];
+
+int int_src[num_vars * depth];
+int int_dest[num_vars];
+
+void foo (int level, int throw_to)
+{
+  float *fsrc = &float_src[level * num_vars];
+  float f00 = *fsrc++ + 1.0f;
+  float f01 = *fsrc++ + 1.0f;
+  float f02 = *fsrc++ + 1.0f;
+  float f03 = *fsrc++ + 1.0f;
+  float f04 = *fsrc++ + 1.0f;
+  float f05 = *fsrc++ + 1.0f;
+  float f06 = *fsrc++ + 1.0f;
+  float f07 = *fsrc++ + 1.0f;
+  float f08 = *fsrc++ + 1.0f;
+  float f09 = *fsrc++ + 1.0f;
+  float f10 = *fsrc++ + 1.0f;
+  float f11 = *fsrc++ + 1.0f;
+  float f12 = *fsrc++ + 1.0f;
+  float f13 = *fsrc++ + 1.0f;
+  float f14 = *fsrc++ + 1.0f;
+  float f15 = *fsrc++ + 1.0f;
+
+  int *isrc = &int_src[level * num_vars];
+  int i00 = *isrc++ + 1;
+  int i01 = *isrc++ + 1;
+  int i02 = *isrc++ + 1;
+  int i03 = *isrc++ + 1;
+  int i04 = *isrc++ + 1;
+  int i05 = *isrc++ + 1;
+  int i06 = *isrc++ + 1;
+  int i07 = *isrc++ + 1;
+  int i08 = *isrc++ + 1;
+  int i09 = *isrc++ + 1;
+  int i10 = *isrc++ + 1;
+  int i11 = *isrc++ + 1;
+  int i12 = *isrc++ + 1;
+  int i13 = *isrc++ + 1;
+  int i14 = *isrc++ + 1;
+  int i15 = *isrc++ + 1;
+
+  try
+    {
+      if (level == 0)
+	throw throw_to;
+      else
+	foo (level - 1, throw_to);
+    }
+  catch (int i)
+    {
+      if (i == level)
+	{
+	  float *fdest = float_dest;
+	  *fdest++ = f00;
+	  *fdest++ = f01;
+	  *fdest++ = f02;
+	  *fdest++ = f03;
+	  *fdest++ = f04;
+	  *fdest++ = f05;
+	  *fdest++ = f06;
+	  *fdest++ = f07;
+	  *fdest++ = f08;
+	  *fdest++ = f09;
+	  *fdest++ = f10;
+	  *fdest++ = f11;
+	  *fdest++ = f12;
+	  *fdest++ = f13;
+	  *fdest++ = f14;
+	  *fdest++ = f15;
+
+	  int *idest = int_dest;
+	  *idest++ = i00;
+	  *idest++ = i01;
+	  *idest++ = i02;
+	  *idest++ = i03;
+	  *idest++ = i04;
+	  *idest++ = i05;
+	  *idest++ = i06;
+	  *idest++ = i07;
+	  *idest++ = i08;
+	  *idest++ = i09;
+	  *idest++ = i10;
+	  *idest++ = i11;
+	  *idest++ = i12;
+	  *idest++ = i13;
+	  *idest++ = i14;
+	  *idest++ = i15;
+	}
+      else
+	{
+	  throw;
+	}
+    }
+}
+
+int main ()
+{
+  for (int i = 0; i < depth * num_vars; i++)
+    {
+      int_src[i] = i * i;
+      float_src[i] = i * 2.0f;
+    }
+  for (int level = 0; level < depth; level++)
+    for (int throw_to = 0; throw_to <= level; throw_to++)
+      {
+	foo (level, throw_to);
+	float *fsrc = &float_src[throw_to * num_vars];
+	int *isrc = &int_src[throw_to * num_vars];
+	for (int i = 0; i < num_vars; i++)
+	  {
+	    if (int_dest[i] != isrc[i] + 1)
+	      abort ();
+	    if (float_dest[i] != fsrc[i] + 1.0f)
+	      abort ();
+	  }
+      }
+  exit (0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow1.cpp b/tests/device/test-stlport_static-exception/jni/rethrow1.cpp
new file mode 100644
index 0000000..286f1bd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow1.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw A();
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw;
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow2.cpp b/tests/device/test-stlport_static-exception/jni/rethrow2.cpp
new file mode 100644
index 0000000..cd2dd7e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow2.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw;
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow3.cpp b/tests/device/test-stlport_static-exception/jni/rethrow3.cpp
new file mode 100644
index 0000000..952318b
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow3.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+#include <stdio.h>
+#include <stdlib.h>
+#include <exception>
+
+static void
+eh_terminate ()
+{
+  printf ("CALLING TERMINATE\n");
+  exit (1);
+}
+
+void
+eh_test (int level)
+{
+  try
+    {
+      if (level < 2)
+	eh_test (level + 1);
+      else
+	{
+	  printf ("%d: Throwing\n", level);
+	  throw (level);
+	}
+    }
+  catch (int &x)
+    {
+      printf ("%d: Got level %d\n",
+	      level, x);
+
+      if (level > 0)
+	throw;
+    }
+}
+
+int main ()
+{
+  std::set_terminate (&eh_terminate);
+  eh_test (0);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow4.cpp b/tests/device/test-stlport_static-exception/jni/rethrow4.cpp
new file mode 100644
index 0000000..df54e49
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow4.cpp
@@ -0,0 +1,46 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Throwing 3...\n");
+	      throw A();
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow5.cpp b/tests/device/test-stlport_static-exception/jni/rethrow5.cpp
new file mode 100644
index 0000000..34a56e4
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow5.cpp
@@ -0,0 +1,45 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+	{
+	  printf ("Throwing 1...\n");
+	  throw A();
+	}
+      catch (A)
+	{
+	  try
+	    {
+	      printf ("Throwing 2...\n");
+	      throw;
+	    }
+	  catch (A)
+	    {
+	      printf ("Falling out...\n");
+	    }
+	}
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rethrow6.cpp b/tests/device/test-stlport_static-exception/jni/rethrow6.cpp
new file mode 100644
index 0000000..ce99626
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rethrow6.cpp
@@ -0,0 +1,76 @@
+// { dg-do run  }
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+int wrong;
+
+struct A
+{
+  int i;
+  A () { i = c++; printf ("A() %d\n", i); }
+  A (const A&) { i = c++; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+struct B
+{
+  ~B () {
+    try
+      {
+	printf ("Rethrowing III...\n");
+	throw;
+      }
+    catch (A& a)
+      {
+	printf ("Caught III %d...\n", a.i);
+	if (a.i != 1)
+	  {
+	    printf ("** rethrew uncaught exception **\n");
+	    wrong = 1;
+	  }
+      }
+    printf ("continuing to unwind II...\n");
+  }
+};
+
+int
+main ()
+{
+  {
+    A a;
+
+    try
+      {
+	try
+	  {
+	    printf ("Throwing I...\n");
+	    throw a;
+	  }
+	catch (A& a)
+	  {
+	    printf ("Caught I %d...\n", a.i);
+	    try
+	      {
+		B b;
+		printf ("Throwing II...\n");
+		throw a;
+	      }
+	    catch (A& a)
+	      {
+		printf ("Caught II %d...\n", a.i);
+		printf ("Throwing IV...\n");
+		throw;
+	      }
+	  }
+      }
+    catch (A& a)
+      {
+	printf ("Caught IV %d.\n", a.i);
+      }
+  }
+
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d || wrong;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/rvalue1.cpp b/tests/device/test-stlport_static-exception/jni/rvalue1.cpp
new file mode 100644
index 0000000..277d594
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/rvalue1.cpp
@@ -0,0 +1,52 @@
+// { dg-do run  }
+// PRMS Id: 6000
+// Bug: g++ gets confused trying to build up a reference to a cast.
+
+class String {
+protected:
+  char *cp;
+public:
+  String(char *incp);
+  String(const String &constStringRef);
+  virtual void virtualFn1(void) const {;}
+};
+
+String::String(char *incp)
+{
+  cp = incp;
+}
+
+String::String(const String &constStringRef)
+{
+// Right here, do an 'info args', and look at the virtual function table
+// pointer: typically junk! Calling the function through that table could
+// do anything, since we're really leaping off into the void. This example
+// goes down with 'SIGBUS', but I've seen 'SIGSEGV' too, and 'SIGILL' is
+// possible.
+
+  cp = constStringRef.cp;
+  constStringRef.virtualFn1();
+}
+
+void foofun(String string)
+{
+  ;
+}
+
+class Class1 {
+public:
+  Class1(const String & constStringRef);
+};
+
+Class1 :: Class1 (const String & constStringRef)
+{
+// If instead of calling the function 'foofun()' here, we just assign
+// 'constStringRef' to a local variable, then the vptr is typically == 0!
+
+  foofun(String(constStringRef));
+}
+
+int main(void)
+{
+  Class1 *class1 = new Class1((char*) "Hi!");
+}
diff --git a/tests/device/test-stlport_static-exception/jni/singleton.cpp b/tests/device/test-stlport_static-exception/jni/singleton.cpp
new file mode 100644
index 0000000..2a27ca3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/singleton.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// This tests two things:
+// 1. there is an annoying warning.
+// singleton.C:26: warning: `class singleton' only defines private constructors and has no friends
+// egcs fails to see that there is a public static accessor function.
+// 2. the program crashes, because apparently the static variable s in
+// singleton::instance() is considered constructed although the ctor
+// exited via an exception. (crash changed to nonzero return here)
+
+class singleton {
+public:
+       static singleton& instance() {
+               static singleton s;
+               return s;
+       }
+       int check() {return initialized;}
+
+private:
+       singleton() : initialized(1) {
+               if ( counter++ == 0 ) throw "just for the heck of it";
+               initialized = 2;
+       }
+       singleton( const singleton& rhs );
+       void operator=( const singleton& rhs );
+       int initialized;
+       static int counter;
+};  
+
+int singleton::counter;
+
+int main()
+{
+       while (1) {
+               try {
+                       return singleton::instance().check()-2;
+               } catch (...) { }
+       }
+}
+
diff --git a/tests/device/test-stlport_static-exception/jni/spbp.cpp b/tests/device/test-stlport_static-exception/jni/spbp.cpp
new file mode 100644
index 0000000..181e65d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spbp.cpp
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-gdwarf-2" } */
+/* { dg-skip-if "No Dwarf" { { *-*-aix* hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */
+
+/* This was a bug on x86-darwin, where the register numbering for SP
+   and BP was swapped (it's easy to do because on that port it's
+   different for eh_frame and debug_frame).  */
+
+#include <stdlib.h>
+
+void f1(int t)
+{
+  char u[t];
+  throw 1;
+}
+
+int main()
+{
+  bool b = true;
+  try {
+    f1(100);
+  } catch (int x) {
+    if (b)
+      exit (0);
+  }
+  abort ();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec1.cpp b/tests/device/test-stlport_static-exception/jni/spec1.cpp
new file mode 100644
index 0000000..0ff8883
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec1.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 1: the original exception succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (char, int, std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 0;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec2.cpp b/tests/device/test-stlport_static-exception/jni/spec2.cpp
new file mode 100644
index 0000000..5c7a913
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec2.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 2: the second throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (int, std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 0;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec3.cpp b/tests/device/test-stlport_static-exception/jni/spec3.cpp
new file mode 100644
index 0000000..20bcfc3
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec3.cpp
@@ -0,0 +1,24 @@
+// PR c++/4381
+// Test that exception-specs work properly for classes with virtual bases.
+
+// { dg-do run }
+
+class Base {};
+
+struct A : virtual public Base
+{
+  A() {}
+};
+
+struct B {};
+
+void func() throw (B,A)
+{
+  throw A();
+}
+
+int main(void)
+{
+  try {	func(); }
+  catch (A& a) { }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec3_1.cpp b/tests/device/test-stlport_static-exception/jni/spec3_1.cpp
new file mode 100644
index 0000000..6239270
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec3_1.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 3: the bad_exception throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (std::bad_exception)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 0;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec4.cpp b/tests/device/test-stlport_static-exception/jni/spec4.cpp
new file mode 100644
index 0000000..e1f702e
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec4.cpp
@@ -0,0 +1,39 @@
+// { dg-do run  }
+// Testing exception specifications.
+// Test 4: all throws fail, call terminate.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (0); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (short)
+{
+  throw 'a';
+}
+
+int main ()
+{
+  std::set_terminate (my_term);
+  std::set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (std::bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec5.cpp b/tests/device/test-stlport_static-exception/jni/spec5.cpp
new file mode 100644
index 0000000..be8f327
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec5.cpp
@@ -0,0 +1,22 @@
+// Test for extension to allow incomplete types in an
+// exception-specification for a declaration.
+
+// { dg-do run }
+// { dg-options "-fpermissive -w" }
+
+struct A;
+
+struct B
+{
+  void f () throw (A);
+};
+
+struct A {};
+
+void B::f () throw (A) {}
+
+int main ()
+{
+  B b;
+  b.f();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec7.cpp b/tests/device/test-stlport_static-exception/jni/spec7.cpp
new file mode 100644
index 0000000..e013ba9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec7.cpp
@@ -0,0 +1,35 @@
+// PR 14535
+// { dg-do run }
+// { dg-options "-O -finline" }
+//
+// Original test case failure required that Raiser constructor be inlined.
+
+extern "C" void abort(); 
+bool destructor_called = false; 
+
+struct B { 
+  virtual void Run(){}; 
+}; 
+
+  struct D : public B { 
+    virtual void Run() 
+    { 
+      struct O { 
+        ~O() { destructor_called = true; }; 
+      } o; 
+
+      struct Raiser { 
+        Raiser()  throw( int ) {throw 1;}; 
+      } raiser; 
+    }; 
+  }; 
+
+int main() { 
+  try { 
+    D d; 
+    static_cast<B&>(d).Run(); 
+  } catch (...) {} 
+
+  if (!destructor_called)
+    abort (); 
+} 
diff --git a/tests/device/test-stlport_static-exception/jni/spec7_1.cpp b/tests/device/test-stlport_static-exception/jni/spec7_1.cpp
new file mode 100644
index 0000000..2ef88a2
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec7_1.cpp
@@ -0,0 +1,20 @@
+// { dg-do run  }
+// Test that we allow simple throw specs on pointers.
+
+void f() throw () { }
+void (*pf)() throw () = f;
+
+struct A
+{
+  void g() throw () { }
+  static void (A::*pmf)() throw ();
+};
+
+void (A::* A::pmf)() = &A::g;
+
+int main()
+{
+  pf ();
+  A a;
+  (a.*A::pmf)();
+}
diff --git a/tests/device/test-stlport_static-exception/jni/spec9.cpp b/tests/device/test-stlport_static-exception/jni/spec9.cpp
new file mode 100644
index 0000000..9e00d1c
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/spec9.cpp
@@ -0,0 +1,19 @@
+// PR c++/15745
+// { dg-do run }
+
+typedef int IntArray[10];
+IntArray i;
+
+void test_array() throw (IntArray)
+{
+  throw i;
+}
+
+int main ()
+{
+  try
+    {
+      test_array();
+    }
+  catch (IntArray) {}
+}
diff --git a/tests/device/test-stlport_static-exception/jni/synth2.cpp b/tests/device/test-stlport_static-exception/jni/synth2.cpp
new file mode 100644
index 0000000..2da814d
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/synth2.cpp
@@ -0,0 +1,24 @@
+// PR c++/24580
+// { dg-do run }
+
+struct vbase {};
+
+struct foo : virtual vbase
+{
+  foo()
+  {
+    throw "exception in foo ctor";
+  }
+};
+
+struct bar :  public foo {};
+
+int main()
+{
+  try
+    {
+      bar a;
+    }
+  catch ( ... ) { }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/template1.cpp b/tests/device/test-stlport_static-exception/jni/template1.cpp
new file mode 100644
index 0000000..2cbf9c6
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/template1.cpp
@@ -0,0 +1,38 @@
+// Test whether exception specifier dependent on template parameter
+// is accepted during template decl processing.
+// { dg-do run }
+
+extern "C" void abort();
+
+class A {};
+
+template <class T>
+struct B
+{
+  typedef A E;
+};
+
+template <class T>
+struct C
+{
+  typedef B<T> D;
+  typedef typename D::E E;
+  void f() throw(E) { throw E(); }
+};
+
+int main()
+{
+  int caught = 0;
+  try
+    {
+      C<int> x;
+      x.f();
+    }
+  catch (A)
+    {
+      ++caught;
+    }
+  if (caught != 1)
+    abort ();
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/terminate1.cpp b/tests/device/test-stlport_static-exception/jni/terminate1.cpp
new file mode 100644
index 0000000..09dd84f
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/terminate1.cpp
@@ -0,0 +1,28 @@
+// { dg-do run  }
+// Test that an exception thrown out of the constructor for the exception
+// object (i.e. "after completing evaluation of the expression to be thrown
+// but before the exception is caught") causes us to call terminate.
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+struct A
+{
+  A () {}
+  A (const A&) { throw 1; }
+};
+
+int main (void)
+{
+  std::set_terminate (my_terminate);
+
+  A a;
+  try { throw a; }
+  catch (...) {}
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/terminate2.cpp b/tests/device/test-stlport_static-exception/jni/terminate2.cpp
new file mode 100644
index 0000000..3a31158
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/terminate2.cpp
@@ -0,0 +1,17 @@
+// { dg-do run  }
+// Test that an unhandled exception causes us to call terminate.
+
+#include <exception>
+#include <cstdlib>
+
+void my_terminate ()
+{
+  std::exit (0);
+}
+
+int main (void)
+{
+  std::set_terminate (my_terminate);
+  throw 1;
+  return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/throw-1.cpp b/tests/device/test-stlport_static-exception/jni/throw-1.cpp
new file mode 100644
index 0000000..b1d2e27
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/throw-1.cpp
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k,l,m,n;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+	  for (k=0; k < j; k++)
+	  for (l=0; l < k; l++)
+	  for (m=0; m < l; m++)
+	  for (n=0; n < m; n++)
+     		global2 = k;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+	throw 0;
+}
+
+void foo()
+{
+	bar();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  foo();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/throw-2.cpp b/tests/device/test-stlport_static-exception/jni/throw-2.cpp
new file mode 100644
index 0000000..5f3f1dc
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/throw-2.cpp
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+     		global2 = k;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+	throw 0;
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/throw-3.cpp b/tests/device/test-stlport_static-exception/jni/throw-3.cpp
new file mode 100644
index 0000000..d3e53b8
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/throw-3.cpp
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+     		global2 = k;
+	throw 0;
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/throw-4.cpp b/tests/device/test-stlport_static-exception/jni/throw-4.cpp
new file mode 100644
index 0000000..a9c15bd
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/throw-4.cpp
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+
+#include "check.h"
+
+#ifndef ALIGNMENT
+#define ALIGNMENT       64
+#endif
+
+typedef int t_align __attribute__((aligned(ALIGNMENT)));
+
+
+int global, global2;
+void bar()
+{
+	volatile t_align a = 1;
+        int i,j,k;
+        i=j=k=0;
+  	for (i=0; i < global; i++)
+	  for (j=0; j < i; j++)
+	    {
+	      global2 = k;
+	      throw 0;
+	    }
+	if (check_int ((int *) &a,  __alignof__(a)) != a)
+	  abort ();
+}
+
+int main()
+{
+	int ll = 1;
+        int i = 0,j = 1,k = 2,l = 3,m = 4,n = 5;
+	try {
+  	  for (; i < global; i++)
+	  for (; j < i; j++)
+	  for (; k < j; k++)
+	  for (; l < k; l++)
+	  for (; m < l; m++)
+	  for (; n < m; n++)
+     		global2 = k;
+	  bar ();
+	}
+	catch (...)
+	{
+	}
+	ll = i+j+k+l+m+n;
+	if (ll != 15)
+	{
+#ifdef DEBUG
+		printf("FAIL: sum %d != 15\n", ll);
+#endif
+		abort();
+	}
+	return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/tmpl1.cpp b/tests/device/test-stlport_static-exception/jni/tmpl1.cpp
new file mode 100644
index 0000000..985fcae
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/tmpl1.cpp
@@ -0,0 +1,16 @@
+// { dg-do run  }
+template <class T>
+void f() throw (T)
+{
+  throw 7;
+}
+
+
+int main()
+{
+  try {
+    f<int>();
+  } catch (...) {
+    return 0;
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/unexpected1.cpp b/tests/device/test-stlport_static-exception/jni/unexpected1.cpp
new file mode 100644
index 0000000..e5982ff
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/unexpected1.cpp
@@ -0,0 +1,46 @@
+// PR 3719
+// Test that an unexpected handler can rethrow to categorize.
+// { dg-do run }
+
+#include <exception>
+
+extern "C" void abort ();
+
+struct One { };
+struct Two { };
+
+static void
+handle_unexpected ()
+{
+  try
+  {
+    throw;
+  }
+  catch (One &)
+  {
+    throw Two ();
+  }
+}
+
+static void
+doit () throw (Two)
+{
+  throw One ();
+}
+
+int main ()
+{
+  std::set_unexpected (handle_unexpected);
+
+  try
+  {
+    doit ();
+  }
+  catch (Two &)
+  {
+  }
+  catch (...)
+  {
+    abort ();
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/unroll1.cpp b/tests/device/test-stlport_static-exception/jni/unroll1.cpp
new file mode 100644
index 0000000..94705d9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/unroll1.cpp
@@ -0,0 +1,420 @@
+// PR optimization/12340
+// Origin: Richard Guenther <richard.guenther@uni-tuebingen.de>
+// Testcase by Eric Botcazou <ebotcazou@libertysurf.fr>
+
+// This used to segfault on x86 because the loop optimizer wrongly
+// interpreted a double assignment to a biv as a double increment,
+// which subsequently fooled the unroller.
+
+// { dg-do run }
+// { dg-options "-O2 -fno-exceptions -funroll-loops" }
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void operator delete (void*, void*) throw() { };
+
+class Loc;
+class Interval;
+
+template<class DT>
+class DomainBase
+{
+public:
+  typedef typename DT::Domain_t Domain_t;
+  typedef typename DT::Storage_t Storage_t;
+
+  Domain_t &unwrap() { return *static_cast<Domain_t *>(this); }
+
+  const Domain_t &unwrap() const {
+    return *static_cast<Domain_t *>(const_cast<DomainBase<DT> *>(this));
+  }
+
+protected:
+  Storage_t domain_m;
+};
+
+template<class DT>
+class Domain : public DomainBase<DT>
+{
+  typedef DomainBase<DT> Base_t;
+
+public:
+  typedef typename DT::Size_t Size_t;
+  typedef typename DT::Element_t Element_t;
+  typedef typename Base_t::Domain_t Domain_t;
+  typedef typename Base_t::Storage_t Storage_t;
+
+  Domain_t &operator[](int) { return this->unwrap(); }
+
+  const Domain_t &operator[](int) const { return this->unwrap(); }
+
+  template<class T>
+  void setDomain(const T &newdom) {
+    DT::setDomain(this->domain_m, newdom);
+  }
+
+  Element_t first() const { return DT::first(this->domain_m); }
+
+  Size_t length() const { return DT::length(this->domain_m); }
+
+  Size_t size() const { return length(); }
+};
+
+template<class T>
+struct DomainTraits;
+
+template<>
+struct DomainTraits<Interval>
+{
+  typedef int Size_t;
+  typedef int Element_t;
+  typedef Interval Domain_t;
+  typedef Interval OneDomain_t;
+  typedef Loc AskDomain_t;
+  typedef int Storage_t[2];
+  enum { dimensions = 1 };
+  enum { wildcard = false };
+
+  static int first(const Storage_t &d) { return d[0]; }
+
+  static int length(const Storage_t &d) { return d[1]; }
+
+  static OneDomain_t &getDomain(Domain_t &d, int) { return d; }
+
+  static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; }
+
+  template<class T>
+  static void setDomain(Storage_t &dom, const T &newdom) {
+    dom[0] = newdom.first();  
+    dom[1] = newdom.length();
+  }
+
+  template<class T1, class T2>
+  static void setDomain(Storage_t &dom, const T1 &begval, const T2 &endval) {
+    dom[0] = begval;
+    dom[1] = (endval - begval + 1);
+  }
+
+};
+
+class Interval : public Domain<DomainTraits<Interval> >
+{
+public:
+  Interval(const Interval &a) : Domain<DomainTraits<Interval> >() {    
+    for (int i=0; i < DomainTraits<Interval>::dimensions; ++i)
+      DomainTraits<Interval>::getDomain(*this, i).setDomain(
+                                DomainTraits<Interval>::getDomain(a, i));
+  }
+
+  Interval(int a) : Domain<DomainTraits<Interval> >()
+  {
+    DomainTraits<Interval>::setDomain(domain_m, 0, a - 1);
+  }
+};
+
+template<>
+struct DomainTraits<Loc>
+{
+  typedef int Size_t;
+  typedef int Element_t;
+  typedef Loc Domain_t;
+  typedef Loc AskDomain_t;
+  typedef Loc MultResult_t;
+  typedef int Storage_t;
+
+  static int first(int d) { return d; }
+
+  template<class T>
+  static void setDomain(int &dom, const T &newdom) {
+    dom = DomainTraits<T>::getFirst(newdom);
+  }
+};
+
+template<>
+struct DomainTraits<int>
+ {
+  enum { dimensions = 1 };
+  enum { wildcard = false };
+
+  static int getPointDomain(int d, int) { return d; }
+
+  static int getFirst(const int &d) { return d; }
+};
+
+class Loc : public Domain<DomainTraits<Loc> >
+{
+public:
+  explicit Loc(const int &a) : Domain<DomainTraits<Loc> >() {
+    for (int i=0; i < 1; ++i)
+      (*this)[i].setDomain(DomainTraits<int>::getPointDomain(a, 0));
+  }
+};
+
+struct ElementProperties
+{
+  enum { hasTrivialDefaultConstructor = false };
+  enum { hasTrivialDestructor = false };
+
+  static void construct(double* addr)
+  {
+    new (addr) double();
+  }
+
+  static void construct(double* addr, const double& model)
+  {
+    new (addr) double(model);
+  }
+
+  static void destruct(double *addr) {}
+};
+
+class RefCounted
+{
+public:
+  RefCounted() : count_m(0) {}
+
+  void addReference() { ++count_m; }
+  bool removeRefAndCheckGarbage()
+  {
+    return (--count_m == 0);
+  }
+
+private:
+  int count_m;
+};
+
+class RefBlockController : public RefCounted
+{
+public:
+  explicit RefBlockController(unsigned int size)
+    : pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0), dealloc_m(false)
+  {
+    reallocateStorage(size, false);
+
+    if (!ElementProperties::hasTrivialDefaultConstructor)
+      {
+        for (double * pt = begin(); pt != end(); ++pt)
+          ElementProperties::construct(pt);
+      }
+  }
+  
+  ~RefBlockController()
+  {
+    deleteStorage();
+  }
+
+  double *begin() const
+  {
+    return pBegin_m;
+  }
+
+  double *end() const
+  {
+    return pEnd_m;
+  }
+
+  bool isMine() const
+  {
+    return dealloc_m;
+  }
+
+private:
+  void deleteStorage()
+  {
+    if (isMine() && pBegin_m != 0)
+      {
+        if (!ElementProperties::hasTrivialDestructor)
+          for (double *pt = begin(); pt != end(); ++pt)
+            ElementProperties::destruct(pt);
+
+        char *tmp = reinterpret_cast<char *>(pBegin_m);
+        delete [] tmp;
+      }
+  }
+
+  void reallocateStorage(unsigned int newsize, bool copyold = false)
+  {
+    double *pBeginNew = 0;
+    double *pEndNew = 0;
+    double *pEndOfStorageNew = 0;
+
+    if (newsize > 0)
+      {
+        int nsize = newsize * sizeof(double);
+        char *tmp = new char[nsize];
+        pBeginNew = reinterpret_cast<double *>(tmp);
+        pEndNew = pBeginNew + newsize;
+        pEndOfStorageNew = pBeginNew + (nsize / sizeof(double));
+
+        if (copyold)
+          {
+            double * pOld = begin();
+            double * pNew = pBeginNew;
+            while (pOld != end() && pNew != pEndNew)
+              ElementProperties::construct(pNew++,*pOld++);
+          }
+      }
+
+    deleteStorage();
+
+    pBegin_m = pBeginNew;
+    pEnd_m = pEndNew;
+    pEndOfStorage_m = pEndOfStorageNew;
+    dealloc_m = true;
+  }
+
+  double *pBegin_m;
+  double *pEnd_m;
+  double *pEndOfStorage_m;
+  bool dealloc_m;
+};
+
+class DataBlockController : public RefBlockController
+{
+public:
+  explicit
+  DataBlockController(unsigned int size)
+    : RefBlockController(size), dataObjectPtr_m(new char), owned_m(true) {}
+
+  ~DataBlockController()
+  {
+    if (owned_m) delete dataObjectPtr_m;
+  }
+
+private:
+  mutable char *dataObjectPtr_m;
+  bool owned_m;
+};
+
+class RefCountedPtr
+{
+public:
+  RefCountedPtr(DataBlockController * const pT) : ptr_m(pT)
+    { if (isValid()) ptr_m->addReference(); }
+
+  ~RefCountedPtr() { invalidate(); }
+
+  DataBlockController* operator->() const { return ptr_m; }
+  void invalidate();
+  bool isValid() const { return ptr_m != 0; }
+
+private:
+  friend class RefCountedBlockPtr;
+  DataBlockController * ptr_m;
+};
+
+inline void RefCountedPtr::invalidate()
+{
+  if ( isValid() && ptr_m->removeRefAndCheckGarbage() )
+    delete ptr_m;
+  ptr_m = 0;
+}
+
+class RefCountedBlockPtr
+{
+public:
+  explicit RefCountedBlockPtr(unsigned int size)
+    : offset_m(0),
+      blockControllerPtr_m(new DataBlockController(size)) {}
+
+  int offset() const
+  {
+    return offset_m;
+  }
+
+  double *beginPointer() const
+  {
+    return blockControllerPtr_m->begin();
+  }
+
+  double *currentPointer() const
+  {
+    return beginPointer() + offset();
+  }
+
+protected:
+  int offset_m;
+  RefCountedPtr blockControllerPtr_m;
+};
+
+class DataBlockPtr : public RefCountedBlockPtr
+{
+public:
+  explicit DataBlockPtr(unsigned int size) : RefCountedBlockPtr(size) {}
+};
+
+class Node
+{
+public:
+  Node(const Interval &owned, const Interval &allocated)
+    : domain_m(owned), allocated_m(allocated) {}
+
+  const Interval &allocated() const { return allocated_m; }
+
+private:
+  Interval domain_m;
+  Interval allocated_m;
+};
+
+class DomainLayout
+{
+public:
+  explicit DomainLayout(const Interval &dom) : node_m(0, dom) {}
+
+  const Interval &domain() const
+  {
+    return node_m.allocated();
+  }
+
+private:
+  Node node_m;
+};
+
+class BrickBase
+{
+public:
+  explicit BrickBase(const Interval &domain);
+
+  int offset(const Loc &dom) const { return off_m + dom[0].first(); }
+
+protected:
+  DomainLayout layout_m;
+  int firsts_m;
+  int off_m;
+};
+
+BrickBase::BrickBase(const Interval &dom)
+  : layout_m(dom)
+{
+  firsts_m = layout_m.domain()[0].first();
+  off_m = -firsts_m;
+}
+
+class Engine : public BrickBase
+{
+public:
+  explicit Engine(const Interval &dom)
+  : BrickBase(dom), dataBlock_m(dom.size()), data_m(dataBlock_m.currentPointer()) {}
+
+  double& operator()(const Loc &loc) const
+  {
+    return data_m[this->offset(loc)];
+  }
+
+private:
+  DataBlockPtr dataBlock_m;
+  double *data_m;
+};
+
+int
+main()
+{
+  Interval I(10);
+  Engine A(I);
+
+  for (int i = 0; i < 10; i++)
+    A(Loc(i)) = 2.0 + i - i*i;
+
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/unwind1.cpp b/tests/device/test-stlport_static-exception/jni/unwind1.cpp
new file mode 100644
index 0000000..076b550
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/unwind1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Test that unwinding properly restores SP.
+// Contributed by Jason Merrill <jason@cygnus.com>
+
+void f (int i)
+{
+  throw i;
+}
+
+int main ()
+{  
+  void *sp1 = __builtin_alloca (0);
+
+  try
+    {
+      f (0);
+    }
+  catch (int)
+    {
+    }
+
+  void *sp2 = __builtin_alloca (0);
+
+  return (sp1 != sp2);
+}
diff --git a/tests/device/test-stlport_static-exception/jni/variadic73.cpp b/tests/device/test-stlport_static-exception/jni/variadic73.cpp
new file mode 100644
index 0000000..7bff85b
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/variadic73.cpp
@@ -0,0 +1,33 @@
+// { dg-do "run" }
+// { dg-options "-std=gnu++0x" }
+struct A {};
+struct B {};
+struct C {};
+
+template<typename... Exceptions> void f(int idx) throw(Exceptions...) {
+  if (idx == 0) throw A();
+  else if (idx == 1) throw B();
+  else if (idx == 2) throw C();
+}
+
+extern "C" void abort();
+
+int main()
+{
+  try {
+    f<A, B, C>(0);
+    abort();
+  } catch (A) {
+  }
+  try {
+    f<A, B, C>(1);
+    abort();
+  } catch (B) {
+  }
+  try {
+    f<A, B, C>(2);
+    abort();
+  } catch (C) {
+  }
+  return 0;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/vbase1_1.cpp b/tests/device/test-stlport_static-exception/jni/vbase1_1.cpp
new file mode 100644
index 0000000..96766d6
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/vbase1_1.cpp
@@ -0,0 +1,25 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+int j;
+
+struct B
+{
+  B() { i = 1; }
+  ~B() { j = 7; }
+};
+
+struct D : virtual public B {
+  D () { throw 3; }
+};
+
+int main ()
+{
+  try {
+    D d;
+  } catch (int) {
+    if (i != 1 || j != 7)
+      return 1;
+  }
+}
diff --git a/tests/device/test-stlport_static-exception/jni/vbase2_1.cpp b/tests/device/test-stlport_static-exception/jni/vbase2_1.cpp
new file mode 100644
index 0000000..eaae9d9
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/vbase2_1.cpp
@@ -0,0 +1,35 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+
+struct A
+{
+  A () { i++; }
+  ~A () { i--; }
+};
+
+struct B : public virtual A
+{
+  B () { throw 1; }
+};
+
+struct D: public B, virtual public A
+{
+};
+
+void f()
+{
+  D d;
+}
+
+int main ()
+{
+  try {
+    f();
+  } catch (int) {
+  }
+
+  return i;
+}
+
diff --git a/tests/device/test-stlport_static-exception/jni/vbase2_2.cpp b/tests/device/test-stlport_static-exception/jni/vbase2_2.cpp
new file mode 100644
index 0000000..812b547
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/vbase2_2.cpp
@@ -0,0 +1,37 @@
+// { dg-do run  }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+int i;
+
+struct A
+{
+  ~A ();
+};
+
+A::~A () {
+  i = 1;
+}
+
+struct B : virtual public A {
+};
+
+struct C {
+  C ();
+
+  B b;
+};
+
+C::C () {
+  throw 3;
+}
+
+int main () 
+{
+  try { 
+    C c;
+  } catch (...) {
+  }
+
+  if (i != 1)
+    return 1;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/vbase4_1.cpp b/tests/device/test-stlport_static-exception/jni/vbase4_1.cpp
new file mode 100644
index 0000000..f151ed0
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/vbase4_1.cpp
@@ -0,0 +1,40 @@
+// { dg-do run  }
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
+
+// Derived from PR#7
+
+// We need to destroy the thrown object when exiting the catch
+// clause. That needs to destroy the original thrown object, not
+// the caught one (which might be a base).
+
+static int ok = 0;
+
+struct A
+{
+  A (){}
+  virtual ~A () {}
+};
+
+struct B : virtual A
+{
+  int value;
+  B ()
+    :value(10)
+    {}
+  ~B()
+  {
+    if (value == 10)
+      ok = 1;
+  }
+};
+
+int main()
+{
+  try {
+    throw B ();
+  } catch (A & e) {
+  }
+  return !ok;
+}
diff --git a/tests/device/test-stlport_static-exception/jni/vtable2.cpp b/tests/device/test-stlport_static-exception/jni/vtable2.cpp
new file mode 100644
index 0000000..008cfe5
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/vtable2.cpp
@@ -0,0 +1,213 @@
+// { dg-do run  }
+// { dg-options "-fno-strict-aliasing" }
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+
+#include <stddef.h>
+
+struct S0
+{
+  virtual void s0 ();
+};
+
+struct S1 : virtual public S0
+{
+  virtual void s1 ();
+};
+
+struct S2 : virtual public S1
+{
+  virtual void s1 ();
+  virtual void s0 ();
+};
+
+struct S3
+{
+  virtual void s3 ();
+};
+
+struct S4 : public S3, virtual public S2
+{
+  virtual void s1 ();
+};
+
+void S0::s0 ()
+{
+}
+
+void S1::s1 ()
+{
+}
+
+void S2::s1 ()
+{
+}
+
+void S2::s0 ()
+{
+}
+
+void S3::s3 ()
+{
+}
+
+void S4::s1 ()
+{
+}
+
+/* The vtables should look like:
+
+   S0 primary vtable
+   
+     S0 offset to top
+     S0 RTTI
+     S0::s0
+
+   =================
+
+   S1 primary vtable
+
+     S0::s0 vcall offset
+     S0 vbase offset
+     S1 offset to top
+     S1 RTTI
+     S0::s0
+     S1::s1
+
+   =================
+
+   S2 primary vtable
+   
+     S2::s1 vcall offset
+     S1 vbase offset
+     S2::s0 vcall offset
+     S0 vbase offset
+     S2 offset to top
+     S2 RTTI
+     S2::s0
+     S2::s1
+
+   =================
+
+   S3 primary vtable
+
+     S3 offset to top
+     S3 RTTI
+     S3::s3
+
+   =================
+
+   S4 primary vtable
+
+     vbase offset for S0
+     vbase offset for S1
+     vbase offset for S2
+     S4 offset to top
+     S4 RTTI
+     S3::s3
+     S4::s1
+
+   S2-in-S4 secondary vtable
+
+     S1 vbase offset
+     S4::s1 vcall offset
+     S0 vbase offset
+     S2:s0 vcall offset
+     S2 offset to top
+     S4 RTTI
+     S2::s0
+     S4::s1
+
+*/
+
+// These are tricks to allow us to get raw function pointers for
+// member functions.
+extern "C" {
+  /* We can use weakref here without dg-require-weak, because we know
+     the symbols are defined, so we don't actually issue the .weak
+     directives.  */
+  static void S3_s3 () __attribute__((__weakref__ ("_ZN2S32s3Ev")));
+  static void S4_s1 () __attribute__((__weakref__ ("_ZN2S42s1Ev")));
+}
+
+// IA-64 uses function descriptors not function pointers in its vtables.
+#if defined __ia64__
+#define CMP_VPTR(A, B)	(*(void **)(A) == *(void **)(B))
+#ifdef _LP64
+#define INC_VPTR(A)	((A) += 2)
+#define INC_VDATA(A,N)	((A) += (N))
+#else
+#define INC_VPTR(A)	((A) += 4)
+#define INC_VDATA(A,N)	((A) += 2*(N))
+#endif
+#else
+#define CMP_VPTR(A, B)	(*(A) == (ptrdiff_t)(B))
+#define INC_VPTR(A)	((A) += 1)
+#define INC_VDATA(A,N)	((A) += (N))
+#endif
+
+int main ()
+{
+  S4 s4;
+  ptrdiff_t **vptr;
+  ptrdiff_t *vtbl;
+
+  // Set vtbl to point at the beginning of S4's primary vtable.
+  vptr = (ptrdiff_t **) &s4;
+  vtbl = *vptr;
+  INC_VDATA (vtbl, -5);
+
+  if (*vtbl != ((char*) (S0*) &s4) - (char*) &s4)
+    return 1;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != ((char*) (S1*) &s4) - (char*) &s4)
+    return 2;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != ((char*) (S2*) &s4) - (char*) &s4)
+    return 3;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 4;
+  INC_VDATA (vtbl, 1);
+  // Skip the RTTI entry.
+  INC_VDATA (vtbl, 1);
+  if (! CMP_VPTR (vtbl, &S3_s3))
+    return 5;
+  INC_VPTR (vtbl);
+  if (! CMP_VPTR (vtbl, &S4_s1))
+    return 6;
+  INC_VPTR (vtbl);
+  // The S1 vbase offset.
+  if (*vtbl != 0)
+    return 7;
+  INC_VDATA (vtbl, 1);
+  // The S4::s1 vcall offset is negative; once you convert to S2, you
+  // have to convert to S4 to find the final overrider.
+  if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4))
+    return 8;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 9;
+  INC_VDATA (vtbl, 1);
+  if (*vtbl != 0)
+    return 10;
+  INC_VDATA (vtbl, 1);
+  // Now we're at the S2 offset to top entry.
+  if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4))
+    return 11;
+  INC_VDATA (vtbl, 1);
+  // Skip the RTTI entry.
+  INC_VDATA (vtbl, 1);
+  // Skip the reint maining virtual functions -- they are thunks.
+  INC_VPTR (vtbl);
+  INC_VPTR (vtbl);
+}
+
+#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
+
+int main ()
+{
+}
+
+#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
diff --git a/tests/device/test-stlport_static-exception/jni/weak1.cpp b/tests/device/test-stlport_static-exception/jni/weak1.cpp
new file mode 100644
index 0000000..f78d195
--- /dev/null
+++ b/tests/device/test-stlport_static-exception/jni/weak1.cpp
@@ -0,0 +1,23 @@
+// PR target/29487
+// { dg-do run { xfail { hppa*-*-hpux* && { ! hppa*64*-*-* } } } }
+// { dg-require-weak-override "" }
+// { dg-additional-sources "weak1-a.cc" }
+// { dg-options "-O2" }
+
+extern __attribute__((weak)) 
+void f() {
+}
+
+int main () {
+  try {
+    f();
+    return 1;
+  } catch (int i) {
+    /* Although the implementation of f in this file does not throw
+       any exceptions, it is weak, and may therefore be replaced at
+       link time.  Therefore, the compiler must not optimize away this
+       catch clause.  */
+    if (i != 7)
+      return 2;
+  }
+}
diff --git a/tests/run-tests-all.sh b/tests/run-tests-all.sh
index 82a877d..a7b2643 100755
--- a/tests/run-tests-all.sh
+++ b/tests/run-tests-all.sh
@@ -61,15 +61,21 @@
 NDK_TOOLCHAIN_VERSION=clang3.1 ./run-tests.sh --continue-on-build-fail --full
 
 if [ "$SYSTEM" = "linux-x86" -a -d "$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/windows" ] ; then
-    # enumerate all cases using windows toolchain
-    dump "### Running windows 4.7 full tests"
-    NDK_TOOLCHAIN_VERSION=4.7 ./run-tests.sh --continue-on-build-fail --full --wine
-    dump "### Running windows 4.6 full tests"
-    NDK_TOOLCHAIN_VERSION=4.6 ./run-tests.sh --continue-on-build-fail --full --wine
-    dump "### Running windows 4.4.3 full tests"
-    NDK_TOOLCHAIN_VERSION=4.4.3 ./run-tests.sh --continue-on-build-fail --full --wine
-    dump "### Running windows clang 3.1 full tests"
-    NDK_TOOLCHAIN_VERSION=clang3.1 ./run-tests.sh --continue-on-build-fail --full --wine
+    find_program WINE wine
+    if [ -n "$WINE" ]; then
+        WINE_VERSION=`$WINE --version`
+        if [ -n "$WINE_VERSION" -a "$WINE_VERSION" != "wine-1.4" ]; then
+            # enumerate all cases using windows toolchain
+            dump "### Running windows 4.7 tests"
+            NDK_TOOLCHAIN_VERSION=4.7 ./run-tests.sh --continue-on-build-fail --wine # --full
+            dump "### Running windows 4.6 tests"
+            NDK_TOOLCHAIN_VERSION=4.6 ./run-tests.sh --continue-on-build-fail --wine # --full
+            dump "### Running windows 4.4.3 tests"
+            NDK_TOOLCHAIN_VERSION=4.4.3 ./run-tests.sh --continue-on-build-fail --wine # --full
+            dump "### Running windows clang 3.1 tests"
+            NDK_TOOLCHAIN_VERSION=clang3.1 ./run-tests.sh --continue-on-build-fail --wine # --full
+        fi
+    fi
 fi
 
 # add more if you want ...
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 48ba4ef..3855dd6 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -34,7 +34,7 @@
 
 # The list of tests that are too long to be part of a normal run of
 # run-tests.sh. Most of these do not run properly at the moment.
-LONG_TESTS="prebuild-stlport test-stlport test-gnustl"
+LONG_TESTS="prebuild-stlport test-stlport test-gnustl-full test-stlport_shared-exception test-stlport_static-exception"
 
 #
 # Parse options
diff --git a/toolchains/arm-linux-androideabi-clang3.1/setup.mk b/toolchains/arm-linux-androideabi-clang3.1/setup.mk
index 2a47cc2..6670288 100644
--- a/toolchains/arm-linux-androideabi-clang3.1/setup.mk
+++ b/toolchains/arm-linux-androideabi-clang3.1/setup.mk
@@ -39,8 +39,8 @@
 TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(TOOLCHAIN_ROOT))
 TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/arm-linux-androideabi-
 
-TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang
-TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++
+TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang$(HOST_EXEEXT)
+TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++$(HOST_EXEEXT)
 
 #
 # CFLAGS and LDFLAGS
diff --git a/toolchains/mipsel-linux-android-clang3.1/setup.mk b/toolchains/mipsel-linux-android-clang3.1/setup.mk
index 56115c5..fb7d396 100644
--- a/toolchains/mipsel-linux-android-clang3.1/setup.mk
+++ b/toolchains/mipsel-linux-android-clang3.1/setup.mk
@@ -39,8 +39,8 @@
 TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(TOOLCHAIN_ROOT))
 TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/mipsel-linux-android-
 
-TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang
-TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++
+TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang$(HOST_EXEEXT)
+TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++$(HOST_EXEEXT)
 
 #
 # CFLAGS, C_INCLUDES, and LDFLAGS
diff --git a/toolchains/x86-clang3.1/setup.mk b/toolchains/x86-clang3.1/setup.mk
index 40e3c08..50d0a8c 100644
--- a/toolchains/x86-clang3.1/setup.mk
+++ b/toolchains/x86-clang3.1/setup.mk
@@ -39,8 +39,8 @@
 TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(TOOLCHAIN_ROOT))
 TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/i686-linux-android-
 
-TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang
-TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++
+TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang$(HOST_EXEEXT)
+TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++$(HOST_EXEEXT)
 
 LLVM_TRIPLE := i686-none-linux-android