diff -r a3b3a8c53056 contrib/dg-extract-results.sh
--- a/contrib/dg-extract-results.sh	Sun Jan 30 16:27:16 2011 +0100
+++ b/contrib/dg-extract-results.sh	Sun Jan 30 22:24:35 2011 +0100
@@ -6,7 +6,7 @@
 # The resulting file can be used with test result comparison scripts for
 # results from tests that were run in parallel.  See usage() below.
 
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation
+# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation
 # Contributed by Janis Johnson <janis187@us.ibm.com>
 #
 # This file is part of GCC.
@@ -142,65 +142,6 @@
   fi
 fi
 
-if [ "$TOOL" = acats ]; then
-  # Acats *.sum or *.log files aren't dejagnu generated, and they have
-  # somewhat different format.
-  ACATS_AWK=${TMP}/acats.awk
-  cat <<EOF > $ACATS_AWK
-BEGIN {
-  print_prologue=1; curfile=""; insummary=0
-  passcnt=0; failcnt=0; unsupcnt=0; failures=""
-}
-/^[ \t]*=== acats configuration ===/ {
-  insummary=0
-  if (print_prologue) print
-  next
-}
-/^[ \t]*=== acats tests ===/ {
-  if (print_prologue) print
-  print_prologue=0
-  next
-}
-/^Running chapter / {
-  if (curfile) close (curfile)
-  curfile="${TMP}/chapter-"\$3
-  print >> curfile
-  next
-}
-/^[ \t]*=== acats Summary ===/ {
-  if (curfile) close (curfile)
-  curfile=""
-  insummary=1
-  next
-}
-/^# of expected passes/		{ if (insummary == 1) passcnt += \$5; next; }
-/^# of unexpected failures/	{ if (insummary == 1) failcnt += \$5; next; }
-/^# of unsupported tests/	{ if (insummary == 1) unsupcnt += \$5; next; }
-/^\*\*\* FAILURES: / {
-  if (insummary == 1) {
-    if (failures) sub(/^\*\*\* FAILURES:/,"")
-    failures=failures""\$0
-  }
-}
-{
-  if (print_prologue) { print; next }
-  if (curfile) print >> curfile
-}
-END {
-  system ("cat ${TMP}/chapter-*")
-  print "		=== acats Summary ==="
-  print "# of expected passes		" passcnt
-  print "# of unexpected failures	" failcnt
-  if (unsupcnt) print "# of unsupported tests		" unsupcnt
-  if (failures) print failures
-}
-EOF
-
-  rm -f ${TMP}/chapter-*
-  $AWK -f $ACATS_AWK $SUM_FILES
-  exit 0
-fi
-
 # If no variants were specified, find all variants in the remaining
 # summary files.  Otherwise, ignore specified variants that aren't in
 # any of those summary files.
diff -r a3b3a8c53056 gcc/ada/gcc-interface/Make-lang.in
--- a/gcc/ada/gcc-interface/Make-lang.in	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/ada/gcc-interface/Make-lang.in	Sun Jan 30 22:24:35 2011 +0100
@@ -1,6 +1,6 @@
 # Top level -*- makefile -*- fragment for GNU Ada (GNAT).
 #   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   Free Software Foundation, Inc.
 
 #This file is part of GCC.
@@ -992,53 +992,28 @@
 	-$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stagefeedback/ada
 	-$(MV) ada/stamp-* stagefeedback/ada
 
+check-ada: check-gnat
+check-ada-subtargets: check-gnat-subtargets
+
 lang_checks += check-gnat
-
-check-ada: check-acats check-gnat
-check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
-
-ACATSDIR = $(TESTSUITEDIR)/ada/acats
-
-check_acats_targets = $(patsubst %,check-acats%, 0 1 2)
-
-check-acats:
-	@test -d $(ACATSDIR) || mkdir -p $(ACATSDIR); \
-	rootme=`${PWD_COMMAND}`; export rootme; \
-	EXPECT=$(EXPECT); export EXPECT; \
-	if [ -z "$(CHAPTERS)" ] && [ "$(filter -j, $(MFLAGS))" = "-j" ]; \
-	then \
-	  $(MAKE) $(check_acats_targets); \
-	  for idx in 0 1 2; do \
-	    mv -f $(ACATSDIR)$$idx/acats.sum $(ACATSDIR)$$idx/acats.sum.sep; \
-	    mv -f $(ACATSDIR)$$idx/acats.log $(ACATSDIR)$$idx/acats.log.sep; \
-	  done; \
-	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh \
-	    $(ACATSDIR)0/acats.sum.sep $(ACATSDIR)1/acats.sum.sep \
-	    $(ACATSDIR)2/acats.sum.sep > $(ACATSDIR)/acats.sum; \
-	  $(SHELL) $(srcdir)/../contrib/dg-extract-results.sh -L \
-	    $(ACATSDIR)0/acats.log.sep $(ACATSDIR)1/acats.log.sep \
-	    $(ACATSDIR)2/acats.log.sep > $(ACATSDIR)/acats.log; \
-	  exit 0; \
-	fi; \
-	testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
-	export testdir; cd $(ACATSDIR) && $(SHELL) $${testdir}/run_acats $(CHAPTERS)
-
-check-acats-subtargets:
-	@echo $(check_acats_targets)
-
-# Parallelized check-acats
-$(check_acats_targets): check-acats%:
-	test -d $(ACATSDIR)$* || mkdir -p $(ACATSDIR)$*; \
-	testdir=`cd ${srcdir}/${ACATSDIR} && ${PWD_COMMAND}`; \
-	case "$*" in \
-	  0) chapters="`cd $$testdir/tests; echo [a-b]* c[0-4]*`";; \
-	  1) chapters="`cd $$testdir/tests; echo c[5-9ab]*`";; \
-	  2) chapters="`cd $$testdir/tests; echo c[c-z]* [d-z]*`";; \
-	esac; \
-	export testdir; cd $(ACATSDIR)$* && $(SHELL) $${testdir}/run_acats $$chapters
-
-.PHONY: check-acats $(check_acats_targets)
-
+lang_checks_parallelized += check-gnat
+# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
+# FIXME: Adapt when ada/acats/tests gets moved to gnat.acats or simply omit
+# the directory.
+check_gnat_parallelize = acats.exp=tests/\[ab\]* \
+			acats.exp=tests/c\[1-2\]* \
+			acats.exp=tests/c3* \
+			acats.exp=tests/c4* \
+			acats.exp=tests/c\[567\]* \
+			acats.exp=tests/c8* \
+			acats.exp=tests/c9* \
+			acats.exp=tests/c\[ab\]* \
+			acats.exp=tests/cc* \
+			acats.exp=tests/cd* \
+			acats.exp=tests/ce* \
+			acats.exp=tests/c\[f-w\]* \
+			acats.exp=tests/c\[x-z\]* \
+			acats.exp=tests/\[d-z\]*
 
 # Bootstrapping targets for just GNAT - use the same stage directories
 gnatboot: force
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/support/impdef.a
--- a/gcc/testsuite/ada/acats/support/impdef.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/support/impdef.a	Sun Jan 30 22:24:35 2011 +0100
@@ -202,7 +202,7 @@
    function Cd30005_Proc (X : Integer) return Integer;
    pragma Import (C, Cd30005_Proc, "_cd30005_1");
  
-   pragma Linker_Options ("ACATS4GNATDIR/support/cd300051.o");
+   pragma Linker_Options ("support/cd300051.o");
  
    CD30005_1_Foreign_Address : constant System.Address:= Cd30005_Proc'Address;
  
@@ -315,7 +315,7 @@
    -- will expect to find the files to process at this location.
 
    Test_Path_Root : constant String :=
-     "ACATS4GNATDIR/tests/c2/";
+     "tests/";
    -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --- MODIFY HERE AS NEEDED
 
    -- The following two strings must not be modified unless the .AW file
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/a/ac3106a.ada
--- a/gcc/testsuite/ada/acats/tests/a/ac3106a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/a/ac3106a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- AC3106A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34005p.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34005p.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34005p.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34005P.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34005r.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34005r.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34005r.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34005R.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34005s.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34005s.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34005s.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34005S.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34005u.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34005u.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34005u.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34005U.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34005v.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34005v.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34005v.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34005V.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34006g.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34006g.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34006g.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34006G.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34006j.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34006j.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34006j.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34006J.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34006l.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34006l.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34006l.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34006L.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c34008a.ada
--- a/gcc/testsuite/ada/acats/tests/c3/c34008a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c34008a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C34008A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c3/c3a0014.a
--- a/gcc/testsuite/ada/acats/tests/c3/c3a0014.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c3/c3a0014.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C3A0014.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c41103b.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c41103b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c41103b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C41103B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c41203b.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c41203b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c41203b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C41203B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c41306a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c41306a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c41306a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C41306A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45304a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c45304a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45304a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45304A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45304b.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45304b.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45304b.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45304B.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45304c.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45304c.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45304c.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45304C.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45504a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c45504a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45504a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45504A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45504b.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45504b.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45504b.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45504B.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45504c.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45504c.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45504c.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45504C.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45613a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c45613a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45613a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45613A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45613b.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45613b.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45613b.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45613B.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45613c.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45613c.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45613c.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45613C.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45632a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c45632a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45632a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45632A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45632b.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45632b.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45632b.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45632B.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c45632c.dep
--- a/gcc/testsuite/ada/acats/tests/c4/c45632c.dep	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c45632c.dep	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C45632C.DEP
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c460008.a
--- a/gcc/testsuite/ada/acats/tests/c4/c460008.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c460008.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C460008.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c460011.a
--- a/gcc/testsuite/ada/acats/tests/c4/c460011.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c460011.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C460011.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c46014a.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c46014a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c46014a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C46014A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c460a01.a
--- a/gcc/testsuite/ada/acats/tests/c4/c460a01.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c460a01.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C460A01.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c4/c4a012b.ada
--- a/gcc/testsuite/ada/acats/tests/c4/c4a012b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c4/c4a012b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnato" }
+
 -- C4A012B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c5/c52103x.ada
--- a/gcc/testsuite/ada/acats/tests/c5/c52103x.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c5/c52103x.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- C52103X.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c5/c52104x.ada
--- a/gcc/testsuite/ada/acats/tests/c5/c52104x.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c5/c52104x.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- C52104X.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c5/c52104y.ada
--- a/gcc/testsuite/ada/acats/tests/c5/c52104y.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c5/c52104y.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- C52104Y.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c6/c650001.a
--- a/gcc/testsuite/ada/acats/tests/c6/c650001.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c6/c650001.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C650001.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c7/c731001.a
--- a/gcc/testsuite/ada/acats/tests/c7/c731001.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c7/c731001.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
 -- C731001.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c7/c74302b.ada
--- a/gcc/testsuite/ada/acats/tests/c7/c74302b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c7/c74302b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C74302B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c7/c74306a.ada
--- a/gcc/testsuite/ada/acats/tests/c7/c74306a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c7/c74306a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C74306A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c85014a.ada
--- a/gcc/testsuite/ada/acats/tests/c8/c85014a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c85014a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C85014A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c85014b.ada
--- a/gcc/testsuite/ada/acats/tests/c8/c85014b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c85014b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C85014B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c85014c.ada
--- a/gcc/testsuite/ada/acats/tests/c8/c85014c.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c85014c.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C85014C.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c854002.a
--- a/gcc/testsuite/ada/acats/tests/c8/c854002.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c854002.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
 -- C854002.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c87b26b.ada
--- a/gcc/testsuite/ada/acats/tests/c8/c87b26b.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c87b26b.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C87B26B.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c8/c87b41a.ada
--- a/gcc/testsuite/ada/acats/tests/c8/c87b41a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c8/c87b41a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C87B41A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/c9/c99004a.ada
--- a/gcc/testsuite/ada/acats/tests/c9/c99004a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/c9/c99004a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- C99004A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/ca/ca11018.a
--- a/gcc/testsuite/ada/acats/tests/ca/ca11018.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/ca/ca11018.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
 -- CA11018.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/ca/ca11019.a
--- a/gcc/testsuite/ada/acats/tests/ca/ca11019.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/ca/ca11019.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
 -- CA11019.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/ca/ca5006a.ada
--- a/gcc/testsuite/ada/acats/tests/ca/ca5006a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/ca/ca5006a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnatE" }
+
 -- CA5006A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cb/cb1010a.ada
--- a/gcc/testsuite/ada/acats/tests/cb/cb1010a.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cb/cb1010a.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- CB1010A.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cb/cb1010c.ada
--- a/gcc/testsuite/ada/acats/tests/cb/cb1010c.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cb/cb1010c.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- CB1010C.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cb/cb1010d.ada
--- a/gcc/testsuite/ada/acats/tests/cb/cb1010d.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cb/cb1010d.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -fstack-check" }
+
 -- CB1010D.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cb/cb40005.a
--- a/gcc/testsuite/ada/acats/tests/cb/cb40005.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cb/cb40005.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CB40005.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cc/cc3019c0.ada
--- a/gcc/testsuite/ada/acats/tests/cc/cc3019c0.ada	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cc/cc3019c0.ada	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CC3019C0.ADA
 
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cc/cc51b03.a
--- a/gcc/testsuite/ada/acats/tests/cc/cc51b03.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cc/cc51b03.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CC51B03.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cc/cc51d02.a
--- a/gcc/testsuite/ada/acats/tests/cc/cc51d02.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cc/cc51d02.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CC51D02.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cd/cd10002.a
--- a/gcc/testsuite/ada/acats/tests/cd/cd10002.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cd/cd10002.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CD10002.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cd/cdd2a03.a
--- a/gcc/testsuite/ada/acats/tests/cd/cdd2a03.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cd/cdd2a03.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CDD2A03.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cxa/cxac005.a
--- a/gcc/testsuite/ada/acats/tests/cxa/cxac005.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cxa/cxac005.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -gnat95" }
+
 -- CXAC005.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/ada/acats/tests/cxh/cxh1001.a
--- a/gcc/testsuite/ada/acats/tests/cxh/cxh1001.a	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/ada/acats/tests/cxh/cxh1001.a	Sun Jan 30 22:24:35 2011 +0100
@@ -1,3 +1,5 @@
+-- { dg-options "-O2 -a -f" }
+--
 -- CXH1001.A
 --
 --                             Grant of Unlimited Rights
diff -r a3b3a8c53056 gcc/testsuite/gnat.acats/acats.exp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/gnat.acats/acats.exp	Sun Jan 30 22:24:35 2011 +0100
@@ -0,0 +1,55 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 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 GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib gnat-dg.exp
+
+# If a testcase doesn't have special options, use these.
+# FIXME: CFLAGS seems wrong for Ada, cf. gcc/ada/Make*.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS "-O2"
+}
+
+# The ACATS tests are all run tests.
+set saved-dg-do-what ${dg-do-what-default}
+set dg-do-what-default run
+
+# FIXME: Look in old ACATS directory for the moment.
+set saved-srcdir $srcdir
+set srcdir "$srcdir/ada/acats/tests"
+
+# Initialize `dg'
+dg-init
+gnat-acats-init
+
+# Main loop.
+# Some source files are preprocessed, so search testdir, too.
+# Only use first one of multifile testcases.
+gnat-dg-acats-runtest [lsort \
+	[glob -nocomplain $srcdir/*/???????{,0}.{a,ada,adt,am,dep} \
+		tests/???????{,0}.{a,ada,adt,am,dep}]] \
+	"" "$DEFAULT_CFLAGS"
+
+set srcdir ${saved-srcdir}
+set dg-do-what-default ${saved-dg-do-what}
+
+# All done.
+dg-finish
+gnat-acats-finish
+
+# Unset again so gnat.dg isn't affected.
+unset DEFAULT_CFLAGS
diff -r a3b3a8c53056 gcc/testsuite/lib/gnat-dg.exp
--- a/gcc/testsuite/lib/gnat-dg.exp	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/lib/gnat-dg.exp	Sun Jan 30 22:24:35 2011 +0100
@@ -33,16 +33,18 @@
 
     # Remove additional output files apart from $output_file, which may be
     # needed by dg-final.
+    # FIXME: Don't clean ACATS support files.
     set output_file [lindex $result 1]
     set basename [file rootname $output_file]
     set clean_result [remote_exec host [find_gnatclean] "-c -q -n $basename"]
     if { [lindex $clean_result 0] != -1 } {
 	set clean_files [lindex $clean_result 1]
 	# Purge NL from clean_files.
-	regsub -all "\[\r\n\]+" $clean_files " " clean_files
+	regsub -all "\[\n\r\]+" $clean_files " " clean_files
 	# Remove ./ so lremove works.
 	regsub -all "\./" $clean_files "" clean_files
 	lremove clean_files $output_file
+	verbose -log "clean_files = $clean_files"
 	eval remote_file host delete $clean_files
     }
 
@@ -57,9 +59,142 @@
     lappend additional_prunes "fatal error: maximum errors reached"
     lappend additional_prunes "linker input file"
 
+    # FIXME: Explain.
+    # Probably unnecessary with -gnato -gnatE for support files, but maybe
+    # need to move support files to subdir to avoid cleaning them.
+    #lappend additional_prunes "report.adb:312"
+
     return [gcc-dg-prune $system $text]
 }
 
+proc acats-get-options { src } {
+    # dg-options sets a variable called dg-extra-tool-flags.
+    set dg-extra-tool-flags ""
+
+    # current_compiler_flags reads tool_flags from the same stack frame
+    # as dg-extra-tool-flags
+    set tool_flags ""
+
+    set tmp [dg-get-options $src]
+    foreach op $tmp {
+	set cmd [lindex $op 0]
+	if { ![string compare "dg-options" $cmd] } {
+	    set status [catch "$op" errmsg]
+	    if { $status != 0 } {
+		perror "$src: $errmsg for \"$op\"\n"
+		unresolved "$src: $errmsg for \"$op\""
+		return
+	    }
+	} else {
+	    # Ignore unrecognized dg- commands, but warn about them.
+	    warning "gnat-dg.exp does not support $cmd"
+	}
+    }
+
+    # Return flags to use for compiling the primary source file and for
+    # linking.
+    return ${dg-extra-tool-flags}
+}
+
+proc gnat-dg-acats-runtest { testcases flags default-extra-flags } {
+    global runtests
+    global board_info
+
+    # FIXME: Better use set_board_info, unset_board_info from targetdb.exp?
+    # Or global var or uplevel N info proc ...?
+    set board_info(gnat,acats) 1
+
+    verbose -log "testcases = $testcases"
+    foreach testcase $testcases {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $testcase] {
+	    continue
+	}
+	verbose "Testing [file tail [file dirname $testcase]]/[file tail $testcase]"
+	
+	verbose -log "testcase = $testcase"
+
+	if [string match "*/???????0.*" $testcase] {
+	    regsub "0\\..*" $testcase "?.{a,ada,adt,am,dep}" testpattern
+	    set testfiles [lsort [glob -nocomplain $testpattern]]
+	} else {
+	    set testfiles $testcase
+	}
+	verbose -log "testfiles = $testfiles"
+
+	# FIXME: Perhaps move to gnat_init?
+	gnat_set_ada_env_vars
+
+	# FIXME: Determine options from testcase source.
+	set extra_flags [acats-get-options $testcase]
+	if { $extra_flags != "" } {
+	    set save_flags $flags
+	    eval lappend flags $extra_flags
+	}
+
+	set chop_result [remote_exec target [find_gnatchop] "-c -w $testfiles"]
+	if { [lindex $chop_result 0] != -1 } {
+	    set chop_files [lindex $chop_result 1]
+	    # Filter out comments so sources are not removed.
+	    regsub -all "splitting \[^\n\r\]+ into:\[\n\r\]+" $chop_files "" chop_files
+	    # FIXME: Filter out "warning:.*", "<N> warning(s)"
+	    # Purge NL from chop_files.
+	    regsub -all "\[\n\r\]+" $chop_files " " chop_files
+	    verbose -log "chop_files = $chop_files"
+	}
+
+	set basename [file rootname [file tail $testcase]]
+	verbose -log "basename = $basename"
+	switch -glob $basename {
+	    "cxb30*" {
+		# FIXME: Handle via
+		# -- { dg-additional-files "cxb30040.o cxb30060.o cxb30130.o cxb30131.o" }
+		# but already passes without!?
+		
+	    }
+	    "ca1020e*" {
+		remote_file host delete ca1020e_func1.adb ca1020e_func2.adb \
+		    ca1020e_proc1.adb ca1020e_proc2.adb
+	    }
+	    "ca14028*" {
+		remote_file host delete ca14028_func2.ads ca14028_func3.ads \
+		    ca14028_proc1.ads ca14028_proc3.ads
+	    }
+	    "cxh1001*" {
+		set out [open gnat.adc w]
+		puts $out "pragma Normalize_Scalars;"
+		close $out
+		# FIXME: Rename to clean_files.
+		lappend chop_files gnat.adc
+	    }
+	}
+
+	# Change testcase to reflect this.
+	# FIXME: use gnatls -u instead?
+	set basename [file rootname [file tail $testcase]]
+	# Take only 7 characters.
+	set basename [string range $basename 0 6]
+	verbose -log "basename = $basename"
+	set mainfiles [lsort [glob -nocomplain $basename?.adb]]
+	eval lappend mainfiles [lsort [glob -nocomplain $basename*m.adb]]
+	eval lappend mainfiles [lsort [glob -nocomplain $basename.adb]]
+	set testcase [lindex $mainfiles [expr [llength $mainfiles]-1]]
+	verbose -log "testcase = $testcase"
+
+	dg-test $testcase $flags ${default-extra-flags}
+
+	eval remote_file host delete $chop_files
+
+	# Restore flags for next testcase.
+	if { $extra_flags != "" } {
+	    set flags $save_flags
+	}
+    }
+
+    unset board_info(gnat,acats)
+}
+
 # Utility routines.
 
 #
@@ -79,7 +214,23 @@
 	if { [regexp "tasking not implemented" $output] } {
 	    return [list "unsupported" $output]
 	}
-	return $result
+
+	#
+	# For ACATS tests, PASS or FAIL doesn't depend on exit status, but
+	# on test output.  Cf. report.adb:
+	#
+	# status		pattern
+	#
+	# PASS			==== 
+	# DOES_NOT_APPLY	++++ 
+	# ACTION_REQUIRED	!!!! 
+	# OTHERS		**** 
+	#
+	if { [regexp {==== |\+\+\+\+ |!!!! } $output] } {
+	    return [list "pass" $output]
+	} else {
+	    return $result
+	}
     }
 }
 
diff -r a3b3a8c53056 gcc/testsuite/lib/gnat.exp
--- a/gcc/testsuite/lib/gnat.exp	Sun Jan 30 16:27:16 2011 +0100
+++ b/gcc/testsuite/lib/gnat.exp	Sun Jan 30 22:24:35 2011 +0100
@@ -25,6 +25,7 @@
 load_lib gcc-defs.exp
 load_lib gcc.exp
 load_lib timeout.exp
+load_lib copy-file.exp
 
 #
 # GNAT_UNDER_TEST is the compiler under test.
@@ -107,14 +108,172 @@
     }
 }
 
+# Build ACATS support files first, but not in gnat_init which is generic.
+proc gnat-acats-init { } {
+    global srcdir
+    global target_triplet
+    global env
+
+    # FIXME: Explain.  Adapt later.
+    set support $srcdir/../support
+
+    # FIXME: Only put *.tst files from tests into ., place support file in
+    # support subdir?
+    # FIXME: subdir necessary?  Doesn't show up in test names anyway, but
+    # helps to distinguish testcases from support files.
+    #remote_load host [which mkdir] c2
+    file mkdir tests
+    file mkdir support
+
+    gnat_target_compile $support/impbit.adb impbit executable ""
+    set result [remote_exec target impbit "" ""]
+    if { [lindex $result 0] != -1 } {
+	set target_bit [lindex $result 1]
+	# Purge NL from target_bit.
+	regsub -all "\[\r\n\]+" $target_bit "" target_bit
+	verbose -log "target_bit = $target_bit"
+    }
+    # FIXME: Cleanup.
+    # Currently handled in gnat-dg-test, move elsewhere, perhaps
+    # gnat_target_compile?
+    eval remote_exec target [find_gnatclean] impbit
+
+    switch $target_triplet {
+	"ia64*-*-*" -
+	"s390*-*-*" {
+	    set target_insn "nop 0"
+	}
+	"mmix-*-*" {
+	    set target_insn "swym 0"
+	}
+	default {
+	    set target_insn "nop"
+	}
+    }
+    verbose -log "target_insn = $target_insn"
+
+    # Unset environment variables that interfere with host compiler.
+    if { [info exists env(ADA_INCLUDE_PATH)] } {
+	verbose -log "unsetting ADA_INCLUDE_PATH"
+	set orig_ada_include_path $env(ADA_INCLUDE_PATH)
+	unsetenv ADA_INCLUDE_PATH
+    }
+    if { [info exists env(ADA_OBJECTS_PATH)] } {
+	verbose -log "unsetting ADA_OBJECTS_PATH"
+	set orig_ada_objects_path $env(ADA_OBJECTS_PATH)
+	unsetenv ADA_OBJECTS_PATH
+    }
+    if { [info exists env(GCC_EXEC_PREFIX)] } {
+	verbose -log "unsetting GCC_EXEC_PREFIX"
+	set orig_gcc_exec_prefix $env(GCC_EXEC_PREFIX)
+	unsetenv GCC_EXEC_PREFIX
+    }
+
+    # FIXME: Loop to avoid overflowing command line.
+    remote_exec host [which gnatchop] \
+	"-c -w [glob -nocomplain $support/*.{a,ada}] support"
+
+    set inp [open $support/macro.dfs r]
+    set out [open MACRO.DFS w]
+    while { [gets $inp line] >= 0 } {
+	regsub -all "ACATS4GNATBIT" $line $target_bit line
+	regsub -all "ACATS4GNATINSN" $line $target_insn line
+	puts $out $line
+    }
+    close $inp
+    close $out
+
+    gcc_copy_files [glob -nocomplain $srcdir/*/*.tst] tests
+    gcc_copy_files [glob -nocomplain $support/*.tst] support
+    set out [open TSTTESTS.DAT w]
+    foreach tst [glob -nocomplain */*.tst] {
+	puts $out $tst
+    }
+    close $out
+
+    remote_exec host [which gnatmake] "-q -gnatws support/macrosub.adb"
+    remote_load host ./macrosub
+    eval remote_exec host [which gnatclean] macrosub
+    file_on_host delete MACRO.DFS
+    file_on_host delete TSTTESTS.DAT
+
+    # FIXME: How to properly locate host CC?
+    # Place into support subdir.
+    remote_exec host [which gcc] "-c $srcdir/cd/cd300051.c -o support/cd300051.o"
+
+    # Copy c2/c25000[12].aw into build dir.
+    gcc_copy_files [glob -nocomplain $srcdir/c2/*.aw] tests
+
+    remote_exec host [which gnatmake] "-q -gnatws support/widechr.adb"
+    remote_load host ./widechr
+    eval remote_exec host [which gnatclean] widechr
+
+    # Restore environment variables.
+    if { $orig_ada_include_path != "" } {
+	setenv ADA_INCLUDE_PATH $orig_ada_include_path
+    }
+    if { $orig_ada_objects_path != "" } {
+	setenv ADA_OBJECTS_PATH $orig_ada_objects_path
+    }
+    if { $orig_gcc_exec_prefix != "" } {
+	setenv GCC_EXEC_PREFIX $orig_gcc_exec_prefix
+    }
+
+    foreach src [glob -nocomplain $srcdir/*/*.c] {
+	set obj support/[file rootname [file tail $src]].o
+	gnat_target_compile $src $obj object ""
+    }
+
+    # FIXME: Loop to avoid overflowing command line?
+    remote_exec target [find_gnatchop] \
+	"-c -w [glob -nocomplain tests/*.adt tests]"
+    remote_exec target [find_gnatchop] \
+	"-c -w [glob -nocomplain support/*.adt support]"
+
+    # FIXME: Really compile *.ads?
+    # Compile all at once?
+    # Two loops, first over *.ads, then over *.adb?
+    lappend opts "additional_flags=-gnatws -O2 -gnato -gnatE -D support"
+    foreach src [glob -nocomplain support/*.ad\[sb\]] {
+	set obj [file rootname [file tail $src]].o
+	gnat_target_compile $src $obj object $opts
+    }
+}
+
+# Cleanup ACATS support files.
+proc gnat-acats-finish { } {
+    # FIXME: Maybe remember file lists in gnat-acats-init?
+    # Simply remove support and tests subdirs.
+}
+
+proc gnat_set_ada_env_vars { } {
+    global rtsdir
+
+    if [info exists TOOL_OPTIONS] {
+	set rtsdir "[get_multilibs ${TOOL_OPTIONS}]/libada"
+    } else {
+	set rtsdir "[get_multilibs]/libada"
+    }
+
+    # gnatlink looks for system.ads itself and has no --RTS option, so
+    # specify via environment
+    setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
+    setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
+    # Always log so compilations can be repeated manually.
+    verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
+    verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
+}
+
 proc gnat_target_compile { source dest type options } {
     global rootme
     global tmpdir
     global gluefile wrap_flags
     global srcdir
+    global rtsdir
     global GNAT_UNDER_TEST
     global TOOL_OPTIONS
     global gnat_target_current
+    global board_info
 
     # dg-require-effective-target tests must be compiled as C.
     if [ string match "*.c" $source ] then {
@@ -125,30 +284,29 @@
     # GNAT_UNDER_TEST and the appropriate RTS.
     if { $gnat_target_current!="[current_target_name]" } {
 	set gnat_target_current "[current_target_name]"
-	if [info exists TOOL_OPTIONS] {
-	    set rtsdir "[get_multilibs ${TOOL_OPTIONS}]/libada"
-	} else {
-	    set rtsdir "[get_multilibs]/libada"
-	}
+
+	gnat_set_ada_env_vars
+
 	if [info exists TOOL_EXECUTABLE] {
 	    set GNAT_UNDER_TEST "$TOOL_EXECUTABLE"
 	} else {
 	    set GNAT_UNDER_TEST "[local_find_gnatmake]"
 	}
         set GNAT_UNDER_TEST "$GNAT_UNDER_TEST --RTS=$rtsdir"
-
-	# gnatlink looks for system.ads itself and has no --RTS option, so
-	# specify via environment
-	setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
-	setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
-	# Always log so compilations can be repeated manually.
-	verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
-	verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
     }
 
-    lappend options "compiler=$GNAT_UNDER_TEST -q -f"
+    # FIXME: Is -f necessary/desirable for gnat.dg?  It hurts for gnat.acats.
+    #lappend options "compiler=$GNAT_UNDER_TEST -q -f"
+    lappend options "compiler=$GNAT_UNDER_TEST -q"
     lappend options "timeout=[timeout_value]"
 
+    # FIXME: What's right here, target_info or board_info?
+    if [info exists board_info(gnat,acats)] {
+	# Pass -Isupport to locate support files.
+	# FIXME: Why -gnatws?
+	lappend options "additional_flags=-Isupport -gnatws"
+    }
+
     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
 	lappend options "libs=${gluefile}"
 	lappend options "ldflags=$wrap_flags"
@@ -234,6 +392,26 @@
     return $gnatclean
 }
 
+proc find_gnatchop {} {
+    global tool_root_dir
+
+    if ![is_remote host] {
+        set file [lookfor_file $tool_root_dir gnatchop]
+        if { $file == "" } {
+	    set file [lookfor_file $tool_root_dir gcc/gnatchop]
+        }
+        if { $file != "" } {
+	    set root [file dirname $file]
+	    set CC "$file --GCC=$root/xgcc";
+        } else {
+	    set CC [transform gnatchop]
+        }
+    } else {
+        set CC [transform gnatchop]
+    }
+    return $CC
+}
+
 # Local Variables:
 # tcl-indent-level:4
 # End:
