aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@the-meissners.org>2011-11-22 20:39:52 +0000
committerMichael Meissner <meissner@the-meissners.org>2011-11-22 20:39:52 +0000
commitc1d31fd56bee64aeab0e7ac21d1dc60aa4b7da22 (patch)
tree9ea23e5af605beb09120efa901042f8c0087797e
parent2f6dfd3ac1f3f1cd110c5e18f7039cfb331947b7 (diff)
parent84a6a88fd7241ce145de3e6ae43afa0b344b4f83 (diff)
Merge up to 181632
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/meissner-bc8@181636 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog13
-rw-r--r--MAINTAINERS4
-rw-r--r--boehm-gc/ChangeLog4
-rwxr-xr-xboehm-gc/configure12
-rw-r--r--config/ChangeLog4
-rw-r--r--config/weakref.m448
-rw-r--r--contrib/ChangeLog4
-rw-r--r--contrib/make_sunver.pl3
-rw-r--r--gcc/ChangeLog326
-rw-r--r--gcc/ChangeLog.meissner5
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/REVISION2
-rw-r--r--gcc/ada/ChangeLog466
-rw-r--r--gcc/ada/a-cbdlli.adb51
-rw-r--r--gcc/ada/a-cfdlli.adb68
-rw-r--r--gcc/ada/a-finali.ads6
-rw-r--r--gcc/ada/adaint.c8
-rwxr-xr-xgcc/ada/aspects.adb6
-rwxr-xr-xgcc/ada/aspects.ads3
-rw-r--r--gcc/ada/checks.adb34
-rw-r--r--gcc/ada/env.c2
-rw-r--r--gcc/ada/exp_attr.adb129
-rw-r--r--gcc/ada/exp_ch6.adb76
-rw-r--r--gcc/ada/exp_imgv.adb134
-rw-r--r--gcc/ada/exp_prag.adb9
-rw-r--r--gcc/ada/exp_util.adb78
-rw-r--r--gcc/ada/freeze.adb4
-rw-r--r--gcc/ada/frontend.adb6
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in313
-rw-r--r--gcc/ada/gcc-interface/Makefile.in12
-rw-r--r--gcc/ada/gcc-interface/decl.c179
-rw-r--r--gcc/ada/gcc-interface/trans.c226
-rw-r--r--gcc/ada/gcc-interface/utils.c16
-rw-r--r--gcc/ada/gcc-interface/utils2.c8
-rw-r--r--gcc/ada/gnat_rm.texi14
-rw-r--r--gcc/ada/gnat_ugn.texi51
-rw-r--r--gcc/ada/init.c4
-rw-r--r--gcc/ada/layout.adb102
-rw-r--r--gcc/ada/lib-load.adb19
-rw-r--r--gcc/ada/lib-load.ads3
-rw-r--r--gcc/ada/lib-xref.adb10
-rw-r--r--gcc/ada/lib.ads4
-rw-r--r--gcc/ada/opt.ads5
-rw-r--r--gcc/ada/par-ch4.adb5
-rw-r--r--gcc/ada/par-ch6.adb4
-rw-r--r--gcc/ada/par-prag.adb1
-rw-r--r--gcc/ada/restrict.adb147
-rw-r--r--gcc/ada/restrict.ads92
-rw-r--r--gcc/ada/rtsfind.ads2
-rw-r--r--gcc/ada/s-atocou-builtin.adb14
-rw-r--r--gcc/ada/s-finmas.adb6
-rwxr-xr-xgcc/ada/s-os_lib.ads2
-rw-r--r--gcc/ada/s-rident.ads12
-rw-r--r--gcc/ada/s-stposu.adb58
-rw-r--r--gcc/ada/s-stposu.ads7
-rw-r--r--gcc/ada/s-taprop-irix.adb16
-rw-r--r--gcc/ada/s-taprop-linux.adb57
-rw-r--r--gcc/ada/s-taprop-posix.adb8
-rw-r--r--gcc/ada/s-taprop-solaris.adb8
-rw-r--r--gcc/ada/s-taprop-vms.adb8
-rwxr-xr-xgcc/ada/s-utf_32.adb3
-rw-r--r--gcc/ada/sem.adb27
-rw-r--r--gcc/ada/sem_attr.adb42
-rw-r--r--gcc/ada/sem_ch10.adb27
-rw-r--r--gcc/ada/sem_ch12.adb20
-rw-r--r--gcc/ada/sem_ch3.adb36
-rw-r--r--gcc/ada/sem_ch6.adb102
-rw-r--r--gcc/ada/sem_elab.adb27
-rw-r--r--gcc/ada/sem_prag.adb101
-rw-r--r--gcc/ada/sem_res.adb60
-rw-r--r--gcc/ada/sem_util.adb44
-rw-r--r--gcc/ada/sem_util.ads12
-rw-r--r--gcc/ada/sinfo.adb18
-rw-r--r--gcc/ada/sinfo.ads25
-rw-r--r--gcc/ada/sinput.ads73
-rw-r--r--gcc/ada/snames.ads-tmpl2
-rw-r--r--gcc/ada/sysdep.c73
-rw-r--r--gcc/ada/types.ads8
-rw-r--r--gcc/ada/vms_data.ads18
-rw-r--r--gcc/config/arm/arm.c45
-rw-r--r--gcc/config/avr/avr-c.c15
-rw-r--r--gcc/config/avr/avr-devices.c36
-rw-r--r--gcc/config/avr/avr-protos.h12
-rw-r--r--gcc/config/avr/avr.c1873
-rw-r--r--gcc/config/avr/avr.h20
-rw-r--r--gcc/config/avr/avr.md485
-rw-r--r--gcc/config/avr/predicates.md5
-rw-r--r--gcc/config/cris/cris-protos.h2
-rw-r--r--gcc/config/cris/cris.c5
-rw-r--r--gcc/config/cris/cris.h6
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c8
-rw-r--r--gcc/config/darwin.h22
-rw-r--r--gcc/config/darwin9.h6
-rw-r--r--gcc/config/i386/darwin.h3
-rw-r--r--gcc/config/i386/emmintrin.h8
-rw-r--r--gcc/config/i386/i386-builtin-types.def2
-rw-r--r--gcc/config/i386/i386.c33
-rw-r--r--gcc/config/i386/i386.md101
-rw-r--r--gcc/config/i386/mmx.md18
-rw-r--r--gcc/config/i386/sse.md150
-rw-r--r--gcc/config/i386/sync.md109
-rw-r--r--gcc/config/mips/mips.c8
-rw-r--r--gcc/config/sparc/sparc-protos.h2
-rw-r--r--gcc/config/sparc/sparc.c65
-rw-r--r--gcc/config/sparc/sparc.h18
-rwxr-xr-xgcc/configure12
-rw-r--r--gcc/coverage.c37
-rw-r--r--gcc/cp/ChangeLog67
-rw-r--r--gcc/cp/cp-tree.def2
-rw-r--r--gcc/cp/cp-tree.h9
-rw-r--r--gcc/cp/error.c1
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/parser.c188
-rw-r--r--gcc/cp/pt.c110
-rw-r--r--gcc/cp/ptree.c4
-rw-r--r--gcc/cp/search.c8
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/cp/typeck.c13
-rw-r--r--gcc/doc/extend.texi1
-rw-r--r--gcc/doc/install.texi3
-rw-r--r--gcc/doc/tm.texi4
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/expmed.c18
-rw-r--r--gcc/expr.c11
-rw-r--r--gcc/fold-const.c6
-rw-r--r--gcc/fortran/ChangeLog14
-rw-r--r--gcc/fortran/class.c3
-rw-r--r--gcc/fortran/trans-decl.c12
-rw-r--r--gcc/fortran/trans.h1
-rw-r--r--gcc/gimple-streamer-in.c4
-rw-r--r--gcc/gimple-streamer-out.c5
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-lang.c17
-rw-r--r--gcc/optabs.c4
-rw-r--r--gcc/opts.c2
-rw-r--r--gcc/output.h1
-rw-r--r--gcc/postreload.c18
-rw-r--r--gcc/reorg.c4
-rw-r--r--gcc/target.def7
-rw-r--r--gcc/testsuite/ChangeLog142
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr33466.c12
-rw-r--r--gcc/testsuite/c-c++-common/tm/malloc.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr51216.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae11.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae26.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae30.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C63
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C27
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C40
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic120.C24
-rw-r--r--gcc/testsuite/g++.dg/debug/using6.C22
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-10.C20
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-11.C42
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-8.C14
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-9.C17
-rw-r--r--gcc/testsuite/g++.dg/lookup/using46.C62
-rw-r--r--gcc/testsuite/g++.dg/lookup/using47.C29
-rw-r--r--gcc/testsuite/g++.dg/lookup/using48.C23
-rw-r--r--gcc/testsuite/g++.dg/lookup/using49.C20
-rw-r--r--gcc/testsuite/g++.dg/template/error46.C11
-rw-r--r--gcc/testsuite/g++.dg/template/unify11.C8
-rw-r--r--gcc/testsuite/g++.dg/tm/pr47747.C21
-rw-r--r--gcc/testsuite/g++.dg/tm/template-2.C22
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44707.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/assert4.c4
-rw-r--r--gcc/testsuite/gcc.dg/delay-slot-2.c116
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c19
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr50765.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr50827.c17
-rw-r--r--gcc/testsuite/gcc.dg/tm/20100615.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr51074.c24
-rw-r--r--gcc/testsuite/gcc.dg/volatile-bitfields-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/vshift-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/vshift-3.c4
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-13.c1
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-16.c12
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-17.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr51235.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr51236.c12
-rw-r--r--gcc/testsuite/gnat.dg/discr32.adb21
-rw-r--r--gcc/testsuite/gnat.dg/discr32_pkg.ads24
-rw-r--r--gcc/testsuite/lib/target-supports.exp4
-rw-r--r--gcc/tracer.c9
-rw-r--r--gcc/trans-mem.c29
-rw-r--r--gcc/tree.c1
-rw-r--r--gcc/tree.def3
-rw-r--r--gcc/var-tracking.c2
-rw-r--r--gcc/varasm.c10
-rw-r--r--libada/ChangeLog2
-rw-r--r--libcpp/ChangeLog12
-rw-r--r--libcpp/expr.c4
-rw-r--r--libcpp/include/line-map.h10
-rw-r--r--libcpp/line-map.c90
-rw-r--r--libffi/ChangeLog4
-rwxr-xr-xlibffi/configure6
-rw-r--r--libgcc/ChangeLog63
-rw-r--r--libgcc/Makefile.in8
-rw-r--r--libgcc/config.host19
-rw-r--r--libgcc/config/avr/lib1funcs.S423
-rw-r--r--libgcc/config/avr/t-avr5
-rw-r--r--libgcc/config/darwin-crt-tm.c83
-rw-r--r--libgcc/config/i386/t-darwin642
-rw-r--r--libgcc/config/sh/t-netbsd2
-rw-r--r--libgcc/config/t-darwin6
-rw-r--r--libgcc/crtstuff.c86
-rw-r--r--libgcc/static-object.mk7
-rw-r--r--libgfortran/ChangeLog4
-rwxr-xr-xlibgfortran/configure12
-rw-r--r--libgomp/ChangeLog4
-rwxr-xr-xlibgomp/configure12
-rw-r--r--libitm/ChangeLog41
-rw-r--r--libitm/Makefile.am20
-rw-r--r--libitm/Makefile.in28
-rw-r--r--libitm/acinclude.m463
-rw-r--r--libitm/aclocal.m41
-rw-r--r--libitm/alloc_cpp.cc4
-rw-r--r--libitm/config.h.in3
-rw-r--r--libitm/config/x86/sjlj.S57
-rw-r--r--libitm/configure158
-rw-r--r--libitm/configure.ac2
-rw-r--r--libitm/eh_cpp.cc4
-rw-r--r--libitm/libitm_i.h8
-rw-r--r--libitm/testsuite/Makefile.in10
-rw-r--r--libitm/testsuite/libitm.c/memcpy-1.c6
-rw-r--r--libitm/testsuite/libitm.c/memset-1.c6
-rw-r--r--libjava/ChangeLog5
-rwxr-xr-xlibjava/configure16
-rw-r--r--libjava/configure.ac2
-rw-r--r--libjava/libltdl/ChangeLog5
-rw-r--r--libjava/libltdl/acinclude.m46
-rwxr-xr-xlibjava/libltdl/configure4
-rw-r--r--libmudflap/ChangeLog4
-rwxr-xr-xlibmudflap/configure6
-rw-r--r--libobjc/ChangeLog4
-rwxr-xr-xlibobjc/configure6
-rw-r--r--libquadmath/ChangeLog4
-rwxr-xr-xlibquadmath/configure6
-rw-r--r--libssp/ChangeLog4
-rwxr-xr-xlibssp/configure6
-rw-r--r--libstdc++-v3/ChangeLog78
-rwxr-xr-xlibstdc++-v3/configure12
-rw-r--r--libstdc++-v3/doc/xml/faq.xml9
-rw-r--r--libstdc++-v3/doc/xml/manual/appendix_contributing.xml25
-rw-r--r--libstdc++-v3/doc/xml/manual/messages.xml5
-rw-r--r--libstdc++-v3/doc/xml/manual/shared_ptr.xml78
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxx2011.xml57
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxxtr1.xml16
-rw-r--r--libstdc++-v3/doc/xml/manual/utilities.xml2
-rw-r--r--libstdc++-v3/include/backward/binders.h9
-rw-r--r--libstdc++-v3/include/debug/bitset9
-rw-r--r--libstdc++-v3/include/profile/bitset4
-rw-r--r--libstdc++-v3/include/std/functional69
-rw-r--r--libstdc++-v3/include/std/tuple50
-rw-r--r--libstdc++-v3/include/std/type_traits22
-rw-r--r--libstdc++-v3/include/tr1/functional176
-rw-r--r--libstdc++-v3/testsuite/20_util/bind/cv_quals_3.cc65
-rw-r--r--libstdc++-v3/testsuite/20_util/bind/ref_neg.cc8
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_constructible/51185.cc39
-rw-r--r--libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr-2.cc36
-rw-r--r--libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr.cc9
-rw-r--r--libstdc++-v3/testsuite/tr1/3_function_objects/bind/cv_quals.cc53
-rw-r--r--libstdc++-v3/testsuite/tr1/3_function_objects/bind/mixed.cc139
-rw-r--r--libtool.m48
-rw-r--r--lto-plugin/ChangeLog4
-rwxr-xr-xlto-plugin/configure6
-rw-r--r--maintainer-scripts/ChangeLog5
-rwxr-xr-xmaintainer-scripts/update_web_docs_svn1
-rw-r--r--zlib/ChangeLog.gcj4
-rwxr-xr-xzlib/configure6
285 files changed, 8499 insertions, 2303 deletions
diff --git a/ChangeLog b/ChangeLog
index bae8f29fcf8..e70df0cb9e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-11-21 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * MAINTAINERS: Add self as co-maintainer of the Ada front end.
+
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * libtool.m4: dditional FreeBSD 10 fixes.
+
+2011-11-21 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * MAINTAINERS: Move myself from Write After Approval to CPU Port
+ Maintainers section, as Epiphany maintainer.
+
2011-11-18 Iain Sandoe <iains@gcc.gnu.org>
PR target/49992
diff --git a/MAINTAINERS b/MAINTAINERS
index 6c18fe0c4f8..198dfa63f66 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -55,6 +55,7 @@ bfin port Bernd Schmidt bernds@codesourcery.com
bfin port Jie Zhang jzhang918@gmail.com
c6x port Bernd Schmidt bernds@codesourcery.com
cris port Hans-Peter Nilsson hp@axis.com
+epiphany port Joern Rennecke joern.rennecke@embecosm.com
fr30 port Nick Clifton nickc@redhat.com
frv port Nick Clifton nickc@redhat.com
frv port Alexandre Oliva aoliva@redhat.com
@@ -138,6 +139,7 @@ C front end/ISO C99 Richard Henderson rth@redhat.com
Ada front end Geert Bosch bosch@gnat.com
Ada front end Robert Dewar dewar@gnat.com
Ada front end Arnaud Charlet charlet@act-europe.fr
+Ada front end Eric Botcazou ebotcazou@libertysurf.fr
Fortran Paul Brook paul@codesourcery.com
c++ Jason Merrill jason@redhat.com
c++ Mark Mitchell mark@codesourcery.com
@@ -468,8 +470,6 @@ Ramana Radhakrishnan ramana.radhakrishnan@arm.com
Easwaran Raman eraman@google.com
Rolf Rasmussen rolfwr@gcc.gnu.org
Volker Reichelt v.reichelt@netcologne.de
-Joern Rennecke amylaar@spamcop.net
-Joern Rennecke joern.rennecke@embecosm.com
Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Tom Rix trix@redhat.com
Craig Rodrigues rodrigc@gcc.gnu.org
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 15f079dd3a2..22ea666ce5e 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-08-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (THREADS): Remove posix95.
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 632a229cdf2..a901e505b73 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -9518,7 +9518,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -10434,7 +10434,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -10452,7 +10452,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -12342,7 +12342,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -14117,7 +14117,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -14135,7 +14135,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/config/ChangeLog b/config/ChangeLog
index 4f202ffbc9a..4ebecc32f70 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * weakref.m4: New file.
+
2011-11-09 Richard Henderson <rth@redhat.com>
* asmcfi.m4: New file.
diff --git a/config/weakref.m4 b/config/weakref.m4
new file mode 100644
index 00000000000..39b63d39b8a
--- /dev/null
+++ b/config/weakref.m4
@@ -0,0 +1,48 @@
+
+dnl Check if the target supports weak.
+AC_DEFUN([GCC_CHECK_ATTRIBUTE_WEAK], [
+ AC_CACHE_CHECK([whether the target supports weak],
+ ac_cv_have_attribute_weak, [
+ weakref_m4_saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_COMPILE([void __attribute__((weak)) foo(void) { }],
+ [], ac_cv_have_attribute_weak=yes,
+ ac_cv_have_attribute_weak=no)
+ CFLAGS="$weakref_m4_saved_CFLAGS"])
+ if test x"$ac_cv_have_attribute_weak" = xyes; then
+ AC_DEFINE(HAVE_ATTRIBUTE_WEAK, 1,
+ [Define to 1 if the target supports __attribute__((weak)).])
+ fi])
+
+dnl Check whether weak refs work like the ELF ones.
+dnl This means that the weak reference works without having to satify
+dnl linkage for the item.
+dnl There are targets (at least Darwin) where we have fully functional
+dnl weakrefs at runtime, but must supply the referenced item at link time.
+AC_DEFUN([GCC_CHECK_ELF_STYLE_WEAKREF], [
+ AC_CACHE_CHECK([whether weak refs work like ELF],
+ ac_cv_have_elf_style_weakref, [
+ weakref_m4_saved_CFLAGS="$CFLAGS"
+ case "${host}" in
+ *-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
+ *) ;;
+ esac
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+extern void fNotToBeFound(void) __attribute__((weak));
+int main ()
+{
+ if (fNotToBeFound)
+ return 1;
+ else
+ return 0;
+}
+]])], ac_cv_have_elf_style_weakref=yes, ac_cv_have_elf_style_weakref=no, [
+case "${host}" in
+ alpha*-dec-osf*) ac_cv_have_elf_style_weakref=no ;;
+ *-apple-darwin[[89]]*) ac_cv_have_elf_style_weakref=no ;;
+ *) ac_cv_have_elf_style_weakref=yes;;
+esac])CFLAGS="$weakref_m4_saved_CFLAGS"])
+if test x"$ac_cv_have_elf_style_weakref" = xyes; then
+ AC_DEFINE(HAVE_ELF_STYLE_WEAKREF, 1, [Define to 1 if target has a weakref that works like the ELF one.])
+fi])
+
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index b3828975b68..abe317ad9db 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * make_sunver.pl: Convert '?' in glob patterns to '.'.
+
2011-11-07 Richard Henderson <rth@redhat.com>
Merged from transactional-memory.
diff --git a/contrib/make_sunver.pl b/contrib/make_sunver.pl
index 292837402db..96ad22c2311 100644
--- a/contrib/make_sunver.pl
+++ b/contrib/make_sunver.pl
@@ -276,9 +276,10 @@ while (<F>) {
if (/^([ \t]*)([^ \t;{}#]+);?[ \t]*$/) {
my $ws = $1;
my $ptn = $2;
- # Turn the glob into a regex by replacing '*' with '.*'.
+ # Turn the glob into a regex by replacing '*' with '.*', '?' with '.'.
# Keep $ptn so we can still print the original form.
($pattern = $ptn) =~ s/\*/\.\*/g;
+ $pattern =~ s/\?/\./g;
if ($glob eq 'ign') {
# We're in a local: * section; just continue.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6fb03faab6f..700e833677b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,329 @@
+2011-11-22 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * postreload.c (reload_combine): Mark reg_state as invalid at
+ volatile insns if there has been a use already.
+
+2011-11-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * opts.c (finish_options): Do not fail for -fgnu-tm.
+ * gimple-streamer-out.c (output_gimple_stmt): Handle GIMPLE_TRANSACTION.
+ * gimple-streamer-in.c (input_gimple_stmt): Same.
+ * lto-cgraph.c (input_overwrite_node): Read tm_clone bit.
+ (lto_output_node): Write tm_clone bit.
+
+2011-11-22 Ian Lance Taylor <iant@google.com>
+
+ * doc/install.texi (Configuration): Correct doc of
+ --enable-build-poststage1-with-cxx: it is not experimental.
+
+2011-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51074
+ * fold-const.c (fold_binary_loc): Fix up VEC_INTERLEAVE_*_EXPR
+ handling for BYTES_BIG_ENDIAN.
+ * optabs.c (can_vec_perm_for_code_p): Likewise.
+
+2011-11-22 Michael Matz <matz@suse.de>
+
+ PR other/51125
+ * trans-mem.c (expand_block_tm): Ignore clobbers.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * config/darwin.h (ENDFILE_SPEC): New.
+ (DARWIN_CRT1_SPEC): Add crttms.o.
+ (STARTFILE_SPEC): Likewise for dynamic libs and bundles.
+ * config/i386.h (ENDFILE_SPEC): Amend to include crttme.o.
+
+2011-11-22 Michael Matz <matz@suse.de>
+
+ PR c++/51264
+ * tree.c (iterative_hash_expr): Remove break after return.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * target.def (tm_clone_table_section): New hook.
+ * doc/tm.texi.in (TARGET_ASM_TM_CLONE_TABLE_SECTION): Define.
+ * doc/tm.texi: Regenerate.
+ * varasm.c (dump_tm_clone_pairs): Use target tm_clone_table_section.
+ * output.h (default_clone_table_section): New prototype.
+ * config/darwin.h (TARGET_ASM_TM_CLONE_TABLE_SECTION): New.
+ * config/darwin-protos.h (darwin_tm_clone_table_section): New prototype.
+ * config/darwin.c (darwin_tm_clone_table_section): New.
+
+2011-11-21 Torvald Riegel <triegel@redhat.com>
+
+ * trans-mem.c (diagnose_tm_1): Print an expression instead of a
+ declaration in error messages for indirect calls.
+
+2011-11-21 David S. Miller <davem@davemloft.net>
+
+ * config/sparc/sparc.c (sparc_regmode_natural_size): New function
+ implementing REGMODE_NATURAL_SIZE taking into consideration vector
+ modes.
+ (sparc_modes_tieable_p): Similarly for MODES_TIEABLE_P.
+ * config/sparc/sparc-protos.h (sparc_regmode_natural_size,
+ sparc_modes_tieable_p): Declare.
+ * gcc/config/sparc/sparc.h (REGMODE_NATURAL_SIZE,
+ MODES_TIEABLE_P): Use new helper functions.
+
+ Revert
+ 2011-11-16 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ PR middle-end/50325
+ * expmed.c (store_bit_field_1): Use extract_bit_field on big
+ endian targets if the source cannot be exactly covered by word
+ mode chunks.
+
+2011-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/50827
+ * var-tracking.c (loc_cmp): For ENTRY_VALUEs use ENTRY_VALUE_EXP
+ macro instead of XEXP.
+
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
+2011-11-21 Georg-Johann Lay <avr@gjlay.de>
+
+ * config/avr/avr.c (output_reload_in_const): Loading a byte with 0
+ must not affect cc0.
+ * config/avr/avr.md (*movhi, *movpsi, *movsi, *movsf): Zero to any
+ register does not change cc0. Same for any constant to ld-register.
+
+2011-11-21 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/mmx.md (unspec) <UNSPEC_MOVNTQ, UNSPEC_PFRCP,
+ UNSPEC_PFRCPIT1, UNSPEC_PFRCPIT2, UNSPEC_PFRSQRT, UNSPEC_PFRSQIT1>:
+ Move from config/i386/i386.md
+ (unspecv) <UNSPECV_EMMS, UNSPECV_FEMMS>: Ditto.
+ * config/i386/sse.md (unspec) <UNSPEC_MOVNT,UNSPEC_MOVU, UNSPEC_LDDQU,
+ UNSPEC_PSHUFB, UNSPEC_PSIGN, UNSPEC_PALIGNR, UNSPEC_EXTRQI,
+ UNSPEC_EXTRQ, UNSPEC_INSERTQI, UNSPEC_INSERTQ, UNSPEC_BLENDV,
+ UNSPEC_INSERTPS, UNSPEC_DP, UNSPEC_MOVNTDQA, UNSPEC_MPSADBW,
+ UNSPEC_PHMINPOSUW, UNSPEC_PTEST, UNSPEC_PCMPESTR, UNSPEC_PCMPISTR,
+ UNSPEC_FMADDSUB, UNSPEC_XOP_UNSIGNED_CMP, UNSPEC_XOP_TRUEFALSE,
+ UNSPEC_XOP_PERMUTE, UNSPEC_FRCZ, UNSPEC_AESENC, UNSPEC_AESENCLAST,
+ UNSPEC_AESDEC, UNSPEC_AESDECLAST, UNSPEC_AESIMC,
+ UNSPEC_AESKEYGENASSIST, UNSPEC_PCLMUL, UNSPEC_PCMP, UNSPEC_VPERMIL,
+ UNSPEC_VPERMIL2, UNSPEC_VPERMIL2F128, UNSPEC_CAST, UNSPEC_VTESTP,
+ UNSPEC_VCVTPH2PS, UNSPEC_VCVTPS2PH, UNSPEC_VPERMSI, UNSPEC_VPERMDF,
+ UNSPEC_VPERMSF, UNSPEC_VPERMTI, UNSPEC_GATHER, UNSPEC_VSIBADDR>: Ditto.
+ (unspecv) <UNSPECV_LDMXCSR, UNSPECV_STMXCSR, UNSPECV_CLFLUSH,
+ UNSPECV_MONITOR, UNSPECV_MWAIT, UNSPECV_VZEROALL, UNSPECV_VZEROUPPER>:
+ Ditto.
+ * config/i386/sync.md (unspec) <UNSPEC_LFENCE, UNSPEC_SFENCE,
+ UNSPEC_MFENCE, UNSPEC_MOVA>: Ditto.
+ (unspecv) <UNSPECV_CMPXCHG_1, UNSPECV_CMPXCHG_2, UNSPECV_CMPXCHG_3,
+ UNSPECV_CMPXCHG_4, UNSPECV_XCHG, UNSPECV_LOCK>: Ditto.
+ (sse2_lfence): Move from config/i386/sse.md.
+ (*sse2_lfence): Ditto.
+ (sse_sfence): Ditto.
+ (*sse_sfence): Ditto.
+ (sse2_mfence): Ditto.
+ (mfence_sse2): Ditto. Rename from *sse2_mfence. Enable also
+ for TARGET_64BIT.
+ (mem_thread_fence): Use mfence_sse2.
+
+2011-11-21 Georg-Johann Lay <avr@gjlay.de>
+
+ * config/avr/avr.h (struct base_arch_s): Add field sfr_offset.
+ * config/avr/avr-devices.c: Ditto. And initialize it.
+ * config/avr/avr-c.c (avr_cpu_cpp_builtins): New built-in define
+ __AVR_SFR_OFFSET__.
+ * config/avr/avr-protos.h (out_movqi_r_mr, out_movqi_mr_r): Remove.
+ (out_movhi_r_mr, out_movhi_mr_r): Remove.
+ (out_movsi_r_mr, out_movsi_mr_r): Remove.
+ * config/avr/avr.md (*cbi, *sbi): Use %i instead of %m-0x20.
+ (*insv.io, *insv.not.io): Ditto.
+ * config/avr/avr.c (out_movsi_r_mr, out_movsi_mr_r): Make static.
+ (print_operand): Implement "%i" to print address as I/O address.
+ (output_movqi): Clean up call of out_movqi_mr_r.
+ (output_movhi): Clean up call of out_movhi_mr_r.
+ (avr_file_start): Use avr_current_arch->sfr_offset instead of
+ magic -0x20. Use TMP_REGNO, ZERO_REGNO instead of 0, 1.
+ (avr_out_sbxx_branch): Use %i instead of %m-0x20.
+ (out_movqi_r_mr, out_movqi_mr_r): Ditto. And make static.
+ (out_movhi_r_mr, out_movhi_mr_r): Ditto. And use avr_asm_len.
+ (out_shift_with_cnt): Clean up code: Use avr_asm_len.
+ (output_movsisf): Use output_reload_insisf for all CONSTANT_P sources.
+ (avr_out_movpsi): USE avr_out_reload_inpsi for all CONSTANT_P sources.
+ Clean up call of avr_out_store_psi.
+ (output_reload_in_const): Don't cut symbols longer than 2 bytes.
+ (output_reload_insisf): Filter CONST_INT_P or CONST_DOUBLE_P to
+ try if setting pre-cleared register is advantageous.
+ (avr_out_plus_1): Use gen_int_mode instead of GEN_INT.
+
+2011-11-20 Joey Ye <joey.ye@arm.com>
+
+ * expr.c (expand_expr_real_1): Correctly handle strict volatile
+ bitfield loads smaller than mode size.
+
+2011-11-20 Richard Henderson <rth@redhat.com>
+
+ * config/mips/mips.c (mips_init_libfuncs): Call init_sync_libfuncs.
+
+2011-11-20 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/51235
+ * config/i386/i386.c (ix86_expand_vcond): Generate TARGET_XOP
+ patterns for supported mode only.
+
+ PR target/51236
+ * config/i386/i386.c (ix86_expand_builtin)
+ <IX86_BUILTIN_GATHERALTSIV4DI>: Use CODE_FOR_avx2_gathersiv4di.
+
+2011-11-20 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (UNSPEC_MOVNTI): Remove.
+ (UNSPEC_MOVNTQ): New unspec.
+ * config/i386/mmx.md (sse_movntq): Rename from sse_movntdi.
+ Use UNSPEC_MOVNTQ instead of UNSPEC_MOVNT.
+ * config/i386/sse.md (sse2_movnti<mode>): Use UNSPEC_MOVNT instead of
+ UNSPEC_MOVNTI.
+ (STORENT_MODE): Add DI and V4DI modes.
+
+2011-11-20 Nathan Sidwell <nathan@acm.org>
+
+ PR gcov-profile/51113
+ * coverage.c (build_var): Propagate visibility for public
+ decls. Use make_decl_one_only for PIC correctness.
+
+ testsuite/
+ * gcc.misc-tests/gcov-13.c: Check gcovpart-13b coverage
+ * gcc.misc-tests/gcov-16.c: New.
+ * gcc.misc-tests/gcov-17.c: New.
+ * g++.dg/gcov/gcov-8.C: New.
+ * g++.dg/gcov/gcov-9.C: New.
+ * g++.dg/gcov/gcov-10.C: New.
+
+2011-11-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/51187
+ * reorg.c (relax_delay_slots): Do not consider a jump useless if there
+ is a barrier between the jump and its target label.
+
+2011-11-19 Patrick Marlier <patrick.marlier@gmail.com>
+
+ PR middle-end/51211
+ * tracer.c (ignore_bb_p): Don't copy GIMPLE_TRANSACTION.
+
+2011-11-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expmed.c (store_bit_field_1): Revert bogus formatting change.
+
+2011-11-19 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/50493
+ * config/arm/arm.c (neon_disambiguate_copy): Correctly handle partial
+ overlap of src and dest operands.
+
+2011-11-19 Iain Sandoe <iains@gcc.gnu.org>
+
+ * config/darwin.h (ASM_DEBUG_SPEC): New.
+ * config/darwin9.h (ASM_DEBUG_SPEC): New.
+
+2011-11-18 Jan Hubicka <jh@suse.cz>
+
+ * config/i386/i386.c (atom_cost): Disable SSE loop until alignment
+ issues are fixed.
+
+2011-11-18 Anatoly Sokolov <aesok@post.ru>
+
+ * config/cris/cris.c (cris_function_value_regno_p): Make static.
+ (TARGET_FUNCTION_VALUE_REGNO_P): Define.
+ * config/cris/cris.h (FUNCTION_VALUE_REGNO_P): Remove.
+ * config/cris/cris-protos.h (cris_function_value_regno_p): Remove.
+
+2011-11-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/33944
+ * doc/extend.texi: Document __builtin_ia32_movnti64.
+
+ * config/i386/emmintrin.h (_mm_stream_si64): New.
+
+ * config/i386/i386-builtin-types.def: Add VOID_FTYPE_PLONGLONG_LONGLONG.
+
+ * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_MOVNTI64.
+ (bdesc_special_args): Update __builtin_ia32_movnti. Add
+ __builtin_ia32_movnti64.
+ (ix86_expand_special_args_builtin): Handle
+ VOID_FTYPE_PLONGLONG_LONGLONG.
+
+ * config/i386/i386.md (UNSPEC_MOVNTI): New.
+
+ * config/i386/sse.md (sse2_movntsi): Renamed to ...
+ (sse2_movnti<mode>): This.
+
+2011-11-18 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/49868
+ * config/avr/avr.h (base_arch_s): Add field n_segments.
+ (ADDR_SPACE_PGM1, ADDR_SPACE_PGM2, ADDR_SPACE_PGM3,
+ ADDR_SPACE_PGM4, ADDR_SPACE_PGM5, ADDR_SPACE_PGMX): New address spaces.
+ (AVR_HAVE_ELPM, AVR_HAVE_ELPMX): New defines.
+ (INIT_EXPANDERS): New define.
+ * config/avr/avr-protos.h (avr_mem_pgmx_p): New.
+ (avr_init_expanders): New.
+ (avr_emit_movmemhi, avr_out_movmem): New.
+ (avr_xload_libgcc_p): New.
+ * config/avr/avr-c.c (avr_register_target_pragmas): Register
+ address spaces __pgm1, __pgm2, __pgm3, __pgm4 __pgm5, __pgmx.
+ (avr_cpu_cpp_builtins): Add built-in defines __PGM1,
+ __PGM2, __PGM3, __PGM4, __PGM5, __PGMX.
+ * config/avr/avr-devices.c (avr_arch_types): Set field n_segments.
+
+ * config/avr/avr.c (AVR_SECTION_PROGMEM): Change define to cover
+ 3 bits instead of just 1.
+ (xstring_empty, xstring_e, rampz_rtx): New static GTYed variables.
+ (progmem_section): Change from section to array of sections.
+ (progmem_section_prefix): New static variable.
+ (avr_file_start): Print set for __RAMPZ__
+ (avr_option_override): Move initialization of RTXes from here...
+ (avr_init_expanders): ...to this new function.
+ (avr_pgm_segment): New static function.
+ (avr_decl_pgm_p): Handle error_mark_node.
+ (avr_mem_pgmx_p, avr_decl_pgmx_p): New static functions.
+ (avr_out_xload, avr_find_unused_d_reg): New static functions.
+ (expand_prologue, expand_epilogue): Use rampz_rtx.
+ (print_operand): Hande CONST_STRING.
+ (avr_xload_libgcc_p): New static function.
+ (avr_out_lpm_no_lpmx, avr_out_lpm): Handle ELPM.
+ (avr_progmem_p): Return 2 for 24-bit flash address space.
+ (avr_out_sbxx_branch): Clean-up code from ASn macros.
+ (out_movqi_r_mr, out_movqi_mr_r): Ditto. And recognize RAMPZ's
+ address and print symbolically.
+ (avr_asm_named_section, avr_section_type_flags,
+ avr_encode_section_info, avr_asm_select_section,
+ avr_addr_space_address_mode, avr_addr_space_pointer_mode,
+ avr_addr_space_legitimate_address_p, avr_addr_space_convert,
+ avr_addr_space_legitimize_address): Handle new address spaces.
+ (avr_output_progmem_section_asm_op): New static function.
+ (avr_asm_init_sections): Initialize progmem_section[].
+ (adjust_insn_length): Handle ADJUST_LEN_XLOAD, ADJUST_LEN_MOVMEM.
+ (avr_const_address_lo16): New static function.
+ (avr_assemble_integer): Use it to handle 3-byte integers.
+ (avr_emit_movmemhi, avr_out_movmem): New functions.
+
+ * config/avr/predicates.md (nox_general_operand): Handle new
+ address spaces.
+ * config/avr/avr.md (unspec): Add UNSPEC_MOVMEM.
+ (adjust_len): Add xload, movmem.
+ (SP_ADDR): New define_constants.
+ (isa): Add "lpm", "lpmx", "elpm", "elpmx".
+ (enabled): Handle them.
+ (load<mode>_libgcc): New expander.
+ (*load.<mode>.libgcc): Rename to load_<mode>_libgcc.
+ (xload8_A, xload<mode>_A): New insn-and-splits.
+ (xload_8, xload_<mode>_libgcc, xload_<mode>, loadmem_elpm): New insns.
+ (mov<mode>): Handle new address spaces.
+ (movmemhi): Rewrite using avr_emit_movmemhi.
+ (MOVMEM_r_d): New mode attribute.
+ (movmem_<mode>, movmem_qi_elpm): New insns.
+ (setmemhi, *clrmemqi, *clrmemhi, strlenhi, *strlenhi): Unquote
+ C-code. Use label instead of hard-coded instrunction lengths.
+
2011-11-18 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50605
diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
index 69d394262d3..dd43e6bba6e 100644
--- a/gcc/ChangeLog.meissner
+++ b/gcc/ChangeLog.meissner
@@ -1,5 +1,10 @@
2011-11-22 Michael Meissner <meissner@the-meissners.org>
+ Merge up to 181632.
+ * REVISION: Update subversion id.
+
+2011-11-22 Michael Meissner <meissner@the-meissners.org>
+
* config/rs6000/rs6000.opt (-msmall-cbranch): New switch, enable
branch conditional + 8 optimization (BC+8).
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a41febbbc1c..3a44afcf488 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20111118
+20111122
diff --git a/gcc/REVISION b/gcc/REVISION
index 5b869d739cc..1939b0df773 100644
--- a/gcc/REVISION
+++ b/gcc/REVISION
@@ -1 +1 @@
-ibm/meissner-bc8 branch, merged from trunk at subversion id 181481.
+ibm/meissner-bc8 branch, merged from trunk at subversion id 181632.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e196ffe2fa2..65cb5e92cf4 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,28 +1,476 @@
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * exp_imgv.adb (Expand_Width_Attribute): Handle case of
+ Discard_Names.
+ * sem_attr.adb (Eval_Attribute, case Width): Ditto.
+
+2011-11-21 Thomas Quinot <quinot@adacore.com>
+
+ * sinfo.ads: Minor reformatting.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * exp_util.adb: Minor reformatting. Update comments.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * exp_prag.adb, exp_util.adb, sinfo.ads, sem_res.adb, s-stposu.adb,
+ sem_attr.adb, s-stposu.ads, s-taprop-solaris.adb, s-taprop-irix.adb,
+ sem_ch6.adb: Minor reformatting.
+
+2011-11-21 Arnaud Charlet <charlet@adacore.com>
+
+ * s-taprop-irix.adb, s-taprop-solaris.adb (Create_Task): Use
+ Unrestricted_Access to deal with fact that we properly detect the
+ error if Access is used.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Check): Place error on first character
+ of expression.
+ * sem_res.adb (Resolve_Short_Circuit): Place error on first
+ character of expression.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * exp_util.adb (Remove_Side_Effects): Do nothing in Alfa mode.
+
+2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference, case
+ Max_Size_In_Storage_Elements): Account for the size of the
+ hidden list header which precedes controlled objects allocated
+ on the heap.
+ * rtsfind.ads: Add RE_Header_Size_With_Padding to the runtime
+ tables.
+ * sinfo.adb (Header_Size_Added): New routine.
+ (Set_Header_Size_Added): New routine.
+ * sinfo.ads: Add flag Controlled_Header_Added along with
+ associated comment.
+ (Header_Size_Added): New inlined routine.
+ (Set_Header_Size_Added): New inlined routine.
+ * s-stposu.adb (Allocate_Any_Controlled): Use
+ Header_Size_With_Padding to calculate the proper
+ size of the header.
+ (Deallocate_Any_Controlled): Use
+ Header_Size_With_Padding to calculate the proper size
+ of the header. (Header_Size_With_Padding): New routine.
+ (Nearest_Multiple_Rounded_Up): Removed along with its uses.
+ * s-stposu.ads (Header_Size_With_Padding): New routine.
+
+2011-11-21 Ed Schonberg <schonberg@adacore.com>
+
+ * aspects.adb: Aspect specifications are allowed on renaming
+ declarations
+ * par-ch6.adb (P_Subprogram): Parse aspect specifications in a
+ subprogram renaming declaration
+
+2011-11-21 Tristan Gingold <gingold@adacore.com>
+
+ * env.c: Remove unused declaration.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * s-os_lib.ads: Minor style fix.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * adaint.c (__gnat_dup2): When fd are stdout, stdin or stderr and
+ identical, do nothing on Windows XP.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * sem_ch3.adb (Constrain_Index, Process_Range_Expr_In_Decl):
+ Use Full_Expander_Active instead of Expander_Active to control
+ the forced evaluation of expressions for the sake of generating
+ checks.
+
+2011-11-21 Thomas Quinot <quinot@adacore.com>
+
+ * init.c: On FreeBSD, stack checking failures may raise SIGBUS.
+
+2011-11-21 Tristan Gingold <gingold@adacore.com>
+
+ * sysdep.c (mode_read_text, mode_write_text, mode_append_text,
+ mode_read_binary, mode_write_binary, mode_append_binary,
+ mode_read_text_plus, mode_write_text_plus, mode_append_text_plus,
+ mode_read_binary_plus, mode_write_binary_plus,
+ mode_append_binary_plus): Remove unused declarations.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * gnat_rm.texi: Minor rewording.
+
+2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_imgv.adb (Expand_Width_Attribute): Emit
+ an error message rather than a warning when pragma Discard_Names
+ prevents the computation of 'Width. Do not emit an error through
+ the use of RE_Null.
+
+2011-11-21 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Add
+ implicit type conversion when the type of the allocator is an
+ interface. Done to force generation of displacement of the "this"
+ pointer when required.
+
+2011-11-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb: Corresponding_Spec applies to expression
+ functions, and is set when the expression is a completion of a
+ previous declaration.
+ * sem_ch6.adb (Analyze_Expression_Function): To determine properly
+ whether an expression function completes a previous declaration,
+ use Find_Corresponding_Spec, as when analyzing a subprogram body.
+
+2011-11-21 Steve Baird <baird@adacore.com>
+
+ * sem_util.adb (Deepest_Type_Access_Level): Improve comment.
+ (Type_Access_Level): Improve comment.
+
+2011-11-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/Makefile.in (INCLUDES_FOR_SUBDIR): Add $(fsrcdir) by
+ means of -iquote unconditionally.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb, sem_util.adb, sem_res.adb, sem_attr.adb: Minor
+ reformatting.
+
+2011-11-21 Arnaud Charlet <charlet@adacore.com>
+
+ * s-taprop-posix.adb (Create_Task): Use Unrestricted_Access
+ to deal with fact that we properly detect the error if Access
+ is used.
+
+2011-11-21 Steve Baird <baird@adacore.com>
+
+ * sem_util.ads: Update comment describing function
+ Deepest_Access_Level.
+ * sem_util.adb (Deepest_Type_Access_Level): Return Int'Last for a
+ generic formal type.
+ (Type_Access_Level): Return library level
+ for a generic formal type.
+ * sem_attr.adb (Resolve_Attribute): Replace two Type_Access_Level
+ calls with calls to Deepest_Type_Access_Level.
+ * sem_ch3.adb (Analyze_Component_Declaration): replace a
+ Type_Access_Level call with a call to Deepest_Type_Access_Level.
+ * sem_res.adb (Resolve_Allocator.Check_Allocator_Discrim_Accessibility):
+ Replace three Type_Access_Level calls with calls to
+ Deepest_Type_Access_Level.
+ (Resolve_Allocator): Replace a Type_Access_Level call with a call to
+ Deepest_Type_Access_Level.
+ (Valid_Conversion.Valid_Array_Conversion): Replace a
+ Type_Access_Level call with a call to Deepest_Type_Access_Level.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb, s-taprop-vms.adb, opt.ads: Minor reformatting.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sinput.ads: Minor comment fix.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference, case First_Bit,
+ Last_Bit, Position): Handle 2005 case.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * s-atocou-builtin.adb (Decrement): Use Unrestricted_Access
+ to deal with fact that we properly detect the error if Access
+ is used.
+ (Increment): Same fix.
+ * s-taprop-linux.adb (Create_Task): Use Unrestricted_Access
+ to deal with fact that we properly detect the error if Access
+ is used.
+ * sem_util.adb (Is_Volatile_Object): Properly record that A.B is
+ volatile if the B component is volatile. This affects the check
+ for passing such a by reference volatile actual to a non-volatile
+ formal (which should be illegal)
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb (Freeze_Enumeration_Type): Make sure to set both
+ size and alignment for foreign convention enumeration types.
+ * layout.adb (Set_Elem_Alignment): Redo setting of alignment
+ when size is set.
+
+2011-11-21 Yannick Moy <moy@adacore.com>
+
+ * checks.adb (Apply_Access_Check, Apply_Arithmetic_Overflow_Check,
+ Apply_Discriminant_Check, Apply_Divide_Check,
+ Apply_Selected_Length_Checks, Apply_Selected_Range_Checks,
+ Build_Discriminant_Checks, Insert_Range_Checks, Selected_Length_Checks,
+ Selected_Range_Checks): Replace reference to Expander_Active
+ with reference to Full_Expander_Active, so that expansion of
+ checks is not performed in Alfa mode
+
+2011-11-21 Tristan Gingold <gingold@adacore.com>
+
+ * s-taprop-vms.adb (Create_Task): Use Unrestricted_Access to deal with
+ fact that we properly detect the error if Access is used.
+
+2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * par-ch4.adb (P_Quantified_Expression): Add an Ada 2012 check.
+
+2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_imgv.adb: Add with and use clause for Errout.
+ (Expand_Width_Attribute): Emit a warning when in
+ configurable run-time mode to provide a better diagnostic message.
+
+2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * s-finmas.adb (Finalize): Add comment concerning double finalization.
+
+2011-11-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Definition): If the access definition
+ is itself the return type of an access to function definition
+ which is ultimately the return type of an access to subprogram
+ declaration, its scope is the enclosing scope of the ultimate
+ access to subprogram.
+
+2011-11-21 Steve Baird <baird@adacore.com>
+
+ * sem_res.adb (Valid_Conversion): If a conversion was legal
+ in the body of a generic, then the corresponding conversion is
+ legal in the expanded body of an instance of the generic.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * s-utf_32.adb (Is_UTF_32_Line_Terminator): Recognize NEL as
+ line terminator.
+ * sinput.ads: Add section on Handling of Source Line Terminators.
+ * types.ads (Line_Terminator): Adjust comments.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * frontend.adb (Frontend): Capture restrictions from config files
+ * lib-load.adb (Load_Unit): Save/set/restore restriction pragma
+ information
+ * lib-xref.adb (Generate_Reference): Fix handling of obsolescent
+ references. This was noticed during debugging, but it is not
+ known if it causes real bugs.
+ * restrict.ads, restrict.adb: New routines to save/set/restore
+ non-partition-wide restrictions.
+ * s-rident.ads: Comment changes for new handling of
+ No_Elaboration_Code
+ * sem.adb (Sem): Save/Set/Restore non-partition-wide restrictions
+ * sem_ch10.adb (Analyze_Compilation_Unit): Remove incomplete
+ attempt to save/restore non-partition-wide restrictions (now
+ this work is all done in Sem).
+ * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
+ Special handling for restriction No_Elaboration_Code.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Document new handling of restrictions pragmas.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * s-taprop-linux.adb (Initialize_Lock): Do not allocate a cond
+ attribute as not needed.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb: Minor reformatting.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * gnat_rm.texi: Document restriction for stdcall convention on
+ dispatching calls.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * sem_prag.adb (Process_Convention): A dispatching call cannot
+ have a stdcall calling convention.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * s-taprop-linux.adb (Initialize_Lock): Do not allocate a
+ mutex attribute as not needed.
+ (Initialize_TCB): Likewise.
+ (Initialize): Likewise.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch6.adb (Is_Public_Subprogram_For): New procedure
+ (Process_PPCs): Invariants only apply to public subprograms.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.adb, sem_util.ads, sem_attr.adb, restrict.adb,
+ restrict.ads: Fix for No_Implicit_Aliasing in the renames case.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * a-finali.ads: Use pragma Pure_12 for this unit
+ * aspects.adb: Add aspect Pure_12
+ * aspects.ads: Add aspect Pure_12
+ * opt.ads: Add note on Pure_12
+ * par-prag.adb: Add dummy entry for Pure_12
+ * sem_prag.adb: Implement Pure_12 pragma
+ * snames.ads-tmpl: Add Entry for Pure_12
+
+2011-11-21 Sergey Rybin <rybin@adacore.com frybin>
+
+ * vms_data.ads: Add qualifiers for new gnatpp options
+ '--call_threshold' and '--par_threshold".
+ * gnat_ugn.texi: Add description for new gnatpp options
+ '--call_threshold' and '--par_threshold".
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * lib.ads: Minor reformatting.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * lib-load.ads: Add comment.
+
+2011-11-21 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_elab.adb: Minor reformatting
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch6.adb: Minor reformatting.
+
+2011-11-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Check_Formal_Package_Instance): If a formal
+ subprogram of the formal package is covered by an others
+ association with a box initialization, no check is needed
+ against the actual in the instantiation of the formal package.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_elab.adb (Check_Internal_Call_Continue): Suppress junk
+ elab warning from within precondition/postcondition etc.
+
+2011-11-21 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Expand_Actuals): In Ada 2012, a function call
+ with out parameters may generate assignments to force constraint
+ checks. These checks must be properly placed in the code after the
+ declaration or statement that contains the call.
+
+2011-11-21 Fedor Rybin <frybin@adacore.com>
+
+ * gnat_ugn.texi: Adding info on current gnattest limitations an
+ support of -X option.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * a-cfdlli.adb, a-cbdlli.adb: Minor reformatting.
+
+2011-11-20 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch6.adb, exp_util.adb: Minor reformatting
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sinfo.ads (Reference): Document that it is OK to set
+ Is_Known_Non_Null on a temporary initialized to a N_Reference
+ node.
+
+2011-11-20 Matthew Heaney <heaney@adacore.com>
+
+ * a-cbdlli.adb, a-cfdlli.adb (Move): Set Last component to 0
+ for Source list.
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Assignment):
+ Declare NEW_EXPR local variable and attach the
+ temporary to it. Set Is_Known_Non_Null on the temporary.
+ (Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
+ * exp_util.adb (Remove_Side_Effects): Set Is_Known_Non_Null on
+ the temporary created to hold the 'Reference of the expression,
+ if any.
+ * checks.adb (Install_Null_Excluding_Check): Bail out for the
+ Get_Current_Excep.all.all idiom generated by the expander.
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (struct language_function): Add GNAT_RET.
+ (f_gnat_ret): New macro.
+ (struct nrv_data): Add GNAT_RET.
+ (finalize_nrv_unc_r): New helper function.
+ (finalize_nrv): Add GNAT_RET parameter. Copy it into DATA. If the
+ function returns unconstrained, use finalize_nrv_unc_r as callback.
+ (return_value_ok_for_nrv_p): Test the alignment of RET_OBJ only if
+ RET_OBJ is non-null.
+ (Subprogram_Body_to_gnu): Pass GNAT_RET to finalize_nrv.
+ (gnat_to_gnu) <N_Return_Statement>: In the return-unconstrained case,
+ if optimization is enabled, record candidates for the Named Return
+ Value optimization.
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Add comment.
+ (gnat_to_gnu) <N_Return_Statement>: Add 'else' to avoid doing a useless
+ test. Tweak default case.
+ <N_Goto_Statement>: Use better formatting.
+ * gcc-interface/utils2.c (maybe_wrap_malloc): Use INIT_EXPR instead of
+ MODIFY_EXPR to initialize the storage.
+ (build_allocator): Likewise.
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Adjust
+ call to components_to_record.
+ (components_to_record): Add FIRST_FREE_POS parameter. For the variant
+ part, reuse enclosing union even if there is a representation clause
+ on the Unchecked_Union. If there is a variant part, compute the new
+ first free position, if any. Adjust call to self. Use a single field
+ directly only if it hasn't got a representation clause or is placed at
+ offset zero. Create the variant part at offset 0 if all the fields
+ down to this level have a rep clause. Do not chain the variant part
+ immediately and adjust downstream.
+ Do not test ALL_REP before moving the fields without rep clause to the
+ previous level. Call create_rep_part to create the REP part and force
+ a minimum size on it if necessary. Do not chain it immediately.
+ Create a fake REP part if there are fields without rep clause that need
+ to be laid out starting from FIRST_FREE_POS.
+ At the end, chain the REP part and then the variant part.
+ (create_rep_part): New function.
+ (get_rep_part): Minor tweak.
+ * gcc-interface/utils.c (tree_code_for_record_type): Minor tweak.
+
2011-11-18 Iain Sandoe <iains@gcc.gnu.org>
PR target/50678
- * init.c (__gnat_error_handler) [Darwin]: Move work-around to the
- bug filed as radar #10302855 from __gnat_error_handler ...
- ... to (__gnat_adjust_context_for_raise) [Darwin]: New.
+ * init.c (__gnat_error_handler) [Darwin]: Move workaround to the
+ bug filed as radar #10302855 from __gnat_error_handler to...
+ (__gnat_adjust_context_for_raise) [Darwin]: ...here. New function.
(HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE) [Darwin]: Define.
- (__gnat_error_handler) [Darwin]: Use __gnat_adjust_context_for_raise.
2011-11-18 Tristan Gingold <gingold@adacore.com>
Iain Sandoe <iains@gcc.gnu.org>
PR target/49992
* mlib-tgt-specific-darwin.adb (Archive_Indexer_Options): Remove.
- * gcc-interface/Makefile.in (darwin): Remove ranlib special-casing
- for Darwin.
+ * gcc-interface/Makefile.in (darwin): Remove ranlib special-casing.
2011-11-12 Iain Sandoe <iains@gcc.gnu.org>
* gcc-interface/Makefile.in (stamp-gnatlib-$(RTSDIR)): Don't link
s-oscons.ads.
(OSCONS_CPP, OSCONS_EXTRACT): New.
- (./bldtools/oscons/xoscons): New Target.
- ($(RTSDIR)/s-oscons.ads): New Target.
- (gnatlib): Depend on $(RTSDIR)/s-oscons.ads.
+ (./bldtools/oscons/xoscons): New target.
+ ($(RTSDIR)/s-oscons.ads): Likewise.
+ (gnatlib): Depend on $(RTSDIR)/s-oscons.ads.
* gcc-interface/Make-lang.in (ada/s-oscons.ads) Remove as dependency.
* Make-generated.in: Remove machinery to generate xoscons and
ada/s-oscons.ads.
diff --git a/gcc/ada/a-cbdlli.adb b/gcc/ada/a-cbdlli.adb
index e1f7725d5cd..5a3169eee50 100644
--- a/gcc/ada/a-cbdlli.adb
+++ b/gcc/ada/a-cbdlli.adb
@@ -1164,18 +1164,66 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is
"attempt to tamper with cursors of Source (list is busy)";
end if;
+ -- Clear target, note that this checks busy bits of Target
+
Clear (Target);
- while Source.Length > 0 loop
+ while Source.Length > 1 loop
+ pragma Assert (Source.First in 1 .. Source.Capacity);
+ pragma Assert (Source.Last /= Source.First);
+ pragma Assert (N (Source.First).Prev = 0);
+ pragma Assert (N (Source.Last).Next = 0);
+
+ -- Copy first element from Source to Target
+
X := Source.First;
Append (Target, N (X).Element);
+ -- Unlink first node of Source
+
Source.First := N (X).Next;
N (Source.First).Prev := 0;
Source.Length := Source.Length - 1;
+
+ -- The representation invariants for Source have been restored. It is
+ -- now safe to free the unlinked node, without fear of corrupting the
+ -- active links of Source.
+
+ -- Note that the algorithm we use here models similar algorithms used
+ -- in the unbounded form of the doubly-linked list container. In that
+ -- case, Free is an instantation of Unchecked_Deallocation, which can
+ -- fail (because PE will be raised if controlled Finalize fails), so
+ -- we must defer the call until the last step. Here in the bounded
+ -- form, Free merely links the node we have just "deallocated" onto a
+ -- list of inactive nodes, so technically Free cannot fail. However,
+ -- for consistency, we handle Free the same way here as we do for the
+ -- unbounded form, with the pessimistic assumption that it can fail.
+
Free (Source, X);
end loop;
+
+ if Source.Length = 1 then
+ pragma Assert (Source.First in 1 .. Source.Capacity);
+ pragma Assert (Source.Last = Source.First);
+ pragma Assert (N (Source.First).Prev = 0);
+ pragma Assert (N (Source.Last).Next = 0);
+
+ -- Copy element from Source to Target
+
+ X := Source.First;
+ Append (Target, N (X).Element);
+
+ -- Unlink node of Source
+
+ Source.First := 0;
+ Source.Last := 0;
+ Source.Length := 0;
+
+ -- Return the unlinked node to the free store
+
+ Free (Source, X);
+ end if;
end Move;
----------
@@ -1198,6 +1246,7 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is
declare
Nodes : Node_Array renames Position.Container.Nodes;
Node : constant Count_Type := Nodes (Position.Node).Next;
+
begin
if Node = 0 then
return No_Element;
diff --git a/gcc/ada/a-cfdlli.adb b/gcc/ada/a-cfdlli.adb
index 93a88a725d6..3c73c0467aa 100644
--- a/gcc/ada/a-cfdlli.adb
+++ b/gcc/ada/a-cfdlli.adb
@@ -743,7 +743,6 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
begin
if Before.Node /= 0 then
- null;
pragma Assert (Vet (Container, Before), "bad cursor in Insert");
end if;
@@ -793,7 +792,6 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
begin
if Before.Node /= 0 then
- null;
pragma Assert (Vet (Container, Before), "bad cursor in Insert");
end if;
@@ -1007,16 +1005,62 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
Clear (Target);
- while Source.Length > 0 loop
+ while Source.Length > 1 loop
+ pragma Assert (Source.First in 1 .. Source.Capacity);
+ pragma Assert (Source.Last /= Source.First);
+ pragma Assert (N (Source.First).Prev = 0);
+ pragma Assert (N (Source.Last).Next = 0);
+
+ -- Copy first element from Source to Target
+
X := Source.First;
Append (Target, N (X).Element); -- optimize away???
+ -- Unlink first node of Source
+
Source.First := N (X).Next;
N (Source.First).Prev := 0;
Source.Length := Source.Length - 1;
+
+ -- The representation invariants for Source have been restored. It is
+ -- now safe to free the unlinked node, without fear of corrupting the
+ -- active links of Source.
+
+ -- Note that the algorithm we use here models similar algorithms used
+ -- in the unbounded form of the doubly-linked list container. In that
+ -- case, Free is an instantation of Unchecked_Deallocation, which can
+ -- fail (because PE will be raised if controlled Finalize fails), so
+ -- we must defer the call until the last step. Here in the bounded
+ -- form, Free merely links the node we have just "deallocated" onto a
+ -- list of inactive nodes, so technically Free cannot fail. However,
+ -- for consistency, we handle Free the same way here as we do for the
+ -- unbounded form, with the pessimistic assumption that it can fail.
+
Free (Source, X);
end loop;
+
+ if Source.Length = 1 then
+ pragma Assert (Source.First in 1 .. Source.Capacity);
+ pragma Assert (Source.Last = Source.First);
+ pragma Assert (N (Source.First).Prev = 0);
+ pragma Assert (N (Source.Last).Next = 0);
+
+ -- Copy element from Source to Target
+
+ X := Source.First;
+ Append (Target, N (X).Element);
+
+ -- Unlink node of Source
+
+ Source.First := 0;
+ Source.Last := 0;
+ Source.Length := 0;
+
+ -- Return the unlinked node to the free store
+
+ Free (Source, X);
+ end if;
end Move;
----------
@@ -1172,8 +1216,8 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
"attempt to tamper with cursors (list is locked)";
end if;
- pragma Assert (Vet (Container, Position),
- "bad cursor in Replace_Element");
+ pragma Assert
+ (Vet (Container, Position), "bad cursor in Replace_Element");
declare
N : Node_Array renames Container.Nodes;
@@ -1372,7 +1416,6 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
begin
if Before.Node /= 0 then
- null;
pragma Assert (Vet (Target, Before), "bad cursor in Splice");
end if;
@@ -1464,17 +1507,16 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
begin
if Before.Node /= 0 then
- null;
- pragma Assert (Vet (Container, Before),
- "bad Before cursor in Splice");
+ pragma Assert
+ (Vet (Container, Before), "bad Before cursor in Splice");
end if;
if Position.Node = 0 then
raise Constraint_Error with "Position cursor has no element";
end if;
- pragma Assert (Vet (Container, Position),
- "bad Position cursor in Splice");
+ pragma Assert
+ (Vet (Container, Position), "bad Position cursor in Splice");
if Position.Node = Before.Node
or else N (Position.Node).Next = Before.Node
@@ -1683,8 +1725,8 @@ package body Ada.Containers.Formal_Doubly_Linked_Lists is
raise Constraint_Error with "Position cursor has no element";
end if;
- pragma Assert (Vet (Container, Position),
- "bad cursor in Update_Element");
+ pragma Assert
+ (Vet (Container, Position), "bad cursor in Update_Element");
declare
B : Natural renames Container.Busy;
diff --git a/gcc/ada/a-finali.ads b/gcc/ada/a-finali.ads
index d5cada210e2..b53fd2a8784 100644
--- a/gcc/ada/a-finali.ads
+++ b/gcc/ada/a-finali.ads
@@ -34,14 +34,16 @@
------------------------------------------------------------------------------
pragma Warnings (Off);
--- System.Finalization_Root does not have category Remote_Types, but we
--- allow it anyway.
with System.Finalization_Root;
pragma Warnings (On);
package Ada.Finalization is
+ pragma Pure_12;
+ -- Ada.Finalization is declared pure in Ada 2012 (AI05-0212)
+
pragma Preelaborate;
pragma Remote_Types;
+ -- The above apply in versions of Ada before Ada 2012
type Controlled is abstract tagged private;
pragma Preelaborable_Initialization (Controlled);
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 7e701f53c14..dde33429575 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -2449,6 +2449,14 @@ __gnat_dup2 (int oldfd, int newfd)
/* Not supported on VxWorks 5.x, but supported on VxWorks 6.0 when using
RTPs. */
return -1;
+#elif defined (_WIN32)
+ /* Special case when oldfd and newfd are identical and are the standard
+ input, output or error as this makes Windows XP hangs. Note that we
+ do that only for standard file descriptors that are known to be valid. */
+ if (oldfd == newfd && newfd >= 0 && newfd <= 2)
+ return newfd;
+ else
+ return dup2 (oldfd, newfd);
#else
return dup2 (oldfd, newfd);
#endif
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb
index 9b707734b76..7cc218e1d98 100755
--- a/gcc/ada/aspects.adb
+++ b/gcc/ada/aspects.adb
@@ -180,6 +180,7 @@ package body Aspects is
N_Component_Declaration => True,
N_Entry_Declaration => True,
N_Exception_Declaration => True,
+ N_Exception_Renaming_Declaration => True,
N_Formal_Abstract_Subprogram_Declaration => True,
N_Formal_Concrete_Subprogram_Declaration => True,
N_Formal_Object_Declaration => True,
@@ -188,11 +189,14 @@ package body Aspects is
N_Full_Type_Declaration => True,
N_Function_Instantiation => True,
N_Generic_Package_Declaration => True,
+ N_Generic_Renaming_Declaration => True,
N_Generic_Subprogram_Declaration => True,
N_Object_Declaration => True,
+ N_Object_Renaming_Declaration => True,
N_Package_Declaration => True,
N_Package_Instantiation => True,
N_Package_Specification => True,
+ N_Package_Renaming_Declaration => True,
N_Private_Extension_Declaration => True,
N_Private_Type_Declaration => True,
N_Procedure_Instantiation => True,
@@ -202,6 +206,7 @@ package body Aspects is
N_Single_Task_Declaration => True,
N_Subprogram_Body => True,
N_Subprogram_Declaration => True,
+ N_Subprogram_Renaming_Declaration => True,
N_Subtype_Declaration => True,
N_Task_Body => True,
N_Task_Type_Declaration => True,
@@ -255,6 +260,7 @@ package body Aspects is
Aspect_Preelaborate_05 => Aspect_Preelaborate_05,
Aspect_Pure => Aspect_Pure,
Aspect_Pure_05 => Aspect_Pure_05,
+ Aspect_Pure_12 => Aspect_Pure_12,
Aspect_Remote_Call_Interface => Aspect_Remote_Call_Interface,
Aspect_Remote_Types => Aspect_Remote_Types,
Aspect_Shared_Passive => Aspect_Shared_Passive,
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index 582a71e7a55..c1dbe72cd3f 100755
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -96,6 +96,7 @@ package Aspects is
Aspect_Preelaborate_05, -- GNAT
Aspect_Pure,
Aspect_Pure_05, -- GNAT
+ Aspect_Pure_12, -- GNAT
Aspect_Remote_Call_Interface,
Aspect_Remote_Types,
Aspect_Shared_Passive,
@@ -154,6 +155,7 @@ package Aspects is
Aspect_Compiler_Unit => True,
Aspect_Preelaborate_05 => True,
Aspect_Pure_05 => True,
+ Aspect_Pure_12 => True,
Aspect_Universal_Data => True,
Aspect_Ada_2005 => True,
Aspect_Ada_2012 => True,
@@ -324,6 +326,7 @@ package Aspects is
Aspect_Priority => Name_Priority,
Aspect_Pure => Name_Pure,
Aspect_Pure_05 => Name_Pure_05,
+ Aspect_Pure_12 => Name_Pure_12,
Aspect_Pure_Function => Name_Pure_Function,
Aspect_Read => Name_Read,
Aspect_Remote_Call_Interface => Name_Remote_Call_Interface,
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 67febfe1919..01f240fc034 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -442,7 +442,7 @@ package body Checks is
-- are cases (e.g. with pragma Debug) where generating the checks
-- can cause real trouble).
- if not Expander_Active then
+ if not Full_Expander_Active then
return;
end if;
@@ -878,7 +878,7 @@ package body Checks is
if Backend_Overflow_Checks_On_Target
or else not Do_Overflow_Check (N)
- or else not Expander_Active
+ or else not Full_Expander_Active
or else (Present (Parent (N))
and then Nkind (Parent (N)) = N_Type_Conversion
and then Integer_Promotion_Possible (Parent (N)))
@@ -1178,7 +1178,7 @@ package body Checks is
-- Nothing to do if discriminant checks are suppressed or else no code
-- is to be generated
- if not Expander_Active
+ if not Full_Expander_Active
or else Discriminant_Checks_Suppressed (T_Typ)
then
return;
@@ -1462,7 +1462,7 @@ package body Checks is
-- Don't actually use this value
begin
- if Expander_Active
+ if Full_Expander_Active
and then not Backend_Divide_Checks_On_Target
and then Check_Needed (Right, Division_Check)
then
@@ -2118,7 +2118,7 @@ package body Checks is
(not Length_Checks_Suppressed (Target_Typ));
begin
- if not Expander_Active then
+ if not Full_Expander_Active then
return;
end if;
@@ -2226,7 +2226,7 @@ package body Checks is
(not Range_Checks_Suppressed (Target_Typ));
begin
- if not Expander_Active or else not Checks_On then
+ if not Full_Expander_Active or else not Checks_On then
return;
end if;
@@ -5309,7 +5309,7 @@ package body Checks is
-- enhanced to check for an always True value in the condition and to
-- generate a compilation warning???
- if not Expander_Active or else not Checks_On then
+ if not Full_Expander_Active or else not Checks_On then
return;
end if;
@@ -5673,6 +5673,22 @@ package body Checks is
return;
end if;
+ -- No check needed for the Get_Current_Excep.all.all idiom generated by
+ -- the expander within exception handlers, since we know that the value
+ -- can never be null.
+
+ -- Is this really the right way to do this? Normally we generate such
+ -- code in the expander with checks off, and that's how we suppress this
+ -- kind of junk check ???
+
+ if Nkind (N) = N_Function_Call
+ and then Nkind (Name (N)) = N_Explicit_Dereference
+ and then Nkind (Prefix (Name (N))) = N_Identifier
+ and then Is_RTE (Entity (Prefix (Name (N))), RE_Get_Current_Excep)
+ then
+ return;
+ end if;
+
-- Otherwise install access check
Insert_Action (N,
@@ -6220,7 +6236,7 @@ package body Checks is
-- Start of processing for Selected_Length_Checks
begin
- if not Expander_Active then
+ if not Full_Expander_Active then
return Ret_Result;
end if;
@@ -6794,7 +6810,7 @@ package body Checks is
-- Start of processing for Selected_Range_Checks
begin
- if not Expander_Active then
+ if not Full_Expander_Active then
return Ret_Result;
end if;
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 1719684034a..31c878e7795 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -110,8 +110,6 @@ __gnat_getenv (char *name, int *len, char **value)
#ifdef VMS
-static char *to_host_path_spec (char *);
-
typedef struct _ile3
{
unsigned short len, code;
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 57e94d29840..ac6fdf9f26e 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -2117,21 +2117,38 @@ package body Exp_Attr is
-- computation to be completed in the back-end, since we don't know what
-- layout will be chosen.
- when Attribute_First_Bit => First_Bit : declare
+ when Attribute_First_Bit => First_Bit_Attr : declare
CE : constant Entity_Id := Entity (Selector_Name (Pref));
begin
- if Known_Static_Component_Bit_Offset (CE) then
+ -- In Ada 2005 (or later) if we have the standard nondefault
+ -- bit order, then we return the original value as given in
+ -- the component clause (RM 2005 13.5.2(3/2)).
+
+ if Present (Component_Clause (CE))
+ and then Ada_Version >= Ada_2005
+ and then not Reverse_Bit_Order (Scope (CE))
+ then
Rewrite (N,
Make_Integer_Literal (Loc,
- Component_Bit_Offset (CE) mod System_Storage_Unit));
+ Intval => Expr_Value (First_Bit (Component_Clause (CE)))));
+ Analyze_And_Resolve (N, Typ);
+
+ -- Otherwise (Ada 83/95 or Ada 2005 or later with reverse bit order),
+ -- rewrite with normalized value if we know it statically.
+ elsif Known_Static_Component_Bit_Offset (CE) then
+ Rewrite (N,
+ Make_Integer_Literal (Loc,
+ Component_Bit_Offset (CE) mod System_Storage_Unit));
Analyze_And_Resolve (N, Typ);
+ -- Otherwise left to back end, just do universal integer checks
+
else
Apply_Universal_Integer_Attribute_Checks (N);
end if;
- end First_Bit;
+ end First_Bit_Attr;
-----------------
-- Fixed_Value --
@@ -2680,24 +2697,41 @@ package body Exp_Attr is
-- the computation up to the back end, since we don't know what layout
-- will be chosen.
- when Attribute_Last_Bit => Last_Bit : declare
+ when Attribute_Last_Bit => Last_Bit_Attr : declare
CE : constant Entity_Id := Entity (Selector_Name (Pref));
begin
- if Known_Static_Component_Bit_Offset (CE)
+ -- In Ada 2005 (or later) if we have the standard nondefault
+ -- bit order, then we return the original value as given in
+ -- the component clause (RM 2005 13.5.2(4/2)).
+
+ if Present (Component_Clause (CE))
+ and then Ada_Version >= Ada_2005
+ and then not Reverse_Bit_Order (Scope (CE))
+ then
+ Rewrite (N,
+ Make_Integer_Literal (Loc,
+ Intval => Expr_Value (Last_Bit (Component_Clause (CE)))));
+ Analyze_And_Resolve (N, Typ);
+
+ -- Otherwise (Ada 83/95 or Ada 2005 or later with reverse bit order),
+ -- rewrite with normalized value if we know it statically.
+
+ elsif Known_Static_Component_Bit_Offset (CE)
and then Known_Static_Esize (CE)
then
Rewrite (N,
Make_Integer_Literal (Loc,
Intval => (Component_Bit_Offset (CE) mod System_Storage_Unit)
+ Esize (CE) - 1));
-
Analyze_And_Resolve (N, Typ);
+ -- Otherwise leave to back end, just apply universal integer checks
+
else
Apply_Universal_Integer_Attribute_Checks (N);
end if;
- end Last_Bit;
+ end Last_Bit_Attr;
------------------
-- Leading_Part --
@@ -2955,6 +2989,52 @@ package body Exp_Attr is
Analyze_And_Resolve (N, Typ);
end Mantissa;
+ ----------------------------------
+ -- Max_Size_In_Storage_Elements --
+ ----------------------------------
+
+ when Attribute_Max_Size_In_Storage_Elements =>
+ Apply_Universal_Integer_Attribute_Checks (N);
+
+ -- Heap-allocated controlled objects contain two extra pointers which
+ -- are not part of the actual type. Transform the attribute reference
+ -- into a runtime expression to add the size of the hidden header.
+
+ -- Do not perform this expansion on .NET/JVM targets because the
+ -- two pointers are already present in the type.
+
+ if VM_Target = No_VM
+ and then Nkind (N) = N_Attribute_Reference
+ and then Needs_Finalization (Ptyp)
+ and then not Header_Size_Added (N)
+ then
+ Set_Header_Size_Added (N);
+
+ -- Generate:
+ -- P'Max_Size_In_Storage_Elements +
+ -- Universal_Integer
+ -- (Header_Size_With_Padding (Ptyp'Alignment))
+
+ Rewrite (N,
+ Make_Op_Add (Loc,
+ Left_Opnd => Relocate_Node (N),
+ Right_Opnd =>
+ Convert_To (Universal_Integer,
+ Make_Function_Call (Loc,
+ Name =>
+ New_Reference_To
+ (RTE (RE_Header_Size_With_Padding), Loc),
+
+ Parameter_Associations => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix =>
+ New_Reference_To (Ptyp, Loc),
+ Attribute_Name => Name_Alignment))))));
+
+ Analyze (N);
+ return;
+ end if;
+
--------------------
-- Mechanism_Code --
--------------------
@@ -3495,21 +3575,41 @@ package body Exp_Attr is
-- the computation up to the back end, since we don't know what layout
-- will be chosen.
- when Attribute_Position => Position :
+ when Attribute_Position => Position_Attr :
declare
CE : constant Entity_Id := Entity (Selector_Name (Pref));
begin
if Present (Component_Clause (CE)) then
- Rewrite (N,
- Make_Integer_Literal (Loc,
- Intval => Component_Bit_Offset (CE) / System_Storage_Unit));
+
+ -- In Ada 2005 (or later) if we have the standard nondefault
+ -- bit order, then we return the original value as given in
+ -- the component clause (RM 2005 13.5.2(2/2)).
+
+ if Ada_Version >= Ada_2005
+ and then not Reverse_Bit_Order (Scope (CE))
+ then
+ Rewrite (N,
+ Make_Integer_Literal (Loc,
+ Intval => Expr_Value (Position (Component_Clause (CE)))));
+
+ -- Otherwise (Ada 83 or 95, or reverse bit order specified in
+ -- later Ada version), return the normalized value.
+
+ else
+ Rewrite (N,
+ Make_Integer_Literal (Loc,
+ Intval => Component_Bit_Offset (CE) / System_Storage_Unit));
+ end if;
+
Analyze_And_Resolve (N, Typ);
+ -- If back end is doing things, just apply universal integer checks
+
else
Apply_Universal_Integer_Attribute_Checks (N);
end if;
- end Position;
+ end Position_Attr;
----------
-- Pred --
@@ -5518,8 +5618,7 @@ package body Exp_Attr is
-- that the result is in range.
when Attribute_Aft |
- Attribute_Max_Alignment_For_Allocation |
- Attribute_Max_Size_In_Storage_Elements =>
+ Attribute_Max_Alignment_For_Allocation =>
Apply_Universal_Integer_Attribute_Checks (N);
-- The following attributes should not appear at this stage, since they
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 6049c452cb8..93396525dde 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -1750,24 +1750,50 @@ package body Exp_Ch6 is
if not Is_Empty_List (Post_Call) then
- -- If call is not a list member, it must be the triggering statement
- -- of a triggering alternative or an entry call alternative, and we
- -- can add the post call stuff to the corresponding statement list.
+ -- Cases where the call is not a member of a statement list
if not Is_List_Member (N) then
declare
- P : constant Node_Id := Parent (N);
+ P : Node_Id := Parent (N);
begin
- pragma Assert (Nkind_In (P, N_Triggering_Alternative,
- N_Entry_Call_Alternative));
+ -- In Ada 2012 the call may be a function call in an expression
+ -- (since OUT and IN OUT parameters are now allowed for such
+ -- calls. The write-back of (in)-out parameters is handled
+ -- by the back-end, but the constraint checks generated when
+ -- subtypes of formal and actual don't match must be inserted
+ -- in the form of assignments, at the nearest point after the
+ -- declaration or statement that contains the call.
+
+ if Ada_Version >= Ada_2012
+ and then Nkind (N) = N_Function_Call
+ then
+ while Nkind (P) not in N_Declaration
+ and then
+ Nkind (P) not in N_Statement_Other_Than_Procedure_Call
+ loop
+ P := Parent (P);
+ end loop;
+
+ Insert_Actions_After (P, Post_Call);
+
+ -- If not the special Ada 2012 case of a function call, then
+ -- we must have the triggering statement of a triggering
+ -- alternative or an entry call alternative, and we can add
+ -- the post call stuff to the corresponding statement list.
- if Is_Non_Empty_List (Statements (P)) then
- Insert_List_Before_And_Analyze
- (First (Statements (P)), Post_Call);
else
- Set_Statements (P, Post_Call);
+ pragma Assert (Nkind_In (P, N_Triggering_Alternative,
+ N_Entry_Call_Alternative));
+
+ if Is_Non_Empty_List (Statements (P)) then
+ Insert_List_Before_And_Analyze
+ (First (Statements (P)), Post_Call);
+ else
+ Set_Statements (P, Post_Call);
+ end if;
end if;
+
end;
-- Otherwise, normal case where N is in a statement sequence,
@@ -2764,7 +2790,7 @@ package body Exp_Ch6 is
Next_Formal (Formal);
end loop;
- -- If we are calling an Ada2012 function which needs to have the
+ -- If we are calling an Ada 2012 function which needs to have the
-- "accessibility level determined by the point of call" (AI05-0234)
-- passed in to it, then pass it in.
@@ -7779,6 +7805,15 @@ package body Exp_Ch6 is
-- to the object created by the allocator).
Rewrite (Allocator, Make_Reference (Loc, Relocate_Node (Function_Call)));
+
+ -- Ada 2005 (AI-251): If the type of the allocator is an interface then
+ -- generate an implicit conversion to force displacement of the "this"
+ -- pointer.
+
+ if Is_Interface (Designated_Type (Acc_Type)) then
+ Rewrite (Allocator, Convert_To (Acc_Type, Relocate_Node (Allocator)));
+ end if;
+
Analyze_And_Resolve (Allocator, Acc_Type);
end Make_Build_In_Place_Call_In_Allocator;
@@ -7954,6 +7989,7 @@ package body Exp_Ch6 is
Obj_Id : Entity_Id;
Ptr_Typ : Entity_Id;
Ptr_Typ_Decl : Node_Id;
+ New_Expr : Node_Id;
Result_Subt : Entity_Id;
Target : Node_Id;
@@ -8033,16 +8069,20 @@ package body Exp_Ch6 is
Insert_After_And_Analyze (Assign, Ptr_Typ_Decl);
-- Finally, create an access object initialized to a reference to the
- -- function call.
+ -- function call. We know this access value is non-null, so mark the
+ -- entity accordingly to suppress junk access checks.
+
+ New_Expr := Make_Reference (Loc, Relocate_Node (Func_Call));
- Obj_Id := Make_Temporary (Loc, 'R');
+ Obj_Id := Make_Temporary (Loc, 'R', New_Expr);
Set_Etype (Obj_Id, Ptr_Typ);
+ Set_Is_Known_Non_Null (Obj_Id);
Obj_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Obj_Id,
Object_Definition => New_Reference_To (Ptr_Typ, Loc),
- Expression => Make_Reference (Loc, Relocate_Node (Func_Call)));
+ Expression => New_Expr);
Insert_After_And_Analyze (Ptr_Typ_Decl, Obj_Decl);
Rewrite (Assign, Make_Null_Statement (Loc));
@@ -8295,12 +8335,14 @@ package body Exp_Ch6 is
end if;
-- Finally, create an access object initialized to a reference to the
- -- function call.
+ -- function call. We know this access value cannot be null, so mark the
+ -- entity accordingly to suppress the access check.
New_Expr := Make_Reference (Loc, Relocate_Node (Func_Call));
Def_Id := Make_Temporary (Loc, 'R', New_Expr);
Set_Etype (Def_Id, Ref_Type);
+ Set_Is_Known_Non_Null (Def_Id);
Insert_After_And_Analyze (Ptr_Typ_Decl,
Make_Object_Declaration (Loc,
@@ -8499,8 +8541,8 @@ package body Exp_Ch6 is
return False;
-- Handle a corner case, a cross-dialect subp renaming. For example,
- -- an Ada2012 renaming of an Ada05 subprogram. This can occur when a
- -- non-Ada2012 unit references predefined runtime units.
+ -- an Ada 2012 renaming of an Ada 2005 subprogram. This can occur when
+ -- an Ada 2005 (or earlier) unit references predefined run-time units.
elsif Present (Alias (Func_Id)) then
diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index 78d9b006abc..14443b0ef88 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -245,7 +245,10 @@ package body Exp_Imgv is
-- Snn (1 .. Pnn) then occurs as in the other cases. A special case is
-- when pragma Discard_Names applies, in which case we replace expr by:
- -- Missing ???
+ -- (rt'pos (expr))'Img
+
+ -- So that the result is a space followed by the decimal value for the
+ -- position of the enumeration value in the enumeration type.
procedure Expand_Image_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -368,7 +371,7 @@ package body Exp_Imgv is
or else No (Lit_Strings (Root_Type (Ptyp)))
then
-- When pragma Discard_Names applies to the first subtype, build
- -- (Pref'Pos)'Img.
+ -- (Pref'Pos (Expr))'Img.
Rewrite (N,
Make_Attribute_Reference (Loc,
@@ -1055,9 +1058,14 @@ package body Exp_Imgv is
-- typ'Pos (Typ'Last))
-- Wide_Character_Encoding_Method);
- -- where typS and typI are the enumeration image strings and
- -- indexes table, as described in Build_Enumeration_Image_Tables.
- -- NN is 8/16/32 for depending on the element type for typI.
+ -- where typS and typI are the enumeration image strings and indexes
+ -- table, as described in Build_Enumeration_Image_Tables. NN is 8/16/32
+ -- for depending on the element type for typI.
+
+ -- Finally if Discard_Names is in effect for an enumeration type, then
+ -- a special conditional expression is built that yields the space needed
+ -- for the decimal representation of the largest pos value in the subtype.
+ -- See code below for details.
procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal) is
Loc : constant Source_Ptr := Sloc (N);
@@ -1065,10 +1073,10 @@ package body Exp_Imgv is
Pref : constant Node_Id := Prefix (N);
Ptyp : constant Entity_Id := Etype (Pref);
Rtyp : constant Entity_Id := Root_Type (Ptyp);
- XX : RE_Id;
- YY : Entity_Id;
Arglist : List_Id;
Ttyp : Entity_Id;
+ XX : RE_Id;
+ YY : Entity_Id;
begin
-- Types derived from Standard.Boolean
@@ -1125,7 +1133,6 @@ package body Exp_Imgv is
-- Real types
elsif Is_Real_Type (Rtyp) then
-
Rewrite (N,
Make_Conditional_Expression (Loc,
Expressions => New_List (
@@ -1155,21 +1162,116 @@ package body Exp_Imgv is
else
pragma Assert (Is_Enumeration_Type (Rtyp));
- if Discard_Names (Rtyp) then
+ -- Whenever pragma Discard_Names is in effect, the value we need
+ -- is the value needed to accomodate the largest integer pos value
+ -- in the range of the subtype + 1 for the space at the start. We
+ -- build:
+
+ -- Tnn : constant Integer := Rtyp'Pos (Ptyp'Last)
- -- This is a configurable run-time, or else a restriction is in
- -- effect. In either case the attribute cannot be supported. Force
- -- a load error from Rtsfind to generate an appropriate message,
- -- as is done with other ZFP violations.
+ -- and replace the expression by
+ -- (if Ptyp'Range_Length = 0 then 0
+ -- else (if Tnn < 10 then 2
+ -- else (if Tnn < 100 then 3
+ -- ...
+ -- else n)))...
+
+ -- where n is equal to Rtyp'Pos (Rtyp'Last) + 1
+
+ -- Note: The above processing is in accordance with the intent of
+ -- the RM, which is that Width should be related to the impl-defined
+ -- behavior of Image. It is not clear what this means if Image is
+ -- not defined (as in the configurable run-time case for GNAT) and
+ -- gives an error at compile time.
+
+ -- We choose in this case to just go ahead and implement Width the
+ -- same way, returning what Image would have returned if it has been
+ -- available in the configurable run-time library.
+
+ if Discard_Names (Rtyp) then
declare
- Discard : constant Entity_Id := RTE (RE_Null);
- pragma Unreferenced (Discard);
+ Tnn : constant Entity_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('T'));
+
+ Cexpr : Node_Id;
+ P : Int;
+ M : Int;
+ K : Int;
+
begin
+ Insert_Action (N,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Tnn,
+ Constant_Present => True,
+ Object_Definition =>
+ New_Occurrence_Of (Standard_Integer, Loc),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Rtyp, Loc),
+ Attribute_Name => Name_Pos,
+ Expressions => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Ptyp, Loc),
+ Attribute_Name => Name_Last)))));
+
+ -- OK, now we need to build the conditional expression. First
+ -- get the value of M, the largest possible value needed.
+
+ P := UI_To_Int
+ (Enumeration_Pos (Entity (Type_High_Bound (Rtyp))));
+
+ K := 1;
+ M := 1;
+ while M < P loop
+ M := M * 10;
+ K := K + 1;
+ end loop;
+
+ -- Build inner else
+
+ Cexpr := Make_Integer_Literal (Loc, K);
+
+ -- Wrap in inner if's until counted down to 2
+
+ while K > 2 loop
+ M := M / 10;
+ K := K - 1;
+
+ Cexpr :=
+ Make_Conditional_Expression (Loc,
+ Expressions => New_List (
+ Make_Op_Lt (Loc,
+ Left_Opnd => New_Occurrence_Of (Tnn, Loc),
+ Right_Opnd => Make_Integer_Literal (Loc, M)),
+ Make_Integer_Literal (Loc, K),
+ Cexpr));
+ end loop;
+
+ -- Add initial comparison for null range and we are done, so
+ -- rewrite the attribute occurrence with this expression.
+
+ Rewrite (N,
+ Convert_To (Typ,
+ Make_Conditional_Expression (Loc,
+ Expressions => New_List (
+ Make_Op_Eq (Loc,
+ Left_Opnd =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Ptyp, Loc),
+ Attribute_Name => Name_Range_Length),
+ Right_Opnd => Make_Integer_Literal (Loc, 0)),
+ Make_Integer_Literal (Loc, 0),
+ Cexpr))));
+
+ Analyze_And_Resolve (N, Typ);
return;
end;
end if;
+ -- Normal case, not Discard_Names
+
Ttyp := Component_Type (Etype (Lit_Indexes (Rtyp)));
case Attr is
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 22e9bb04691..8cb084d6ba2 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -270,10 +270,17 @@ package body Exp_Prag is
procedure Expand_Pragma_Check (N : Node_Id) is
Cond : constant Node_Id := Arg2 (N);
- Loc : constant Source_Ptr := Sloc (Cond);
Nam : constant Name_Id := Chars (Arg1 (N));
Msg : Node_Id;
+ Loc : constant Source_Ptr := Sloc (First_Node (Cond));
+ -- Source location used in the case of a failed assertion. Note that
+ -- the source location of the expression is not usually the best choice
+ -- here. For example, it gets located on the last AND keyword in a
+ -- chain of boolean expressiond AND'ed together. It is best to put the
+ -- message on the first character of the assertion, which is the effect
+ -- of the First_Node call here.
+
begin
-- We already know that this check is enabled, because otherwise the
-- semantic pass dealt with rewriting the assertion (see Sem_Prag)
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index e675da82889..83506f08ff7 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6420,17 +6420,29 @@ package body Exp_Util is
-- Start of processing for Remove_Side_Effects
begin
- -- Handle cases in which there is nothing to do
-
- if not Expander_Active then
+ -- We only need to do removal of side effects if we are generating
+ -- actual code. That's because the whole issue of side effects is purely
+ -- a run-time issue, and the removal is required only to get proper
+ -- behavior at run-time.
+
+ -- In the Alfa case, we don't need to remove side effects because we
+ -- only perform formal verification is performed only on expressions
+ -- that are provably side-effect free. If we tried to remove side
+ -- effects in the Alfa case, we would get into a mess since in the case
+ -- of limited types in particular, removal of side effects involves the
+ -- use of access types or references which are not permitted in Alfa
+ -- mode.
+
+ if not Full_Expander_Active then
return;
+ end if;
-- Cannot generate temporaries if the invocation to remove side effects
-- was issued too early and the type of the expression is not resolved
-- (this happens because routines Duplicate_Subexpr_XX implicitly invoke
-- Remove_Side_Effects).
- elsif No (Exp_Type)
+ if No (Exp_Type)
or else Ekind (Exp_Type) = E_Access_Attribute_Type
then
return;
@@ -6622,15 +6634,6 @@ package body Exp_Util is
-- Otherwise we generate a reference to the value
else
- -- An expression which is in Alfa mode is considered side effect free
- -- if the resulting value is captured by a variable or a constant.
-
- if Alfa_Mode
- and then Nkind (Parent (Exp)) = N_Object_Declaration
- then
- return;
- end if;
-
-- Special processing for function calls that return a limited type.
-- We need to build a declaration that will enable build-in-place
-- expansion of the call. This is not done if the context is already
@@ -6665,39 +6668,25 @@ package body Exp_Util is
Def_Id := Make_Temporary (Loc, 'R', Exp);
Set_Etype (Def_Id, Exp_Type);
- -- The regular expansion of functions with side effects involves the
- -- generation of an access type to capture the return value found on
- -- the secondary stack. Since Alfa (and why) cannot process access
- -- types, use a different approach which ignores the secondary stack
- -- and "copies" the returned object.
-
- if Alfa_Mode then
- Res := New_Reference_To (Def_Id, Loc);
- Ref_Type := Exp_Type;
-
- -- Regular expansion utilizing an access type and 'reference
-
- else
- Res :=
- Make_Explicit_Dereference (Loc,
- Prefix => New_Reference_To (Def_Id, Loc));
+ Res :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Reference_To (Def_Id, Loc));
- -- Generate:
- -- type Ann is access all <Exp_Type>;
+ -- Generate:
+ -- type Ann is access all <Exp_Type>;
- Ref_Type := Make_Temporary (Loc, 'A');
+ Ref_Type := Make_Temporary (Loc, 'A');
- Ptr_Typ_Decl :=
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Ref_Type,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present => True,
- Subtype_Indication =>
- New_Reference_To (Exp_Type, Loc)));
+ Ptr_Typ_Decl :=
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Ref_Type,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication =>
+ New_Reference_To (Exp_Type, Loc)));
- Insert_Action (Exp, Ptr_Typ_Decl);
- end if;
+ Insert_Action (Exp, Ptr_Typ_Decl);
E := Exp;
if Nkind (E) = N_Explicit_Dereference then
@@ -6710,8 +6699,13 @@ package body Exp_Util is
if Alfa_Mode then
New_Exp := E;
+
+ -- Otherwise generate reference, marking the value as non-null
+ -- since we know it cannot be null and we don't want a check.
+
else
New_Exp := Make_Reference (Loc, E);
+ Set_Is_Known_Non_Null (Def_Id);
end if;
end if;
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index b1a33d58da1..d9759843b72 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -4239,7 +4239,8 @@ package body Freeze is
-- By default, if no size clause is present, an enumeration type with
-- Convention C is assumed to interface to a C enum, and has integer
-- size. This applies to types. For subtypes, verify that its base
- -- type has no size clause either.
+ -- type has no size clause either. Treat other foreign conventions
+ -- in the same way, and also make sure alignment is set right.
if Has_Foreign_Convention (Typ)
and then not Has_Size_Clause (Typ)
@@ -4247,6 +4248,7 @@ package body Freeze is
and then Esize (Typ) < Standard_Integer_Size
then
Init_Esize (Typ, Standard_Integer_Size);
+ Set_Alignment (Typ, Alignment (Standard_Integer));
else
-- If the enumeration type interfaces to C, and it has a size clause
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 2dad57a3b3b..35e7d9e769b 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -226,6 +226,12 @@ begin
Opt.Suppress_Options := Scope_Suppress;
end;
+ -- This is where we can capture the value of the compilation unit specific
+ -- restrictions that have been set by the config pragma files (or from
+ -- Targparm), for later restoration when processing e.g. subunits.
+
+ Save_Config_Cunit_Boolean_Restrictions;
+
-- If there was a -gnatem switch, initialize the mappings of unit names to
-- file names and of file names to path names from the mapping file.
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 4dfc45b6e79..8174b2d2e68 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -1545,10 +1545,10 @@ ada/checks.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads \
ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/par_sco.ads ada/put_alfa.ads ada/restrict.ads ada/restrict.adb \
- ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \
- ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/opt.adb \
+ ada/output.ads ada/par_sco.ads ada/put_alfa.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
+ ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads \
ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
@@ -2396,29 +2396,31 @@ ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads ada/exp_dist.ads \
- ada/exp_imgv.ads ada/exp_imgv.adb ada/exp_pakd.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
- ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \
- ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
- ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/rtsfind.adb ada/sem.ads ada/sem_aux.ads \
+ ada/err_vars.ads ada/errout.ads ada/errout.adb ada/erroutc.ads \
+ ada/erroutc.adb ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads \
+ ada/exp_ch4.ads ada/exp_dist.ads ada/exp_imgv.ads ada/exp_imgv.adb \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-load.ads ada/lib-sort.adb ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem_aux.ads \
ada/sem_aux.adb ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads \
ada/sem_dist.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_util.ads \
ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/urealp.adb ada/validsw.ads ada/widechar.ads
+ ada/stringt.adb ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
+ ada/widechar.ads
ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2544,18 +2546,19 @@ ada/exp_smem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib-load.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/rtsfind.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads \
- ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
- ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
- ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_prag.ads ada/sem_util.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_prag.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/exp_strm.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
@@ -2666,21 +2669,22 @@ ada/expander.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/gnat.ads ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib-load.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
+ ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
+ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
+ ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stylesw.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/fmap.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/fmap.ads ada/fmap.adb \
@@ -2936,21 +2940,22 @@ ada/inline.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/hostparm.ads ada/inline.ads ada/inline.adb ada/interfac.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \
- ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
- ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/scans.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_prag.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stylesw.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/interfac.o : ada/interfac.ads ada/system.ads
@@ -2963,19 +2968,19 @@ ada/itypes.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
ada/itypes.adb ada/lib.ads ada/lib-load.ads ada/namet.ads ada/namet.adb \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
- ada/rident.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads \
- ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
- ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
- ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
+ ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
+ ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/sem_ch9.ads ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/krunch.o : ada/ada.ads ada/a-unccon.ads ada/hostparm.ads \
ada/krunch.ads ada/krunch.adb ada/system.ads ada/s-exctab.ads \
@@ -3689,24 +3694,24 @@ ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \
- ada/output.ads ada/put_alfa.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
- ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch2.ads ada/sem_ch2.adb \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_eval.ads \
- ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/warnsw.ads ada/widechar.ads
+ ada/output.ads ada/put_alfa.ads ada/restrict.ads ada/restrict.adb \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch11.ads \
+ ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch2.ads \
+ ada/sem_ch2.adb ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
+ ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
+ ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3812,14 +3817,14 @@ ada/sem_case.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/gnatvsn.ads ada/hlo.ads ada/hostparm.ads ada/inline.ads \
ada/interfac.ads ada/lib.ads ada/lib-load.ads ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
- ada/opt.ads ada/output.ads ada/rident.ads ada/scans.ads ada/sem.ads \
- ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb \
- ada/sem_case.ads ada/sem_case.adb ada/sem_ch10.ads ada/sem_ch11.ads \
- ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads \
- ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads \
- ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_eval.ads ada/sem_prag.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_aux.adb ada/sem_case.ads ada/sem_case.adb ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_eval.ads \
+ ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
@@ -4044,7 +4049,7 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \
+ ada/nmake.adb ada/opt.ads ada/opt.adb ada/output.ads ada/par_sco.ads \
ada/put_alfa.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads ada/sem_case.adb \
@@ -4345,23 +4350,23 @@ ada/sem_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib-load.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem.adb \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads \
- ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_dist.adb ada/sem_eval.ads ada/sem_prag.ads \
- ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/types.adb \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
+ ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
+ ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
+ ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/sem_ch9.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_dist.adb \
+ ada/sem_eval.ads ada/sem_prag.ads ada/sem_res.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/stylesw.ads ada/system.ads \
+ ada/s-carun8.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/types.ads \
+ ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4409,22 +4414,23 @@ ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \
- ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
- ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_elim.ads ada/sem_elim.adb ada/sem_prag.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-htable.adb ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-strhas.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/scans.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_elim.ads \
+ ada/sem_elim.adb ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/stand.ads ada/stringt.ads ada/stylesw.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-strhas.ads ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4494,21 +4500,22 @@ ada/sem_mech.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/gnat.ads ada/g-htable.ads ada/gnatvsn.ads ada/hlo.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib-load.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \
- ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads ada/sem_aux.ads \
- ada/sem_aux.adb ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
- ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_mech.ads ada/sem_mech.adb ada/sem_prag.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stylesw.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/scans.ads ada/sem.ads ada/sem.adb \
+ ada/sem_attr.ads ada/sem_aux.ads ada/sem_aux.adb ada/sem_ch10.ads \
+ ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch2.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_mech.ads \
+ ada/sem_mech.adb ada/sem_prag.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/ali.ads ada/alloc.ads ada/aspects.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index ebb7ddb949f..4248a74f4fb 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -273,15 +273,9 @@ INCLUDES = -I- -I. -I.. -I$(srcdir)/ada -I$(srcdir) -I$(srcdir)/config \
ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
-INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include
-
-ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
- # On Windows native the tconfig.h files used by C runtime files needs to have
- # the gcc source dir in its include dir list
- INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. -iquote $(fsrcdir)/ada \
- -I$(fsrcdir)/../include -I$(fsrcdir)
-endif
+INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
+ -iquote $(fsrcdir)/ada -iquote $(fsrcdir) \
+ -I$(fsrcdir)/../include
ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index d7ca5dbbe6e..12971a63038 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -160,7 +160,7 @@ static bool compile_time_known_address_p (Node_Id);
static bool cannot_be_superflat_p (Node_Id);
static bool constructor_address_p (tree);
static void components_to_record (tree, Node_Id, tree, int, bool, bool, bool,
- bool, bool, bool, bool, tree *);
+ bool, bool, bool, bool, tree, tree *);
static Uint annotate_value (tree);
static void annotate_rep (Entity_Id, tree);
static tree build_position_list (tree, bool, tree, tree, unsigned int, tree);
@@ -176,6 +176,7 @@ static unsigned int ceil_alignment (unsigned HOST_WIDE_INT);
static void check_ok_for_atomic (tree, Entity_Id, bool);
static tree create_field_decl_from (tree, tree, tree, tree, tree,
VEC(subst_pair,heap) *);
+static tree create_rep_part (tree, tree, tree);
static tree get_rep_part (tree);
static tree create_variant_part_from (tree, VEC(variant_desc,heap) *, tree,
tree, VEC(subst_pair,heap) *);
@@ -3048,7 +3049,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_field_list, packed, definition, false,
all_rep, is_unchecked_union, debug_info_p,
false, OK_To_Reorder_Components (gnat_entity),
- NULL);
+ all_rep ? NULL_TREE : bitsize_zero_node, NULL);
/* If it is passed by reference, force BLKmode to ensure that objects
of this type will always be put in memory. */
@@ -7096,6 +7097,10 @@ compare_field_bitpos (const PTR rt1, const PTR rt2)
REORDER is true if we are permitted to reorder components of this type.
+ FIRST_FREE_POS, if nonzero, is the first (lowest) free field position in
+ the outer record type down to this variant level. It is nonzero only if
+ all the fields down to this level have a rep clause and ALL_REP is false.
+
P_GNU_REP_LIST, if nonzero, is a pointer to a list to which each field
with a rep clause is to be added; in this case, that is all that should
be done with such fields. */
@@ -7106,12 +7111,13 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
bool cancel_alignment, bool all_rep,
bool unchecked_union, bool debug_info,
bool maybe_unused, bool reorder,
- tree *p_gnu_rep_list)
+ tree first_free_pos, tree *p_gnu_rep_list)
{
bool all_rep_and_size = all_rep && TYPE_SIZE (gnu_record_type);
bool layout_with_rep = false;
Node_Id component_decl, variant_part;
tree gnu_field, gnu_next, gnu_last;
+ tree gnu_rep_part = NULL_TREE;
tree gnu_variant_part = NULL_TREE;
tree gnu_rep_list = NULL_TREE;
tree gnu_var_list = NULL_TREE;
@@ -7185,7 +7191,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
= concat_name (get_identifier (Get_Name_String (Chars (gnat_discr))),
"XVN");
tree gnu_union_type, gnu_union_name;
- tree gnu_variant_list = NULL_TREE;
+ tree this_first_free_pos, gnu_variant_list = NULL_TREE;
if (TREE_CODE (gnu_name) == TYPE_DECL)
gnu_name = DECL_NAME (gnu_name);
@@ -7193,12 +7199,10 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
gnu_union_name
= concat_name (gnu_name, IDENTIFIER_POINTER (gnu_var_name));
- /* Reuse an enclosing union if all fields are in the variant part
- and there is no representation clause on the record, to match
- the layout of C unions. There is an associated check below. */
- if (!gnu_field_list
- && TREE_CODE (gnu_record_type) == UNION_TYPE
- && !TYPE_PACKED (gnu_record_type))
+ /* Reuse the enclosing union if this is an Unchecked_Union whose fields
+ are all in the variant part, to match the layout of C unions. There
+ is an associated check below. */
+ if (TREE_CODE (gnu_record_type) == UNION_TYPE)
gnu_union_type = gnu_record_type;
else
{
@@ -7210,6 +7214,29 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
TYPE_PACKED (gnu_union_type) = TYPE_PACKED (gnu_record_type);
}
+ /* If all the fields down to this level have a rep clause, find out
+ whether all the fields at this level also have one. If so, then
+ compute the new first free position to be passed downward. */
+ this_first_free_pos = first_free_pos;
+ if (this_first_free_pos)
+ {
+ for (gnu_field = gnu_field_list;
+ gnu_field;
+ gnu_field = DECL_CHAIN (gnu_field))
+ if (DECL_FIELD_OFFSET (gnu_field))
+ {
+ tree pos = bit_position (gnu_field);
+ if (!tree_int_cst_lt (pos, this_first_free_pos))
+ this_first_free_pos
+ = size_binop (PLUS_EXPR, pos, DECL_SIZE (gnu_field));
+ }
+ else
+ {
+ this_first_free_pos = NULL_TREE;
+ break;
+ }
+ }
+
for (variant = First_Non_Pragma (Variants (variant_part));
Present (variant);
variant = Next_Non_Pragma (variant))
@@ -7231,8 +7258,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
TYPE_PACKED (gnu_variant_type) = TYPE_PACKED (gnu_record_type);
/* Similarly, if the outer record has a size specified and all
- fields have record rep clauses, we can propagate the size
- into the variant part. */
+ the fields have a rep clause, we can propagate the size. */
if (all_rep_and_size)
{
TYPE_SIZE (gnu_variant_type) = TYPE_SIZE (gnu_record_type);
@@ -7244,20 +7270,24 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
we aren't sure to really use it at this point, see below. */
components_to_record (gnu_variant_type, Component_List (variant),
NULL_TREE, packed, definition,
- !all_rep_and_size, all_rep,
- unchecked_union, debug_info,
- true, reorder, &gnu_rep_list);
+ !all_rep_and_size, all_rep, unchecked_union,
+ debug_info, true, reorder, this_first_free_pos,
+ all_rep || this_first_free_pos
+ ? NULL : &gnu_rep_list);
gnu_qual = choices_to_gnu (gnu_discr, Discrete_Choices (variant));
-
Set_Present_Expr (variant, annotate_value (gnu_qual));
- /* If this is an Unchecked_Union and we have exactly one field,
- use this field directly to match the layout of C unions. */
- if (unchecked_union
- && TYPE_FIELDS (gnu_variant_type)
- && !DECL_CHAIN (TYPE_FIELDS (gnu_variant_type)))
- gnu_field = TYPE_FIELDS (gnu_variant_type);
+ /* If this is an Unchecked_Union whose fields are all in the variant
+ part and we have a single field with no representation clause or
+ placed at offset zero, use the field directly to match the layout
+ of C unions. */
+ if (TREE_CODE (gnu_record_type) == UNION_TYPE
+ && (gnu_field = TYPE_FIELDS (gnu_variant_type)) != NULL_TREE
+ && !DECL_CHAIN (gnu_field)
+ && (!DECL_FIELD_OFFSET (gnu_field)
+ || integer_zerop (bit_position (gnu_field))))
+ DECL_CONTEXT (gnu_field) = gnu_union_type;
else
{
/* Deal with packedness like in gnat_to_gnu_field. */
@@ -7328,15 +7358,18 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
gnu_variant_part
= create_field_decl (gnu_var_name, gnu_union_type, gnu_record_type,
all_rep ? TYPE_SIZE (gnu_union_type) : 0,
- all_rep ? bitsize_zero_node : 0,
+ all_rep || this_first_free_pos
+ ? bitsize_zero_node : 0,
union_field_packed, 0);
DECL_INTERNAL_P (gnu_variant_part) = 1;
- DECL_CHAIN (gnu_variant_part) = gnu_field_list;
- gnu_field_list = gnu_variant_part;
}
}
+ /* From now on, a zero FIRST_FREE_POS is totally useless. */
+ if (first_free_pos && integer_zerop (first_free_pos))
+ first_free_pos = NULL_TREE;
+
/* Scan GNU_FIELD_LIST and see if any fields have rep clauses and, if we are
permitted to reorder components, self-referential sizes or variable sizes.
If they do, pull them out and put them onto the appropriate list. We have
@@ -7368,33 +7401,24 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
continue;
}
- if (reorder)
+ /* Reorder non-internal fields with non-fixed size. */
+ if (reorder
+ && !DECL_INTERNAL_P (gnu_field)
+ && !(DECL_SIZE (gnu_field)
+ && TREE_CODE (DECL_SIZE (gnu_field)) == INTEGER_CST))
{
- /* Pull out the variant part and put it onto GNU_SELF_LIST. */
- if (gnu_field == gnu_variant_part)
+ tree type_size = TYPE_SIZE (TREE_TYPE (gnu_field));
+
+ if (CONTAINS_PLACEHOLDER_P (type_size))
{
MOVE_FROM_FIELD_LIST_TO (gnu_self_list);
continue;
}
- /* Skip internal fields and fields with fixed size. */
- if (!DECL_INTERNAL_P (gnu_field)
- && !(DECL_SIZE (gnu_field)
- && TREE_CODE (DECL_SIZE (gnu_field)) == INTEGER_CST))
+ if (TREE_CODE (type_size) != INTEGER_CST)
{
- tree type_size = TYPE_SIZE (TREE_TYPE (gnu_field));
-
- if (CONTAINS_PLACEHOLDER_P (type_size))
- {
- MOVE_FROM_FIELD_LIST_TO (gnu_self_list);
- continue;
- }
-
- if (TREE_CODE (type_size) != INTEGER_CST)
- {
- MOVE_FROM_FIELD_LIST_TO (gnu_var_list);
- continue;
- }
+ MOVE_FROM_FIELD_LIST_TO (gnu_var_list);
+ continue;
}
}
@@ -7416,14 +7440,14 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
= chainon (nreverse (gnu_self_list),
chainon (nreverse (gnu_var_list), gnu_field_list));
- /* If we have any fields in our rep'ed field list and it is not the case that
- all the fields in the record have rep clauses and P_REP_LIST is nonzero,
- set it and ignore these fields. */
- if (gnu_rep_list && p_gnu_rep_list && !all_rep)
+ /* If P_REP_LIST is nonzero, this means that we are asked to move the fields
+ in our REP list to the previous level because this level needs them in
+ order to do a correct layout, i.e. avoid having overlapping fields. */
+ if (p_gnu_rep_list && gnu_rep_list)
*p_gnu_rep_list = chainon (*p_gnu_rep_list, gnu_rep_list);
/* Otherwise, sort the fields by bit position and put them into their own
- record, before the others, if we also have fields without rep clauses. */
+ record, before the others, if we also have fields without rep clause. */
else if (gnu_rep_list)
{
tree gnu_rep_type
@@ -7451,11 +7475,12 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
if (gnu_field_list)
{
finish_record_type (gnu_rep_type, gnu_rep_list, 1, debug_info);
- gnu_field
- = create_field_decl (get_identifier ("REP"), gnu_rep_type,
- gnu_record_type, NULL_TREE, NULL_TREE, 0, 1);
- DECL_INTERNAL_P (gnu_field) = 1;
- gnu_field_list = chainon (gnu_field_list, gnu_field);
+
+ /* If FIRST_FREE_POS is nonzero, we need to ensure that the fields
+ without rep clause are laid out starting from this position.
+ Therefore, we force it as a minimal size on the REP part. */
+ gnu_rep_part
+ = create_rep_part (gnu_rep_type, gnu_record_type, first_free_pos);
}
else
{
@@ -7464,6 +7489,28 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
}
}
+ /* If FIRST_FREE_POS is nonzero, we need to ensure that the fields without
+ rep clause are laid out starting from this position. Therefore, if we
+ have not already done so, we create a fake REP part with this size. */
+ if (first_free_pos && !layout_with_rep && !gnu_rep_part)
+ {
+ tree gnu_rep_type = make_node (RECORD_TYPE);
+ finish_record_type (gnu_rep_type, NULL_TREE, 0, debug_info);
+ gnu_rep_part
+ = create_rep_part (gnu_rep_type, gnu_record_type, first_free_pos);
+ }
+
+ /* Now chain the REP part at the end of the reversed field list. */
+ if (gnu_rep_part)
+ gnu_field_list = chainon (gnu_field_list, gnu_rep_part);
+
+ /* And the variant part at the beginning. */
+ if (gnu_variant_part)
+ {
+ DECL_CHAIN (gnu_variant_part) = gnu_field_list;
+ gnu_field_list = gnu_variant_part;
+ }
+
if (cancel_alignment)
TYPE_ALIGN (gnu_record_type) = 0;
@@ -8567,6 +8614,24 @@ create_field_decl_from (tree old_field, tree field_type, tree record_type,
return new_field;
}
+/* Create the REP part of RECORD_TYPE with REP_TYPE. If MIN_SIZE is nonzero,
+ it is the minimal size the REP_PART must have. */
+
+static tree
+create_rep_part (tree rep_type, tree record_type, tree min_size)
+{
+ tree field;
+
+ if (min_size && !tree_int_cst_lt (TYPE_SIZE (rep_type), min_size))
+ min_size = NULL_TREE;
+
+ field = create_field_decl (get_identifier ("REP"), rep_type, record_type,
+ min_size, bitsize_zero_node, 0, 1);
+ DECL_INTERNAL_P (field) = 1;
+
+ return field;
+}
+
/* Return the REP part of RECORD_TYPE, if any. Otherwise return NULL. */
static tree
@@ -8575,10 +8640,10 @@ get_rep_part (tree record_type)
tree field = TYPE_FIELDS (record_type);
/* The REP part is the first field, internal, another record, and its name
- doesn't start with an underscore (i.e. is not generated by the FE). */
+ starts with an 'R'. */
if (DECL_INTERNAL_P (field)
&& TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
- && IDENTIFIER_POINTER (DECL_NAME (field)) [0] != '_')
+ && IDENTIFIER_POINTER (DECL_NAME (field)) [0] == 'R')
return field;
return NULL_TREE;
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 8a74e6ccb45..42b4e9154c3 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -129,6 +129,7 @@ struct GTY(()) language_function {
VEC(parm_attr,gc) *parm_attr_cache;
bitmap named_ret_val;
VEC(tree,gc) *other_ret_val;
+ int gnat_ret;
};
#define f_parm_attr_cache \
@@ -140,6 +141,9 @@ struct GTY(()) language_function {
#define f_other_ret_val \
DECL_STRUCT_FUNCTION (current_function_decl)->language->other_ret_val
+#define f_gnat_ret \
+ DECL_STRUCT_FUNCTION (current_function_decl)->language->gnat_ret
+
/* A structure used to gather together information about a statement group.
We use this to gather related statements, for example the "then" part
of a IF. In the case where it represents a lexical scope, we may also
@@ -2674,12 +2678,20 @@ establish_gnat_vms_condition_handler (void)
first list. These are the Named Return Values.
4. Adjust the relevant RETURN_EXPRs and replace the occurrences of the
- Named Return Values in the function with the RESULT_DECL. */
+ Named Return Values in the function with the RESULT_DECL.
+
+ If the function returns an unconstrained type, things are a bit different
+ because the anonymous return object is allocated on the secondary stack
+ and RESULT_DECL is only a pointer to it. Each return object can be of a
+ different size and is allocated separately so we need not care about the
+ aforementioned overlapping issues. Therefore, we don't collect the other
+ expressions and skip step #2 in the algorithm. */
struct nrv_data
{
bitmap nrv;
tree result;
+ Node_Id gnat_ret;
struct pointer_set_t *visited;
};
@@ -2812,8 +2824,153 @@ finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
*tp = convert (TREE_TYPE (t), dp->result);
/* Avoid walking into the same tree more than once. Unfortunately, we
- can't just use walk_tree_without_duplicates because it would only call
- us for the first occurrence of NRVs in the function body. */
+ can't just use walk_tree_without_duplicates because it would only
+ call us for the first occurrence of NRVs in the function body. */
+ if (pointer_set_insert (dp->visited, *tp))
+ *walk_subtrees = 0;
+
+ return NULL_TREE;
+}
+
+/* Likewise, but used when the function returns an unconstrained type. */
+
+static tree
+finalize_nrv_unc_r (tree *tp, int *walk_subtrees, void *data)
+{
+ struct nrv_data *dp = (struct nrv_data *)data;
+ tree t = *tp;
+
+ /* No need to walk into types. */
+ if (TYPE_P (t))
+ *walk_subtrees = 0;
+
+ /* We need to see the DECL_EXPR of NRVs before any other references so we
+ walk the body of BIND_EXPR before walking its variables. */
+ else if (TREE_CODE (t) == BIND_EXPR)
+ walk_tree (&BIND_EXPR_BODY (t), finalize_nrv_unc_r, data, NULL);
+
+ /* Change RETURN_EXPRs of NRVs to assign to the RESULT_DECL only the final
+ return value built by the allocator instead of the whole construct. */
+ else if (TREE_CODE (t) == RETURN_EXPR
+ && TREE_CODE (TREE_OPERAND (t, 0)) == MODIFY_EXPR)
+ {
+ tree ret_val = TREE_OPERAND (TREE_OPERAND (t, 0), 1);
+
+ /* This is the construct returned by the allocator. */
+ if (TREE_CODE (ret_val) == COMPOUND_EXPR
+ && TREE_CODE (TREE_OPERAND (ret_val, 0)) == INIT_EXPR)
+ {
+ if (TYPE_IS_FAT_POINTER_P (TREE_TYPE (ret_val)))
+ ret_val
+ = VEC_index (constructor_elt,
+ CONSTRUCTOR_ELTS
+ (TREE_OPERAND (TREE_OPERAND (ret_val, 0), 1)),
+ 1)->value;
+ else
+ ret_val = TREE_OPERAND (TREE_OPERAND (ret_val, 0), 1);
+ }
+
+ /* Strip useless conversions around the return value. */
+ if (gnat_useless_type_conversion (ret_val)
+ || TREE_CODE (ret_val) == VIEW_CONVERT_EXPR)
+ ret_val = TREE_OPERAND (ret_val, 0);
+
+ /* Strip unpadding around the return value. */
+ if (TREE_CODE (ret_val) == COMPONENT_REF
+ && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (ret_val, 0))))
+ ret_val = TREE_OPERAND (ret_val, 0);
+
+ /* Assign the new return value to the RESULT_DECL. */
+ if (is_nrv_p (dp->nrv, ret_val))
+ TREE_OPERAND (TREE_OPERAND (t, 0), 1)
+ = TREE_OPERAND (DECL_INITIAL (ret_val), 0);
+ }
+
+ /* Adjust the DECL_EXPR of NRVs to call the allocator and save the result
+ into a new variable. */
+ else if (TREE_CODE (t) == DECL_EXPR
+ && is_nrv_p (dp->nrv, DECL_EXPR_DECL (t)))
+ {
+ tree saved_current_function_decl = current_function_decl;
+ tree var = DECL_EXPR_DECL (t);
+ tree alloc, p_array, new_var, new_ret;
+ VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2);
+
+ /* Create an artificial context to build the allocation. */
+ current_function_decl = decl_function_context (var);
+ start_stmt_group ();
+ gnat_pushlevel ();
+
+ /* This will return a COMPOUND_EXPR with the allocation in the first
+ arm and the final return value in the second arm. */
+ alloc = build_allocator (TREE_TYPE (var), DECL_INITIAL (var),
+ TREE_TYPE (dp->result),
+ Procedure_To_Call (dp->gnat_ret),
+ Storage_Pool (dp->gnat_ret),
+ Empty, false);
+
+ /* The new variable is built as a reference to the allocated space. */
+ new_var
+ = build_decl (DECL_SOURCE_LOCATION (var), VAR_DECL, DECL_NAME (var),
+ build_reference_type (TREE_TYPE (var)));
+ DECL_BY_REFERENCE (new_var) = 1;
+
+ if (TYPE_IS_FAT_POINTER_P (TREE_TYPE (alloc)))
+ {
+ /* The new initial value is a COMPOUND_EXPR with the allocation in
+ the first arm and the value of P_ARRAY in the second arm. */
+ DECL_INITIAL (new_var)
+ = build2 (COMPOUND_EXPR, TREE_TYPE (new_var),
+ TREE_OPERAND (alloc, 0),
+ VEC_index (constructor_elt,
+ CONSTRUCTOR_ELTS (TREE_OPERAND (alloc, 1)),
+ 0)->value);
+
+ /* Build a modified CONSTRUCTOR that references NEW_VAR. */
+ p_array = TYPE_FIELDS (TREE_TYPE (alloc));
+ CONSTRUCTOR_APPEND_ELT (v, p_array,
+ fold_convert (TREE_TYPE (p_array), new_var));
+ CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (p_array),
+ VEC_index (constructor_elt,
+ CONSTRUCTOR_ELTS
+ (TREE_OPERAND (alloc, 1)),
+ 1)->value);
+ new_ret = build_constructor (TREE_TYPE (alloc), v);
+ }
+ else
+ {
+ /* The new initial value is just the allocation. */
+ DECL_INITIAL (new_var) = alloc;
+ new_ret = fold_convert (TREE_TYPE (alloc), new_var);
+ }
+
+ gnat_pushdecl (new_var, Empty);
+
+ /* Destroy the artificial context and insert the new statements. */
+ gnat_zaplevel ();
+ *tp = end_stmt_group ();
+ current_function_decl = saved_current_function_decl;
+
+ /* Chain NEW_VAR immediately after VAR and ignore the latter. */
+ DECL_CHAIN (new_var) = DECL_CHAIN (var);
+ DECL_CHAIN (var) = new_var;
+ DECL_IGNORED_P (var) = 1;
+
+ /* Save the new return value and the dereference of NEW_VAR. */
+ DECL_INITIAL (var)
+ = build2 (COMPOUND_EXPR, TREE_TYPE (var), new_ret,
+ build1 (INDIRECT_REF, TREE_TYPE (var), new_var));
+ /* ??? Kludge to avoid messing up during inlining. */
+ DECL_CONTEXT (var) = NULL_TREE;
+ }
+
+ /* And replace all uses of NRVs with the dereference of NEW_VAR. */
+ else if (is_nrv_p (dp->nrv, t))
+ *tp = TREE_OPERAND (DECL_INITIAL (t), 1);
+
+ /* Avoid walking into the same tree more than once. Unfortunately, we
+ can't just use walk_tree_without_duplicates because it would only
+ call us for the first occurrence of NRVs in the function body. */
if (pointer_set_insert (dp->visited, *tp))
*walk_subtrees = 0;
@@ -2822,13 +2979,14 @@ finalize_nrv_r (tree *tp, int *walk_subtrees, void *data)
/* Finalize the Named Return Value optimization for FNDECL. The NRV bitmap
contains the candidates for Named Return Value and OTHER is a list of
- the other return values. */
+ the other return values. GNAT_RET is a representative return node. */
static void
-finalize_nrv (tree fndecl, bitmap nrv, VEC(tree,gc) *other)
+finalize_nrv (tree fndecl, bitmap nrv, VEC(tree,gc) *other, Node_Id gnat_ret)
{
struct cgraph_node *node;
struct nrv_data data;
+ walk_tree_fn func;
unsigned int i;
tree iter;
@@ -2860,8 +3018,13 @@ finalize_nrv (tree fndecl, bitmap nrv, VEC(tree,gc) *other)
/* Adjust the relevant RETURN_EXPRs and replace the occurrences of NRVs. */
data.nrv = nrv;
data.result = DECL_RESULT (fndecl);
+ data.gnat_ret = gnat_ret;
data.visited = pointer_set_create ();
- walk_tree (&DECL_SAVED_TREE (fndecl), finalize_nrv_r, &data, NULL);
+ if (TYPE_RETURN_UNCONSTRAINED_P (TREE_TYPE (fndecl)))
+ func = finalize_nrv_unc_r;
+ else
+ func = finalize_nrv_r;
+ walk_tree (&DECL_SAVED_TREE (fndecl), func, &data, NULL);
pointer_set_destroy (data.visited);
}
@@ -2886,7 +3049,7 @@ return_value_ok_for_nrv_p (tree ret_obj, tree ret_val)
if (TREE_ADDRESSABLE (ret_val))
return false;
- if (DECL_ALIGN (ret_val) > DECL_ALIGN (ret_obj))
+ if (ret_obj && DECL_ALIGN (ret_val) > DECL_ALIGN (ret_obj))
return false;
return true;
@@ -3278,6 +3441,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
save_gnu_tree (gnat_param, NULL_TREE, false);
}
+ /* Disconnect the variable created for the return value. */
if (gnu_return_var_elmt)
TREE_VALUE (gnu_return_var_elmt) = void_type_node;
@@ -3285,8 +3449,10 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
a Named Return Value, finalize the optimization. */
if (optimize && gnu_subprog_language->named_ret_val)
{
- finalize_nrv (gnu_subprog_decl, gnu_subprog_language->named_ret_val,
- gnu_subprog_language->other_ret_val);
+ finalize_nrv (gnu_subprog_decl,
+ gnu_subprog_language->named_ret_val,
+ gnu_subprog_language->other_ret_val,
+ gnu_subprog_language->gnat_ret);
gnu_subprog_language->named_ret_val = NULL;
gnu_subprog_language->other_ret_val = NULL;
}
@@ -5881,6 +6047,34 @@ gnat_to_gnu (Node_Id gnat_node)
else if (TYPE_RETURN_UNCONSTRAINED_P (gnu_subprog_type))
{
gnu_ret_val = maybe_unconstrained_array (gnu_ret_val);
+
+ /* And find out whether this is a candidate for Named Return
+ Value. If so, record it. */
+ if (!TYPE_CI_CO_LIST (gnu_subprog_type) && optimize)
+ {
+ tree ret_val = gnu_ret_val;
+
+ /* Strip useless conversions around the return value. */
+ if (gnat_useless_type_conversion (ret_val))
+ ret_val = TREE_OPERAND (ret_val, 0);
+
+ /* Strip unpadding around the return value. */
+ if (TREE_CODE (ret_val) == COMPONENT_REF
+ && TYPE_IS_PADDING_P
+ (TREE_TYPE (TREE_OPERAND (ret_val, 0))))
+ ret_val = TREE_OPERAND (ret_val, 0);
+
+ /* Now apply the test to the return value. */
+ if (return_value_ok_for_nrv_p (NULL_TREE, ret_val))
+ {
+ if (!f_named_ret_val)
+ f_named_ret_val = BITMAP_GGC_ALLOC ();
+ bitmap_set_bit (f_named_ret_val, DECL_UID (ret_val));
+ if (!f_gnat_ret)
+ f_gnat_ret = gnat_node;
+ }
+ }
+
gnu_ret_val = build_allocator (TREE_TYPE (gnu_ret_val),
gnu_ret_val,
TREE_TYPE (gnu_ret_obj),
@@ -5889,12 +6083,12 @@ gnat_to_gnu (Node_Id gnat_node)
gnat_node, false);
}
- /* If the function returns by invisible reference, dereference
+ /* Otherwise, if it returns by invisible reference, dereference
the pointer it is passed using the type of the return value
and build the copy operation manually. This ensures that we
don't copy too much data, for example if the return type is
unconstrained with a maximum size. */
- if (TREE_ADDRESSABLE (gnu_subprog_type))
+ else if (TREE_ADDRESSABLE (gnu_subprog_type))
{
tree gnu_ret_deref
= build_unary_op (INDIRECT_REF, TREE_TYPE (gnu_ret_val),
@@ -5905,11 +6099,9 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_ret_val = NULL_TREE;
}
}
+
else
- {
- gnu_ret_obj = NULL_TREE;
- gnu_ret_val = NULL_TREE;
- }
+ gnu_ret_obj = gnu_ret_val = NULL_TREE;
/* If we have a return label defined, convert this into a branch to
that label. The return proper will be handled elsewhere. */
@@ -5934,8 +6126,8 @@ gnat_to_gnu (Node_Id gnat_node)
break;
case N_Goto_Statement:
- gnu_result = build1 (GOTO_EXPR, void_type_node,
- gnat_to_gnu (Name (gnat_node)));
+ gnu_result
+ = build1 (GOTO_EXPR, void_type_node, gnat_to_gnu (Name (gnat_node)));
break;
/***************************/
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 73657528a8a..a71a3d28878 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -4744,19 +4744,17 @@ unchecked_convert (tree type, tree expr, bool notrunc_p)
enum tree_code
tree_code_for_record_type (Entity_Id gnat_type)
{
- Node_Id component_list
- = Component_List (Type_Definition
- (Declaration_Node
- (Implementation_Base_Type (gnat_type))));
- Node_Id component;
-
- /* Make this a UNION_TYPE unless it's either not an Unchecked_Union or
- we have a non-discriminant field outside a variant. In either case,
- it's a RECORD_TYPE. */
+ Node_Id component_list, component;
+ /* Return UNION_TYPE if it's an Unchecked_Union whose non-discriminant
+ fields are all in the variant part. Otherwise, return RECORD_TYPE. */
if (!Is_Unchecked_Union (gnat_type))
return RECORD_TYPE;
+ gnat_type = Implementation_Base_Type (gnat_type);
+ component_list
+ = Component_List (Type_Definition (Declaration_Node (gnat_type)));
+
for (component = First_Non_Pragma (Component_Items (component_list));
Present (component);
component = Next_Non_Pragma (component))
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index c303e2f20a3..f9e48b79fe5 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -2126,7 +2126,7 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
return
build2 (COMPOUND_EXPR, TREE_TYPE (aligning_field_addr),
- build_binary_op (MODIFY_EXPR, NULL_TREE,
+ build_binary_op (INIT_EXPR, NULL_TREE,
storage_ptr_slot, storage_ptr),
aligning_field_addr);
}
@@ -2279,12 +2279,12 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (storage_type)),
init);
storage_init
- = build_binary_op (MODIFY_EXPR, NULL_TREE, storage_deref,
+ = build_binary_op (INIT_EXPR, NULL_TREE, storage_deref,
gnat_build_constructor (storage_type, v));
}
else
storage_init
- = build_binary_op (MODIFY_EXPR, NULL_TREE,
+ = build_binary_op (INIT_EXPR, NULL_TREE,
build_component_ref (storage_deref, NULL_TREE,
TYPE_FIELDS (storage_type),
false),
@@ -2332,7 +2332,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
storage_deref = build_unary_op (INDIRECT_REF, NULL_TREE, storage);
TREE_THIS_NOTRAP (storage_deref) = 1;
storage_init
- = build_binary_op (MODIFY_EXPR, NULL_TREE, storage_deref, init);
+ = build_binary_op (INIT_EXPR, NULL_TREE, storage_deref, init);
return build2 (COMPOUND_EXPR, result_type, storage_init, storage);
}
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 2d342c347bc..ffe4358fb40 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -6372,12 +6372,11 @@ refer to the value of the prefix on entry. So for
example if you have an argument of a record type X called Arg1,
you can refer to Arg1.Field'Old which yields the value of
Arg1.Field on entry. The implementation simply involves generating
-an object declaration which captures the value on entry. Any
-prefix is allowed except one of a limited type (since limited
-types cannot be copied to capture their values) or an expression
-which references a local variable
-(since local variables do not exist at subprogram entry time).
-
+an object declaration which captures the value on entry.
+The prefix must denote an object of a nonlimited type (since limited types
+cannot be copied to capture their values) and it must not reference a local
+variable (since local variables do not exist at subprogram entry time). Note
+that the variable introduced by a quantified expression is a local variable.
The following example shows the use of 'Old to implement
a test of a postcondition:
@@ -9633,7 +9632,8 @@ separate section on Intrinsic Subprograms.
@item Stdcall
Stdcall (used for Windows implementations only). This convention correspond
to the WINAPI (previously called Pascal convention) C/C++ convention under
-Windows. A function with this convention cleans the stack before exit.
+Windows. A routine with this convention cleans the stack before
+exit. This pragma cannot be applied to a dispatching call.
@item DLL
Synonym for Stdcall
@item Win32
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 253cfff172b..266aa7d8f15 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -11805,7 +11805,7 @@ recognized by GNAT:
@section Handling of Configuration Pragmas
Configuration pragmas may either appear at the start of a compilation
-unit, in which case they apply only to that unit, or they may apply to
+unit, or they can appear in a configuration pragma file to apply to
all compilations performed in a given compilation environment.
GNAT also provides the @code{gnatchop} utility to provide an automatic
@@ -11816,6 +11816,30 @@ However, for most purposes, it will be more convenient to edit the
@file{gnat.adc} file that contains configuration pragmas directly,
as described in the following section.
+In the case of @code{Restrictions} pragmas appearing as configuration
+pragmas in individual compilation units, the exact handling depends on
+the type of restriction.
+
+Restrictions that require partition-wide consistency (like
+@code{No_Tasking}) are
+recognized wherever they appear
+and can be freely inherited, e.g. from a with'ed unit to the with'ing
+unit. This makes sense since the binder will in any case insist on seeing
+consistent use, so any unit not conforming to any restrictions that are
+anywhere in the partition will be rejected, and you might as well find
+that out at compile time rather than at bind time.
+
+For restrictions that do not require partition-wide consistency, e.g.
+SPARK or No_Implementation_Attributes, in general the restriction applies
+only to the unit in which the pragma appears, and not to any other units.
+
+The exception is No_Elaboration_Code which always applies to the entire
+object file from a compilation, i.e. to the body, spec, and all subunits.
+This restriction can be specified in a configuration pragma file, or it
+can be on the body and/or the spec (in eithe case it applies to all the
+relevant units). It can appear on a subunit only if it has previously
+appeared in the body of spec.
+
@node The Configuration Pragmas Files
@section The Configuration Pragmas Files
@cindex @file{gnat.adc}
@@ -13364,6 +13388,19 @@ and variants if there are @var{nnn} or more (the default
value is 10).
If @var{nnn} is 0, an additional indentation level is
used for @b{case} alternatives and variants regardless of their number.
+
+@item ^--call_threshold=@var{nnn}^/MAX_ACT=@var{nnn}^
+@cindex @option{^--call_threshold^/MAX_ACT^} (@command{gnatpp})
+If the number of parameter associations is greater than @var{nnn} and if at
+least one association uses named notation, start each association from
+a new line. If @var{nnn} is 0, no check for the number of associations
+is made, this is the default.
+
+@item ^--par_threshold=@var{nnn}^/MAX_PAR=@var{nnn}^
+@cindex @option{^--par_threshold^/MAX_PAR^} (@command{gnatpp})
+If the number of parameter specifications is greater than @var{nnn}
+(or equal to @var{nnn} in case of a function), start each specification from
+a new line. The default for @var{nnn} is 3.
@end table
@node Setting the Source Search Path
@@ -17889,6 +17926,9 @@ gnatmake -P<harness-dir>/test_driver
test_runner
@end smallexample
+Note that you might need to specify the necessary values of scenario variables
+when you are not using the AUnit defaults.
+
@item actual unit test stubs
a test stub for each visible subprogram is created in a separate file, if it
doesn't exist already. By default, those separate test files are located in a
@@ -17899,6 +17939,9 @@ file my_unit.ads in directory src contains a visible subprogram Proc, then
the corresponding unit test will be found in file
src/tests/my_unit-tests-proc_<code>.adb. <code> is a signature encoding used to
differentiate test names in cases of overloading.
+
+Note that if the project already has both my_unit.ads and my_unit-tests.ads this
+will cause name a conflict with generated test package.
@end itemize
@node Switches for gnattest
@@ -17921,6 +17964,10 @@ manual tests to be added to the test suite.
@cindex @option{-r} (@command{gnattest})
Recursively consider all sources from all projects.
+@item -X@var{name=value}
+@cindex @option{-X} (@command{gnattest})
+Indicate that external variable @var{name} has the value @var{value}.
+
@item -q
@cindex @option{-q} (@command{gnattest})
Suppresses noncritical output messages.
@@ -18311,6 +18358,8 @@ The tool currently does not support following features:
@item generic tests for generic packages and package instantiations
@item tests for protected subprograms and entries
@item aspects Precondition, Postcondition, and Test_Case
+@item generating test packages for code that is not conformant with ada 2005
+
@end itemize
@c *********************************
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index b6d6e6a57e1..cc6c1d2c50b 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1808,8 +1808,8 @@ __gnat_error_handler (int sig,
break;
case SIGBUS:
- exception = &constraint_error;
- msg = "SIGBUS";
+ exception = &storage_error;
+ msg = "SIGBUS: possible stack overflow";
break;
default:
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index bb8aa113211..519fad0f357 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -3088,7 +3088,7 @@ package body Layout is
end if;
-- Here we calculate the alignment as the largest power of two multiple
- -- of System.Storage_Unit that does not exceed either the actual size of
+ -- of System.Storage_Unit that does not exceed either the object size of
-- the type, or the maximum allowed alignment.
declare
@@ -3126,21 +3126,101 @@ package body Layout is
A := 2 * A;
end loop;
- -- Now we think we should set the alignment to A, but we skip this if
- -- an alignment is already set to a value greater than A (happens for
- -- derived types).
+ -- If alignment is currently not set, then we can safetly set it to
+ -- this new calculated value.
- -- However, if the alignment is known and too small it must be
- -- increased, this happens in a case like:
+ if Unknown_Alignment (E) then
+ Init_Alignment (E, A);
+
+ -- Cases where we have inherited an alignment
+
+ -- For constructed types, always reset the alignment, these are
+ -- Generally invisible to the user anyway, and that way we are
+ -- sure that no constructed types have weird alignments.
+
+ elsif not Comes_From_Source (E) then
+ Init_Alignment (E, A);
+
+ -- If this inherited alignment is the same as the one we computed,
+ -- then obviously everything is fine, and we do not need to reset it.
- -- type R is new Character;
- -- for R'Size use 16;
+ elsif Alignment (E) = A then
+ null;
- -- Here the alignment inherited from Character is 1, but it must be
- -- increased to 2 to reflect the increased size.
+ -- Now we come to the difficult cases where we have inherited an
+ -- alignment and size, but overridden the size but not the alignment.
+
+ elsif Has_Size_Clause (E) or else Has_Object_Size_Clause (E) then
+
+ -- This is tricky, it might be thought that we should try to
+ -- inherit the alignment, since that's what the RM implies, but
+ -- that leads to complex rules and oddities. Consider for example:
+
+ -- type R is new Character;
+ -- for R'Size use 16;
+
+ -- It seems quite bogus in this case to inherit an alignment of 1
+ -- from the parent type Character. Furthermore, if that's what the
+ -- programmer really wanted for some odd reason, then they could
+ -- specify the alignment they wanted.
+
+ -- Furthermore we really don't want to inherit the alignment in
+ -- the case of a specified Object_Size for a subtype, since then
+ -- there would be no way of overriding to give a reasonable value
+ -- (we don't have an Object_Subtype attribute). Consider:
+
+ -- subtype R is new Character;
+ -- for R'Object_Size use 16;
+
+ -- If we inherit the alignment of 1, then we have an odd
+ -- inefficient alignment for the subtype, which cannot be fixed.
+
+ -- So we make the decision that if Size (or Object_Size) is given
+ -- (and, in the case of a first subtype, the alignment is not set
+ -- with a specific alignment clause). We reset the alignment to
+ -- the appropriate value for the specified size. This is a nice
+ -- simple rule to implement and document.
+
+ -- There is one slight glitch, which is that a confirming size
+ -- clause can now change the alignment, which, if we really think
+ -- that confirming rep clauses should have no effect, is a no-no.
+
+ -- type R is new Character;
+ -- for R'Alignment use 2;
+ -- type S is new R;
+ -- for S'Size use Character'Size;
+
+ -- Now the alignment of S is 1 instead of 2, as a result of
+ -- applying the above rule to the confirming rep clause for S. Not
+ -- clear this is worth worrying about. If we recorded whether a
+ -- size clause was confirming we could avoid this, but right now
+ -- we have no way of doing that or easily figuring it out, so we
+ -- don't bother.
+
+ -- Historical note. In versions of GNAT prior to Nov 6th, 2010, an
+ -- odd distinction was made between inherited alignments greater
+ -- than the computed alignment (where the larger alignment was
+ -- inherited) and inherited alignments smaller than the computed
+ -- alignment (where the smaller alignment was overridden). This
+ -- was a dubious fix to get around an ACATS problem which seems
+ -- to have disappeared anyway, and in any case, this peculiarity
+ -- was never documented.
- if Unknown_Alignment (E) or else Alignment (E) < A then
Init_Alignment (E, A);
+
+ -- If no Size (or Object_Size) was specified, then we inherited the
+ -- object size, so we should inherit the alignment as well and not
+ -- modify it. This takes care of cases like:
+
+ -- type R is new Integer;
+ -- for R'Alignment use 1;
+ -- subtype S is R;
+
+ -- Here we have R has a default Object_Size of 32, and a specified
+ -- alignment of 1, and it seeems right for S to inherit both values.
+
+ else
+ null;
end if;
end;
end Set_Elem_Alignment;
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb
index 894c76017d9..0ac729ece6c 100644
--- a/gcc/ada/lib-load.adb
+++ b/gcc/ada/lib-load.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -359,9 +359,25 @@ package body Lib.Load is
Src_Ind : Source_File_Index;
Save_PMES : constant Boolean := Parsing_Main_Extended_Source;
+ Save_Cunit_Restrictions : constant Save_Cunit_Boolean_Restrictions :=
+ Cunit_Boolean_Restrictions_Save;
+ -- Save current restrictions for restore at end
+
begin
Parsing_Main_Extended_Source := PMES;
+ -- Initialize restrictions to config restrictions for unit to load if
+ -- it is part of the main extended source, otherwise reset them.
+
+ -- Note: it's a bit odd but PMES is False for subunits, which is why
+ -- we have the OR here. Should be investigated some time???
+
+ if PMES or Subunit then
+ Restore_Config_Cunit_Boolean_Restrictions;
+ else
+ Reset_Cunit_Boolean_Restrictions;
+ end if;
+
-- If renamings are allowed and we have a child unit name, then we
-- must first load the parent to deal with finding the real name.
-- Retain the with_clause that names the child, so that if it is
@@ -782,6 +798,7 @@ package body Lib.Load is
<<Done>>
Parsing_Main_Extended_Source := Save_PMES;
+ Cunit_Boolean_Restrictions_Restore (Save_Cunit_Restrictions);
return Unum;
end Load_Unit;
diff --git a/gcc/ada/lib-load.ads b/gcc/ada/lib-load.ads
index d2856aa41f2..a029d3793b0 100644
--- a/gcc/ada/lib-load.ads
+++ b/gcc/ada/lib-load.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -155,6 +155,7 @@ package Lib.Load is
--
-- PMES indicates the required setting of Parsing_Main_Extended_Unit during
-- loading of the unit. This flag is saved and restored over the call.
+ -- Note: PMES is false for the subunit case, which seems wrong???
procedure Change_Main_Unit_To_Spec;
-- This procedure is called if the main unit file contains a No_Body pragma
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 83a06e452f3..0e8337f70c6 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -577,14 +577,16 @@ package body Lib.Xref is
-- doing in such cases. For example the calls in Ada.Characters.Handling
-- to its own obsolescent subprograms are just fine.
- -- In any case we do not generate warnings within the extended source
- -- unit of the entity in question, since we assume the source unit
- -- itself knows what is going on (and for sure we do not want silly
- -- warnings, e.g. on the end line of an obsolescent procedure body).
+ -- In any case we only generate warnings if we are in the extended main
+ -- source unit, and the entity itself is not in the extended main source
+ -- unit, since we assume the source unit itself knows what is going on
+ -- (and for sure we do not want silly warnings, e.g. on the end line of
+ -- an obsolescent procedure body).
if Is_Obsolescent (E)
and then not GNAT_Mode
and then not In_Extended_Main_Source_Unit (E)
+ and then In_Extended_Main_Source_Unit (N)
then
Check_Restriction (No_Obsolescent_Features, N);
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index 76810c22862..2b3f90650cd 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -518,7 +518,7 @@ package Lib is
-- its subunits (considered recursively). Units for which this enquiry
-- returns True are those for which code will be generated. Nodes from
-- instantiations are included in the extended main unit for this call.
- -- If the main unit is itself a subunit, then the extended main unit
+ -- If the main unit is itself a subunit, then the extended main code unit
-- includes its parent unit, and the parent unit spec if it is separate.
function In_Extended_Main_Code_Unit (Loc : Source_Ptr) return Boolean;
@@ -533,7 +533,7 @@ package Lib is
-- returns True are those for which code will be generated. This differs
-- from In_Extended_Main_Code_Unit only in that instantiations are not
-- included for the purposes of this call. If the main unit is itself
- -- a subunit, then the extended main unit includes its parent unit,
+ -- a subunit, then the extended main source unit includes its parent unit,
-- and the parent unit spec if it is separate.
function In_Extended_Main_Source_Unit (Loc : Source_Ptr) return Boolean;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index e6a42815e82..4c1f5609318 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -140,7 +140,7 @@ package Opt is
-- or internal units, so it reflects the Ada version explicitly set
-- using configuration pragmas or compiler switches (or if neither
-- appears, it remains set to Ada_Version_Default). This is used in
- -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05)
+ -- the rare cases (notably for pragmas Preelaborate_05 and Pure_05/12)
-- where in the run-time we want the explicit version set.
Ada_Version_Runtime : Ada_Version_Type := Ada_2012;
@@ -1830,6 +1830,9 @@ package Opt is
-- this flag, see package Expander. Indeed this flag might more logically
-- be in the spec of Expander, but it is referenced by Errout, and it
-- really seems wrong for Errout to depend on Expander.
+ --
+ -- Note: for many purposes, it is more appropriate to test the flag
+ -- Full_Expander_Active, which also checks that Alfa mode is not active.
Static_Dispatch_Tables : Boolean := True;
-- This flag indicates if the backend supports generation of statically
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 85b4024df8c..59884d24c73 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2553,6 +2553,11 @@ package body Ch4 is
Node1 : Node_Id;
begin
+ if Ada_Version < Ada_2012 then
+ Error_Msg_SC ("quantified expression is an Ada 2012 feature");
+ Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
+ end if;
+
Scan; -- past FOR
Node1 := New_Node (N_Quantified_Expression, Prev_Token_Ptr);
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 7d598547911..dc7b26cbaa1 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -108,7 +108,8 @@ package body Ch6 is
-- end [DESIGNATOR];
-- SUBPROGRAM_RENAMING_DECLARATION ::=
- -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME;
+ -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- SUBPROGRAM_BODY_STUB ::=
-- SUBPROGRAM_SPECIFICATION is separate;
@@ -506,6 +507,7 @@ package body Ch6 is
Scan; -- past RENAMES
Set_Name (Rename_Node, P_Name);
Set_Specification (Rename_Node, Specification_Node);
+ P_Aspect_Specifications (Rename_Node);
TF_Semicolon;
Pop_Scope_Stack;
return Rename_Node;
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 224b992274e..1a126759f6b 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -1216,6 +1216,7 @@ begin
Pragma_Psect_Object |
Pragma_Pure |
Pragma_Pure_05 |
+ Pragma_Pure_12 |
Pragma_Pure_Function |
Pragma_Queuing_Policy |
Pragma_Relative_Deadline |
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index 813568deea6..df2ec7a888c 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -41,6 +41,9 @@ with Uname; use Uname;
package body Restrict is
+ Config_Cunit_Boolean_Restrictions : Save_Cunit_Boolean_Restrictions;
+ -- Save compilation unit restrictions set by config pragma files
+
Restricted_Profile_Result : Boolean := False;
-- This switch memoizes the result of Restricted_Profile function calls for
-- improved efficiency. Valid only if Restricted_Profile_Cached is True.
@@ -100,6 +103,17 @@ package body Restrict is
end if;
end Abort_Allowed;
+ ----------------------------------------
+ -- Add_To_Config_Boolean_Restrictions --
+ ----------------------------------------
+
+ procedure Add_To_Config_Boolean_Restrictions (R : Restriction_Id) is
+ begin
+ Config_Cunit_Boolean_Restrictions (R) := True;
+ end Add_To_Config_Boolean_Restrictions;
+ -- Add specified restriction to stored configuration boolean restrictions.
+ -- This is used for handling the special case of No_Elaboration_Code.
+
-------------------------
-- Check_Compiler_Unit --
-------------------------
@@ -183,6 +197,78 @@ package body Restrict is
end if;
end Check_SPARK_Restriction;
+ --------------------------------
+ -- Check_No_Implicit_Aliasing --
+ --------------------------------
+
+ procedure Check_No_Implicit_Aliasing (Obj : Node_Id) is
+ E : Entity_Id;
+
+ begin
+ -- If restriction not active, nothing to check
+
+ if not Restriction_Active (No_Implicit_Aliasing) then
+ return;
+ end if;
+
+ -- If we have an entity name, check entity
+
+ if Is_Entity_Name (Obj) then
+ E := Entity (Obj);
+
+ -- Restriction applies to entities that are objects
+
+ if Is_Object (E) then
+ if Is_Aliased (E) then
+ return;
+
+ elsif Present (Renamed_Object (E)) then
+ Check_No_Implicit_Aliasing (Renamed_Object (E));
+ return;
+ end if;
+
+ -- If we don't have an object, then it's OK
+
+ else
+ return;
+ end if;
+
+ -- For selected component, check selector
+
+ elsif Nkind (Obj) = N_Selected_Component then
+ Check_No_Implicit_Aliasing (Selector_Name (Obj));
+ return;
+
+ -- Indexed component is OK if aliased components
+
+ elsif Nkind (Obj) = N_Indexed_Component then
+ if Has_Aliased_Components (Etype (Prefix (Obj)))
+ or else
+ (Is_Access_Type (Etype (Prefix (Obj)))
+ and then Has_Aliased_Components
+ (Designated_Type (Etype (Prefix (Obj)))))
+ then
+ return;
+ end if;
+
+ -- For type conversion, check converted expression
+
+ elsif Nkind_In (Obj, N_Unchecked_Type_Conversion, N_Type_Conversion) then
+ Check_No_Implicit_Aliasing (Expression (Obj));
+ return;
+
+ -- Explicit dereference is always OK
+
+ elsif Nkind (Obj) = N_Explicit_Dereference then
+ return;
+ end if;
+
+ -- If we fall through, then we have an aliased view that does not meet
+ -- the rules for being explicitly aliased, so issue restriction msg.
+
+ Check_Restriction (No_Implicit_Aliasing, Obj);
+ end Check_No_Implicit_Aliasing;
+
-----------------------------------------
-- Check_Implicit_Dynamic_Code_Allowed --
-----------------------------------------
@@ -426,7 +512,9 @@ package body Restrict is
Update_Restrictions (Restrictions);
- -- If in main extended unit, update main restrictions as well
+ -- If in main extended unit, update main restrictions as well. Note
+ -- that as usual we check for Main_Unit explicitly to deal with the
+ -- case of configuration pragma files.
if Current_Sem_Unit = Main_Unit
or else In_Extended_Main_Source_Unit (N)
@@ -570,6 +658,16 @@ package body Restrict is
for J in Cunit_Boolean_Restrictions loop
Restrictions.Set (J) := R (J);
end loop;
+
+ -- If No_Elaboration_Code set in configuration restrictions, and we
+ -- in the main extended source, then set it here now. This is part of
+ -- the special processing for No_Elaboration_Code.
+
+ if In_Extended_Main_Source_Unit (Cunit_Entity (Current_Sem_Unit))
+ and then Config_Cunit_Boolean_Restrictions (No_Elaboration_Code)
+ then
+ Restrictions.Set (No_Elaboration_Code) := True;
+ end if;
end Cunit_Boolean_Restrictions_Restore;
-------------------------------------
@@ -584,7 +682,6 @@ package body Restrict is
begin
for J in Cunit_Boolean_Restrictions loop
R (J) := Restrictions.Set (J);
- Restrictions.Set (J) := False;
end loop;
return R;
@@ -700,6 +797,26 @@ package body Restrict is
return New_Name;
end Process_Restriction_Synonyms;
+ --------------------------------------
+ -- Reset_Cunit_Boolean_Restrictions --
+ --------------------------------------
+
+ procedure Reset_Cunit_Boolean_Restrictions is
+ begin
+ for J in Cunit_Boolean_Restrictions loop
+ Restrictions.Set (J) := False;
+ end loop;
+ end Reset_Cunit_Boolean_Restrictions;
+
+ -----------------------------------------------
+ -- Restore_Config_Cunit_Boolean_Restrictions --
+ -----------------------------------------------
+
+ procedure Restore_Config_Cunit_Boolean_Restrictions is
+ begin
+ Cunit_Boolean_Restrictions_Restore (Config_Cunit_Boolean_Restrictions);
+ end Restore_Config_Cunit_Boolean_Restrictions;
+
------------------------
-- Restricted_Profile --
------------------------
@@ -932,6 +1049,15 @@ package body Restrict is
end if;
end Same_Unit;
+ --------------------------------------------
+ -- Save_Config_Cunit_Boolean_Restrictions --
+ --------------------------------------------
+
+ procedure Save_Config_Cunit_Boolean_Restrictions is
+ begin
+ Config_Cunit_Boolean_Restrictions := Cunit_Boolean_Restrictions_Save;
+ end Save_Config_Cunit_Boolean_Restrictions;
+
------------------------------
-- Set_Hidden_Part_In_SPARK --
------------------------------
@@ -998,23 +1124,6 @@ package body Restrict is
N : Node_Id)
is
begin
- -- Restriction No_Elaboration_Code must be enforced on a unit by unit
- -- basis. Hence, we avoid setting the restriction when processing an
- -- unit which is not the main one being compiled (or its corresponding
- -- spec). It can happen, for example, when processing an inlined body
- -- (the package containing the inlined subprogram is analyzed,
- -- including its pragma Restrictions).
-
- -- This seems like a very nasty kludge??? This is not the only per unit
- -- restriction why is this treated specially ???
-
- if R = No_Elaboration_Code
- and then Current_Sem_Unit /= Main_Unit
- and then Cunit (Current_Sem_Unit) /= Library_Unit (Cunit (Main_Unit))
- then
- return;
- end if;
-
Restrictions.Set (R) := True;
if Restricted_Profile_Cached and Restricted_Profile_Result then
diff --git a/gcc/ada/restrict.ads b/gcc/ada/restrict.ads
index 10875025e2b..5d03f831267 100644
--- a/gcc/ada/restrict.ads
+++ b/gcc/ada/restrict.ads
@@ -71,10 +71,6 @@ package Restrict is
-- set if Restriction_Warnings is set, so this does not look like a
-- restriction to the binder.
- type Save_Cunit_Boolean_Restrictions is private;
- -- Type used for saving and restoring compilation unit restrictions.
- -- See Cunit_Boolean_Restrictions_[Save|Restore] subprograms.
-
-- The following declarations establish a mapping between restriction
-- identifiers, and the names of corresponding restriction library units.
@@ -279,6 +275,13 @@ package Restrict is
-- Same as Check_SPARK_Restriction except there is a continuation message
-- Msg2 following the initial message Msg1.
+ procedure Check_No_Implicit_Aliasing (Obj : Node_Id);
+ -- Obj is a node for which Is_Aliased_View is True, which is being used in
+ -- a context (e.g. 'Access) where no implicit aliasing is allowed if the
+ -- restriction No_Implicit_Aliasing is set. This procedure checks for the
+ -- case where the restriction is active and Obj does not meet the required
+ -- rules for avoiding implicit aliases, and issues a restriction message.
+
procedure Check_Implicit_Dynamic_Code_Allowed (N : Node_Id);
-- Tests to see if dynamic code generation (dynamically generated
-- trampolines, in particular) is allowed by the current restrictions
@@ -305,22 +308,6 @@ package Restrict is
-- [Wide_]Wide_Character or [Wide_]Wide_String, then the restriction
-- violation is recorded, and an appropriate message given.
- function Cunit_Boolean_Restrictions_Save
- return Save_Cunit_Boolean_Restrictions;
- -- This function saves the compilation unit restriction settings, and
- -- resets them to False. This is used e.g. when compiling a with'ed
- -- unit to avoid incorrectly propagating restrictions. Note that it
- -- would not be wrong to also save and reset the partition restrictions,
- -- since the binder would catch inconsistencies, but actually it is a
- -- good thing to acquire restrictions from with'ed units if they are
- -- required to be partition wide, because it allows the restriction
- -- violation message to be given at compile time instead of link time.
-
- procedure Cunit_Boolean_Restrictions_Restore
- (R : Save_Cunit_Boolean_Restrictions);
- -- This is the corresponding restore procedure to restore restrictions
- -- previously saved by Cunit_Boolean_Restrictions_Save.
-
function Get_Restriction_Id
(N : Name_Id) return Restriction_Id;
-- Given an identifier name, determines if it is a valid restriction
@@ -428,6 +415,71 @@ package Restrict is
-- Tests if tasking operations are allowed by the current restrictions
-- settings. For tasking to be allowed Max_Tasks must be non-zero.
+ ----------------------------------------------
+ -- Handling of Boolean Compilation Switches --
+ ----------------------------------------------
+
+ -- The following declarations are used for proper saving and restoring of
+ -- restrictions for separate compilation units. There are two cases:
+
+ -- For partition-wide restrictions, we just let the restrictions pragmas
+ -- pile up, and we never reset them. We might as well detect what we can
+ -- at compile time. If e.g. a with'ed unit has a restriction for one of
+ -- the partition-wide restrictions, then the binder will enforce it on
+ -- all units in the partition, including the unit with the WITH. Although
+ -- it would not be wrong to leave this till bind time, we might as well
+ -- flag it earlier at compile time.
+
+ -- For non-partition-wide restrictions, we have quite a different state
+ -- of affairs. Here it would be quite wrong to carry a restriction from
+ -- a with'ed unit to another with'ed unit, or from a package spec to the
+ -- package body. This means that we have to reset these non-partition
+ -- wide restrictions at the start of each separate compilation unit. For
+ -- units in the extended main program, we need to reset them all to the
+ -- values set by the configuration pragma file(s). For units not in the
+ -- extended main program, e.g. with'ed units, we might as well reset all
+ -- of these restrictions to off (False). The actual initial values will
+ -- be taken from the config files active when those units are compiled
+ -- as main units.
+
+ type Save_Cunit_Boolean_Restrictions is private;
+ -- Type used for saving and restoring compilation unit restrictions.
+
+ function Cunit_Boolean_Restrictions_Save
+ return Save_Cunit_Boolean_Restrictions;
+ -- This function saves the compilation unit restriction settings, leaving
+ -- then unchanged. This is used e.g. at the start of processing a context
+ -- clause, so that the main unit restrictions can be restored after all
+ -- the with'ed units have been processed.
+
+ procedure Cunit_Boolean_Restrictions_Restore
+ (R : Save_Cunit_Boolean_Restrictions);
+ -- This is the corresponding restore procedure to restore restrictions
+ -- previously saved by Cunit_Boolean_Restrictions_Save. However it does
+ -- not reset No_Elaboration_Code, this stays set if it was set before
+ -- the call, and also if it is set before the call, then the Config
+ -- setting is also updated to include this restriction. This is what
+ -- implements the special handling of No_Elaboration_Code.
+
+ procedure Save_Config_Cunit_Boolean_Restrictions;
+ -- This saves the current compilation unit restrictions in an internal
+ -- variable, and leaves them unchanged. This is called immediately after
+ -- processing the configuration file pragmas, to record the restrictions
+ -- set by these configuration file pragmas.
+
+ procedure Restore_Config_Cunit_Boolean_Restrictions;
+ -- This restores the value saved by the previous call to save config values
+ -- saved by Save_Config_Cunit_Boolean_Restrictions. It is called at the
+ -- start of processing a new unit that is part of the main sources (e.g.
+ -- a package spec when the main unit is a package body).
+
+ procedure Reset_Cunit_Boolean_Restrictions;
+ -- Turns off all non-partition-wide boolean restrictions
+
+ procedure Add_To_Config_Boolean_Restrictions (R : Restriction_Id);
+ -- Add specified restriction to stored configuration boolean restrictions.
+ -- This is used for handling the special case of No_Elaboration_Code.
+
private
type Save_Cunit_Boolean_Restrictions is
array (Cunit_Boolean_Restrictions) of Boolean;
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index b7a02066b77..261365d9292 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -1353,6 +1353,7 @@ package Rtsfind is
RE_Allocate_Any_Controlled, -- System.Storage_Pools.Subpools
RE_Deallocate_Any_Controlled, -- System.Storage_Pools.Subpools
+ RE_Header_Size_With_Padding, -- System.Storage_Pools.Subpools
RE_Root_Storage_Pool_With_Subpools, -- System.Storage_Pools.Subpools
RE_Root_Subpool, -- System.Storage_Pools.Subpools
RE_Subpool_Handle, -- System.Storage_Pools.Subpools
@@ -2550,6 +2551,7 @@ package Rtsfind is
RE_Allocate_Any_Controlled => System_Storage_Pools_Subpools,
RE_Deallocate_Any_Controlled => System_Storage_Pools_Subpools,
+ RE_Header_Size_With_Padding => System_Storage_Pools_Subpools,
RE_Root_Storage_Pool_With_Subpools => System_Storage_Pools_Subpools,
RE_Root_Subpool => System_Storage_Pools_Subpools,
RE_Subpool_Handle => System_Storage_Pools_Subpools,
diff --git a/gcc/ada/s-atocou-builtin.adb b/gcc/ada/s-atocou-builtin.adb
index 8ec851e8f20..f230721af00 100644
--- a/gcc/ada/s-atocou-builtin.adb
+++ b/gcc/ada/s-atocou-builtin.adb
@@ -50,7 +50,12 @@ package body System.Atomic_Counters is
function Decrement (Item : in out Atomic_Counter) return Boolean is
begin
- return Sync_Sub_And_Fetch (Item.Value'Access, 1) = 0;
+ -- Note: the use of Unrestricted_Access here is required because we
+ -- are obtaining an access-to-volatile pointer to a non-volatile object.
+ -- This is not allowed for [Unchecked_]Access, but is safe in this case
+ -- because we know that no aliases are being created.
+
+ return Sync_Sub_And_Fetch (Item.Value'Unrestricted_Access, 1) = 0;
end Decrement;
---------------
@@ -59,7 +64,12 @@ package body System.Atomic_Counters is
procedure Increment (Item : in out Atomic_Counter) is
begin
- Sync_Add_And_Fetch (Item.Value'Access, 1);
+ -- Note: the use of Unrestricted_Access here is required because we
+ -- are obtaining an access-to-volatile pointer to a non-volatile object.
+ -- This is not allowed for [Unchecked_]Access, but is safe in this case
+ -- because we know that no aliases are being created.
+
+ Sync_Add_And_Fetch (Item.Value'Unrestricted_Access, 1);
end Increment;
------------
diff --git a/gcc/ada/s-finmas.adb b/gcc/ada/s-finmas.adb
index 8474ff4a8f3..918519b6781 100644
--- a/gcc/ada/s-finmas.adb
+++ b/gcc/ada/s-finmas.adb
@@ -181,6 +181,12 @@ package body System.Finalization_Masters is
if Master.Finalization_Started then
Unlock_Task.all;
+
+ -- Double finalization may occur during the handling of stand alone
+ -- libraries or the finalization of a pool with subpools. Due to the
+ -- potential aliasing of masters in these two cases, do not process
+ -- the same master twice.
+
return;
end if;
diff --git a/gcc/ada/s-os_lib.ads b/gcc/ada/s-os_lib.ads
index 1c63e386ea9..3599261498c 100755
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -174,7 +174,7 @@ package System.OS_Lib is
-- File descriptors for standard input output files
Invalid_FD : constant File_Descriptor := -1;
- -- File descriptor returned when error in opening/creating file;
+ -- File descriptor returned when error in opening/creating file
type Mode is (Binary, Text);
for Mode'Size use Integer'Size;
diff --git a/gcc/ada/s-rident.ads b/gcc/ada/s-rident.ads
index 1c306e34664..d067f3d7f4f 100644
--- a/gcc/ada/s-rident.ads
+++ b/gcc/ada/s-rident.ads
@@ -124,7 +124,15 @@ package System.Rident is
No_Default_Initialization, -- GNAT
- -- The following cases do not require consistency checking
+ -- The following cases do not require consistency checking and if used
+ -- as a configuration pragma within a specific unit, apply only to that
+ -- unit (e.g. if used in the package spec, do not apply to the body)
+
+ -- Note: No_Elaboration_Code is handled specially. Like the other
+ -- non-partition-wide restrictions, it can only be set in a unit that
+ -- is part of the extended main source unit (body/spec/subunits). But
+ -- it is sticky, in that if it is found anywhere within any of these
+ -- units, it applies to all units in this extended main source.
Immediate_Reclamation, -- (RM H.4(10))
No_Implementation_Aspect_Specifications, -- Ada 2012 AI-241
@@ -202,7 +210,7 @@ package System.Rident is
-- Boolean restrictions that are not checked for partition consistency
-- and that thus apply only to the current unit. Note that for these
-- restrictions, the compiler does not apply restrictions found in
- -- with'ed units, parent specs etc. to the main unit.
+ -- with'ed units, parent specs etc. to the main unit, and vice versa.
subtype All_Parameter_Restrictions is
Restriction_Id range
diff --git a/gcc/ada/s-stposu.adb b/gcc/ada/s-stposu.adb
index 4bbff767d96..78958412ab2 100644
--- a/gcc/ada/s-stposu.adb
+++ b/gcc/ada/s-stposu.adb
@@ -56,12 +56,6 @@ package body System.Storage_Pools.Subpools is
procedure Detach (N : not null SP_Node_Ptr);
-- Unhook a subpool node from an arbitrary subpool list
- function Nearest_Multiple_Rounded_Up
- (Size : Storage_Count;
- Alignment : Storage_Count) return Storage_Count;
- -- Given arbitrary values of storage size and alignment, calculate the
- -- nearest multiple of the alignment rounded up where size can fit.
-
--------------
-- Allocate --
--------------
@@ -218,10 +212,7 @@ package body System.Storage_Pools.Subpools is
-- Account for possible padding space before the header due to a
-- larger alignment.
- Header_And_Padding :=
- Nearest_Multiple_Rounded_Up
- (Size => Header_Size,
- Alignment => Alignment);
+ Header_And_Padding := Header_Size_With_Padding (Alignment);
N_Size := Storage_Size + Header_And_Padding;
@@ -388,10 +379,7 @@ package body System.Storage_Pools.Subpools is
-- Account for possible padding space before the header due to a
-- larger alignment.
- Header_And_Padding :=
- Nearest_Multiple_Rounded_Up
- (Size => Header_Size,
- Alignment => Alignment);
+ Header_And_Padding := Header_Size_With_Padding (Alignment);
-- N_Addr N_Ptr Addr (from input)
-- | | |
@@ -571,6 +559,28 @@ package body System.Storage_Pools.Subpools is
Free (Subpool.Node);
end Finalize_Subpool;
+ ------------------------------
+ -- Header_Size_With_Padding --
+ ------------------------------
+
+ function Header_Size_With_Padding
+ (Alignment : System.Storage_Elements.Storage_Count)
+ return System.Storage_Elements.Storage_Count
+ is
+ Size : constant Storage_Count := Header_Size;
+
+ begin
+ if Size mod Alignment = 0 then
+ return Size;
+
+ -- Add enough padding to reach the nearest multiple of the alignment
+ -- rounding up.
+
+ else
+ return ((Size + Alignment - 1) / Alignment) * Alignment;
+ end if;
+ end Header_Size_With_Padding;
+
----------------
-- Initialize --
----------------
@@ -592,26 +602,6 @@ package body System.Storage_Pools.Subpools is
Pool.Subpools.Prev := Pool.Subpools'Unchecked_Access;
end Initialize_Pool;
- ---------------------------------
- -- Nearest_Multiple_Rounded_Up --
- ---------------------------------
-
- function Nearest_Multiple_Rounded_Up
- (Size : Storage_Count;
- Alignment : Storage_Count) return Storage_Count
- is
- begin
- if Size mod Alignment = 0 then
- return Size;
-
- -- Add enough padding to reach the nearest multiple of the alignment
- -- rounding up.
-
- else
- return ((Size + Alignment - 1) / Alignment) * Alignment;
- end if;
- end Nearest_Multiple_Rounded_Up;
-
---------------------
-- Pool_Of_Subpool --
---------------------
diff --git a/gcc/ada/s-stposu.ads b/gcc/ada/s-stposu.ads
index 0c5bd218515..38f8cfc73a3 100644
--- a/gcc/ada/s-stposu.ads
+++ b/gcc/ada/s-stposu.ads
@@ -329,6 +329,13 @@ private
-- subpool from its owner's list. Deallocate the associated doubly linked
-- list node.
+ function Header_Size_With_Padding
+ (Alignment : System.Storage_Elements.Storage_Count)
+ return System.Storage_Elements.Storage_Count;
+ -- Given an arbitrary alignment, calculate the size of the header which
+ -- precedes a controlled object as the nearest multiple rounded up of the
+ -- alignment.
+
overriding procedure Initialize (Controller : in out Pool_Controller);
-- Buffer routine, calls Initialize_Pool
diff --git a/gcc/ada/s-taprop-irix.adb b/gcc/ada/s-taprop-irix.adb
index 5b4d4bef16e..62cb4f75e0a 100644
--- a/gcc/ada/s-taprop-irix.adb
+++ b/gcc/ada/s-taprop-irix.adb
@@ -836,9 +836,15 @@ package body System.Task_Primitives.Operations is
-- do not need to manipulate caller's signal mask at this point.
-- All tasks in RTS will have All_Tasks_Mask initially.
+ -- Note: the use of Unrestricted_Access in the following call is needed
+ -- because otherwise we have an error of getting a access-to-volatile
+ -- value which points to a non-volatile object. But in this case it is
+ -- safe to do this, since we know we have no problems with aliasing and
+ -- Unrestricted_Access bypasses this check.
+
Result :=
pthread_create
- (T.Common.LL.Thread'Access,
+ (T.Common.LL.Thread'Unrestricted_Access,
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
@@ -865,9 +871,15 @@ package body System.Task_Primitives.Operations is
(Attributes'Access, To_Int (T.Common.Task_Info.Scope));
pragma Assert (Result = 0);
+ -- Note: the use of Unrestricted_Access in the following call
+ -- is needed because otherwise we have an error of getting a
+ -- access-to-volatile value which points to a non-volatile object.
+ -- But in this case it is safe to do this, since we know we have no
+ -- aliasing problems and Unrestricted_Access bypasses this check.
+
Result :=
pthread_create
- (T.Common.LL.Thread'Access,
+ (T.Common.LL.Thread'Unrestricted_Access,
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb
index c63d5531b62..4e69ea4b321 100644
--- a/gcc/ada/s-taprop-linux.adb
+++ b/gcc/ada/s-taprop-linux.adb
@@ -291,14 +291,10 @@ package body System.Task_Primitives.Operations is
else
declare
- Mutex_Attr : aliased pthread_mutexattr_t;
- Result : Interfaces.C.int;
+ Result : Interfaces.C.int;
begin
- Result := pthread_mutexattr_init (Mutex_Attr'Access);
- pragma Assert (Result = 0);
-
- Result := pthread_mutex_init (L.WO'Access, Mutex_Attr'Access);
+ Result := pthread_mutex_init (L.WO'Access, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
@@ -315,14 +311,10 @@ package body System.Task_Primitives.Operations is
is
pragma Unreferenced (Level);
- Mutex_Attr : aliased pthread_mutexattr_t;
- Result : Interfaces.C.int;
+ Result : Interfaces.C.int;
begin
- Result := pthread_mutexattr_init (Mutex_Attr'Access);
- pragma Assert (Result = 0);
-
- Result := pthread_mutex_init (L, Mutex_Attr'Access);
+ Result := pthread_mutex_init (L, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
@@ -817,9 +809,8 @@ package body System.Task_Primitives.Operations is
--------------------
procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
- Mutex_Attr : aliased pthread_mutexattr_t;
- Cond_Attr : aliased pthread_condattr_t;
- Result : Interfaces.C.int;
+ Cond_Attr : aliased pthread_condattr_t;
+ Result : Interfaces.C.int;
begin
-- Give the task a unique serial number
@@ -831,11 +822,8 @@ package body System.Task_Primitives.Operations is
Self_ID.Common.LL.Thread := Null_Thread_Id;
if not Single_Lock then
- Result := pthread_mutexattr_init (Mutex_Attr'Access);
- pragma Assert (Result = 0);
-
Result :=
- pthread_mutex_init (Self_ID.Common.LL.L'Access, Mutex_Attr'Access);
+ pthread_mutex_init (Self_ID.Common.LL.L'Access, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result /= 0 then
@@ -1002,11 +990,18 @@ package body System.Task_Primitives.Operations is
-- do not need to manipulate caller's signal mask at this point.
-- All tasks in RTS will have All_Tasks_Mask initially.
- Result := pthread_create
- (T.Common.LL.Thread'Access,
- Attributes'Access,
- Thread_Body_Access (Wrapper),
- To_Address (T));
+ -- Note: the use of Unrestricted_Access in the following call is needed
+ -- because otherwise we have an error of getting a access-to-volatile
+ -- value which points to a non-volatile object. But in this case it is
+ -- safe to do this, since we know we have no problems with aliasing and
+ -- Unrestricted_Access bypasses this check.
+
+ Result :=
+ pthread_create
+ (T.Common.LL.Thread'Unrestricted_Access,
+ Attributes'Access,
+ Thread_Body_Access (Wrapper),
+ To_Address (T));
pragma Assert
(Result = 0 or else Result = EAGAIN or else Result = ENOMEM);
@@ -1081,9 +1076,7 @@ package body System.Task_Primitives.Operations is
----------------
procedure Initialize (S : in out Suspension_Object) is
- Mutex_Attr : aliased pthread_mutexattr_t;
- Cond_Attr : aliased pthread_condattr_t;
- Result : Interfaces.C.int;
+ Result : Interfaces.C.int;
begin
-- Initialize internal state (always to False (RM D.10(6)))
@@ -1093,10 +1086,7 @@ package body System.Task_Primitives.Operations is
-- Initialize internal mutex
- Result := pthread_mutexattr_init (Mutex_Attr'Access);
- pragma Assert (Result = 0);
-
- Result := pthread_mutex_init (S.L'Access, Mutex_Attr'Access);
+ Result := pthread_mutex_init (S.L'Access, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
@@ -1106,10 +1096,7 @@ package body System.Task_Primitives.Operations is
-- Initialize internal condition variable
- Result := pthread_condattr_init (Cond_Attr'Access);
- pragma Assert (Result = 0);
-
- Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
+ Result := pthread_cond_init (S.CV'Access, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb
index 425508a32c2..44015cf85d5 100644
--- a/gcc/ada/s-taprop-posix.adb
+++ b/gcc/ada/s-taprop-posix.adb
@@ -975,8 +975,14 @@ package body System.Task_Primitives.Operations is
-- do not need to manipulate caller's signal mask at this point.
-- All tasks in RTS will have All_Tasks_Mask initially.
+ -- Note: the use of Unrestricted_Access in the following call is needed
+ -- because otherwise we have an error of getting a access-to-volatile
+ -- value which points to a non-volatile object. But in this case it is
+ -- safe to do this, since we know we have no problems with aliasing and
+ -- Unrestricted_Access bypasses this check.
+
Result := pthread_create
- (T.Common.LL.Thread'Access,
+ (T.Common.LL.Thread'Unrestricted_Access,
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
diff --git a/gcc/ada/s-taprop-solaris.adb b/gcc/ada/s-taprop-solaris.adb
index b5fe1ee9d42..c98da19eb49 100644
--- a/gcc/ada/s-taprop-solaris.adb
+++ b/gcc/ada/s-taprop-solaris.adb
@@ -1005,6 +1005,12 @@ package body System.Task_Primitives.Operations is
Opts := THR_DETACHED + THR_BOUND;
end if;
+ -- Note: the use of Unrestricted_Access in the following call is needed
+ -- because otherwise we have an error of getting a access-to-volatile
+ -- value which points to a non-volatile object. But in this case it is
+ -- safe to do this, since we know we have no problems with aliasing and
+ -- Unrestricted_Access bypasses this check.
+
Result :=
thr_create
(System.Null_Address,
@@ -1012,7 +1018,7 @@ package body System.Task_Primitives.Operations is
Thread_Body_Access (Wrapper),
To_Address (T),
Opts,
- T.Common.LL.Thread'Access);
+ T.Common.LL.Thread'Unrestricted_Access);
Succeeded := Result = 0;
pragma Assert
diff --git a/gcc/ada/s-taprop-vms.adb b/gcc/ada/s-taprop-vms.adb
index 92b6023bdff..67cf363dd4e 100644
--- a/gcc/ada/s-taprop-vms.adb
+++ b/gcc/ada/s-taprop-vms.adb
@@ -809,9 +809,15 @@ package body System.Task_Primitives.Operations is
(Attributes'Access, PTHREAD_EXPLICIT_SCHED);
pragma Assert (Result = 0);
+ -- Note: the use of Unrestricted_Access in the following call is needed
+ -- because otherwise we have an error of getting a access-to-volatile
+ -- value which points to a non-volatile object. But in this case it is
+ -- safe to do this, since we know we have no problems with aliasing and
+ -- Unrestricted_Access bypasses this check.
+
Result :=
pthread_create
- (T.Common.LL.Thread'Access,
+ (T.Common.LL.Thread'Unrestricted_Access,
Attributes'Access,
Thread_Body_Access (Wrapper),
To_Address (T));
diff --git a/gcc/ada/s-utf_32.adb b/gcc/ada/s-utf_32.adb
index a5af4fbc60e..f044b9bcc70 100755
--- a/gcc/ada/s-utf_32.adb
+++ b/gcc/ada/s-utf_32.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2005-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -6182,6 +6182,7 @@ package body System.UTF_32 is
function Is_UTF_32_Line_Terminator (U : UTF_32) return Boolean is
begin
return U in 10 .. 13 -- Ascii.LF Ascii.VT Ascii.FF Ascii.CR
+ or else U = 16#00085# -- NEL
or else U = 16#02028# -- LINE SEPARATOR
or else U = 16#02029#; -- PARAGRAPH SEPARATOR
end Is_UTF_32_Line_Terminator;
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index b463d37a938..2a273609a09 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -35,6 +35,7 @@ with Lib; use Lib;
with Lib.Load; use Lib.Load;
with Nlists; use Nlists;
with Output; use Output;
+with Restrict; use Restrict;
with Sem_Attr; use Sem_Attr;
with Sem_Ch2; use Sem_Ch2;
with Sem_Ch3; use Sem_Ch3;
@@ -1361,6 +1362,11 @@ package body Sem is
-- Variable used to save values of config switches while we analyze the
-- new unit, to be restored on exit for proper recursive behavior.
+ Save_Cunit_Restrictions : Save_Cunit_Boolean_Restrictions;
+ -- Used to save non-partition wide restrictions before processing new
+ -- unit. All with'ed units are analyzed with config restrictions reset
+ -- and we need to restore these saved values at the end.
+
procedure Do_Analyze;
-- Procedure to analyze the compilation unit. This is called more than
-- once when the high level optimizer is activated.
@@ -1442,11 +1448,27 @@ package body Sem is
In_Spec_Expression := False;
Set_Comes_From_Source_Default (False);
+
+ -- Save current config switches and reset then appropriately
+
Save_Opt_Config_Switches (Save_Config_Switches);
Set_Opt_Config_Switches
(Is_Internal_File_Name (Unit_File_Name (Current_Sem_Unit)),
Current_Sem_Unit = Main_Unit);
+ -- Save current non-partition-wide restrictions
+
+ Save_Cunit_Restrictions := Cunit_Boolean_Restrictions_Save;
+
+ -- For unit in main extended unit, we reset the configuration values
+ -- for the non-partition-wide restrictions. For other units reset them.
+
+ if In_Extended_Main_Source_Unit (Comp_Unit) then
+ Restore_Config_Cunit_Boolean_Restrictions;
+ else
+ Reset_Cunit_Boolean_Restrictions;
+ end if;
+
-- Only do analysis of unit that has not already been analyzed
if not Analyzed (Comp_Unit) then
@@ -1511,6 +1533,11 @@ package body Sem is
Outer_Generic_Scope := S_Outer_Gen_Scope;
Restore_Opt_Config_Switches (Save_Config_Switches);
+
+ -- Deal with restore of restrictions
+
+ Cunit_Boolean_Restrictions_Restore (Save_Cunit_Restrictions);
+
Expander_Mode_Restore;
if Debug_Unit_Walk then
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index ae7edbf9dc2..c2277851bc4 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -841,13 +841,8 @@ package body Sem_Attr is
and then not In_Instance
and then not In_Inlined_Body
then
- if Restriction_Check_Required (No_Implicit_Aliasing) then
- Error_Attr_P
- ("prefix of % attribute must be explicitly aliased");
- else
- Error_Attr_P
- ("prefix of % attribute must be aliased");
- end if;
+ Error_Attr_P ("prefix of % attribute must be aliased");
+ Check_No_Implicit_Aliasing (P);
end if;
end Analyze_Access_Attribute;
@@ -2245,6 +2240,8 @@ package body Sem_Attr is
if Restriction_Check_Required (No_Implicit_Aliasing) then
if not Is_Aliased_View (P) then
Check_Restriction (No_Implicit_Aliasing, P);
+ else
+ Check_No_Implicit_Aliasing (P);
end if;
end if;
@@ -7824,14 +7821,30 @@ package body Sem_Attr is
T := T / 10;
end loop;
+ -- User declared enum type with discard names
+
+ elsif Discard_Names (R) then
+
+ -- If range is null, result is zero, that has already
+ -- been dealt with, so what we need is the power of ten
+ -- that accomodates the Pos of the largest value, which
+ -- is the high bound of the range + one for the space.
+
+ W := 1;
+ T := Hi;
+ while T /= 0 loop
+ T := T / 10;
+ W := W + 1;
+ end loop;
+
-- Only remaining possibility is user declared enum type
+ -- with normal case of Discard_Names not active.
else
pragma Assert (Is_Enumeration_Type (P_Type));
W := 0;
L := First_Literal (P_Type);
-
while Present (L) loop
-- Only pay attention to in range characters
@@ -8645,13 +8658,14 @@ package body Sem_Attr is
end if;
end if;
- -- Check the static accessibility rule of 3.10.2(28).
- -- Note that this check is not performed for the
- -- case of an anonymous access type, since the access
- -- attribute is always legal in such a context.
+ -- Check the static accessibility rule of 3.10.2(28). Note that
+ -- this check is not performed for the case of an anonymous
+ -- access type, since the access attribute is always legal
+ -- in such a context.
if Attr_Id /= Attribute_Unchecked_Access
- and then Object_Access_Level (P) > Type_Access_Level (Btyp)
+ and then
+ Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp)
and then Ekind (Btyp) = E_General_Access_Type
then
Accessibility_Message;
@@ -8673,7 +8687,7 @@ package body Sem_Attr is
-- anonymous_access_to_protected, there are no accessibility
-- checks either. Omit check entirely for Unrestricted_Access.
- elsif Object_Access_Level (P) > Type_Access_Level (Btyp)
+ elsif Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp)
and then Comes_From_Source (N)
and then Ekind (Btyp) = E_Access_Protected_Subprogram_Type
and then Attr_Id /= Attribute_Unrestricted_Access
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 34346e39925..e5afc1b8b2f 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -467,7 +467,6 @@ package body Sem_Ch10 is
-- generated with clauses or limited with clauses. Note that
-- we examine with clauses having pragmas Elaborate or
-- Elaborate_All applied to them due to cases such as:
- --
-- with Pack;
-- with Pack;
@@ -725,7 +724,12 @@ package body Sem_Ch10 is
return;
else
+ -- Analyze the package spec
+
Semantics (Lib_Unit);
+
+ -- Check for unused with's
+
Check_Unused_Withs (Get_Cunit_Unit_Number (Lib_Unit));
-- Verify that the library unit is a package declaration
@@ -857,8 +861,6 @@ package body Sem_Ch10 is
declare
Save_Style_Check : constant Boolean := Style_Check;
- Save_C_Restrict : constant Save_Cunit_Boolean_Restrictions :=
- Cunit_Boolean_Restrictions_Save;
begin
if not GNAT_Mode then
@@ -867,8 +869,10 @@ package body Sem_Ch10 is
Semantics (Parent_Spec (Unit_Node));
Version_Update (N, Parent_Spec (Unit_Node));
+
+ -- Restore style check settings
+
Style_Check := Save_Style_Check;
- Cunit_Boolean_Restrictions_Restore (Save_C_Restrict);
end;
end if;
@@ -1052,8 +1056,6 @@ package body Sem_Ch10 is
Un : Unit_Number_Type;
Save_Style_Check : constant Boolean := Style_Check;
- Save_C_Restrict : constant Save_Cunit_Boolean_Restrictions :=
- Cunit_Boolean_Restrictions_Save;
begin
Item := First (Context_Items (N));
@@ -1122,8 +1124,9 @@ package body Sem_Ch10 is
Next (Item);
end loop;
+ -- Restore style checks settings
+
Style_Check := Save_Style_Check;
- Cunit_Boolean_Restrictions_Restore (Save_C_Restrict);
end;
end if;
@@ -1641,7 +1644,7 @@ package body Sem_Ch10 is
-- subunit, and that the current unit is one of its parents which was
-- being analyzed to provide the needed context for the analysis of the
-- subunit. In this case we analyze the subunit and continue with the
- -- parent, without looking a subsequent subunits.
+ -- parent, without looking at subsequent subunits.
if Is_Loaded (Subunit_Name) then
@@ -2351,7 +2354,6 @@ package body Sem_Ch10 is
-- warnings if we have this definite error.
Save_Style_Check : constant Boolean := Opt.Style_Check;
- Save_C_Restrict : Save_Cunit_Boolean_Restrictions;
begin
U := Unit (Library_Unit (N));
@@ -2388,10 +2390,6 @@ package body Sem_Ch10 is
end if;
end if;
- -- Save current restriction set, does not apply to with'ed unit
-
- Save_C_Restrict := Cunit_Boolean_Restrictions_Save;
-
-- Several actions are skipped for dummy packages (those supplied for
-- with's where no matching file could be found). Such packages are
-- identified by the Sloc value being set to No_Location.
@@ -2591,10 +2589,9 @@ package body Sem_Ch10 is
end if;
end if;
- -- Restore style checks and restrictions
+ -- Restore style checks
Style_Check := Save_Style_Check;
- Cunit_Boolean_Restrictions_Restore (Save_C_Restrict);
-- Record the reference, but do NOT set the unit as referenced, we want
-- to consider the unit as unreferenced if this is the only reference
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index e51b8029803..2a431f8635e 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -5076,6 +5076,18 @@ package body Sem_Ch12 is
then
null;
+ -- If the formal package has an "others" box association that
+ -- covers this formal, there is no need for a check either.
+
+ elsif Nkind (Unit_Declaration_Node (E2)) in
+ N_Formal_Subprogram_Declaration
+ and then Box_Present (Unit_Declaration_Node (E2))
+ then
+ null;
+
+ -- Otherwise the actual in the formal and the actual in the
+ -- instantiation of the formal must match, up to renamings.
+
else
Check_Mismatch
(Ekind (E2) /= Ekind (E1) or else (Alias (E1)) /= Alias (E2));
@@ -12383,9 +12395,11 @@ package body Sem_Ch12 is
procedure Reset_Entity (N : Node_Id) is
procedure Set_Global_Type (N : Node_Id; N2 : Node_Id);
- -- If the type of N2 is global to the generic unit. Save the type in
- -- the generic node.
- -- What does this comment mean???
+ -- If the type of N2 is global to the generic unit, save the type in
+ -- the generic node. Just as we perform name capture for explicit
+ -- references within the generic, we must capture the global types
+ -- of local entities because they may participate in resolution in
+ -- the instance.
function Top_Ancestor (E : Entity_Id) return Entity_Id;
-- Find the ultimate ancestor of the current unit. If it is not a
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 488e6dc98cc..16147713712 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -726,13 +726,33 @@ package body Sem_Ch3 is
-- If the access definition is the return type of another access to
-- function, scope is the current one, because it is the one of the
- -- current type declaration.
+ -- current type declaration, except for the pathological case below.
if Nkind_In (Related_Nod, N_Object_Declaration,
N_Access_Function_Definition)
then
Anon_Scope := Current_Scope;
+ -- A pathological case: function returning access functions that
+ -- return access functions, etc. Each anonymous access type created
+ -- is in the enclosing scope of the outermost function.
+
+ declare
+ Par : Node_Id;
+
+ begin
+ Par := Related_Nod;
+ while Nkind_In (Par, N_Access_Function_Definition,
+ N_Access_Definition)
+ loop
+ Par := Parent (Par);
+ end loop;
+
+ if Nkind (Par) = N_Function_Specification then
+ Anon_Scope := Scope (Defining_Entity (Par));
+ end if;
+ end;
+
-- For the anonymous function result case, retrieve the scope of the
-- function specification's associated entity rather than using the
-- current scope. The current scope will be the function itself if the
@@ -1876,7 +1896,9 @@ package body Sem_Ch3 is
-- (Ada 2005: AI-230): Accessibility check for anonymous
-- components
- if Type_Access_Level (Etype (E)) > Type_Access_Level (T) then
+ if Type_Access_Level (Etype (E)) >
+ Deepest_Type_Access_Level (T)
+ then
Error_Msg_N
("expression has deeper access level than component " &
"(RM 3.10.2 (12.2))", E);
@@ -2664,8 +2686,8 @@ package body Sem_Ch3 is
-- Process expression, replacing error by integer zero, to avoid
-- cascaded errors or aborts further along in the processing
- -- Replace Error by integer zero, which seems least likely to
- -- cause cascaded errors.
+ -- Replace Error by integer zero, which seems least likely to cause
+ -- cascaded errors.
if E = Error then
Rewrite (E, Make_Integer_Literal (Sloc (E), Uint_0));
@@ -11764,7 +11786,7 @@ package body Sem_Ch3 is
-- needed, since checks may cause duplication of the expressions
-- which must not be reevaluated.
- if Expander_Active then
+ if Full_Expander_Active then
Force_Evaluation (Low_Bound (R));
Force_Evaluation (High_Bound (R));
end if;
@@ -18304,7 +18326,7 @@ package body Sem_Ch3 is
-- if needed, before applying checks, since checks may cause
-- duplication of the expression without forcing evaluation.
- if Expander_Active then
+ if Full_Expander_Active then
Force_Evaluation (Lo);
Force_Evaluation (Hi);
end if;
@@ -18414,7 +18436,7 @@ package body Sem_Ch3 is
-- Case of other than an explicit N_Range node
- elsif Expander_Active then
+ elsif Full_Expander_Active then
Get_Index_Bounds (R, Lo, Hi);
Force_Evaluation (Lo);
Force_Evaluation (Hi);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index a9f84d34faa..4a44e43c151 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -268,14 +268,19 @@ package body Sem_Ch6 is
procedure Analyze_Expression_Function (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
LocX : constant Source_Ptr := Sloc (Expression (N));
- Def_Id : constant Entity_Id := Defining_Entity (Specification (N));
Expr : constant Node_Id := Expression (N);
- New_Body : Node_Id;
- New_Decl : Node_Id;
+ Spec : constant Node_Id := Specification (N);
+
+ Def_Id : Entity_Id;
+ pragma Unreferenced (Def_Id);
- Prev : constant Entity_Id := Current_Entity_In_Scope (Def_Id);
+ Prev : Entity_Id;
-- If the expression is a completion, Prev is the entity whose
- -- declaration is completed.
+ -- declaration is completed. Def_Id is needed to analyze the spec.
+
+ New_Body : Node_Id;
+ New_Decl : Node_Id;
+ New_Spec : Node_Id;
begin
-- This is one of the occasions on which we transform the tree during
@@ -286,10 +291,20 @@ package body Sem_Ch6 is
-- determine whether this is possible.
Inline_Processing_Required := True;
+ New_Spec := Copy_Separate_Tree (Spec);
+ Prev := Current_Entity_In_Scope (Defining_Entity (Spec));
+
+ -- If there are previous overloadable entities with the same name,
+ -- check whether any of them is completed by the expression function.
+
+ if Present (Prev) and then Is_Overloadable (Prev) then
+ Def_Id := Analyze_Subprogram_Specification (Spec);
+ Prev := Find_Corresponding_Spec (N);
+ end if;
New_Body :=
Make_Subprogram_Body (Loc,
- Specification => Copy_Separate_Tree (Specification (N)),
+ Specification => New_Spec,
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (LocX,
@@ -307,6 +322,7 @@ package body Sem_Ch6 is
Insert_After (N, New_Body);
Rewrite (N, Make_Null_Statement (Loc));
+ Set_Has_Completion (Prev, False);
Analyze (N);
Analyze (New_Body);
Set_Is_Inlined (Prev);
@@ -314,6 +330,7 @@ package body Sem_Ch6 is
elsif Present (Prev)
and then Comes_From_Source (Prev)
then
+ Set_Has_Completion (Prev, False);
Rewrite (N, New_Body);
Analyze (N);
@@ -333,8 +350,7 @@ package body Sem_Ch6 is
else
New_Decl :=
- Make_Subprogram_Declaration (Loc,
- Specification => Specification (N));
+ Make_Subprogram_Declaration (Loc, Specification => Spec);
Rewrite (N, New_Decl);
Analyze (N);
@@ -8536,19 +8552,19 @@ package body Sem_Ch6 is
and then In_Private_Part (Current_Scope)
then
Priv_Decls :=
- Private_Declarations (
- Specification (Unit_Declaration_Node (Current_Scope)));
+ Private_Declarations
+ (Specification (Unit_Declaration_Node (Current_Scope)));
return In_Package_Body (Current_Scope)
or else
(Is_List_Member (Decl)
- and then List_Containing (Decl) = Priv_Decls)
+ and then List_Containing (Decl) = Priv_Decls)
or else (Nkind (Parent (Decl)) = N_Package_Specification
- and then not
- Is_Compilation_Unit
- (Defining_Entity (Parent (Decl)))
- and then List_Containing (Parent (Parent (Decl)))
- = Priv_Decls);
+ and then not
+ Is_Compilation_Unit
+ (Defining_Entity (Parent (Decl)))
+ and then List_Containing (Parent (Parent (Decl))) =
+ Priv_Decls);
else
return False;
end if;
@@ -9562,6 +9578,15 @@ package body Sem_Ch6 is
-- or IN OUT parameters of the subprogram, or (for a function) if the
-- return value has an invariant.
+ function Is_Public_Subprogram_For (T : Entity_Id) return Boolean;
+ -- T is the entity for a private type for which invariants are defined.
+ -- This function returns True if the procedure corresponding to the
+ -- value of Designator is a public procedure from the point of view of
+ -- this type (i.e. its spec is in the visible part of the package that
+ -- contains the declaration of the private type). A True value means
+ -- that an invariant check is required (for an IN OUT parameter, or
+ -- the returned value of a function.
+
--------------
-- Grab_PPC --
--------------
@@ -9689,6 +9714,45 @@ package body Sem_Ch6 is
return False;
end Invariants_Or_Predicates_Present;
+ ------------------------------
+ -- Is_Public_Subprogram_For --
+ ------------------------------
+
+ -- The type T is a private type, its declaration is therefore in
+ -- the list of public declarations of some package. The test for a
+ -- public subprogram is that its declaration is in this same list
+ -- of declarations for the same package (note that all the public
+ -- declarations are in one list, and all the private declarations
+ -- in another, so this deals with the public/private distinction).
+
+ function Is_Public_Subprogram_For (T : Entity_Id) return Boolean is
+ DD : constant Node_Id := Unit_Declaration_Node (Designator);
+ -- The subprogram declaration for the subprogram in question
+
+ TL : constant List_Id :=
+ Visible_Declarations
+ (Specification (Unit_Declaration_Node (Scope (T))));
+ -- The list of declarations containing the private declaration of
+ -- the type. We know it is a private type, so we know its scope is
+ -- the package in question, and we know it must be in the visible
+ -- declarations of this package.
+
+ begin
+ -- If the subprogram declaration is not a list member, it must be
+ -- an Init_Proc, in which case we want to consider it to be a
+ -- public subprogram, since we do get initializations to deal with.
+
+ if not Is_List_Member (DD) then
+ return True;
+
+ -- Otherwise we test whether the subprogram is declared in the
+ -- visible declarations of the package containing the type.
+
+ else
+ return TL = List_Containing (DD);
+ end if;
+ end Is_Public_Subprogram_For;
+
-- Start of processing for Process_PPCs
begin
@@ -9985,10 +10049,13 @@ package body Sem_Ch6 is
Parameter_Type => New_Occurrence_Of (Ftyp, Loc),
Defining_Identifier => Rent));
- -- Add invariant call if returning type with invariants
+ -- Add invariant call if returning type with invariants and
+ -- this is a public function, i.e. a function declared in the
+ -- visible part of the package defining the private type.
if Has_Invariants (Etype (Rent))
and then Present (Invariant_Procedure (Etype (Rent)))
+ and then Is_Public_Subprogram_For (Etype (Rent))
then
Append_To (Plist,
Make_Invariant_Call (New_Occurrence_Of (Rent, Loc)));
@@ -10017,6 +10084,7 @@ package body Sem_Ch6 is
if Has_Invariants (Ftype)
and then Present (Invariant_Procedure (Ftype))
+ and then Is_Public_Subprogram_For (Ftype)
then
Append_To (Plist,
Make_Invariant_Call
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 5df43afc43e..ce4cff39d92 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -2130,7 +2130,32 @@ package body Sem_Elab is
end if;
-- Here is the case of calling a subprogram where the body has not yet
- -- been encountered, a warning message is needed.
+ -- been encountered. A warning message is needed, except if this is the
+ -- case of appearing within an aspect specification that results in
+ -- a check call, we do not really have such a situation, so no warning
+ -- is needed (e.g. the case of a precondition, where the call appears
+ -- textually before the body, but in actual fact is moved to the
+ -- appropriate subprogram body and so does not need a check).
+
+ declare
+ P : Node_Id;
+ begin
+ P := Parent (N);
+ loop
+ if Nkind (P) in N_Subexpr then
+ P := Parent (P);
+ elsif Nkind (P) = N_If_Statement
+ and then Nkind (Original_Node (P)) = N_Pragma
+ and then Present (Corresponding_Aspect (Original_Node (P)))
+ then
+ return;
+ else
+ exit;
+ end if;
+ end loop;
+ end;
+
+ -- Not that special case, warning and dynamic check is required
-- If we have nothing in the call stack, then this is at the outer
-- level, and the ABE is bound to occur.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 397c73380a2..14961cbb940 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -3524,12 +3524,25 @@ package body Sem_Prag is
("second argument of pragma% must be a subprogram", Arg2);
end if;
- -- For Stdcall, a subprogram, variable or subprogram type is required
+ -- Stdcall case
if C = Convention_Stdcall
- and then not Is_Subprogram (E)
- and then not Is_Generic_Subprogram (E)
+
+ -- Subprogram is allowed, but not a generic subprogram, and not a
+ -- dispatching operation. A dispatching subprogram cannot be used
+ -- to interface to the Win32 API, so in fact this check does not
+ -- impose any effective restriction.
+
+ and then
+ ((not Is_Subprogram (E) and then not Is_Generic_Subprogram (E))
+ or else Is_Dispatching_Operation (E))
+
+ -- A variable is OK
+
and then Ekind (E) /= E_Variable
+
+ -- An access to subprogram is also allowed
+
and then not
(Is_Access_Type (E)
and then Ekind (Designated_Type (E)) = E_Subprogram_Type)
@@ -5337,6 +5350,46 @@ package body Sem_Prag is
Check_Restriction (No_Implementation_Restrictions, Arg);
end if;
+ -- Special processing for No_Elaboration_Code restriction
+
+ if R_Id = No_Elaboration_Code then
+
+ -- Restriction is only recognized within a configuration
+ -- pragma file, or within a unit of the main extended
+ -- program. Note: the test for Main_Unit is needed to
+ -- properly include the case of configuration pragma files.
+
+ if not (Current_Sem_Unit = Main_Unit
+ or else In_Extended_Main_Source_Unit (N))
+ then
+ return;
+
+ -- Don't allow in a subunit unless already specified in
+ -- body or spec.
+
+ elsif Nkind (Parent (N)) = N_Compilation_Unit
+ and then Nkind (Unit (Parent (N))) = N_Subunit
+ and then not Restriction_Active (No_Elaboration_Code)
+ then
+ Error_Msg_N
+ ("invalid specification of ""No_Elaboration_Code""",
+ N);
+ Error_Msg_N
+ ("\restriction cannot be specified in a subunit", N);
+ Error_Msg_N
+ ("\unless also specified in body or spec", N);
+ return;
+
+ -- If we have a No_Elaboration_Code pragma that we
+ -- accept, then it needs to be added to the configuration
+ -- restrcition set so that we get proper application to
+ -- other units in the main extended source as required.
+
+ else
+ Add_To_Config_Boolean_Restrictions (No_Elaboration_Code);
+ end if;
+ end if;
+
-- If this is a warning, then set the warning unless we already
-- have a real restriction active (we never want a warning to
-- override a real restriction).
@@ -12647,6 +12700,47 @@ package body Sem_Prag is
end if;
end Pure_05;
+ -------------
+ -- Pure_12 --
+ -------------
+
+ -- pragma Pure_12 [(library_unit_NAME)];
+
+ -- This pragma is useable only in GNAT_Mode, where it is used like
+ -- pragma Pure but it is only effective in Ada 2012 mode (otherwise
+ -- it is ignored). It may be used after a pragma Preelaborate, in
+ -- which case it overrides the effect of the pragma Preelaborate.
+ -- This is used to implement AI05-0212 which recategorizes some
+ -- run-time packages in Ada 2012 mode.
+
+ when Pragma_Pure_12 => Pure_12 : declare
+ Ent : Entity_Id;
+
+ begin
+ GNAT_Pragma;
+ Check_Valid_Library_Unit_Pragma;
+
+ if not GNAT_Mode then
+ Error_Pragma ("pragma% only available in GNAT mode");
+ end if;
+
+ if Nkind (N) = N_Null_Statement then
+ return;
+ end if;
+
+ -- This is one of the few cases where we need to test the value of
+ -- Ada_Version_Explicit rather than Ada_Version (which is always
+ -- set to Ada_2012 in a predefined unit), we need to know the
+ -- explicit version set to know if this pragma is active.
+
+ if Ada_Version_Explicit >= Ada_2012 then
+ Ent := Find_Lib_Unit_Name;
+ Set_Is_Preelaborated (Ent, False);
+ Set_Is_Pure (Ent);
+ Set_Suppress_Elaboration_Warnings (Ent);
+ end if;
+ end Pure_12;
+
-------------------
-- Pure_Function --
-------------------
@@ -14959,6 +15053,7 @@ package body Sem_Prag is
Pragma_Psect_Object => -1,
Pragma_Pure => -1,
Pragma_Pure_05 => -1,
+ Pragma_Pure_12 => -1,
Pragma_Pure_Function => -1,
Pragma_Queuing_Policy => -1,
Pragma_Ravenscar => -1,
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index ad59f952252..ae2e089c099 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4086,7 +4086,7 @@ package body Sem_Res is
is
begin
if Type_Access_Level (Etype (Disc_Exp)) >
- Type_Access_Level (Alloc_Typ)
+ Deepest_Type_Access_Level (Alloc_Typ)
then
Error_Msg_N
("operand type has deeper level than allocator type", Disc_Exp);
@@ -4095,10 +4095,10 @@ package body Sem_Res is
-- object must not be deeper than that of the allocator's type.
elsif Nkind (Disc_Exp) = N_Attribute_Reference
- and then Get_Attribute_Id (Attribute_Name (Disc_Exp))
- = Attribute_Access
- and then Object_Access_Level (Prefix (Disc_Exp))
- > Type_Access_Level (Alloc_Typ)
+ and then Get_Attribute_Id (Attribute_Name (Disc_Exp)) =
+ Attribute_Access
+ and then Object_Access_Level (Prefix (Disc_Exp)) >
+ Deepest_Type_Access_Level (Alloc_Typ)
then
Error_Msg_N
("prefix of attribute has deeper level than allocator type",
@@ -4109,8 +4109,8 @@ package body Sem_Res is
elsif Ekind (Etype (Disc_Exp)) = E_Anonymous_Access_Type
and then Nkind (Disc_Exp) = N_Selected_Component
- and then Object_Access_Level (Prefix (Disc_Exp))
- > Type_Access_Level (Alloc_Typ)
+ and then Object_Access_Level (Prefix (Disc_Exp)) >
+ Deepest_Type_Access_Level (Alloc_Typ)
then
Error_Msg_N
("access discriminant has deeper level than allocator type",
@@ -4314,7 +4314,9 @@ package body Sem_Res is
Exp_Typ := Entity (E);
end if;
- if Type_Access_Level (Exp_Typ) > Type_Access_Level (Typ) then
+ if Type_Access_Level (Exp_Typ) >
+ Deepest_Type_Access_Level (Typ)
+ then
if In_Instance_Body then
Error_Msg_N ("?type in allocator has deeper level than" &
" designated class-wide type", E);
@@ -8666,7 +8668,15 @@ package body Sem_Res is
-- this by making sure that the expanded code points to
-- the Sloc of the expression, not the original pragma.
- Error_Msg_N
+ -- Note: Use Error_Msg_F here rather than Error_Msg_N.
+ -- The source location of the expression is not usually
+ -- the best choice here. For example, it gets located on
+ -- the last AND keyword in a chain of boolean expressiond
+ -- AND'ed together. It is best to put the message on the
+ -- first character of the assertion, which is the effect
+ -- of the First_Node call here.
+
+ Error_Msg_F
("?assertion would fail at run time!",
Expression
(First (Pragma_Argument_Associations (Orig))));
@@ -8691,8 +8701,14 @@ package body Sem_Res is
and then Entity (Expr) = Standard_False
then
null;
+
+ -- Post warning
+
else
- Error_Msg_N
+ -- Again use Error_Msg_F rather than Error_Msg_N, see
+ -- comment above for an explanation of why we do this.
+
+ Error_Msg_F
("?check would fail at run time!",
Expression
(Last (Pragma_Argument_Associations (Orig))));
@@ -10358,13 +10374,15 @@ package body Sem_Res is
Subtypes_Statically_Match (Target_Comp_Type, Opnd_Comp_Type)
then
if Type_Access_Level (Target_Type) <
- Type_Access_Level (Opnd_Type)
+ Deepest_Type_Access_Level (Opnd_Type)
then
if In_Instance_Body then
- Error_Msg_N ("?source array type " &
- "has deeper accessibility level than target", Operand);
- Error_Msg_N ("\?Program_Error will be raised at run time",
- Operand);
+ Error_Msg_N
+ ("?source array type has " &
+ "deeper accessibility level than target", Operand);
+ Error_Msg_N
+ ("\?Program_Error will be raised at run time",
+ Operand);
Rewrite (N,
Make_Raise_Program_Error (Sloc (N),
Reason => PE_Accessibility_Check_Failed));
@@ -10374,8 +10392,9 @@ package body Sem_Res is
-- Conversion not allowed because of accessibility levels
else
- Error_Msg_N ("source array type " &
- "has deeper accessibility level than target", Operand);
+ Error_Msg_N
+ ("source array type has " &
+ "deeper accessibility level than target", Operand);
return False;
end if;
@@ -10398,7 +10417,7 @@ package body Sem_Res is
-- All of this is checked in Subtypes_Statically_Match.
if not Subtypes_Statically_Match
- (Target_Comp_Type, Opnd_Comp_Type)
+ (Target_Comp_Type, Opnd_Comp_Type)
then
Error_Msg_N
("component subtypes must statically match", Operand);
@@ -11069,6 +11088,11 @@ package body Sem_Res is
N);
return True;
+ -- If it was legal in the generic, it's legal in the instance
+
+ elsif In_Instance_Body then
+ return True;
+
-- If both are tagged types, check legality of view conversions
elsif Is_Tagged_Type (Target_Type)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 1764da9db02..edf1fecbfe6 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -2437,6 +2437,12 @@ package body Sem_Util is
(Defining_Identifier
(Associated_Node_For_Itype (Typ))));
+ -- For generic formal type, return Int'Last (infinite).
+ -- See comment preceding Is_Generic_Type call in Type_Access_Level.
+
+ elsif Is_Generic_Type (Root_Type (Typ)) then
+ return UI_From_Int (Int'Last);
+
else
return Type_Access_Level (Typ);
end if;
@@ -6583,10 +6589,6 @@ package body Sem_Util is
if Is_Entity_Name (Obj) then
E := Entity (Obj);
- if Is_Object (E) and then not Is_Aliased (E) then
- Check_Restriction (No_Implicit_Aliasing, Obj);
- end if;
-
return
(Is_Object (E)
and then
@@ -8731,10 +8733,15 @@ package body Sem_Util is
then
return True;
- elsif Nkind (N) = N_Indexed_Component
- or else Nkind (N) = N_Selected_Component
+ elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component)
+ and then Is_Volatile_Prefix (Prefix (N))
then
- return Is_Volatile_Prefix (Prefix (N));
+ return True;
+
+ elsif Nkind (N) = N_Selected_Component
+ and then Is_Volatile (Entity (Selector_Name (N)))
+ then
+ return True;
else
return False;
@@ -10837,9 +10844,7 @@ package body Sem_Util is
-- source. This excludes, for example, calls to a dispatching
-- assignment operation when the left-hand side is tagged.
- if Modification_Comes_From_Source
- or else Alfa_Mode
- then
+ if Modification_Comes_From_Source or else Alfa_Mode then
Generate_Reference (Ent, Exp, 'm');
-- If the target of the assignment is the bound variable
@@ -12715,6 +12720,25 @@ package body Sem_Util is
end if;
end if;
+ -- Return library level for a generic formal type. This is done because
+ -- RM(10.3.2) says that "The statically deeper relationship does not
+ -- apply to ... a descendant of a generic formal type". Rather than
+ -- checking at each point where a static accessibility check is
+ -- performed to see if we are dealing with a formal type, this rule is
+ -- implemented by having Type_Access_Level and Deepest_Type_Access_Level
+ -- return extreme values for a formal type; Deepest_Type_Access_Level
+ -- returns Int'Last. By calling the appropriate function from among the
+ -- two, we ensure that the static accessibility check will pass if we
+ -- happen to run into a formal type. More specifically, we should call
+ -- Deepest_Type_Access_Level instead of Type_Access_Level whenever the
+ -- call occurs as part of a static accessibility check and the error
+ -- case is the case where the type's level is too shallow (as opposed
+ -- to too deep).
+
+ if Is_Generic_Type (Root_Type (Btyp)) then
+ return Scope_Depth (Standard_Standard);
+ end if;
+
return Scope_Depth (Enclosing_Dynamic_Scope (Btyp));
end Type_Access_Level;
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index c7f610d52f0..693ddf2def9 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -314,7 +314,9 @@ package Sem_Util is
-- static accesssibility level of the object. In that case, the dynamic
-- accessibility level of the object may take on values in a range. The low
-- bound of of that range is returned by Type_Access_Level; this function
- -- yields the high bound of that range.
+ -- yields the high bound of that range. Also differs from Type_Access_Level
+ -- in the case of a descendant of a generic formal type (returns Int'Last
+ -- instead of 0).
function Defining_Entity (N : Node_Id) return Entity_Id;
-- Given a declaration N, returns the associated defining entity. If the
@@ -775,8 +777,12 @@ package Sem_Util is
function Is_Aliased_View (Obj : Node_Id) return Boolean;
-- Determine if Obj is an aliased view, i.e. the name of an object to which
- -- 'Access or 'Unchecked_Access can apply. Note that the implementation
- -- takes the No_Implicit_Aiasing restriction into account.
+ -- 'Access or 'Unchecked_Access can apply. Note that this routine uses the
+ -- rules of the language, it does not take into account the restriction
+ -- No_Implicit_Aliasing, so it can return True if the restriction is active
+ -- and Obj violates the restriction. The caller is responsible for calling
+ -- Restrict.Check_No_Implicit_Aliasing if True is returned, but there is a
+ -- requirement for obeying the restriction in the call context.
function Is_Ancestor_Package
(E1 : Entity_Id;
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index b36b930b8c4..440cf02a2e7 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -657,6 +657,7 @@ package body Sinfo is
(N : Node_Id) return Node_Id is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Expression_Function
or else NT (N).Nkind = N_Package_Body
or else NT (N).Nkind = N_Protected_Body
or else NT (N).Nkind = N_Subprogram_Body
@@ -1572,6 +1573,14 @@ package body Sinfo is
return Flag13 (N);
end Has_Wide_Wide_Character;
+ function Header_Size_Added
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Attribute_Reference);
+ return Flag11 (N);
+ end Header_Size_Added;
+
function Hidden_By_Use_Clause
(N : Node_Id) return Elist_Id is
begin
@@ -3729,6 +3738,7 @@ package body Sinfo is
(N : Node_Id; Val : Node_Id) is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Expression_Function
or else NT (N).Nkind = N_Package_Body
or else NT (N).Nkind = N_Protected_Body
or else NT (N).Nkind = N_Subprogram_Body
@@ -4635,6 +4645,14 @@ package body Sinfo is
Set_Flag13 (N, Val);
end Set_Has_Wide_Wide_Character;
+ procedure Set_Header_Size_Added
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Attribute_Reference);
+ Set_Flag11 (N, Val);
+ end Set_Header_Size_Added;
+
procedure Set_Hidden_By_Use_Clause
(N : Node_Id; Val : Elist_Id) is
begin
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 35a73f9ad94..7e308ec328e 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -760,6 +760,9 @@ package Sinfo is
-- renaming declaration when it is a Renaming_As_Body. The field is Empty
-- if there is no corresponding spec, as in the case of a subprogram body
-- that serves as its own spec.
+ --
+ -- In Ada 2012, Corresponding_Spec is set on expression functions that
+ -- complete a subprogram declaration.
-- Corresponding_Stub (Node3-Sem)
-- This field is present in an N_Subunit node. It holds the node in
@@ -1203,6 +1206,13 @@ package Sinfo is
-- code outside the Wide_Character range) appears in the string. Used to
-- implement pragma preference rules.
+ -- Header_Size_Added (Flag11-Sem)
+ -- Present in N_Attribute_Reference nodes, set only for attribute
+ -- Max_Size_In_Storage_Elements. The flag indicates that the size of the
+ -- hidden list header used by the runtime finalization support has been
+ -- added to the size of the prefix. The flag also prevents the infinite
+ -- expansion of the same attribute in the said context.
+
-- Hidden_By_Use_Clause (Elist4-Sem)
-- An entity list present in use clauses that appear within
-- instantiations. For the resolution of local entities, entities
@@ -3324,6 +3334,7 @@ package Sinfo is
-- Entity (Node4-Sem) used if the attribute yields a type
-- Associated_Node (Node4-Sem)
-- Do_Overflow_Check (Flag17-Sem)
+ -- Header_Size_Added (Flag11-Sem)
-- Redundant_Use (Flag13-Sem)
-- Must_Be_Byte_Aligned (Flag14)
-- plus fields for expression
@@ -4607,6 +4618,7 @@ package Sinfo is
-- Sloc points to FUNCTION
-- Specification (Node1)
-- Expression (Node3)
+ -- Corresponding_Spec (Node5-Sem)
-----------------------------------
-- 6.4 Procedure Call Statement --
@@ -7310,6 +7322,11 @@ package Sinfo is
-- more sense to call it an Expression field, but then we would have to
-- special case the treatment of the N_Reference node.
+ -- Note: evaluating a N_Reference node is guaranteed to yield a non-null
+ -- value at run time. Therefore, it is valid to set Is_Known_Non_Null on
+ -- a temporary initialized to a N_Reference node in order to eliminate
+ -- superfluous access checks.
+
-- Sprint syntax: prefix'reference
-- N_Reference
@@ -8547,6 +8564,9 @@ package Sinfo is
function Has_Wide_Wide_Character
(N : Node_Id) return Boolean; -- Flag13
+ function Header_Size_Added
+ (N : Node_Id) return Boolean; -- Flag11
+
function Hidden_By_Use_Clause
(N : Node_Id) return Elist_Id; -- Elist4
@@ -9522,6 +9542,9 @@ package Sinfo is
procedure Set_Has_Wide_Wide_Character
(N : Node_Id; Val : Boolean := True); -- Flag13
+ procedure Set_Header_Size_Added
+ (N : Node_Id; Val : Boolean := True); -- Flag11
+
procedure Set_Hidden_By_Use_Clause
(N : Node_Id; Val : Elist_Id); -- Elist4
@@ -11918,6 +11941,7 @@ package Sinfo is
pragma Inline (Has_Task_Name_Pragma);
pragma Inline (Has_Wide_Character);
pragma Inline (Has_Wide_Wide_Character);
+ pragma Inline (Header_Size_Added);
pragma Inline (Hidden_By_Use_Clause);
pragma Inline (High_Bound);
pragma Inline (Identifier);
@@ -12239,6 +12263,7 @@ package Sinfo is
pragma Inline (Set_Has_Task_Name_Pragma);
pragma Inline (Set_Has_Wide_Character);
pragma Inline (Set_Has_Wide_Wide_Character);
+ pragma Inline (Set_Header_Size_Added);
pragma Inline (Set_Hidden_By_Use_Clause);
pragma Inline (Set_High_Bound);
pragma Inline (Set_Identifier);
diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads
index bdc268eaf0f..1d13f6e60be 100644
--- a/gcc/ada/sinput.ads
+++ b/gcc/ada/sinput.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -43,7 +43,7 @@
-- described in RM 2.2 (13). Any of the characters FF, LF, CR or VT or any
-- wide character that is a Line or Paragraph Separator acts as an end of
-- logical line in this sense, and it is essentially irrelevant whether one
--- or more appears in sequence (since if sequence of such characters is
+-- or more appears in sequence (since if a sequence of such characters is
-- regarded as separate ends of line, then the intervening logical lines
-- are null in any case).
@@ -451,6 +451,75 @@ package Sinput is
Internal_Source'Unrestricted_Access;
-- Pointer to internal source buffer
+ -----------------------------------------
+ -- Handling of Source Line Terminators --
+ -----------------------------------------
+
+ -- In this section we discuss in detail the issue of terminators used to
+ -- terminate source lines. The RM says that one or more format effectors
+ -- (other than horizontal tab) end a source line, and defines the set of
+ -- such format effectors, but does not talk about exactly how they are
+ -- represented in the source program (since in general the RM is not in
+ -- the business of specifying source program formats).
+
+ -- The type Types.Line_Terminator is defined as a subtype of Character
+ -- that includes CR/LF/VT/FF. The most common line enders in practice
+ -- are CR (some MAC systems), LF (Unix systems), and CR/LF (DOS/Windows
+ -- systems). Any of these sequences is recognized as ending a physical
+ -- source line, and if multiple such terminators appear (e.g. LF/LF),
+ -- then we consider we have an extra blank line.
+
+ -- VT and FF are recognized as terminating source lines, but they are
+ -- considered to end a logical line instead of a physical line, so that
+ -- the line numbering ignores such terminators. The use of VT and FF is
+ -- mandated by the standard, and correctly handled in a conforming manner
+ -- by GNAT, but their use is not recommended.
+
+ -- In addition to the set of characters defined by the type in Types, in
+ -- wide character encoding, then the codes returning True for a call to
+ -- System.UTF_32.Is_UTF_32_Line_Terminator are also recognized as ending a
+ -- source line. This includes the standard codes defined above in addition
+ -- to NEL (NEXT LINE), LINE SEPARATOR and PARAGRAPH SEPARATOR. Again, as in
+ -- the case of VT and FF, the standard requires we recognize these as line
+ -- terminators, but we consider them to be logical line terminators. The
+ -- only physical line terminators recognized are the standard ones (CR,
+ -- LF, or CR/LF).
+
+ -- However, we do not recognize the NEL (16#85#) character as having the
+ -- significance of an end of line character when operating in normal 8-bit
+ -- Latin-n input mode for the compiler. Instead the rule in this mode is
+ -- that all upper half control codes (16#80# .. 16#9F#) are illegal if they
+ -- occur in program text, and are ignored if they appear in comments.
+
+ -- First, note that this behavior is fully conforming with the standard.
+ -- The standard has nothing whatever to say about source representation
+ -- and implementations are completely free to make there own rules. In
+ -- this case, in 8-bit mode, GNAT decides that the 16#0085# character is
+ -- not a representation of the NEL character, even though it looks like it.
+ -- If you have NEL's in your program, which you expect to be treated as
+ -- end of line characters, you must use a wide character encoding such as
+ -- UTF-8 for this code to be recognized.
+
+ -- Second, an explanation of why we take this slightly surprising choice.
+ -- We have never encountered anyone actually using the NEL character to
+ -- end lines. One user raised the issue as a result of some experiments,
+ -- but no one has ever submitted a program encoded this way, in any of
+ -- the possible encodings. It seems that even when using wide character
+ -- codes extensively, the normal approach is to use standard line enders
+ -- (LF or CR/LF). So the failure to recognize NEL in this mode seems to
+ -- have no practical downside.
+
+ -- Moreover, what we have seen in a significant number of programs from
+ -- multiple sources is the practice of writing all program text in lower
+ -- half (ASCII) form, but using UTF-8 encoded wide characters freely in
+ -- comments, where the comments are terminated by normal line endings
+ -- (LF or CR/LF). The comments do not contain NEL codes, but they can and
+ -- do contain other UTF-8 encoding sequences where one of the bytes is the
+ -- NEL code. Now such programs can of course be compiled in UTF-8 mode,
+ -- but in practice they also compile fine in standard 8-bit mode without
+ -- specifying a character encoding. Since this is common practice, it would
+ -- be a signficant upwards incompatibility to recognize NEL in 8-bit mode.
+
-----------------
-- Subprograms --
-----------------
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 3ed2a668e00..d15892a5f02 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -524,6 +524,7 @@ package Snames is
Name_Psect_Object : constant Name_Id := N + $; -- VMS
Name_Pure : constant Name_Id := N + $;
Name_Pure_05 : constant Name_Id := N + $; -- GNAT
+ Name_Pure_12 : constant Name_Id := N + $; -- GNAT
Name_Pure_Function : constant Name_Id := N + $; -- GNAT
Name_Relative_Deadline : constant Name_Id := N + $; -- Ada 05
Name_Remote_Call_Interface : constant Name_Id := N + $;
@@ -1672,6 +1673,7 @@ package Snames is
Pragma_Psect_Object,
Pragma_Pure,
Pragma_Pure_05,
+ Pragma_Pure_12,
Pragma_Pure_Function,
Pragma_Relative_Deadline,
Pragma_Remote_Call_Interface,
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 4d383fd0608..a4456f56a24 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -80,54 +80,6 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
#endif
/*
- mode_read_text
- open text file for reading
- rt for DOS and Windows NT, r for Unix
-
- mode_write_text
- truncate to zero length or create text file for writing
- wt for DOS and Windows NT, w for Unix
-
- mode_append_text
- append; open or create text file for writing at end-of-file
- at for DOS and Windows NT, a for Unix
-
- mode_read_binary
- open binary file for reading
- rb for DOS and Windows NT, r for Unix
-
- mode_write_binary
- truncate to zero length or create binary file for writing
- wb for DOS and Windows NT, w for Unix
-
- mode_append_binary
- append; open or create binary file for writing at end-of-file
- ab for DOS and Windows NT, a for Unix
-
- mode_read_text_plus
- open text file for update (reading and writing)
- r+t for DOS and Windows NT, r+ for Unix
-
- mode_write_text_plus
- truncate to zero length or create text file for update
- w+t for DOS and Windows NT, w+ for Unix
-
- mode_append_text_plus
- append; open or create text file for update, writing at end-of-file
- a+t for DOS and Windows NT, a+ for Unix
-
- mode_read_binary_plus
- open binary file for update (reading and writing)
- r+b for DOS and Windows NT, r+ for Unix
-
- mode_write_binary_plus
- truncate to zero length or create binary file for update
- w+b for DOS and Windows NT, w+ for Unix
-
- mode_append_binary_plus
- append; open or create binary file for update, writing at end-of-file
- a+b for DOS and Windows NT, a+ for Unix
-
Notes:
(1) Opening a file with read mode fails if the file does not exist or
@@ -169,18 +121,7 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
*/
#if defined(WINNT)
-static const char *mode_read_text = "rt";
-static const char *mode_write_text = "wt";
-static const char *mode_append_text = "at";
-static const char *mode_read_binary = "rb";
-static const char *mode_write_binary = "wb";
-static const char *mode_append_binary = "ab";
-static const char *mode_read_text_plus = "r+t";
-static const char *mode_write_text_plus = "w+t";
-static const char *mode_append_text_plus = "a+t";
-static const char *mode_read_binary_plus = "r+b";
-static const char *mode_write_binary_plus = "w+b";
-static const char *mode_append_binary_plus = "a+b";
+
const char __gnat_text_translation_required = 1;
void
@@ -261,18 +202,6 @@ __gnat_get_stack_bounds (void **base, void **limit)
#else
-static const char *mode_read_text = "r";
-static const char *mode_write_text = "w";
-static const char *mode_append_text = "a";
-static const char *mode_read_binary = "r";
-static const char *mode_write_binary = "w";
-static const char *mode_append_binary = "a";
-static const char *mode_read_text_plus = "r+";
-static const char *mode_write_text_plus = "w+";
-static const char *mode_append_text_plus = "a+";
-static const char *mode_read_binary_plus = "r+";
-static const char *mode_write_binary_plus = "w+";
-static const char *mode_append_binary_plus = "a+";
const char __gnat_text_translation_required = 0;
/* These functions do nothing in non-DOS systems. */
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index 05d3dbe1b9d..75a910d3301 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -102,12 +102,8 @@ package Types is
-- Graphic characters, as defined in ARM
subtype Line_Terminator is Character range ASCII.LF .. ASCII.CR;
- -- Line terminator characters (LF, VT, FF, CR)
- --
- -- This definition is dubious now that we have two more wide character
- -- sequences that constitute a line terminator. Every reference to this
- -- subtype needs checking to make sure the wide character case is handled
- -- appropriately. ???
+ -- Line terminator characters (LF, VT, FF, CR). For further details,
+ -- see the extensive discussion of line termination in the Sinput spec.
subtype Upper_Half_Character is
Character range Character'Val (16#80#) .. Character'Val (16#FF#);
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index bfda0a73c56..5aecd239c4b 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -6200,6 +6200,14 @@ package VMS_Data is
--
-- Set the maximum line length, nnn from 32 ..256. The default is 79.
+ S_Pretty_Maxact : aliased constant S := "/MAX_ACT=#" &
+ "--call_threshold=#";
+ -- /MAX_ACT=nnn
+ --
+ -- If the number of parameter associations is greater than nnn and if at
+ -- least one association uses named notation, start each association from
+ -- a new line
+
S_Pretty_Maxind : aliased constant S := "/MAX_INDENT=#" &
"-T#";
-- /MAX_INDENT=nnn
@@ -6209,6 +6217,14 @@ package VMS_Data is
-- If nnn is zero, an additional indentation level is used for any
-- number of case alternatives and variants.
+ S_Pretty_Maxpar : aliased constant S := "/MAX_PAR=#" &
+ "--par_threshold=#";
+ -- /MAX_PAR=nnn
+ --
+ -- If the number of parameter specifications is greater than nnn (or equal
+ -- to nnn in case of a function), start each specification from a new line.
+ -- The default value is 3.
+
S_Pretty_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" &
"DEFAULT " &
"-vP0 " &
@@ -6401,7 +6417,9 @@ package VMS_Data is
S_Pretty_Indent 'Access,
S_Pretty_Keyword 'Access,
S_Pretty_Maxlen 'Access,
+ S_Pretty_Maxact 'Access,
S_Pretty_Maxind 'Access,
+ S_Pretty_Maxpar 'Access,
S_Pretty_Mess 'Access,
S_Pretty_Names 'Access,
S_Pretty_No_Labels 'Access,
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 4846d7277f5..e3b0b883ec8 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -20728,39 +20728,34 @@ neon_emit_pair_result_insn (enum machine_mode mode,
emit_move_insn (mem, tmp2);
}
-/* Set up operands for a register copy from src to dest, taking care not to
- clobber registers in the process.
- FIXME: This has rather high polynomial complexity (O(n^3)?) but shouldn't
- be called with a large N, so that should be OK. */
+/* Set up OPERANDS for a register copy from SRC to DEST, taking care
+ not to early-clobber SRC registers in the process.
+ We assume that the operands described by SRC and DEST represent a
+ decomposed copy of OPERANDS[1] into OPERANDS[0]. COUNT is the
+ number of components into which the copy has been decomposed. */
void
neon_disambiguate_copy (rtx *operands, rtx *dest, rtx *src, unsigned int count)
{
- unsigned int copied = 0, opctr = 0;
- unsigned int done = (1 << count) - 1;
- unsigned int i, j;
+ unsigned int i;
- while (copied != done)
+ if (!reg_overlap_mentioned_p (operands[0], operands[1])
+ || REGNO (operands[0]) < REGNO (operands[1]))
{
for (i = 0; i < count; i++)
- {
- int good = 1;
-
- for (j = 0; good && j < count; j++)
- if (i != j && (copied & (1 << j)) == 0
- && reg_overlap_mentioned_p (src[j], dest[i]))
- good = 0;
-
- if (good)
- {
- operands[opctr++] = dest[i];
- operands[opctr++] = src[i];
- copied |= 1 << i;
- }
- }
+ {
+ operands[2 * i] = dest[i];
+ operands[2 * i + 1] = src[i];
+ }
+ }
+ else
+ {
+ for (i = 0; i < count; i++)
+ {
+ operands[2 * i] = dest[count - i - 1];
+ operands[2 * i + 1] = src[count - i - 1];
+ }
}
-
- gcc_assert (opctr == count * 2);
}
/* Expand an expression EXP that calls a built-in function,
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index 63408c033ca..f0b3a628c2c 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -37,6 +37,12 @@ void
avr_register_target_pragmas (void)
{
c_register_addr_space ("__pgm", ADDR_SPACE_PGM);
+ c_register_addr_space ("__pgm1", ADDR_SPACE_PGM1);
+ c_register_addr_space ("__pgm2", ADDR_SPACE_PGM2);
+ c_register_addr_space ("__pgm3", ADDR_SPACE_PGM3);
+ c_register_addr_space ("__pgm4", ADDR_SPACE_PGM4);
+ c_register_addr_space ("__pgm5", ADDR_SPACE_PGM5);
+ c_register_addr_space ("__pgmx", ADDR_SPACE_PGMX);
}
@@ -100,6 +106,9 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
}
+ cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x",
+ avr_current_arch->sfr_offset);
+
/* Define builtin macros so that the user can easily query if or if not
non-generic address spaces (and which) are supported.
This is only supported for C. For C++, a language extension is needed
@@ -109,6 +118,12 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
if (!strcmp (lang_hooks.name, "GNU C"))
{
cpp_define (pfile, "__PGM=__pgm");
+ cpp_define (pfile, "__PGM1=__pgm1");
+ cpp_define (pfile, "__PGM2=__pgm2");
+ cpp_define (pfile, "__PGM3=__pgm3");
+ cpp_define (pfile, "__PGM4=__pgm4");
+ cpp_define (pfile, "__PGM5=__pgm5");
+ cpp_define (pfile, "__PGMX=__pgmx");
}
/* Define builtin macros so that the user can
diff --git a/gcc/config/avr/avr-devices.c b/gcc/config/avr/avr-devices.c
index d0dda8536af..8d6e947f129 100644
--- a/gcc/config/avr/avr-devices.c
+++ b/gcc/config/avr/avr-devices.c
@@ -23,20 +23,30 @@
#include "coretypes.h"
#include "tm.h"
-/* List of all known AVR MCU architectures. */
+/* List of all known AVR MCU architectures.
+ Order as of enum avr_arch from avr.h. */
-const struct base_arch_s avr_arch_types[] = {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, NULL, "avr2" }, /* unknown device specified */
- { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=1", "avr1" },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=2", "avr2" },
- { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=25", "avr25" },
- { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=3", "avr3" },
- { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=31", "avr31" },
- { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=35", "avr35" },
- { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=4", "avr4" },
- { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=5", "avr5" },
- { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, "__AVR_ARCH__=51", "avr51" },
- { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, "__AVR_ARCH__=6", "avr6" }
+const struct base_arch_s
+avr_arch_types[] =
+{
+ /* unknown device specified */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, NULL, "avr2" },
+ /*
+ A M J LM E E E d S S O # F
+ S U M PO L L I a t F ff 6 l
+ M L P MV P P J - - t a R s 4 a
+ XW M M M a r e s
+ X P t t k h */
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=1", "avr1" },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=2", "avr2" },
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=25", "avr25" },
+ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=3", "avr3" },
+ { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0x0060, 32, 2, "__AVR_ARCH__=31", "avr31" },
+ { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=35", "avr35" },
+ { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=4", "avr4" },
+ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0x0060, 32, 1, "__AVR_ARCH__=5", "avr5" },
+ { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, 2, "__AVR_ARCH__=51", "avr51" },
+ { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0x0060, 32, 4, "__AVR_ARCH__=6", "avr6" }
};
const struct mcu_type_s avr_mcu_types[] = {
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 6c017e19b40..22b1548ed66 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -34,6 +34,7 @@ extern int avr_hard_regno_rename_ok (unsigned int, unsigned int);
extern rtx avr_return_addr_rtx (int count, rtx tem);
extern void avr_register_target_pragmas (void);
extern bool avr_accumulate_outgoing_args (void);
+extern void avr_init_expanders (void);
#ifdef TREE_CODE
extern void avr_asm_output_aligned_decl_common (FILE*, const_tree, const char*, unsigned HOST_WIDE_INT, unsigned int, bool);
@@ -50,12 +51,6 @@ extern void init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
#ifdef RTX_CODE
extern const char *output_movqi (rtx insn, rtx operands[], int *l);
extern const char *output_movhi (rtx insn, rtx operands[], int *l);
-extern const char *out_movqi_r_mr (rtx insn, rtx op[], int *l);
-extern const char *out_movqi_mr_r (rtx insn, rtx op[], int *l);
-extern const char *out_movhi_r_mr (rtx insn, rtx op[], int *l);
-extern const char *out_movhi_mr_r (rtx insn, rtx op[], int *l);
-extern const char *out_movsi_r_mr (rtx insn, rtx op[], int *l);
-extern const char *out_movsi_mr_r (rtx insn, rtx op[], int *l);
extern const char *output_movsisf (rtx insn, rtx operands[], int *l);
extern const char *avr_out_tstsi (rtx, rtx*, int*);
extern const char *avr_out_tsthi (rtx, rtx*, int*);
@@ -84,6 +79,7 @@ extern bool avr_rotate_bytes (rtx operands[]);
extern void expand_prologue (void);
extern void expand_epilogue (bool);
+extern bool avr_emit_movmemhi (rtx*);
extern int avr_epilogue_uses (int regno);
extern int avr_starting_frame_offset (void);
@@ -94,6 +90,8 @@ extern const char* avr_out_bitop (rtx, rtx*, int*);
extern const char* avr_out_plus (rtx*, int*, int*);
extern const char* avr_out_plus_noclobber (rtx*, int*, int*);
extern const char* avr_out_addto_sp (rtx*, int*);
+extern const char* avr_out_xload (rtx, rtx*, int*);
+extern const char* avr_out_movmem (rtx, rtx*, int*);
extern bool avr_popcount_each_byte (rtx, int, int);
extern int extra_constraint_Q (rtx x);
@@ -122,7 +120,9 @@ extern bool avr_regno_mode_code_ok_for_base_p (int, enum machine_mode, addr_spac
extern rtx avr_incoming_return_addr_rtx (void);
extern rtx avr_legitimize_reload_address (rtx*, enum machine_mode, int, int, int, int, rtx (*)(rtx,int));
extern bool avr_mem_pgm_p (rtx);
+extern bool avr_mem_pgmx_p (rtx);
extern bool avr_load_libgcc_p (rtx);
+extern bool avr_xload_libgcc_p (enum machine_mode);
#endif /* RTX_CODE */
#ifdef REAL_VALUE_TYPE
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index f33c0c50903..543bb9c56c1 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -55,11 +55,21 @@
/* Return true if STR starts with PREFIX and false, otherwise. */
#define STR_PREFIX_P(STR,PREFIX) (0 == strncmp (STR, PREFIX, strlen (PREFIX)))
-#define AVR_SECTION_PROGMEM (SECTION_MACH_DEP << 0)
+/* The 4 bits starting at SECTION_MACH_DEP are reverved to store
+ 1 + flash segment where progmem data is to be located.
+ For example, data with __pgm2 is stored as (1+2) * SECTION_MACH_DEP. */
+#define AVR_SECTION_PROGMEM (0xf * SECTION_MACH_DEP)
/* Prototypes for local helper functions. */
+static const char* out_movqi_r_mr (rtx, rtx[], int*);
+static const char* out_movhi_r_mr (rtx, rtx[], int*);
+static const char* out_movsi_r_mr (rtx, rtx[], int*);
+static const char* out_movqi_mr_r (rtx, rtx[], int*);
+static const char* out_movhi_mr_r (rtx, rtx[], int*);
+static const char* out_movsi_mr_r (rtx, rtx[], int*);
+
static int avr_naked_function_p (tree);
static int interrupt_function_p (tree);
static int signal_function_p (tree);
@@ -97,6 +107,13 @@ static GTY(()) rtx tmp_reg_rtx;
/* Zeroed register RTX (gen_rtx_REG (QImode, ZERO_REGNO)) */
static GTY(()) rtx zero_reg_rtx;
+/* RAMPZ special function register */
+static GTY(()) rtx rampz_rtx;
+
+/* RTX containing the strings "" and "e", respectively */
+static GTY(()) rtx xstring_empty;
+static GTY(()) rtx xstring_e;
+
/* RTXs for all general purpose registers as QImode */
static GTY(()) rtx all_regs_rtx[32];
@@ -116,7 +133,17 @@ const struct mcu_type_s *avr_current_device;
static GTY(()) section *progmem_swtable_section;
/* Unnamed section associated to __attribute__((progmem)) aka. PROGMEM. */
-static GTY(()) section *progmem_section;
+static GTY(()) section *progmem_section[6];
+
+static const char * const progmem_section_prefix[6] =
+ {
+ ".progmem.data",
+ ".progmem1.data",
+ ".progmem2.data",
+ ".progmem3.data",
+ ".progmem4.data",
+ ".progmem5.data"
+ };
/* To track if code will use .bss and/or .data. */
bool avr_need_clear_bss_p = false;
@@ -317,8 +344,6 @@ avr_popcount_each_byte (rtx xval, int n_bytes, int pop_mask)
static void
avr_option_override (void)
{
- int regno;
-
flag_delete_null_pointer_checks = 0;
/* caller-save.c looks for call-clobbered hard registers that are assigned
@@ -347,15 +372,6 @@ avr_option_override (void)
avr_current_arch = &avr_arch_types[avr_current_device->arch];
avr_extra_arch_macro = avr_current_device->macro;
- for (regno = 0; regno < 32; regno ++)
- all_regs_rtx[regno] = gen_rtx_REG (QImode, regno);
-
- lpm_reg_rtx = all_regs_rtx[LPM_REGNO];
- tmp_reg_rtx = all_regs_rtx[TMP_REGNO];
- zero_reg_rtx = all_regs_rtx[ZERO_REGNO];
-
- lpm_addr_reg_rtx = gen_rtx_REG (HImode, REG_Z);
-
init_machine_status = avr_init_machine_status;
avr_log_set_avr_log();
@@ -369,6 +385,38 @@ avr_init_machine_status (void)
return ggc_alloc_cleared_machine_function ();
}
+
+/* Implement `INIT_EXPANDERS'. */
+/* The function works like a singleton. */
+
+void
+avr_init_expanders (void)
+{
+ int regno;
+
+ static bool done = false;
+
+ if (done)
+ return;
+ else
+ done = true;
+
+ for (regno = 0; regno < 32; regno ++)
+ all_regs_rtx[regno] = gen_rtx_REG (QImode, regno);
+
+ lpm_reg_rtx = all_regs_rtx[LPM_REGNO];
+ tmp_reg_rtx = all_regs_rtx[TMP_REGNO];
+ zero_reg_rtx = all_regs_rtx[ZERO_REGNO];
+
+ lpm_addr_reg_rtx = gen_rtx_REG (HImode, REG_Z);
+
+ rampz_rtx = gen_rtx_MEM (QImode, GEN_INT (RAMPZ_ADDR));
+
+ xstring_empty = gen_rtx_CONST_STRING (VOIDmode, "");
+ xstring_e = gen_rtx_CONST_STRING (VOIDmode, "e");
+}
+
+
/* Return register class for register R. */
enum reg_class
@@ -414,18 +462,60 @@ avr_scalar_mode_supported_p (enum machine_mode mode)
}
+/* Return the segment number of pgm address space AS, i.e.
+ the 64k block it lives in.
+ Return -1 if unknown, i.e. 24-bit AS in flash.
+ Return -2 for anything else. */
+
+static int
+avr_pgm_segment (addr_space_t as)
+{
+ switch (as)
+ {
+ default: return -2;
+
+ case ADDR_SPACE_PGMX: return -1;
+ case ADDR_SPACE_PGM: return 0;
+ case ADDR_SPACE_PGM1: return 1;
+ case ADDR_SPACE_PGM2: return 2;
+ case ADDR_SPACE_PGM3: return 3;
+ case ADDR_SPACE_PGM4: return 4;
+ case ADDR_SPACE_PGM5: return 5;
+ }
+}
+
+
/* Return TRUE if DECL is a VAR_DECL located in Flash and FALSE, otherwise. */
static bool
avr_decl_pgm_p (tree decl)
{
- if (TREE_CODE (decl) != VAR_DECL)
- return false;
+ if (TREE_CODE (decl) != VAR_DECL
+ || TREE_TYPE (decl) == error_mark_node)
+ {
+ return false;
+ }
return !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)));
}
+/* Return TRUE if DECL is a VAR_DECL located in the 24-bit Flash
+ address space and FALSE, otherwise. */
+
+static bool
+avr_decl_pgmx_p (tree decl)
+{
+ if (TREE_CODE (decl) != VAR_DECL
+ || TREE_TYPE (decl) == error_mark_node)
+ {
+ return false;
+ }
+
+ return (ADDR_SPACE_PGMX == TYPE_ADDR_SPACE (TREE_TYPE (decl)));
+}
+
+
/* Return TRUE if X is a MEM rtx located in Flash and FALSE, otherwise. */
bool
@@ -436,6 +526,17 @@ avr_mem_pgm_p (rtx x)
}
+/* Return TRUE if X is a MEM rtx located in the 24-bit Flash
+ address space and FALSE, otherwise. */
+
+bool
+avr_mem_pgmx_p (rtx x)
+{
+ return (MEM_P (x)
+ && ADDR_SPACE_PGMX == MEM_ADDR_SPACE (x));
+}
+
+
/* A helper for the subsequent function attribute used to dig for
attribute 'name' in a FUNCTION_DECL or FUNCTION_TYPE */
@@ -1041,8 +1142,7 @@ expand_prologue (void)
&& TEST_HARD_REG_BIT (set, REG_Z)
&& TEST_HARD_REG_BIT (set, REG_Z + 1))
{
- emit_move_insn (tmp_reg_rtx,
- gen_rtx_MEM (QImode, GEN_INT (RAMPZ_ADDR)));
+ emit_move_insn (tmp_reg_rtx, rampz_rtx);
emit_push_byte (TMP_REGNO, false);
}
@@ -1280,8 +1380,7 @@ expand_epilogue (bool sibcall_p)
&& TEST_HARD_REG_BIT (set, REG_Z + 1))
{
emit_pop_byte (TMP_REGNO);
- emit_move_insn (gen_rtx_MEM (QImode, GEN_INT (RAMPZ_ADDR)),
- tmp_reg_rtx);
+ emit_move_insn (rampz_rtx, tmp_reg_rtx);
}
/* Restore SREG using tmp reg as scratch. */
@@ -1732,7 +1831,7 @@ print_operand (FILE *file, rtx x, int code)
if (code == 'm')
{
if (!CONSTANT_P (addr))
- fatal_insn ("bad address, not a constant):", addr);
+ fatal_insn ("bad address, not a constant:", addr);
/* Assembler template with m-code is data - not progmem section */
if (text_segment_operand (addr, VOIDmode))
if (warning (0, "accessing data memory with"
@@ -1743,6 +1842,24 @@ print_operand (FILE *file, rtx x, int code)
}
output_addr_const (file, addr);
}
+ else if (code == 'i')
+ {
+ if (!io_address_operand (addr, GET_MODE (x)))
+ fatal_insn ("bad address, not an I/O address:", addr);
+
+ switch (INTVAL (addr))
+ {
+ case RAMPZ_ADDR: fprintf (file, "__RAMPZ__"); break;
+ case SREG_ADDR: fprintf (file, "__SREG__"); break;
+ case SP_ADDR: fprintf (file, "__SP_L__"); break;
+ case SP_ADDR+1: fprintf (file, "__SP_H__"); break;
+
+ default:
+ fprintf (file, HOST_WIDE_INT_PRINT_HEX,
+ UINTVAL (addr) - avr_current_arch->sfr_offset);
+ break;
+ }
+ }
else if (code == 'o')
{
if (GET_CODE (addr) != PLUS)
@@ -1795,6 +1912,8 @@ print_operand (FILE *file, rtx x, int code)
REAL_VALUE_TO_TARGET_SINGLE (rv, val);
fprintf (file, "0x%lx", val);
}
+ else if (GET_CODE (x) == CONST_STRING)
+ fputs (XSTR (x, 0), file);
else if (code == 'j')
fputs (cond_string (GET_CODE (x)), file);
else if (code == 'k')
@@ -2247,6 +2366,70 @@ avr_load_libgcc_p (rtx op)
&& avr_mem_pgm_p (op));
}
+/* Return true if a value of mode MODE is read by __xload_* function. */
+
+bool
+avr_xload_libgcc_p (enum machine_mode mode)
+{
+ int n_bytes = GET_MODE_SIZE (mode);
+
+ return (n_bytes > 1
+ && avr_current_arch->n_segments > 1
+ && !AVR_HAVE_ELPMX);
+}
+
+
+/* Find an unused d-register to be used as scratch in INSN.
+ EXCLUDE is either NULL_RTX or some register. In the case where EXCLUDE
+ is a register, skip all possible return values that overlap EXCLUDE.
+ The policy for the returned register is similar to that of
+ `reg_unused_after', i.e. the returned register may overlap the SET_DEST
+ of INSN.
+
+ Return a QImode d-register or NULL_RTX if nothing found. */
+
+static rtx
+avr_find_unused_d_reg (rtx insn, rtx exclude)
+{
+ int regno;
+ bool isr_p = (interrupt_function_p (current_function_decl)
+ || signal_function_p (current_function_decl));
+
+ for (regno = 16; regno < 32; regno++)
+ {
+ rtx reg = all_regs_rtx[regno];
+
+ if ((exclude
+ && reg_overlap_mentioned_p (exclude, reg))
+ || fixed_regs[regno])
+ {
+ continue;
+ }
+
+ /* Try non-live register */
+
+ if (!df_regs_ever_live_p (regno)
+ && (TREE_THIS_VOLATILE (current_function_decl)
+ || cfun->machine->is_OS_task
+ || cfun->machine->is_OS_main
+ || (!isr_p && call_used_regs[regno])))
+ {
+ return reg;
+ }
+
+ /* Any live register can be used if it is unused after.
+ Prologue/epilogue will care for it as needed. */
+
+ if (df_regs_ever_live_p (regno)
+ && reg_unused_after (insn, reg))
+ {
+ return reg;
+ }
+ }
+
+ return NULL_RTX;
+}
+
/* Helper function for the next function in the case where only restricted
version of LPM instruction is available. */
@@ -2279,28 +2462,30 @@ avr_out_lpm_no_lpmx (rtx insn, rtx *xop, int *plen)
gcc_unreachable();
case 1:
- return avr_asm_len ("lpm" CR_TAB
- "mov %0,%3", xop, plen, 2);
+ avr_asm_len ("%4lpm", xop, plen, 1);
+
+ if (regno_dest != LPM_REGNO)
+ avr_asm_len ("mov %0,%3", xop, plen, 1);
+
+ return "";
case 2:
if (REGNO (dest) == REG_Z)
- return avr_asm_len ("lpm" CR_TAB
+ return avr_asm_len ("%4lpm" CR_TAB
"push %3" CR_TAB
"adiw %2,1" CR_TAB
- "lpm" CR_TAB
+ "%4lpm" CR_TAB
"mov %B0,%3" CR_TAB
"pop %A0", xop, plen, 6);
- else
- {
- avr_asm_len ("lpm" CR_TAB
- "mov %A0,%3" CR_TAB
- "adiw %2,1" CR_TAB
- "lpm" CR_TAB
- "mov %B0,%3", xop, plen, 5);
+
+ avr_asm_len ("%4lpm" CR_TAB
+ "mov %A0,%3" CR_TAB
+ "adiw %2,1" CR_TAB
+ "%4lpm" CR_TAB
+ "mov %B0,%3", xop, plen, 5);
- if (!reg_unused_after (insn, addr))
- avr_asm_len ("sbiw %2,1", xop, plen, 1);
- }
+ if (!reg_unused_after (insn, addr))
+ avr_asm_len ("sbiw %2,1", xop, plen, 1);
break; /* 2 */
}
@@ -2310,17 +2495,31 @@ avr_out_lpm_no_lpmx (rtx insn, rtx *xop, int *plen)
case POST_INC:
gcc_assert (REG_Z == REGNO (XEXP (addr, 0))
- && n_bytes <= 2);
+ && n_bytes <= 4);
- avr_asm_len ("lpm" CR_TAB
- "mov %A0,%3" CR_TAB
- "adiw %2,1", xop, plen, 3);
+ if (regno_dest == LPM_REGNO)
+ avr_asm_len ("%4lpm" CR_TAB
+ "adiw %2,1", xop, plen, 2);
+ else
+ avr_asm_len ("%4lpm" CR_TAB
+ "mov %A0,%3" CR_TAB
+ "adiw %2,1", xop, plen, 3);
if (n_bytes >= 2)
- avr_asm_len ("lpm" CR_TAB
+ avr_asm_len ("%4lpm" CR_TAB
"mov %B0,%3" CR_TAB
"adiw %2,1", xop, plen, 3);
+ if (n_bytes >= 3)
+ avr_asm_len ("%4lpm" CR_TAB
+ "mov %C0,%3" CR_TAB
+ "adiw %2,1", xop, plen, 3);
+
+ if (n_bytes >= 4)
+ avr_asm_len ("%4lpm" CR_TAB
+ "mov %D0,%3" CR_TAB
+ "adiw %2,1", xop, plen, 3);
+
break; /* POST_INC */
} /* switch CODE (addr) */
@@ -2337,12 +2536,13 @@ avr_out_lpm_no_lpmx (rtx insn, rtx *xop, int *plen)
static const char*
avr_out_lpm (rtx insn, rtx *op, int *plen)
{
- rtx xop[5];
+ rtx xop[6];
rtx dest = op[0];
rtx src = SET_SRC (single_set (insn));
rtx addr;
int n_bytes = GET_MODE_SIZE (GET_MODE (dest));
int regno_dest;
+ int segment;
if (plen)
*plen = 0;
@@ -2357,17 +2557,66 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
addr = XEXP (src, 0);
- gcc_assert (!avr_load_libgcc_p (src)
- && REG_P (dest)
- && (REG_P (addr) || POST_INC == GET_CODE (addr)));
+ segment = avr_pgm_segment (MEM_ADDR_SPACE (src));
+
+ gcc_assert (REG_P (dest)
+ && ((segment >= 0
+ && (REG_P (addr) || POST_INC == GET_CODE (addr)))
+ || (GET_CODE (addr) == LO_SUM && segment == -1)));
+
+ if (segment == -1)
+ {
+ /* We are called from avr_out_xload because someone wrote
+ __pgmx on a device with just one flash segment. */
+
+ addr = XEXP (addr, 1);
+ }
xop[0] = dest;
xop[1] = addr;
xop[2] = lpm_addr_reg_rtx;
+ xop[4] = xstring_empty;
+ xop[5] = tmp_reg_rtx;
regno_dest = REGNO (dest);
- if (!AVR_HAVE_LPMX)
+ /* Cut down segment number to a number the device actually
+ supports. We do this late to preserve the address space's
+ name for diagnostics. */
+
+ segment %= avr_current_arch->n_segments;
+
+ /* Set RAMPZ as needed. */
+
+ if (segment)
+ {
+ xop[4] = GEN_INT (segment);
+
+ if (xop[3] = avr_find_unused_d_reg (insn, lpm_addr_reg_rtx),
+ xop[3])
+ {
+ avr_asm_len ("ldi %3,%4" CR_TAB
+ "out __RAMPZ__,%3", xop, plen, 2);
+ }
+ else if (segment == 1)
+ {
+ avr_asm_len ("clr %5" CR_TAB
+ "inc %5" CR_TAB
+ "out __RAMPZ__,%5", xop, plen, 3);
+ }
+ else
+ {
+ avr_asm_len ("mov %5,%2" CR_TAB
+ "ldi %2,%4" CR_TAB
+ "out __RAMPZ__,%2" CR_TAB
+ "mov %2,%5", xop, plen, 4);
+ }
+
+ xop[4] = xstring_e;
+ }
+
+ if ((segment == 0 && !AVR_HAVE_LPMX)
+ || (segment != 0 && !AVR_HAVE_ELPMX))
{
return avr_out_lpm_no_lpmx (insn, xop, plen);
}
@@ -2387,17 +2636,17 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
gcc_unreachable();
case 1:
- return avr_asm_len ("lpm %0,%a2", xop, plen, -1);
+ return avr_asm_len ("%4lpm %0,%a2", xop, plen, 1);
case 2:
if (REGNO (dest) == REG_Z)
- return avr_asm_len ("lpm __tmp_reg__,%a2+" CR_TAB
- "lpm %B0,%a2" CR_TAB
- "mov %A0,__tmp_reg__", xop, plen, -3);
+ return avr_asm_len ("%4lpm %5,%a2+" CR_TAB
+ "%4lpm %B0,%a2" CR_TAB
+ "mov %A0,%5", xop, plen, 3);
else
{
- avr_asm_len ("lpm %A0,%a2+" CR_TAB
- "lpm %B0,%a2", xop, plen, -2);
+ avr_asm_len ("%4lpm %A0,%a2+" CR_TAB
+ "%4lpm %B0,%a2", xop, plen, 2);
if (!reg_unused_after (insn, addr))
avr_asm_len ("sbiw %2,1", xop, plen, 1);
@@ -2407,9 +2656,9 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
case 3:
- avr_asm_len ("lpm %A0,%a2+" CR_TAB
- "lpm %B0,%a2+" CR_TAB
- "lpm %C0,%a2", xop, plen, -3);
+ avr_asm_len ("%4lpm %A0,%a2+" CR_TAB
+ "%4lpm %B0,%a2+" CR_TAB
+ "%4lpm %C0,%a2", xop, plen, 3);
if (!reg_unused_after (insn, addr))
avr_asm_len ("sbiw %2,2", xop, plen, 1);
@@ -2418,17 +2667,17 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
case 4:
- avr_asm_len ("lpm %A0,%a2+" CR_TAB
- "lpm %B0,%a2+", xop, plen, -2);
+ avr_asm_len ("%4lpm %A0,%a2+" CR_TAB
+ "%4lpm %B0,%a2+", xop, plen, 2);
if (REGNO (dest) == REG_Z - 2)
- return avr_asm_len ("lpm __tmp_reg__,%a2+" CR_TAB
- "lpm %C0,%a2" CR_TAB
- "mov %D0,__tmp_reg__", xop, plen, 3);
+ return avr_asm_len ("%4lpm %5,%a2+" CR_TAB
+ "%4lpm %C0,%a2" CR_TAB
+ "mov %D0,%5", xop, plen, 3);
else
{
- avr_asm_len ("lpm %C0,%a2+" CR_TAB
- "lpm %D0,%a2", xop, plen, 2);
+ avr_asm_len ("%4lpm %C0,%a2+" CR_TAB
+ "%4lpm %D0,%a2", xop, plen, 2);
if (!reg_unused_after (insn, addr))
avr_asm_len ("sbiw %2,3", xop, plen, 1);
@@ -2444,10 +2693,10 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
gcc_assert (REG_Z == REGNO (XEXP (addr, 0))
&& n_bytes <= 4);
- avr_asm_len ("lpm %A0,%a2+", xop, plen, -1);
- if (n_bytes >= 2) avr_asm_len ("lpm %B0,%a2+", xop, plen, 1);
- if (n_bytes >= 3) avr_asm_len ("lpm %C0,%a2+", xop, plen, 1);
- if (n_bytes >= 4) avr_asm_len ("lpm %D0,%a2+", xop, plen, 1);
+ avr_asm_len ("%4lpm %A0,%a2+", xop, plen, 1);
+ if (n_bytes >= 2) avr_asm_len ("%4lpm %B0,%a2+", xop, plen, 1);
+ if (n_bytes >= 3) avr_asm_len ("%4lpm %C0,%a2+", xop, plen, 1);
+ if (n_bytes >= 4) avr_asm_len ("%4lpm %D0,%a2+", xop, plen, 1);
break; /* POST_INC */
@@ -2457,6 +2706,81 @@ avr_out_lpm (rtx insn, rtx *op, int *plen)
}
+/* Worker function for xload_<mode> and xload_8 insns. */
+
+const char*
+avr_out_xload (rtx insn, rtx *op, int *plen)
+{
+ rtx xop[5];
+ rtx reg = op[0];
+ int n_bytes = GET_MODE_SIZE (GET_MODE (reg));
+ unsigned int regno = REGNO (reg);
+
+ if (avr_current_arch->n_segments == 1)
+ return avr_out_lpm (insn, op, plen);
+
+ xop[0] = reg;
+ xop[1] = op[1];
+ xop[2] = lpm_addr_reg_rtx;
+ xop[3] = lpm_reg_rtx;
+ xop[4] = tmp_reg_rtx;
+
+ avr_asm_len ("out __RAMPZ__,%1", xop, plen, -1);
+
+ if (1 == n_bytes)
+ {
+ if (AVR_HAVE_ELPMX)
+ return avr_asm_len ("elpm %0,%a2", xop, plen, 1);
+ else
+ return avr_asm_len ("elpm" CR_TAB
+ "mov %0,%3", xop, plen, 2);
+ }
+
+ gcc_assert (AVR_HAVE_ELPMX);
+
+ if (!reg_overlap_mentioned_p (reg, lpm_addr_reg_rtx))
+ {
+ /* Insn clobbers the Z-register so we can use post-increment. */
+
+ avr_asm_len ("elpm %A0,%a2+", xop, plen, 1);
+ if (n_bytes >= 2) avr_asm_len ("elpm %B0,%a2+", xop, plen, 1);
+ if (n_bytes >= 3) avr_asm_len ("elpm %C0,%a2+", xop, plen, 1);
+ if (n_bytes >= 4) avr_asm_len ("elpm %D0,%a2+", xop, plen, 1);
+
+ return "";
+ }
+
+ switch (n_bytes)
+ {
+ default:
+ gcc_unreachable();
+
+ case 2:
+ gcc_assert (regno == REGNO (lpm_addr_reg_rtx));
+
+ return avr_asm_len ("elpm %4,%a2+" CR_TAB
+ "elpm %B0,%a2" CR_TAB
+ "mov %A0,%4", xop, plen, 3);
+
+ case 3:
+ case 4:
+ gcc_assert (regno + 2 == REGNO (lpm_addr_reg_rtx));
+
+ avr_asm_len ("elpm %A0,%a2+" CR_TAB
+ "elpm %B0,%a2+", xop, plen, 2);
+
+ if (n_bytes == 3)
+ return avr_asm_len ("elpm %C0,%a2", xop, plen, 1);
+ else
+ return avr_asm_len ("elpm %4,%a2+" CR_TAB
+ "elpm %D0,%a2" CR_TAB
+ "mov %C0,%4", xop, plen, 3);
+ }
+
+ return "";
+}
+
+
const char *
output_movqi (rtx insn, rtx operands[], int *l)
{
@@ -2497,17 +2821,12 @@ output_movqi (rtx insn, rtx operands[], int *l)
}
else if (GET_CODE (dest) == MEM)
{
- const char *templ;
-
- if (src == const0_rtx)
- operands[1] = zero_reg_rtx;
+ rtx xop[2];
- templ = out_movqi_mr_r (insn, operands, real_l);
-
- if (!real_l)
- output_asm_insn (templ, operands);
+ xop[0] = dest;
+ xop[1] = src == const0_rtx ? zero_reg_rtx : src;
- operands[1] = src;
+ return out_movqi_mr_r (insn, xop, real_l);
}
return "";
}
@@ -2578,93 +2897,79 @@ output_movhi (rtx insn, rtx operands[], int *l)
}
else if (GET_CODE (dest) == MEM)
{
- const char *templ;
-
- if (src == const0_rtx)
- operands[1] = zero_reg_rtx;
+ rtx xop[2];
- templ = out_movhi_mr_r (insn, operands, real_l);
-
- if (!real_l)
- output_asm_insn (templ, operands);
+ xop[0] = dest;
+ xop[1] = src == const0_rtx ? zero_reg_rtx : src;
- operands[1] = src;
- return "";
+ return out_movhi_mr_r (insn, xop, real_l);
}
fatal_insn ("invalid insn:", insn);
return "";
}
-const char *
-out_movqi_r_mr (rtx insn, rtx op[], int *l)
+static const char*
+out_movqi_r_mr (rtx insn, rtx op[], int *plen)
{
rtx dest = op[0];
rtx src = op[1];
rtx x = XEXP (src, 0);
- int dummy;
-
- if (!l)
- l = &dummy;
if (CONSTANT_ADDRESS_P (x))
{
- if (CONST_INT_P (x) && INTVAL (x) == SREG_ADDR)
- {
- *l = 1;
- return AS2 (in,%0,__SREG__);
- }
- if (optimize > 0 && io_address_operand (x, QImode))
- {
- *l = 1;
- return AS2 (in,%0,%m1-0x20);
- }
- *l = 2;
- return AS2 (lds,%0,%m1);
+ return optimize > 0 && io_address_operand (x, QImode)
+ ? avr_asm_len ("in %0,%i1", op, plen, -1)
+ : avr_asm_len ("lds %0,%m1", op, plen, -2);
}
- /* memory access by reg+disp */
else if (GET_CODE (x) == PLUS
- && REG_P (XEXP (x,0))
- && GET_CODE (XEXP (x,1)) == CONST_INT)
+ && REG_P (XEXP (x, 0))
+ && CONST_INT_P (XEXP (x, 1)))
{
- if ((INTVAL (XEXP (x,1)) - GET_MODE_SIZE (GET_MODE (src))) >= 63)
- {
- int disp = INTVAL (XEXP (x,1));
- if (REGNO (XEXP (x,0)) != REG_Y)
- fatal_insn ("incorrect insn:",insn);
+ /* memory access by reg+disp */
- if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
- return *l = 3, (AS2 (adiw,r28,%o1-63) CR_TAB
- AS2 (ldd,%0,Y+63) CR_TAB
- AS2 (sbiw,r28,%o1-63));
+ int disp = INTVAL (XEXP (x, 1));
+
+ if (disp - GET_MODE_SIZE (GET_MODE (src)) >= 63)
+ {
+ if (REGNO (XEXP (x, 0)) != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
- return *l = 5, (AS2 (subi,r28,lo8(-%o1)) CR_TAB
- AS2 (sbci,r29,hi8(-%o1)) CR_TAB
- AS2 (ld,%0,Y) CR_TAB
- AS2 (subi,r28,lo8(%o1)) CR_TAB
- AS2 (sbci,r29,hi8(%o1)));
- }
- else if (REGNO (XEXP (x,0)) == REG_X)
- {
- /* This is a paranoid case LEGITIMIZE_RELOAD_ADDRESS must exclude
- it but I have this situation with extremal optimizing options. */
- if (reg_overlap_mentioned_p (dest, XEXP (x,0))
- || reg_unused_after (insn, XEXP (x,0)))
- return *l = 2, (AS2 (adiw,r26,%o1) CR_TAB
- AS2 (ld,%0,X));
-
- return *l = 3, (AS2 (adiw,r26,%o1) CR_TAB
- AS2 (ld,%0,X) CR_TAB
- AS2 (sbiw,r26,%o1));
- }
- *l = 1;
- return AS2 (ldd,%0,%1);
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
+ return avr_asm_len ("adiw r28,%o1-63" CR_TAB
+ "ldd %0,Y+63" CR_TAB
+ "sbiw r28,%o1-63", op, plen, -3);
+
+ return avr_asm_len ("subi r28,lo8(-%o1)" CR_TAB
+ "sbci r29,hi8(-%o1)" CR_TAB
+ "ld %0,Y" CR_TAB
+ "subi r28,lo8(%o1)" CR_TAB
+ "sbci r29,hi8(%o1)", op, plen, -5);
+ }
+ else if (REGNO (XEXP (x, 0)) == REG_X)
+ {
+ /* This is a paranoid case LEGITIMIZE_RELOAD_ADDRESS must exclude
+ it but I have this situation with extremal optimizing options. */
+
+ avr_asm_len ("adiw r26,%o1" CR_TAB
+ "ld %0,X", op, plen, -2);
+
+ if (!reg_overlap_mentioned_p (dest, XEXP (x,0))
+ && !reg_unused_after (insn, XEXP (x,0)))
+ {
+ avr_asm_len ("sbiw r26,%o1", op, plen, 1);
+ }
+
+ return "";
+ }
+
+ return avr_asm_len ("ldd %0,%1", op, plen, -1);
}
- *l = 1;
- return AS2 (ld,%0,%1);
+
+ return avr_asm_len ("ld %0,%1", op, plen, -1);
}
-const char *
-out_movhi_r_mr (rtx insn, rtx op[], int *l)
+static const char*
+out_movhi_r_mr (rtx insn, rtx op[], int *plen)
{
rtx dest = op[0];
rtx src = op[1];
@@ -2674,39 +2979,25 @@ out_movhi_r_mr (rtx insn, rtx op[], int *l)
/* "volatile" forces reading low byte first, even if less efficient,
for correct operation with 16-bit I/O registers. */
int mem_volatile_p = MEM_VOLATILE_P (src);
- int tmp;
-
- if (!l)
- l = &tmp;
if (reg_base > 0)
{
if (reg_dest == reg_base) /* R = (R) */
- {
- *l = 3;
- return (AS2 (ld,__tmp_reg__,%1+) CR_TAB
- AS2 (ld,%B0,%1) CR_TAB
- AS2 (mov,%A0,__tmp_reg__));
- }
- else if (reg_base == REG_X) /* (R26) */
- {
- if (reg_unused_after (insn, base))
- {
- *l = 2;
- return (AS2 (ld,%A0,X+) CR_TAB
- AS2 (ld,%B0,X));
- }
- *l = 3;
- return (AS2 (ld,%A0,X+) CR_TAB
- AS2 (ld,%B0,X) CR_TAB
- AS2 (sbiw,r26,1));
- }
- else /* (R) */
- {
- *l = 2;
- return (AS2 (ld,%A0,%1) CR_TAB
- AS2 (ldd,%B0,%1+1));
- }
+ return avr_asm_len ("ld __tmp_reg__,%1+" CR_TAB
+ "ld %B0,%1" CR_TAB
+ "mov %A0,__tmp_reg__", op, plen, -3);
+
+ if (reg_base != REG_X)
+ return avr_asm_len ("ld %A0,%1" CR_TAB
+ "ldd %B0,%1+1", op, plen, -2);
+
+ avr_asm_len ("ld %A0,X+" CR_TAB
+ "ld %B0,X", op, plen, -2);
+
+ if (!reg_unused_after (insn, base))
+ avr_asm_len ("sbiw r26,1", op, plen, 1);
+
+ return "";
}
else if (GET_CODE (base) == PLUS) /* (R + i) */
{
@@ -2714,109 +3005,90 @@ out_movhi_r_mr (rtx insn, rtx op[], int *l)
int reg_base = true_regnum (XEXP (base, 0));
if (disp > MAX_LD_OFFSET (GET_MODE (src)))
- {
- if (REGNO (XEXP (base, 0)) != REG_Y)
- fatal_insn ("incorrect insn:",insn);
-
- if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
- return *l = 4, (AS2 (adiw,r28,%o1-62) CR_TAB
- AS2 (ldd,%A0,Y+62) CR_TAB
- AS2 (ldd,%B0,Y+63) CR_TAB
- AS2 (sbiw,r28,%o1-62));
+ {
+ if (REGNO (XEXP (base, 0)) != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
+
+ return disp <= 63 + MAX_LD_OFFSET (GET_MODE (src))
+ ? avr_asm_len ("adiw r28,%o1-62" CR_TAB
+ "ldd %A0,Y+62" CR_TAB
+ "ldd %B0,Y+63" CR_TAB
+ "sbiw r28,%o1-62", op, plen, -4)
+
+ : avr_asm_len ("subi r28,lo8(-%o1)" CR_TAB
+ "sbci r29,hi8(-%o1)" CR_TAB
+ "ld %A0,Y" CR_TAB
+ "ldd %B0,Y+1" CR_TAB
+ "subi r28,lo8(%o1)" CR_TAB
+ "sbci r29,hi8(%o1)", op, plen, -6);
+ }
+
+ /* This is a paranoid case. LEGITIMIZE_RELOAD_ADDRESS must exclude
+ it but I have this situation with extremal
+ optimization options. */
- return *l = 6, (AS2 (subi,r28,lo8(-%o1)) CR_TAB
- AS2 (sbci,r29,hi8(-%o1)) CR_TAB
- AS2 (ld,%A0,Y) CR_TAB
- AS2 (ldd,%B0,Y+1) CR_TAB
- AS2 (subi,r28,lo8(%o1)) CR_TAB
- AS2 (sbci,r29,hi8(%o1)));
- }
if (reg_base == REG_X)
- {
- /* This is a paranoid case. LEGITIMIZE_RELOAD_ADDRESS must exclude
- it but I have this situation with extremal
- optimization options. */
-
- *l = 4;
- if (reg_base == reg_dest)
- return (AS2 (adiw,r26,%o1) CR_TAB
- AS2 (ld,__tmp_reg__,X+) CR_TAB
- AS2 (ld,%B0,X) CR_TAB
- AS2 (mov,%A0,__tmp_reg__));
+ return reg_base == reg_dest
+ ? avr_asm_len ("adiw r26,%o1" CR_TAB
+ "ld __tmp_reg__,X+" CR_TAB
+ "ld %B0,X" CR_TAB
+ "mov %A0,__tmp_reg__", op, plen, -4)
- return (AS2 (adiw,r26,%o1) CR_TAB
- AS2 (ld,%A0,X+) CR_TAB
- AS2 (ld,%B0,X) CR_TAB
- AS2 (sbiw,r26,%o1+1));
- }
+ : avr_asm_len ("adiw r26,%o1" CR_TAB
+ "ld %A0,X+" CR_TAB
+ "ld %B0,X" CR_TAB
+ "sbiw r26,%o1+1", op, plen, -4);
- if (reg_base == reg_dest)
- {
- *l = 3;
- return (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
- AS2 (ldd,%B0,%B1) CR_TAB
- AS2 (mov,%A0,__tmp_reg__));
- }
-
- *l = 2;
- return (AS2 (ldd,%A0,%A1) CR_TAB
- AS2 (ldd,%B0,%B1));
+ return reg_base == reg_dest
+ ? avr_asm_len ("ldd __tmp_reg__,%A1" CR_TAB
+ "ldd %B0,%B1" CR_TAB
+ "mov %A0,__tmp_reg__", op, plen, -3)
+
+ : avr_asm_len ("ldd %A0,%A1" CR_TAB
+ "ldd %B0,%B1", op, plen, -2);
}
else if (GET_CODE (base) == PRE_DEC) /* (--R) */
{
if (reg_overlap_mentioned_p (dest, XEXP (base, 0)))
- fatal_insn ("incorrect insn:", insn);
+ fatal_insn ("incorrect insn:", insn);
- if (mem_volatile_p)
- {
- if (REGNO (XEXP (base, 0)) == REG_X)
- {
- *l = 4;
- return (AS2 (sbiw,r26,2) CR_TAB
- AS2 (ld,%A0,X+) CR_TAB
- AS2 (ld,%B0,X) CR_TAB
- AS2 (sbiw,r26,1));
- }
- else
- {
- *l = 3;
- return (AS2 (sbiw,%r1,2) CR_TAB
- AS2 (ld,%A0,%p1) CR_TAB
- AS2 (ldd,%B0,%p1+1));
- }
- }
-
- *l = 2;
- return (AS2 (ld,%B0,%1) CR_TAB
- AS2 (ld,%A0,%1));
+ if (!mem_volatile_p)
+ return avr_asm_len ("ld %B0,%1" CR_TAB
+ "ld %A0,%1", op, plen, -2);
+
+ return REGNO (XEXP (base, 0)) == REG_X
+ ? avr_asm_len ("sbiw r26,2" CR_TAB
+ "ld %A0,X+" CR_TAB
+ "ld %B0,X" CR_TAB
+ "sbiw r26,1", op, plen, -4)
+
+ : avr_asm_len ("sbiw %r1,2" CR_TAB
+ "ld %A0,%p1" CR_TAB
+ "ldd %B0,%p1+1", op, plen, -3);
}
else if (GET_CODE (base) == POST_INC) /* (R++) */
{
if (reg_overlap_mentioned_p (dest, XEXP (base, 0)))
- fatal_insn ("incorrect insn:", insn);
+ fatal_insn ("incorrect insn:", insn);
- *l = 2;
- return (AS2 (ld,%A0,%1) CR_TAB
- AS2 (ld,%B0,%1));
+ return avr_asm_len ("ld %A0,%1" CR_TAB
+ "ld %B0,%1", op, plen, -2);
}
else if (CONSTANT_ADDRESS_P (base))
{
- if (optimize > 0 && io_address_operand (base, HImode))
- {
- *l = 2;
- return (AS2 (in,%A0,%m1-0x20) CR_TAB
- AS2 (in,%B0,%m1+1-0x20));
- }
- *l = 4;
- return (AS2 (lds,%A0,%m1) CR_TAB
- AS2 (lds,%B0,%m1+1));
+ return optimize > 0 && io_address_operand (base, HImode)
+ ? avr_asm_len ("in %A0,%i1" CR_TAB
+ "in %B0,%i1+1", op, plen, -2)
+
+ : avr_asm_len ("lds %A0,%m1" CR_TAB
+ "lds %B0,%m1+1", op, plen, -4);
}
fatal_insn ("unknown move insn:",insn);
return "";
}
-const char *
+static const char*
out_movsi_r_mr (rtx insn, rtx op[], int *l)
{
rtx dest = op[0];
@@ -2977,7 +3249,7 @@ out_movsi_r_mr (rtx insn, rtx op[], int *l)
return "";
}
-const char *
+static const char*
out_movsi_mr_r (rtx insn, rtx op[], int *l)
{
rtx dest = op[0];
@@ -3182,34 +3454,10 @@ output_movsisf (rtx insn, rtx operands[], int *l)
AS2 (mov,%D0,%D1));
}
}
- else if (CONST_INT_P (src)
- || CONST_DOUBLE_P (src))
- {
- return output_reload_insisf (operands, NULL_RTX, real_l);
- }
else if (CONSTANT_P (src))
{
- if (test_hard_reg_class (LD_REGS, dest)) /* ldi d,i */
- {
- *l = 4;
- return (AS2 (ldi,%A0,lo8(%1)) CR_TAB
- AS2 (ldi,%B0,hi8(%1)) CR_TAB
- AS2 (ldi,%C0,hlo8(%1)) CR_TAB
- AS2 (ldi,%D0,hhi8(%1)));
- }
- /* Last resort, better than loading from memory. */
- *l = 10;
- return (AS2 (mov,__tmp_reg__,r31) CR_TAB
- AS2 (ldi,r31,lo8(%1)) CR_TAB
- AS2 (mov,%A0,r31) CR_TAB
- AS2 (ldi,r31,hi8(%1)) CR_TAB
- AS2 (mov,%B0,r31) CR_TAB
- AS2 (ldi,r31,hlo8(%1)) CR_TAB
- AS2 (mov,%C0,r31) CR_TAB
- AS2 (ldi,r31,hhi8(%1)) CR_TAB
- AS2 (mov,%D0,r31) CR_TAB
- AS2 (mov,r31,__tmp_reg__));
- }
+ return output_reload_insisf (operands, NULL_RTX, real_l);
+ }
else if (GET_CODE (src) == MEM)
return out_movsi_r_mr (insn, operands, real_l); /* mov r,m */
}
@@ -3496,41 +3744,21 @@ avr_out_movpsi (rtx insn, rtx *op, int *plen)
return avr_asm_len ("mov %C0,%C1", op, plen, 1);
}
}
- else if (CONST_INT_P (src))
- {
- return avr_out_reload_inpsi (op, NULL_RTX, plen);
- }
else if (CONSTANT_P (src))
{
- if (test_hard_reg_class (LD_REGS, dest)) /* ldi d,i */
- {
- return avr_asm_len ("ldi %A0,lo8(%1)" CR_TAB
- "ldi %B0,hi8(%1)" CR_TAB
- "ldi %C0,hh8(%1)", op, plen, -3);
- }
-
- /* Last resort, better than loading from memory. */
- return avr_asm_len ("mov __tmp_reg__,r31" CR_TAB
- "ldi r31,lo8(%1)" CR_TAB
- "mov %A0,r31" CR_TAB
- "ldi r31,hi8(%1)" CR_TAB
- "mov %B0,r31" CR_TAB
- "ldi r31,hh8(%1)" CR_TAB
- "mov %C0,r31" CR_TAB
- "mov r31,__tmp_reg__", op, plen, -8);
+ return avr_out_reload_inpsi (op, NULL_RTX, plen);
}
else if (MEM_P (src))
return avr_out_load_psi (insn, op, plen); /* mov r,m */
}
else if (MEM_P (dest))
{
- if (src == CONST0_RTX (GET_MODE (dest)))
- op[1] = zero_reg_rtx;
-
- avr_out_store_psi (insn, op, plen);
+ rtx xop[2];
+
+ xop[0] = dest;
+ xop[1] = src == CONST0_RTX (GET_MODE (dest)) ? zero_reg_rtx : src;
- op[1] = src;
- return "";
+ return avr_out_store_psi (insn, xop, plen);
}
fatal_insn ("invalid insn:", insn);
@@ -3538,88 +3766,71 @@ avr_out_movpsi (rtx insn, rtx *op, int *plen)
}
-const char *
-out_movqi_mr_r (rtx insn, rtx op[], int *l)
+static const char*
+out_movqi_mr_r (rtx insn, rtx op[], int *plen)
{
rtx dest = op[0];
rtx src = op[1];
rtx x = XEXP (dest, 0);
- int dummy;
-
- if (!l)
- l = &dummy;
if (CONSTANT_ADDRESS_P (x))
{
- if (CONST_INT_P (x) && INTVAL (x) == SREG_ADDR)
- {
- *l = 1;
- return AS2 (out,__SREG__,%1);
- }
- if (optimize > 0 && io_address_operand (x, QImode))
- {
- *l = 1;
- return AS2 (out,%m0-0x20,%1);
- }
- *l = 2;
- return AS2 (sts,%m0,%1);
+ return optimize > 0 && io_address_operand (x, QImode)
+ ? avr_asm_len ("out %i0,%1", op, plen, -1)
+ : avr_asm_len ("sts %m0,%1", op, plen, -2);
}
- /* memory access by reg+disp */
- else if (GET_CODE (x) == PLUS
- && REG_P (XEXP (x,0))
- && GET_CODE (XEXP (x,1)) == CONST_INT)
+ else if (GET_CODE (x) == PLUS
+ && REG_P (XEXP (x, 0))
+ && CONST_INT_P (XEXP (x, 1)))
{
- if ((INTVAL (XEXP (x,1)) - GET_MODE_SIZE (GET_MODE (dest))) >= 63)
- {
- int disp = INTVAL (XEXP (x,1));
- if (REGNO (XEXP (x,0)) != REG_Y)
- fatal_insn ("incorrect insn:",insn);
+ /* memory access by reg+disp */
- if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
- return *l = 3, (AS2 (adiw,r28,%o0-63) CR_TAB
- AS2 (std,Y+63,%1) CR_TAB
- AS2 (sbiw,r28,%o0-63));
+ int disp = INTVAL (XEXP (x, 1));
- return *l = 5, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
- AS2 (sbci,r29,hi8(-%o0)) CR_TAB
- AS2 (st,Y,%1) CR_TAB
- AS2 (subi,r28,lo8(%o0)) CR_TAB
- AS2 (sbci,r29,hi8(%o0)));
- }
+ if (disp - GET_MODE_SIZE (GET_MODE (dest)) >= 63)
+ {
+ if (REGNO (XEXP (x, 0)) != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
+
+ if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+ return avr_asm_len ("adiw r28,%o0-63" CR_TAB
+ "std Y+63,%1" CR_TAB
+ "sbiw r28,%o0-63", op, plen, -3);
+
+ return avr_asm_len ("subi r28,lo8(-%o0)" CR_TAB
+ "sbci r29,hi8(-%o0)" CR_TAB
+ "st Y,%1" CR_TAB
+ "subi r28,lo8(%o0)" CR_TAB
+ "sbci r29,hi8(%o0)", op, plen, -5);
+ }
else if (REGNO (XEXP (x,0)) == REG_X)
- {
- if (reg_overlap_mentioned_p (src, XEXP (x, 0)))
- {
- if (reg_unused_after (insn, XEXP (x,0)))
- return *l = 3, (AS2 (mov,__tmp_reg__,%1) CR_TAB
- AS2 (adiw,r26,%o0) CR_TAB
- AS2 (st,X,__tmp_reg__));
-
- return *l = 4, (AS2 (mov,__tmp_reg__,%1) CR_TAB
- AS2 (adiw,r26,%o0) CR_TAB
- AS2 (st,X,__tmp_reg__) CR_TAB
- AS2 (sbiw,r26,%o0));
- }
- else
- {
- if (reg_unused_after (insn, XEXP (x,0)))
- return *l = 2, (AS2 (adiw,r26,%o0) CR_TAB
- AS2 (st,X,%1));
+ {
+ if (reg_overlap_mentioned_p (src, XEXP (x, 0)))
+ {
+ avr_asm_len ("mov __tmp_reg__,%1" CR_TAB
+ "adiw r26,%o0" CR_TAB
+ "st X,__tmp_reg__", op, plen, -3);
+ }
+ else
+ {
+ avr_asm_len ("adiw r26,%o0" CR_TAB
+ "st X,%1", op, plen, -2);
+ }
+
+ if (!reg_unused_after (insn, XEXP (x,0)))
+ avr_asm_len ("sbiw r26,%o0", op, plen, 1);
- return *l = 3, (AS2 (adiw,r26,%o0) CR_TAB
- AS2 (st,X,%1) CR_TAB
- AS2 (sbiw,r26,%o0));
- }
- }
- *l = 1;
- return AS2 (std,%0,%1);
+ return "";
+ }
+
+ return avr_asm_len ("std %0,%1", op, plen, 1);
}
- *l = 1;
- return AS2 (st,%0,%1);
+
+ return avr_asm_len ("st %0,%1", op, plen, 1);
}
-const char *
-out_movhi_mr_r (rtx insn, rtx op[], int *l)
+static const char*
+out_movhi_mr_r (rtx insn, rtx op[], int *plen)
{
rtx dest = op[0];
rtx src = op[1];
@@ -3629,127 +3840,103 @@ out_movhi_mr_r (rtx insn, rtx op[], int *l)
/* "volatile" forces writing high byte first, even if less efficient,
for correct operation with 16-bit I/O registers. */
int mem_volatile_p = MEM_VOLATILE_P (dest);
- int tmp;
- if (!l)
- l = &tmp;
if (CONSTANT_ADDRESS_P (base))
- {
- if (optimize > 0 && io_address_operand (base, HImode))
- {
- *l = 2;
- return (AS2 (out,%m0+1-0x20,%B1) CR_TAB
- AS2 (out,%m0-0x20,%A1));
- }
- return *l = 4, (AS2 (sts,%m0+1,%B1) CR_TAB
- AS2 (sts,%m0,%A1));
- }
+ return optimize > 0 && io_address_operand (base, HImode)
+ ? avr_asm_len ("out %i0+1,%B1" CR_TAB
+ "out %i0,%A1", op, plen, -2)
+
+ : avr_asm_len ("sts %m0+1,%B1" CR_TAB
+ "sts %m0,%A1", op, plen, -4);
+
if (reg_base > 0)
{
- if (reg_base == REG_X)
- {
- if (reg_src == REG_X)
- {
- /* "st X+,r26" and "st -X,r26" are undefined. */
- if (!mem_volatile_p && reg_unused_after (insn, src))
- return *l=4, (AS2 (mov,__tmp_reg__,r27) CR_TAB
- AS2 (st,X,r26) CR_TAB
- AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,__tmp_reg__));
- else
- return *l=5, (AS2 (mov,__tmp_reg__,r27) CR_TAB
- AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,__tmp_reg__) CR_TAB
- AS2 (sbiw,r26,1) CR_TAB
- AS2 (st,X,r26));
- }
- else
- {
- if (!mem_volatile_p && reg_unused_after (insn, base))
- return *l=2, (AS2 (st,X+,%A1) CR_TAB
- AS2 (st,X,%B1));
- else
- return *l=3, (AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,%B1) CR_TAB
- AS2 (st,-X,%A1));
- }
- }
- else
- return *l=2, (AS2 (std,%0+1,%B1) CR_TAB
- AS2 (st,%0,%A1));
+ if (reg_base != REG_X)
+ return avr_asm_len ("std %0+1,%B1" CR_TAB
+ "st %0,%A1", op, plen, -2);
+
+ if (reg_src == REG_X)
+ /* "st X+,r26" and "st -X,r26" are undefined. */
+ return !mem_volatile_p && reg_unused_after (insn, src)
+ ? avr_asm_len ("mov __tmp_reg__,r27" CR_TAB
+ "st X,r26" CR_TAB
+ "adiw r26,1" CR_TAB
+ "st X,__tmp_reg__", op, plen, -4)
+
+ : avr_asm_len ("mov __tmp_reg__,r27" CR_TAB
+ "adiw r26,1" CR_TAB
+ "st X,__tmp_reg__" CR_TAB
+ "sbiw r26,1" CR_TAB
+ "st X,r26", op, plen, -5);
+
+ return !mem_volatile_p && reg_unused_after (insn, base)
+ ? avr_asm_len ("st X+,%A1" CR_TAB
+ "st X,%B1", op, plen, -2)
+ : avr_asm_len ("adiw r26,1" CR_TAB
+ "st X,%B1" CR_TAB
+ "st -X,%A1", op, plen, -3);
}
else if (GET_CODE (base) == PLUS)
{
int disp = INTVAL (XEXP (base, 1));
reg_base = REGNO (XEXP (base, 0));
if (disp > MAX_LD_OFFSET (GET_MODE (dest)))
- {
- if (reg_base != REG_Y)
- fatal_insn ("incorrect insn:",insn);
-
- if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
- return *l = 4, (AS2 (adiw,r28,%o0-62) CR_TAB
- AS2 (std,Y+63,%B1) CR_TAB
- AS2 (std,Y+62,%A1) CR_TAB
- AS2 (sbiw,r28,%o0-62));
-
- return *l = 6, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
- AS2 (sbci,r29,hi8(-%o0)) CR_TAB
- AS2 (std,Y+1,%B1) CR_TAB
- AS2 (st,Y,%A1) CR_TAB
- AS2 (subi,r28,lo8(%o0)) CR_TAB
- AS2 (sbci,r29,hi8(%o0)));
- }
- if (reg_base == REG_X)
- {
- /* (X + d) = R */
- if (reg_src == REG_X)
- {
- *l = 7;
- return (AS2 (mov,__tmp_reg__,r26) CR_TAB
- AS2 (mov,__zero_reg__,r27) CR_TAB
- AS2 (adiw,r26,%o0+1) CR_TAB
- AS2 (st,X,__zero_reg__) CR_TAB
- AS2 (st,-X,__tmp_reg__) CR_TAB
- AS1 (clr,__zero_reg__) CR_TAB
- AS2 (sbiw,r26,%o0));
- }
- *l = 4;
- return (AS2 (adiw,r26,%o0+1) CR_TAB
- AS2 (st,X,%B1) CR_TAB
- AS2 (st,-X,%A1) CR_TAB
- AS2 (sbiw,r26,%o0));
- }
- return *l=2, (AS2 (std,%B0,%B1) CR_TAB
- AS2 (std,%A0,%A1));
+ {
+ if (reg_base != REG_Y)
+ fatal_insn ("incorrect insn:",insn);
+
+ return disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest))
+ ? avr_asm_len ("adiw r28,%o0-62" CR_TAB
+ "std Y+63,%B1" CR_TAB
+ "std Y+62,%A1" CR_TAB
+ "sbiw r28,%o0-62", op, plen, -4)
+
+ : avr_asm_len ("subi r28,lo8(-%o0)" CR_TAB
+ "sbci r29,hi8(-%o0)" CR_TAB
+ "std Y+1,%B1" CR_TAB
+ "st Y,%A1" CR_TAB
+ "subi r28,lo8(%o0)" CR_TAB
+ "sbci r29,hi8(%o0)", op, plen, -6);
+ }
+
+ if (reg_base != REG_X)
+ return avr_asm_len ("std %B0,%B1" CR_TAB
+ "std %A0,%A1", op, plen, -2);
+ /* (X + d) = R */
+ return reg_src == REG_X
+ ? avr_asm_len ("mov __tmp_reg__,r26" CR_TAB
+ "mov __zero_reg__,r27" CR_TAB
+ "adiw r26,%o0+1" CR_TAB
+ "st X,__zero_reg__" CR_TAB
+ "st -X,__tmp_reg__" CR_TAB
+ "clr __zero_reg__" CR_TAB
+ "sbiw r26,%o0", op, plen, -7)
+
+ : avr_asm_len ("adiw r26,%o0+1" CR_TAB
+ "st X,%B1" CR_TAB
+ "st -X,%A1" CR_TAB
+ "sbiw r26,%o0", op, plen, -4);
}
else if (GET_CODE (base) == PRE_DEC) /* (--R) */
- return *l=2, (AS2 (st,%0,%B1) CR_TAB
- AS2 (st,%0,%A1));
+ {
+ return avr_asm_len ("st %0,%B1" CR_TAB
+ "st %0,%A1", op, plen, -2);
+ }
else if (GET_CODE (base) == POST_INC) /* (R++) */
{
- if (mem_volatile_p)
- {
- if (REGNO (XEXP (base, 0)) == REG_X)
- {
- *l = 4;
- return (AS2 (adiw,r26,1) CR_TAB
- AS2 (st,X,%B1) CR_TAB
- AS2 (st,-X,%A1) CR_TAB
- AS2 (adiw,r26,2));
- }
- else
- {
- *l = 3;
- return (AS2 (std,%p0+1,%B1) CR_TAB
- AS2 (st,%p0,%A1) CR_TAB
- AS2 (adiw,%r0,2));
- }
- }
+ if (!mem_volatile_p)
+ return avr_asm_len ("st %0,%A1" CR_TAB
+ "st %0,%B1", op, plen, -2);
+
+ return REGNO (XEXP (base, 0)) == REG_X
+ ? avr_asm_len ("adiw r26,1" CR_TAB
+ "st X,%B1" CR_TAB
+ "st -X,%A1" CR_TAB
+ "adiw r26,2", op, plen, -4)
- *l = 2;
- return (AS2 (st,%0,%A1) CR_TAB
- AS2 (st,%0,%B1));
+ : avr_asm_len ("std %p0+1,%B1" CR_TAB
+ "st %p0,%A1" CR_TAB
+ "adiw %r0,2", op, plen, -3);
}
fatal_insn ("unknown move insn:",insn);
return "";
@@ -4044,29 +4231,33 @@ avr_out_tstsi (rtx insn, rtx *op, int *plen)
}
-/* Generate asm equivalent for various shifts.
- Shift count is a CONST_INT, MEM or REG.
- This only handles cases that are not already
- carefully hand-optimized in ?sh??i3_out. */
+/* Generate asm equivalent for various shifts. This only handles cases
+ that are not already carefully hand-optimized in ?sh??i3_out.
+
+ OPERANDS[0] resp. %0 in TEMPL is the operand to be shifted.
+ OPERANDS[2] is the shift count as CONST_INT, MEM or REG.
+ OPERANDS[3] is a QImode scratch register from LD regs if
+ available and SCRATCH, otherwise (no scratch available)
+
+ TEMPL is an assembler template that shifts by one position.
+ T_LEN is the length of this template. */
void
out_shift_with_cnt (const char *templ, rtx insn, rtx operands[],
- int *len, int t_len)
+ int *plen, int t_len)
{
- rtx op[10];
- char str[500];
- int second_label = 1;
- int saved_in_tmp = 0;
- int use_zero_reg = 0;
+ bool second_label = true;
+ bool saved_in_tmp = false;
+ bool use_zero_reg = false;
+ rtx op[5];
op[0] = operands[0];
op[1] = operands[1];
op[2] = operands[2];
op[3] = operands[3];
- str[0] = 0;
- if (len)
- *len = 1;
+ if (plen)
+ *plen = 0;
if (CONST_INT_P (operands[2]))
{
@@ -4076,118 +4267,90 @@ out_shift_with_cnt (const char *templ, rtx insn, rtx operands[],
int max_len = 10; /* If larger than this, always use a loop. */
if (count <= 0)
- {
- if (len)
- *len = 0;
- return;
- }
+ return;
if (count < 8 && !scratch)
- use_zero_reg = 1;
+ use_zero_reg = true;
if (optimize_size)
- max_len = t_len + (scratch ? 3 : (use_zero_reg ? 4 : 5));
+ max_len = t_len + (scratch ? 3 : (use_zero_reg ? 4 : 5));
if (t_len * count <= max_len)
- {
- /* Output shifts inline with no loop - faster. */
- if (len)
- *len = t_len * count;
- else
- {
- while (count-- > 0)
- output_asm_insn (templ, op);
- }
+ {
+ /* Output shifts inline with no loop - faster. */
+
+ while (count-- > 0)
+ avr_asm_len (templ, op, plen, t_len);
- return;
- }
+ return;
+ }
if (scratch)
- {
- if (!len)
- strcat (str, AS2 (ldi,%3,%2));
- }
+ {
+ avr_asm_len ("ldi %3,%2", op, plen, 1);
+ }
else if (use_zero_reg)
- {
- /* Hack to save one word: use __zero_reg__ as loop counter.
- Set one bit, then shift in a loop until it is 0 again. */
+ {
+ /* Hack to save one word: use __zero_reg__ as loop counter.
+ Set one bit, then shift in a loop until it is 0 again. */
- op[3] = zero_reg_rtx;
- if (len)
- *len = 2;
- else
- strcat (str, ("set" CR_TAB
- AS2 (bld,%3,%2-1)));
- }
+ op[3] = zero_reg_rtx;
+
+ avr_asm_len ("set" CR_TAB
+ "bld %3,%2-1", op, plen, 2);
+ }
else
- {
- /* No scratch register available, use one from LD_REGS (saved in
- __tmp_reg__) that doesn't overlap with registers to shift. */
+ {
+ /* No scratch register available, use one from LD_REGS (saved in
+ __tmp_reg__) that doesn't overlap with registers to shift. */
- op[3] = all_regs_rtx[((REGNO (operands[0]) - 1) & 15) + 16];
- op[4] = tmp_reg_rtx;
- saved_in_tmp = 1;
+ op[3] = all_regs_rtx[((REGNO (op[0]) - 1) & 15) + 16];
+ op[4] = tmp_reg_rtx;
+ saved_in_tmp = true;
- if (len)
- *len = 3; /* Includes "mov %3,%4" after the loop. */
- else
- strcat (str, (AS2 (mov,%4,%3) CR_TAB
- AS2 (ldi,%3,%2)));
- }
+ avr_asm_len ("mov %4,%3" CR_TAB
+ "ldi %3,%2", op, plen, 2);
+ }
- second_label = 0;
+ second_label = false;
}
- else if (GET_CODE (operands[2]) == MEM)
+ else if (MEM_P (op[2]))
{
- rtx op_mov[10];
+ rtx op_mov[2];
- op[3] = op_mov[0] = tmp_reg_rtx;
+ op_mov[0] = op[3] = tmp_reg_rtx;
op_mov[1] = op[2];
- if (len)
- out_movqi_r_mr (insn, op_mov, len);
- else
- output_asm_insn (out_movqi_r_mr (insn, op_mov, NULL), op_mov);
+ out_movqi_r_mr (insn, op_mov, plen);
}
- else if (register_operand (operands[2], QImode))
+ else if (register_operand (op[2], QImode))
{
- if (reg_unused_after (insn, operands[2])
- && !reg_overlap_mentioned_p (operands[0], operands[2]))
+ op[3] = op[2];
+
+ if (!reg_unused_after (insn, op[2])
+ || reg_overlap_mentioned_p (op[0], op[2]))
{
- op[3] = op[2];
+ op[3] = tmp_reg_rtx;
+ avr_asm_len ("mov %3,%2", op, plen, 1);
}
- else
- {
- op[3] = tmp_reg_rtx;
- if (!len)
- strcat (str, (AS2 (mov,%3,%2) CR_TAB));
- }
}
else
fatal_insn ("bad shift insn:", insn);
if (second_label)
- {
- if (len)
- ++*len;
- else
- strcat (str, AS1 (rjmp,2f));
- }
+ avr_asm_len ("rjmp 2f", op, plen, 1);
- if (len)
- *len += t_len + 2; /* template + dec + brXX */
- else
- {
- strcat (str, "\n1:\t");
- strcat (str, templ);
- strcat (str, second_label ? "\n2:\t" : "\n\t");
- strcat (str, use_zero_reg ? AS1 (lsr,%3) : AS1 (dec,%3));
- strcat (str, CR_TAB);
- strcat (str, second_label ? AS1 (brpl,1b) : AS1 (brne,1b));
- if (saved_in_tmp)
- strcat (str, (CR_TAB AS2 (mov,%3,%4)));
- output_asm_insn (str, op);
- }
+ avr_asm_len ("1:", op, plen, 0);
+ avr_asm_len (templ, op, plen, t_len);
+
+ if (second_label)
+ avr_asm_len ("2:", op, plen, 0);
+
+ avr_asm_len (use_zero_reg ? "lsr %3" : "dec %3", op, plen, 1);
+ avr_asm_len (second_label ? "brpl 1b" : "brne 1b", op, plen, 1);
+
+ if (saved_in_tmp)
+ avr_asm_len ("mov %3,%4", op, plen, 1);
}
@@ -5652,7 +5815,7 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc)
bool ld_reg_p = test_hard_reg_class (LD_REGS, reg8);
op[0] = reg8;
- op[1] = GEN_INT (val8);
+ op[1] = gen_int_mode (val8, QImode);
/* To get usable cc0 no low-bytes must have been skipped. */
@@ -6201,7 +6364,9 @@ adjust_insn_length (rtx insn, int len)
case ADJUST_LEN_MOV16: output_movhi (insn, op, &len); break;
case ADJUST_LEN_MOV24: avr_out_movpsi (insn, op, &len); break;
case ADJUST_LEN_MOV32: output_movsisf (insn, op, &len); break;
-
+ case ADJUST_LEN_MOVMEM: avr_out_movmem (insn, op, &len); break;
+ case ADJUST_LEN_XLOAD: avr_out_xload (insn, op, &len); break;
+
case ADJUST_LEN_TSTHI: avr_out_tsthi (insn, op, &len); break;
case ADJUST_LEN_TSTPSI: avr_out_tstpsi (insn, op, &len); break;
case ADJUST_LEN_TSTSI: avr_out_tstsi (insn, op, &len); break;
@@ -6346,6 +6511,49 @@ _reg_unused_after (rtx insn, rtx reg)
return 1;
}
+
+/* Return RTX that represents the lower 16 bits of a constant address.
+ Unfortunately, simplify_gen_subreg does not handle this case. */
+
+static rtx
+avr_const_address_lo16 (rtx x)
+{
+ rtx lo16;
+
+ switch (GET_CODE (x))
+ {
+ default:
+ break;
+
+ case CONST:
+ if (PLUS == GET_CODE (XEXP (x, 0))
+ && SYMBOL_REF == GET_CODE (XEXP (XEXP (x, 0), 0))
+ && CONST_INT_P (XEXP (XEXP (x, 0), 1)))
+ {
+ HOST_WIDE_INT offset = INTVAL (XEXP (XEXP (x, 0), 1));
+ const char *name = XSTR (XEXP (XEXP (x, 0), 0), 0);
+
+ lo16 = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
+ lo16 = gen_rtx_CONST (Pmode, plus_constant (lo16, offset));
+
+ return lo16;
+ }
+
+ break;
+
+ case SYMBOL_REF:
+ {
+ const char *name = XSTR (x, 0);
+
+ return gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name));
+ }
+ }
+
+ avr_edump ("\n%?: %r\n", x);
+ gcc_unreachable();
+}
+
+
/* Target hook for assembling integer objects. The AVR version needs
special handling for references to certain labels. */
@@ -6358,11 +6566,30 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
fputs ("\t.word\tgs(", asm_out_file);
output_addr_const (asm_out_file, x);
fputs (")\n", asm_out_file);
+
+ return true;
+ }
+ else if (GET_MODE (x) == PSImode)
+ {
+ default_assemble_integer (avr_const_address_lo16 (x),
+ GET_MODE_SIZE (HImode), aligned_p);
+
+ fputs ("\t.warning\t\"assembling 24-bit address needs binutils extension for hh8(",
+ asm_out_file);
+ output_addr_const (asm_out_file, x);
+ fputs (")\"\n", asm_out_file);
+
+ fputs ("\t.byte\t0\t" ASM_COMMENT_START " hh8(", asm_out_file);
+ output_addr_const (asm_out_file, x);
+ fputs (")\n", asm_out_file);
+
return true;
}
+
return default_assemble_integer (x, size, aligned_p);
}
+
/* Worker function for ASM_DECLARE_FUNCTION_NAME. */
void
@@ -6518,6 +6745,7 @@ avr_attribute_table[] =
Return non-zero if DECL is data that must end up in Flash and
zero if the data lives in RAM (.bss, .data, .rodata, ...).
+ Return 2 if DECL is located in 24-bit flash address-space
Return 1 if DECL is located in 16-bit flash address-space
Return -1 if attribute `progmem' occurs in DECL or ATTRIBUTES
Return 0 otherwise */
@@ -6530,6 +6758,9 @@ avr_progmem_p (tree decl, tree attributes)
if (TREE_CODE (decl) != VAR_DECL)
return 0;
+ if (avr_decl_pgmx_p (decl))
+ return 2;
+
if (avr_decl_pgm_p (decl))
return 1;
@@ -6745,11 +6976,23 @@ avr_output_bss_section_asm_op (const void *data)
}
+/* Unnamed section callback for progmem*.data sections. */
+
+static void
+avr_output_progmem_section_asm_op (const void *data)
+{
+ fprintf (asm_out_file, "\t.section\t%s,\"a\",@progbits\n",
+ (const char*) data);
+}
+
+
/* Implement `TARGET_ASM_INIT_SECTIONS'. */
static void
avr_asm_init_sections (void)
{
+ unsigned int n;
+
/* Set up a section for jump tables. Alignment is handled by
ASM_OUTPUT_BEFORE_CASE_LABEL. */
@@ -6768,9 +7011,12 @@ avr_asm_init_sections (void)
",\"ax\",@progbits");
}
- progmem_section
- = get_unnamed_section (0, output_section_asm_op,
- "\t.section\t.progmem.data,\"a\",@progbits");
+ for (n = 0; n < sizeof (progmem_section) / sizeof (*progmem_section); n++)
+ {
+ progmem_section[n]
+ = get_unnamed_section (0, avr_output_progmem_section_asm_op,
+ progmem_section_prefix[n]);
+ }
/* Override section callbacks to keep track of `avr_need_clear_bss_p'
resp. `avr_need_copy_data_p'. */
@@ -6849,8 +7095,9 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl)
{
if (flags & AVR_SECTION_PROGMEM)
{
+ int segment = (flags & AVR_SECTION_PROGMEM) / SECTION_MACH_DEP - 1;
const char *old_prefix = ".rodata";
- const char *new_prefix = ".progmem.data";
+ const char *new_prefix = progmem_section_prefix[segment];
const char *sname = new_prefix;
if (STR_PREFIX_P (name, old_prefix))
@@ -6877,6 +7124,7 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl)
static unsigned int
avr_section_type_flags (tree decl, const char *name, int reloc)
{
+ int prog;
unsigned int flags = default_section_type_flags (decl, name, reloc);
if (STR_PREFIX_P (name, ".noinit"))
@@ -6890,11 +7138,16 @@ avr_section_type_flags (tree decl, const char *name, int reloc)
}
if (decl && DECL_P (decl)
- && avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
+ && (prog = avr_progmem_p (decl, DECL_ATTRIBUTES (decl)), prog))
{
+ int segment = 0;
+
+ if (prog == 1)
+ segment = avr_pgm_segment (TYPE_ADDR_SPACE (TREE_TYPE (decl)));
+
flags &= ~SECTION_WRITE;
flags &= ~SECTION_BSS;
- flags |= AVR_SECTION_PROGMEM;
+ flags |= (1 + segment % avr_current_arch->n_segments) * SECTION_MACH_DEP;
}
return flags;
@@ -6930,16 +7183,25 @@ avr_encode_section_info (tree decl, rtx rtl,
static section *
avr_asm_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
{
+ int prog;
+
section * sect = default_elf_select_section (decl, reloc, align);
if (decl && DECL_P (decl)
- && avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
+ && (prog = avr_progmem_p (decl, DECL_ATTRIBUTES (decl)), prog))
{
+ int segment = 0;
+
+ if (prog == 1)
+ segment = avr_pgm_segment (TYPE_ADDR_SPACE (TREE_TYPE (decl)));
+
+ segment %= avr_current_arch->n_segments;
+
if (sect->common.flags & SECTION_NAMED)
{
const char * name = sect->named.name;
const char * old_prefix = ".rodata";
- const char * new_prefix = ".progmem.data";
+ const char * new_prefix = progmem_section_prefix[segment];
if (STR_PREFIX_P (name, old_prefix))
{
@@ -6950,31 +7212,38 @@ avr_asm_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
}
}
- return progmem_section;
+ return progmem_section[segment];
}
return sect;
}
/* Implement `TARGET_ASM_FILE_START'. */
-/* Outputs some appropriate text to go at the start of an assembler
- file. */
+/* Outputs some text at the start of each assembler file. */
static void
avr_file_start (void)
{
+ int sfr_offset = avr_current_arch->sfr_offset;
+
if (avr_current_arch->asm_only)
error ("MCU %qs supported for assembler only", avr_current_device->name);
default_file_start ();
-/* fprintf (asm_out_file, "\t.arch %s\n", avr_current_device->name);*/
- fputs ("__SREG__ = 0x3f\n"
- "__SP_H__ = 0x3e\n"
- "__SP_L__ = 0x3d\n", asm_out_file);
-
- fputs ("__tmp_reg__ = 0\n"
- "__zero_reg__ = 1\n", asm_out_file);
+ fprintf (asm_out_file,
+ "__SREG__ = 0x%02x\n"
+ "__SP_H__ = 0x%02x\n"
+ "__SP_L__ = 0x%02x\n"
+ "__RAMPZ__ = 0x%02x\n"
+ "__tmp_reg__ = %d\n"
+ "__zero_reg__ = %d\n",
+ -sfr_offset + SREG_ADDR,
+ -sfr_offset + SP_ADDR + 1,
+ -sfr_offset + SP_ADDR,
+ -sfr_offset + RAMPZ_ADDR,
+ TMP_REGNO,
+ ZERO_REGNO);
}
@@ -8567,7 +8836,13 @@ avr_regno_mode_code_ok_for_base_p (int regno,
LEN != NULL: set *LEN to the length of the instruction sequence
(in words) printed with LEN = NULL.
If CLEAR_P is true, OP[0] had been cleard to Zero already.
- If CLEAR_P is false, nothing is known about OP[0]. */
+ If CLEAR_P is false, nothing is known about OP[0].
+
+ The effect on cc0 is as follows:
+
+ Load 0 to any register : NONE
+ Load ld register with any value : NONE
+ Anything else: : CLOBBER */
static void
output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
@@ -8644,8 +8919,8 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
xop[1] = src;
xop[2] = clobber_reg;
- if (n >= 2)
- avr_asm_len ("clr %0", xop, len, 1);
+ if (n >= 2 + (avr_current_arch->n_segments > 1))
+ avr_asm_len ("mov %0,__zero_reg__", xop, len, 1);
else
avr_asm_len (asm_code[n][ldreg_p], xop, len, ldreg_p ? 1 : 2);
continue;
@@ -8677,14 +8952,13 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p)
}
}
- /* Use CLR to zero a value so that cc0 is set as expected
- for zero. */
+ /* Don't use CLR so that cc0 is set as expected. */
if (ival[n] == 0)
{
if (!clear_p)
- avr_asm_len ("clr %0", &xdest[n], len, 1);
-
+ avr_asm_len (ldreg_p ? "ldi %0,0" : "mov %0,__zero_reg__",
+ &xdest[n], len, 1);
continue;
}
@@ -8820,7 +9094,9 @@ const char *
output_reload_insisf (rtx *op, rtx clobber_reg, int *len)
{
if (AVR_HAVE_MOVW
- && !test_hard_reg_class (LD_REGS, op[0]))
+ && !test_hard_reg_class (LD_REGS, op[0])
+ && (CONST_INT_P (op[1])
+ || CONST_DOUBLE_P (op[1])))
{
int len_clr, len_noclr;
@@ -8954,8 +9230,8 @@ const char *
avr_out_sbxx_branch (rtx insn, rtx operands[])
{
enum rtx_code comp = GET_CODE (operands[0]);
- int long_jump = (get_attr_length (insn) >= 4);
- int reverse = long_jump || jump_over_one_insn_p (insn, operands[3]);
+ bool long_jump = get_attr_length (insn) >= 4;
+ bool reverse = long_jump || jump_over_one_insn_p (insn, operands[3]);
if (comp == GE)
comp = EQ;
@@ -8965,49 +9241,61 @@ avr_out_sbxx_branch (rtx insn, rtx operands[])
if (reverse)
comp = reverse_condition (comp);
- if (GET_CODE (operands[1]) == CONST_INT)
+ switch (GET_CODE (operands[1]))
{
- if (INTVAL (operands[1]) < 0x40)
- {
- if (comp == EQ)
- output_asm_insn (AS2 (sbis,%m1-0x20,%2), operands);
- else
- output_asm_insn (AS2 (sbic,%m1-0x20,%2), operands);
- }
+ default:
+ gcc_unreachable();
+
+ case CONST_INT:
+
+ if (low_io_address_operand (operands[1], QImode))
+ {
+ if (comp == EQ)
+ output_asm_insn ("sbis %i1,%2", operands);
+ else
+ output_asm_insn ("sbic %i1,%2", operands);
+ }
else
- {
- output_asm_insn (AS2 (in,__tmp_reg__,%m1-0x20), operands);
- if (comp == EQ)
- output_asm_insn (AS2 (sbrs,__tmp_reg__,%2), operands);
- else
- output_asm_insn (AS2 (sbrc,__tmp_reg__,%2), operands);
- }
- }
- else /* GET_CODE (operands[1]) == REG */
- {
+ {
+ output_asm_insn ("in __tmp_reg__,%i1", operands);
+ if (comp == EQ)
+ output_asm_insn ("sbrs __tmp_reg__,%2", operands);
+ else
+ output_asm_insn ("sbrc __tmp_reg__,%2", operands);
+ }
+
+ break; /* CONST_INT */
+
+ case REG:
+
if (GET_MODE (operands[1]) == QImode)
- {
- if (comp == EQ)
- output_asm_insn (AS2 (sbrs,%1,%2), operands);
- else
- output_asm_insn (AS2 (sbrc,%1,%2), operands);
- }
- else /* HImode or SImode */
- {
- static char buf[] = "sbrc %A1,0";
- int bit_nr = INTVAL (operands[2]);
- buf[3] = (comp == EQ) ? 's' : 'c';
- buf[6] = 'A' + (bit_nr >> 3);
- buf[9] = '0' + (bit_nr & 7);
- output_asm_insn (buf, operands);
- }
- }
+ {
+ if (comp == EQ)
+ output_asm_insn ("sbrs %1,%2", operands);
+ else
+ output_asm_insn ("sbrc %1,%2", operands);
+ }
+ else /* HImode, PSImode or SImode */
+ {
+ static char buf[] = "sbrc %A1,0";
+ unsigned int bit_nr = UINTVAL (operands[2]);
+
+ buf[3] = (comp == EQ) ? 's' : 'c';
+ buf[6] = 'A' + (bit_nr / 8);
+ buf[9] = '0' + (bit_nr % 8);
+ output_asm_insn (buf, operands);
+ }
+
+ break; /* REG */
+ } /* switch */
if (long_jump)
- return (AS1 (rjmp,.+4) CR_TAB
- AS1 (jmp,%x3));
+ return ("rjmp .+4" CR_TAB
+ "jmp %x3");
+
if (!reverse)
- return AS1 (rjmp,%x3);
+ return "rjmp %x3";
+
return "";
}
@@ -9055,18 +9343,18 @@ avr_case_values_threshold (void)
/* Implement `TARGET_ADDR_SPACE_ADDRESS_MODE'. */
static enum machine_mode
-avr_addr_space_address_mode (addr_space_t as ATTRIBUTE_UNUSED)
+avr_addr_space_address_mode (addr_space_t as)
{
- return HImode;
+ return as == ADDR_SPACE_PGMX ? PSImode : HImode;
}
/* Implement `TARGET_ADDR_SPACE_POINTER_MODE'. */
static enum machine_mode
-avr_addr_space_pointer_mode (addr_space_t as ATTRIBUTE_UNUSED)
+avr_addr_space_pointer_mode (addr_space_t as)
{
- return HImode;
+ return as == ADDR_SPACE_PGMX ? PSImode : HImode;
}
@@ -9111,6 +9399,11 @@ avr_addr_space_legitimate_address_p (enum machine_mode mode, rtx x,
return avr_legitimate_address_p (mode, x, strict);
case ADDR_SPACE_PGM:
+ case ADDR_SPACE_PGM1:
+ case ADDR_SPACE_PGM2:
+ case ADDR_SPACE_PGM3:
+ case ADDR_SPACE_PGM4:
+ case ADDR_SPACE_PGM5:
switch (GET_CODE (x))
{
@@ -9119,8 +9412,7 @@ avr_addr_space_legitimate_address_p (enum machine_mode mode, rtx x,
break;
case POST_INC:
- ok = (!avr_load_libgcc_p (x)
- && avr_reg_ok_for_pgm_addr (XEXP (x, 0), strict));
+ ok = avr_reg_ok_for_pgm_addr (XEXP (x, 0), strict);
break;
default:
@@ -9128,6 +9420,24 @@ avr_addr_space_legitimate_address_p (enum machine_mode mode, rtx x,
}
break; /* PGM */
+
+ case ADDR_SPACE_PGMX:
+ if (REG_P (x))
+ ok = (!strict
+ && can_create_pseudo_p());
+
+ if (LO_SUM == GET_CODE (x))
+ {
+ rtx hi = XEXP (x, 0);
+ rtx lo = XEXP (x, 1);
+
+ ok = (REG_P (hi)
+ && (!strict || REGNO (hi) < FIRST_PSEUDO_REGISTER)
+ && REG_P (lo)
+ && REGNO (lo) == REG_Z);
+ }
+
+ break; /* PGMX */
}
if (avr_log.legitimate_address_p)
@@ -9177,10 +9487,60 @@ avr_addr_space_legitimize_address (rtx x, rtx old_x,
static rtx
avr_addr_space_convert (rtx src, tree type_from, tree type_to)
{
+ addr_space_t as_from = TYPE_ADDR_SPACE (TREE_TYPE (type_from));
+ addr_space_t as_to = TYPE_ADDR_SPACE (TREE_TYPE (type_to));
+
if (avr_log.progmem)
avr_edump ("\n%!: op = %r\nfrom = %t\nto = %t\n",
src, type_from, type_to);
+ if (as_from != ADDR_SPACE_PGMX
+ && as_to == ADDR_SPACE_PGMX)
+ {
+ rtx new_src;
+ int n_segments = avr_current_arch->n_segments;
+ RTX_CODE code = GET_CODE (src);
+
+ if (CONST == code
+ && PLUS == GET_CODE (XEXP (src, 0))
+ && SYMBOL_REF == GET_CODE (XEXP (XEXP (src, 0), 0))
+ && CONST_INT_P (XEXP (XEXP (src, 0), 1)))
+ {
+ HOST_WIDE_INT offset = INTVAL (XEXP (XEXP (src, 0), 1));
+ const char *name = XSTR (XEXP (XEXP (src, 0), 0), 0);
+
+ new_src = gen_rtx_SYMBOL_REF (PSImode, ggc_strdup (name));
+ new_src = gen_rtx_CONST (PSImode,
+ plus_constant (new_src, offset));
+ return new_src;
+ }
+
+ if (SYMBOL_REF == code)
+ {
+ const char *name = XSTR (src, 0);
+
+ return gen_rtx_SYMBOL_REF (PSImode, ggc_strdup (name));
+ }
+
+ src = force_reg (Pmode, src);
+
+ if (ADDR_SPACE_GENERIC_P (as_from)
+ || as_from == ADDR_SPACE_PGM
+ || n_segments == 1)
+ {
+ return gen_rtx_ZERO_EXTEND (PSImode, src);
+ }
+ else
+ {
+ int segment = avr_pgm_segment (as_from) % n_segments;
+
+ new_src = gen_reg_rtx (PSImode);
+ emit_insn (gen_n_extendhipsi2 (new_src, GEN_INT (segment), src));
+
+ return new_src;
+ }
+ }
+
return src;
}
@@ -9188,13 +9548,242 @@ avr_addr_space_convert (rtx src, tree type_from, tree type_to)
/* Implement `TARGET_ADDR_SPACE_SUBSET_P'. */
static bool
-avr_addr_space_subset_p (addr_space_t subset ATTRIBUTE_UNUSED,
- addr_space_t superset ATTRIBUTE_UNUSED)
+avr_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
{
+ if (subset == ADDR_SPACE_PGMX
+ && superset != ADDR_SPACE_PGMX)
+ {
+ return false;
+ }
+
return true;
}
+/* Worker function for movmemhi insn.
+ XOP[0] Destination as MEM:BLK
+ XOP[1] Source " "
+ XOP[2] # Bytes to copy
+
+ Return TRUE if the expansion is accomplished.
+ Return FALSE if the operand compination is not supported. */
+
+bool
+avr_emit_movmemhi (rtx *xop)
+{
+ HOST_WIDE_INT count;
+ enum machine_mode loop_mode;
+ addr_space_t as = MEM_ADDR_SPACE (xop[1]);
+ rtx loop_reg, addr0, addr1, a_src, a_dest, insn, xas, reg_x;
+ rtx a_hi8 = NULL_RTX;
+
+ if (avr_mem_pgm_p (xop[0]))
+ return false;
+
+ if (!CONST_INT_P (xop[2]))
+ return false;
+
+ count = INTVAL (xop[2]);
+ if (count <= 0)
+ return false;
+
+ a_src = XEXP (xop[1], 0);
+ a_dest = XEXP (xop[0], 0);
+
+ /* See if constant fits in 8 bits. */
+
+ loop_mode = (count <= 0x100) ? QImode : HImode;
+
+ if (PSImode == GET_MODE (a_src))
+ {
+ addr1 = simplify_gen_subreg (HImode, a_src, PSImode, 0);
+ a_hi8 = simplify_gen_subreg (QImode, a_src, PSImode, 2);
+ }
+ else
+ {
+ int seg = avr_pgm_segment (as);
+
+ addr1 = a_src;
+
+ if (seg > 0
+ && seg % avr_current_arch->n_segments > 0)
+ {
+ a_hi8 = GEN_INT (seg % avr_current_arch->n_segments);
+ }
+ }
+
+ if (a_hi8
+ && avr_current_arch->n_segments > 1)
+ {
+ emit_move_insn (rampz_rtx, a_hi8 = copy_to_mode_reg (QImode, a_hi8));
+ }
+ else if (!ADDR_SPACE_GENERIC_P (as))
+ {
+ as = ADDR_SPACE_PGM;
+ }
+
+ xas = GEN_INT (as);
+
+ /* Create loop counter register */
+
+ loop_reg = copy_to_mode_reg (loop_mode, gen_int_mode (count, loop_mode));
+
+ /* Copy pointers into new pseudos - they will be changed */
+
+ addr0 = copy_to_mode_reg (HImode, a_dest);
+ addr1 = copy_to_mode_reg (HImode, addr1);
+
+ /* FIXME: Register allocator might come up with spill fails if it is left
+ on its own. Thus, we allocate the pointer registers by hand. */
+
+ emit_move_insn (lpm_addr_reg_rtx, addr1);
+ addr1 = lpm_addr_reg_rtx;
+
+ reg_x = gen_rtx_REG (HImode, REG_X);
+ emit_move_insn (reg_x, addr0);
+ addr0 = reg_x;
+
+ /* FIXME: Register allocator does a bad job and might spill address
+ register(s) inside the loop leading to additional move instruction
+ to/from stack which could clobber tmp_reg. Thus, do *not* emit
+ load and store as seperate insns. Instead, we perform the copy
+ by means of one monolithic insn. */
+
+ if (ADDR_SPACE_GENERIC_P (as))
+ {
+ rtx (*fun) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx)
+ = QImode == loop_mode ? gen_movmem_qi : gen_movmem_hi;
+
+ insn = fun (addr0, addr1, xas, loop_reg,
+ addr0, addr1, tmp_reg_rtx, loop_reg);
+ }
+ else if (as == ADDR_SPACE_PGM)
+ {
+ rtx (*fun) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx)
+ = QImode == loop_mode ? gen_movmem_qi : gen_movmem_hi;
+
+ insn = fun (addr0, addr1, xas, loop_reg, addr0, addr1,
+ AVR_HAVE_LPMX ? tmp_reg_rtx : lpm_reg_rtx, loop_reg);
+ }
+ else
+ {
+ rtx (*fun) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx)
+ = QImode == loop_mode ? gen_movmem_qi_elpm : gen_movmem_hi_elpm;
+
+ insn = fun (addr0, addr1, xas, loop_reg, addr0, addr1,
+ AVR_HAVE_ELPMX ? tmp_reg_rtx : lpm_reg_rtx, loop_reg,
+ a_hi8, a_hi8, GEN_INT (RAMPZ_ADDR));
+ }
+
+ set_mem_addr_space (SET_SRC (XVECEXP (insn, 0, 0)), as);
+ emit_insn (insn);
+
+ return true;
+}
+
+
+/* Print assembler for movmem_qi, movmem_hi insns...
+ $0, $4 : & dest
+ $1, $5 : & src
+ $2 : Address Space
+ $3, $7 : Loop register
+ $6 : Scratch register
+
+ ...and movmem_qi_elpm, movmem_hi_elpm insns.
+
+ $8, $9 : hh8 (& src)
+ $10 : RAMPZ_ADDR
+*/
+
+const char*
+avr_out_movmem (rtx insn ATTRIBUTE_UNUSED, rtx *xop, int *plen)
+{
+ addr_space_t as = (addr_space_t) INTVAL (xop[2]);
+ enum machine_mode loop_mode = GET_MODE (xop[3]);
+
+ bool sbiw_p = test_hard_reg_class (ADDW_REGS, xop[3]);
+
+ gcc_assert (REG_X == REGNO (xop[0])
+ && REG_Z == REGNO (xop[1]));
+
+ if (plen)
+ *plen = 0;
+
+ /* Loop label */
+
+ avr_asm_len ("0:", xop, plen, 0);
+
+ /* Load with post-increment */
+
+ switch (as)
+ {
+ default:
+ gcc_unreachable();
+
+ case ADDR_SPACE_GENERIC:
+
+ avr_asm_len ("ld %6,%a1+", xop, plen, 1);
+ break;
+
+ case ADDR_SPACE_PGM:
+
+ if (AVR_HAVE_LPMX)
+ avr_asm_len ("lpm %6,%a1+", xop, plen, 1);
+ else
+ avr_asm_len ("lpm" CR_TAB
+ "adiw %1,1", xop, plen, 2);
+ break;
+
+ case ADDR_SPACE_PGM1:
+ case ADDR_SPACE_PGM2:
+ case ADDR_SPACE_PGM3:
+ case ADDR_SPACE_PGM4:
+ case ADDR_SPACE_PGM5:
+ case ADDR_SPACE_PGMX:
+
+ if (AVR_HAVE_ELPMX)
+ avr_asm_len ("elpm %6,%a1+", xop, plen, 1);
+ else
+ avr_asm_len ("elpm" CR_TAB
+ "adiw %1,1", xop, plen, 2);
+
+ if (as == ADDR_SPACE_PGMX
+ && !AVR_HAVE_ELPMX)
+ {
+ avr_asm_len ("adc %8,__zero_reg__" CR_TAB
+ "out __RAMPZ__,%8", xop, plen, 2);
+ }
+
+ break;
+ }
+
+ /* Store with post-increment */
+
+ avr_asm_len ("st %a0+,%6", xop, plen, 1);
+
+ /* Decrement loop-counter and set Z-flag */
+
+ if (QImode == loop_mode)
+ {
+ avr_asm_len ("dec %3", xop, plen, 1);
+ }
+ else if (sbiw_p)
+ {
+ avr_asm_len ("sbiw %3,1", xop, plen, 1);
+ }
+ else
+ {
+ avr_asm_len ("subi %A3,1" CR_TAB
+ "sbci %B3,0", xop, plen, 2);
+ }
+
+ /* Loop until zero */
+
+ return avr_asm_len ("brne 0b", xop, plen, 1);
+}
+
+
+
/* Helper for __builtin_avr_delay_cycles */
static void
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 24a687b309b..96133b8da28 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see
/* Names to predefine in the preprocessor for this target machine. */
-struct base_arch_s {
+struct base_arch_s
+{
/* Assembler only. */
int asm_only;
@@ -54,6 +55,13 @@ struct base_arch_s {
/* Default start of data section address for architecture. */
int default_data_section_start;
+ /* Offset between SFR address and RAM address:
+ SFR-address = RAM-address - sfr_offset */
+ int sfr_offset;
+
+ /* Number of 64k segments in the flash. */
+ int n_segments;
+
const char *const macro;
/* Architecture name. */
@@ -131,6 +139,8 @@ extern const struct base_arch_s avr_arch_types[];
#define AVR_HAVE_MUL (avr_current_arch->have_mul)
#define AVR_HAVE_MOVW (avr_current_arch->have_movw_lpmx)
#define AVR_HAVE_LPMX (avr_current_arch->have_movw_lpmx)
+#define AVR_HAVE_ELPM (avr_current_arch->have_elpm)
+#define AVR_HAVE_ELPMX (avr_current_arch->have_elpmx)
#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
#define AVR_HAVE_8BIT_SP (avr_current_device->short_sp || TARGET_TINY_STACK)
@@ -393,6 +403,12 @@ typedef struct avr_args {
#define ADDR_SPACE_PGM 1
+#define ADDR_SPACE_PGM1 2
+#define ADDR_SPACE_PGM2 3
+#define ADDR_SPACE_PGM3 4
+#define ADDR_SPACE_PGM4 5
+#define ADDR_SPACE_PGM5 6
+#define ADDR_SPACE_PGMX 7
#define REGISTER_TARGET_PRAGMAS() \
do { \
@@ -645,3 +661,5 @@ struct GTY(()) machine_function
#define PUSH_ROUNDING(X) (X)
#define ACCUMULATE_OUTGOING_ARGS avr_accumulate_outgoing_args()
+
+#define INIT_EXPANDERS avr_init_expanders()
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 78ffe866bbc..73632d880f7 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -28,6 +28,8 @@
;; j Branch condition.
;; k Reverse branch condition.
;;..m..Constant Direct Data memory address.
+;; i Print the SFR address quivalent of a CONST_INT RAM address.
+;; The resulting addres is suitable to be used in IN/OUT.
;; o Displacement for (mem (plus (reg) (const_int))) operands.
;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z)
;; r POST_INC or PRE_DEC address as a register (r26, r28, r30)
@@ -45,13 +47,17 @@
(LPM_REGNO 0) ; implicit target register of LPM
(TMP_REGNO 0) ; temporary register r0
(ZERO_REGNO 1) ; zero register r1
-
- (SREG_ADDR 0x5F)
- (RAMPZ_ADDR 0x5B)
+
+ ;; RAM addresses of some SFRs common to all Devices.
+
+ (SREG_ADDR 0x5F) ; Status Register
+ (SP_ADDR 0x5D) ; Stack Pointer
+ (RAMPZ_ADDR 0x5B) ; Address' high part when loading via ELPM
])
(define_c_enum "unspec"
[UNSPEC_STRLEN
+ UNSPEC_MOVMEM
UNSPEC_INDEX_JMP
UNSPEC_FMUL
UNSPEC_FMULS
@@ -128,6 +134,7 @@
"out_bitop, out_plus, out_plus_noclobber, addto_sp,
tsthi, tstpsi, tstsi, compare, call,
mov8, mov16, mov24, mov32, reload_in16, reload_in24, reload_in32,
+ xload, movmem,
ashlqi, ashrqi, lshrqi,
ashlhi, ashrhi, lshrhi,
ashlsi, ashrsi, lshrsi,
@@ -137,15 +144,14 @@
;; Flavours of instruction set architecture (ISA), used in enabled attribute
-;; mov: ISA has no MOVW
-;; movw: ISA has MOVW
-;; rjmp: ISA has no CALL/JMP
-;; jmp: ISA has CALL/JMP
-;; ijmp: ISA has no EICALL/EIJMP
-;; eijmp: ISA has EICALL/EIJMP
+;; mov : ISA has no MOVW movw : ISA has MOVW
+;; rjmp : ISA has no CALL/JMP jmp : ISA has CALL/JMP
+;; ijmp : ISA has no EICALL/EIJMP eijmp : ISA has EICALL/EIJMP
+;; lpm : ISA has no LPMX lpmx : ISA has LPMX
+;; elpm : ISA has ELPM but no ELPMX elpmx : ISA has ELPMX
(define_attr "isa"
- "mov,movw, rjmp,jmp, ijmp,eijmp,
+ "mov,movw, rjmp,jmp, ijmp,eijmp, lpm,lpmx, elpm,elpmx,
standard"
(const_string "standard"))
@@ -176,6 +182,22 @@
(and (eq_attr "isa" "eijmp")
(match_test "AVR_HAVE_EIJMP_EICALL"))
(const_int 1)
+
+ (and (eq_attr "isa" "lpm")
+ (match_test "!AVR_HAVE_LPMX"))
+ (const_int 1)
+
+ (and (eq_attr "isa" "lpmx")
+ (match_test "AVR_HAVE_LPMX"))
+ (const_int 1)
+
+ (and (eq_attr "isa" "elpm")
+ (match_test "AVR_HAVE_ELPM && !AVR_HAVE_ELPMX"))
+ (const_int 1)
+
+ (and (eq_attr "isa" "elpmx")
+ (match_test "AVR_HAVE_ELPMX"))
+ (const_int 1)
] (const_int 0)))
@@ -243,12 +265,10 @@
;; even though its function is identical to that in builtins.c
(define_expand "nonlocal_goto"
- [
- (use (match_operand 0 "general_operand"))
- (use (match_operand 1 "general_operand"))
- (use (match_operand 2 "general_operand"))
- (use (match_operand 3 "general_operand"))
- ]
+ [(use (match_operand 0 "general_operand"))
+ (use (match_operand 1 "general_operand"))
+ (use (match_operand 2 "general_operand"))
+ (use (match_operand 3 "general_operand"))]
""
{
rtx r_label = copy_to_reg (operands[1]);
@@ -333,7 +353,7 @@
set_mem_addr_space (operands[1], ADDR_SPACE_PGM);
})
-(define_insn "*load.<mode>.libgcc"
+(define_insn "load_<mode>_libgcc"
[(set (reg:MOVMODE 22)
(match_operand:MOVMODE 0 "memory_operand" "m,m"))]
"avr_load_libgcc_p (operands[0])
@@ -348,6 +368,135 @@
(set_attr "cc" "clobber")])
+(define_insn_and_split "xload8_A"
+ [(set (match_operand:QI 0 "register_operand" "=r")
+ (match_operand:QI 1 "memory_operand" "m"))
+ (clobber (reg:HI REG_Z))]
+ "can_create_pseudo_p()
+ && avr_mem_pgmx_p (operands[1])
+ && REG_P (XEXP (operands[1], 0))"
+ { gcc_unreachable(); }
+ "&& 1"
+ [(clobber (const_int 0))]
+ {
+ rtx insn, addr = XEXP (operands[1], 0);
+ rtx hi8 = gen_reg_rtx (QImode);
+ rtx reg_z = gen_rtx_REG (HImode, REG_Z);
+
+ emit_move_insn (reg_z, simplify_gen_subreg (HImode, addr, PSImode, 0));
+ emit_move_insn (hi8, simplify_gen_subreg (QImode, addr, PSImode, 2));
+
+ insn = emit_insn (gen_xload_8 (operands[0], hi8));
+ set_mem_addr_space (SET_SRC (single_set (insn)),
+ MEM_ADDR_SPACE (operands[1]));
+ DONE;
+ })
+
+(define_insn_and_split "xload<mode>_A"
+ [(set (match_operand:MOVMODE 0 "register_operand" "=r")
+ (match_operand:MOVMODE 1 "memory_operand" "m"))
+ (clobber (reg:QI 21))
+ (clobber (reg:HI REG_Z))]
+ "QImode != <MODE>mode
+ && can_create_pseudo_p()
+ && avr_mem_pgmx_p (operands[1])
+ && REG_P (XEXP (operands[1], 0))"
+ { gcc_unreachable(); }
+ "&& 1"
+ [(clobber (const_int 0))]
+ {
+ rtx addr = XEXP (operands[1], 0);
+ rtx reg_z = gen_rtx_REG (HImode, REG_Z);
+ rtx addr_hi8 = simplify_gen_subreg (QImode, addr, PSImode, 2);
+ addr_space_t as = MEM_ADDR_SPACE (operands[1]);
+ rtx hi8, insn;
+
+ emit_move_insn (reg_z, simplify_gen_subreg (HImode, addr, PSImode, 0));
+
+ if (avr_xload_libgcc_p (<MODE>mode))
+ {
+ emit_move_insn (gen_rtx_REG (QImode, 21), addr_hi8);
+ insn = emit_insn (gen_xload_<mode>_libgcc ());
+ emit_move_insn (operands[0], gen_rtx_REG (<MODE>mode, 22));
+ }
+ else if (avr_current_arch->n_segments == 1
+ && GET_MODE_SIZE (<MODE>mode) > 2
+ && !AVR_HAVE_LPMX)
+ {
+ rtx src = gen_rtx_MEM (<MODE>mode, reg_z);
+
+ as = ADDR_SPACE_PGM;
+ insn = emit_insn (gen_load_<mode>_libgcc (src));
+ emit_move_insn (operands[0], gen_rtx_REG (<MODE>mode, 22));
+ }
+ else
+ {
+ hi8 = gen_reg_rtx (QImode);
+ emit_move_insn (hi8, addr_hi8);
+ insn = emit_insn (gen_xload_<mode> (operands[0], hi8));
+ }
+
+ set_mem_addr_space (SET_SRC (single_set (insn)), as);
+
+ DONE;
+ })
+
+;; Move value from address space pgmx to a register
+;; These insns must be prior to respective generic move insn.
+
+(define_insn "xload_8"
+ [(set (match_operand:QI 0 "register_operand" "=r")
+ (mem:QI (lo_sum:PSI (match_operand:QI 1 "register_operand" "r")
+ (reg:HI REG_Z))))]
+ ""
+ {
+ return avr_out_xload (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "xload")
+ (set_attr "cc" "clobber")])
+
+;; "xload_hi_libgcc"
+;; "xload_psi_libgcc"
+;; "xload_si_libgcc"
+;; "xload_sf_libgcc"
+(define_insn "xload_<mode>_libgcc"
+ [(set (reg:MOVMODE 22)
+ (mem:MOVMODE (lo_sum:PSI (reg:QI 21)
+ (reg:HI REG_Z))))
+ (clobber (reg:QI 21))
+ (clobber (reg:HI REG_Z))]
+ "<MODE>mode != QImode
+ && avr_xload_libgcc_p (<MODE>mode)"
+ {
+ rtx x_bytes = GEN_INT (GET_MODE_SIZE (<MODE>mode));
+
+ /* Devices with ELPM* also have CALL. */
+
+ output_asm_insn ("call __xload_%0", &x_bytes);
+ return "";
+ }
+ [(set_attr "length" "2")
+ (set_attr "cc" "clobber")])
+
+;; "xload_hi"
+;; "xload_psi"
+;; "xload_si"
+;; "xload_sf"
+(define_insn "xload_<mode>"
+ [(set (match_operand:MOVMODE 0 "register_operand" "=r")
+ (mem:MOVMODE (lo_sum:PSI (match_operand:QI 1 "register_operand" "r")
+ (reg:HI REG_Z))))
+ (clobber (scratch:HI))
+ (clobber (reg:HI REG_Z))]
+ "<MODE>mode != QImode
+ && !avr_xload_libgcc_p (<MODE>mode)"
+ {
+ return avr_out_xload (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "xload")
+ (set_attr "cc" "clobber")])
+
+
;; General move expanders
;; "movqi"
@@ -375,6 +524,21 @@
operands[1] = src = copy_to_mode_reg (<MODE>mode, src);
}
+ if (avr_mem_pgmx_p (src))
+ {
+ rtx addr = XEXP (src, 0);
+
+ if (!REG_P (addr))
+ src = replace_equiv_address (src, copy_to_mode_reg (PSImode, addr));
+
+ if (QImode == <MODE>mode)
+ emit_insn (gen_xload8_A (dest, src));
+ else
+ emit_insn (gen_xload<mode>_A (dest, src));
+
+ DONE;
+ }
+
if (avr_load_libgcc_p (src))
{
/* For the small devices, do loads per libgcc call. */
@@ -485,7 +649,7 @@
}
[(set_attr "length" "2,2,6,7,2,6,5,2")
(set_attr "adjust_len" "mov16")
- (set_attr "cc" "none,clobber,clobber,clobber,none,clobber,none,none")])
+ (set_attr "cc" "none,none,clobber,clobber,none,clobber,none,none")])
(define_peephole2 ; movw
[(set (match_operand:QI 0 "even_register_operand" "")
@@ -588,7 +752,7 @@
}
[(set_attr "length" "3,3,8,9,4,10")
(set_attr "adjust_len" "mov24")
- (set_attr "cc" "none,set_zn,clobber,clobber,clobber,clobber")])
+ (set_attr "cc" "none,none,clobber,clobber,none,clobber")])
;;==========================================================================
;; move double word (32 bit)
@@ -629,7 +793,7 @@
}
[(set_attr "length" "4,4,8,9,4,10")
(set_attr "adjust_len" "mov32")
- (set_attr "cc" "none,set_zn,clobber,clobber,clobber,clobber")])
+ (set_attr "cc" "none,none,clobber,clobber,none,clobber")])
;; fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
;; move floating point numbers (32 bit)
@@ -645,7 +809,7 @@
}
[(set_attr "length" "4,4,8,9,4,10")
(set_attr "adjust_len" "mov32")
- (set_attr "cc" "none,set_zn,clobber,clobber,clobber,clobber")])
+ (set_attr "cc" "none,none,clobber,clobber,none,clobber")])
(define_peephole2 ; *reload_insf
[(match_scratch:QI 2 "d")
@@ -673,171 +837,164 @@
;;=========================================================================
;; move string (like memcpy)
-;; implement as RTL loop
(define_expand "movmemhi"
[(parallel [(set (match_operand:BLK 0 "memory_operand" "")
- (match_operand:BLK 1 "memory_operand" ""))
- (use (match_operand:HI 2 "const_int_operand" ""))
- (use (match_operand:HI 3 "const_int_operand" ""))])]
+ (match_operand:BLK 1 "memory_operand" ""))
+ (use (match_operand:HI 2 "const_int_operand" ""))
+ (use (match_operand:HI 3 "const_int_operand" ""))])]
""
- "{
- int prob;
- HOST_WIDE_INT count;
- enum machine_mode mode;
- rtx label = gen_label_rtx ();
- rtx loop_reg;
- rtx jump, src;
-
- /* Copy pointers into new psuedos - they will be changed. */
- rtx addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- rtx addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
-
- /* Create rtx for tmp register - we use this as scratch. */
- rtx tmp_reg_rtx = gen_rtx_REG (QImode, TMP_REGNO);
-
- if (avr_mem_pgm_p (operands[0]))
- DONE;
-
- if (GET_CODE (operands[2]) != CONST_INT)
+ {
+ if (avr_emit_movmemhi (operands))
+ DONE;
+
FAIL;
+ })
- count = INTVAL (operands[2]);
- if (count <= 0)
- FAIL;
+(define_mode_attr MOVMEM_r_d [(QI "r")
+ (HI "d")])
+
+;; $0, $4 : & dest
+;; $1, $5 : & src
+;; $2 : Address Space
+;; $3, $7 : Loop register
+;; $6 : Scratch register
+
+;; "movmem_qi"
+;; "movmem_hi"
+(define_insn "movmem_<mode>"
+ [(set (mem:BLK (match_operand:HI 0 "register_operand" "x"))
+ (mem:BLK (match_operand:HI 1 "register_operand" "z")))
+ (unspec [(match_operand:QI 2 "const_int_operand" "LP")]
+ UNSPEC_MOVMEM)
+ (use (match_operand:QIHI 3 "register_operand" "<MOVMEM_r_d>"))
+ (clobber (match_operand:HI 4 "register_operand" "=0"))
+ (clobber (match_operand:HI 5 "register_operand" "=1"))
+ (clobber (match_operand:QI 6 "register_operand" "=&r"))
+ (clobber (match_operand:QIHI 7 "register_operand" "=3"))]
+ ""
+ {
+ return avr_out_movmem (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "movmem")
+ (set_attr "cc" "clobber")])
+
+;; Ditto and
+;; $8, $9 : hh8 (& src)
+;; $10 : RAMPZ_ADDR
+
+;; "movmem_qi_elpm"
+;; "movmem_hi_elpm"
+(define_insn "movmem_<mode>_elpm"
+ [(set (mem:BLK (match_operand:HI 0 "register_operand" "x"))
+ (mem:BLK (lo_sum:PSI (match_operand:QI 8 "register_operand" "r")
+ (match_operand:HI 1 "register_operand" "z"))))
+ (unspec [(match_operand:QI 2 "const_int_operand" "n")]
+ UNSPEC_MOVMEM)
+ (use (match_operand:QIHI 3 "register_operand" "<MOVMEM_r_d>"))
+ (clobber (match_operand:HI 4 "register_operand" "=0"))
+ (clobber (match_operand:HI 5 "register_operand" "=1"))
+ (clobber (match_operand:QI 6 "register_operand" "=&r"))
+ (clobber (match_operand:QIHI 7 "register_operand" "=3"))
+ (clobber (match_operand:QI 9 "register_operand" "=8"))
+ (clobber (mem:QI (match_operand:QI 10 "io_address_operand" "n")))]
+ ""
+ {
+ return avr_out_movmem (insn, operands, NULL);
+ }
+ [(set_attr "adjust_len" "movmem")
+ (set_attr "cc" "clobber")])
- /* Work out branch probability for latter use. */
- prob = REG_BR_PROB_BASE - REG_BR_PROB_BASE / count;
-
- /* See if constant fit 8 bits. */
- mode = (count < 0x100) ? QImode : HImode;
- /* Create loop counter register. */
- loop_reg = copy_to_mode_reg (mode, gen_int_mode (count, mode));
-
- /* Now create RTL code for move loop. */
- /* Label at top of loop. */
- emit_label (label);
-
- /* Move one byte into scratch and inc pointer. */
- src = gen_rtx_MEM (QImode, addr1);
- set_mem_addr_space (src, MEM_ADDR_SPACE (operands[1]));
- emit_move_insn (tmp_reg_rtx, src);
- emit_move_insn (addr1, gen_rtx_PLUS (Pmode, addr1, const1_rtx));
-
- /* Move to mem and inc pointer. */
- emit_move_insn (gen_rtx_MEM (QImode, addr0), tmp_reg_rtx);
- emit_move_insn (addr0, gen_rtx_PLUS (Pmode, addr0, const1_rtx));
-
- /* Decrement count. */
- emit_move_insn (loop_reg, gen_rtx_PLUS (mode, loop_reg, constm1_rtx));
-
- /* Compare with zero and jump if not equal. */
- emit_cmp_and_jump_insns (loop_reg, const0_rtx, NE, NULL_RTX, mode, 1,
- label);
- /* Set jump probability based on loop count. */
- jump = get_last_insn ();
- add_reg_note (jump, REG_BR_PROB, GEN_INT (prob));
- DONE;
-}")
-;; =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2
+;; =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2 =%2
;; memset (%0, %2, %1)
(define_expand "setmemhi"
[(parallel [(set (match_operand:BLK 0 "memory_operand" "")
- (match_operand 2 "const_int_operand" ""))
- (use (match_operand:HI 1 "const_int_operand" ""))
- (use (match_operand:HI 3 "const_int_operand" "n"))
- (clobber (match_scratch:HI 4 ""))
- (clobber (match_dup 5))])]
+ (match_operand 2 "const_int_operand" ""))
+ (use (match_operand:HI 1 "const_int_operand" ""))
+ (use (match_operand:HI 3 "const_int_operand" ""))
+ (clobber (match_scratch:HI 4 ""))
+ (clobber (match_dup 5))])]
""
- "{
- rtx addr0;
- enum machine_mode mode;
+ {
+ rtx addr0;
+ enum machine_mode mode;
- /* If value to set is not zero, use the library routine. */
- if (operands[2] != const0_rtx)
- FAIL;
+ /* If value to set is not zero, use the library routine. */
+ if (operands[2] != const0_rtx)
+ FAIL;
- if (!CONST_INT_P (operands[1]))
- FAIL;
+ if (!CONST_INT_P (operands[1]))
+ FAIL;
+
+ mode = u8_operand (operands[1], VOIDmode) ? QImode : HImode;
+ operands[5] = gen_rtx_SCRATCH (mode);
+ operands[1] = copy_to_mode_reg (mode,
+ gen_int_mode (INTVAL (operands[1]), mode));
+ addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
+ operands[0] = gen_rtx_MEM (BLKmode, addr0);
+ })
- mode = u8_operand (operands[1], VOIDmode) ? QImode : HImode;
- operands[5] = gen_rtx_SCRATCH (mode);
- operands[1] = copy_to_mode_reg (mode,
- gen_int_mode (INTVAL (operands[1]), mode));
- addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
- operands[0] = gen_rtx_MEM (BLKmode, addr0);
-}")
(define_insn "*clrmemqi"
[(set (mem:BLK (match_operand:HI 0 "register_operand" "e"))
- (const_int 0))
+ (const_int 0))
(use (match_operand:QI 1 "register_operand" "r"))
(use (match_operand:QI 2 "const_int_operand" "n"))
(clobber (match_scratch:HI 3 "=0"))
(clobber (match_scratch:QI 4 "=&1"))]
""
- "st %a0+,__zero_reg__
- dec %1
- brne .-6"
+ "0:\;st %a0+,__zero_reg__\;dec %1\;brne 0b"
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
+
(define_insn "*clrmemhi"
[(set (mem:BLK (match_operand:HI 0 "register_operand" "e,e"))
- (const_int 0))
+ (const_int 0))
(use (match_operand:HI 1 "register_operand" "!w,d"))
(use (match_operand:HI 2 "const_int_operand" "n,n"))
(clobber (match_scratch:HI 3 "=0,0"))
(clobber (match_scratch:HI 4 "=&1,&1"))]
""
- "*{
- if (which_alternative==0)
- return (AS2 (st,%a0+,__zero_reg__) CR_TAB
- AS2 (sbiw,%A1,1) CR_TAB
- AS1 (brne,.-6));
- else
- return (AS2 (st,%a0+,__zero_reg__) CR_TAB
- AS2 (subi,%A1,1) CR_TAB
- AS2 (sbci,%B1,0) CR_TAB
- AS1 (brne,.-8));
-}"
+ "@
+ 0:\;st %a0+,__zero_reg__\;sbiw %A1,1\;brne 0b
+ 0:\;st %a0+,__zero_reg__\;subi %A1,1\;sbci %B1,0\;brne 0b"
[(set_attr "length" "3,4")
(set_attr "cc" "clobber,clobber")])
(define_expand "strlenhi"
- [(set (match_dup 4)
- (unspec:HI [(match_operand:BLK 1 "memory_operand" "")
- (match_operand:QI 2 "const_int_operand" "")
- (match_operand:HI 3 "immediate_operand" "")]
- UNSPEC_STRLEN))
- (set (match_dup 4) (plus:HI (match_dup 4)
- (const_int -1)))
- (set (match_operand:HI 0 "register_operand" "")
- (minus:HI (match_dup 4)
- (match_dup 5)))]
- ""
- "{
- rtx addr;
- if (operands[2] != const0_rtx)
- FAIL;
- addr = copy_to_mode_reg (Pmode, XEXP (operands[1],0));
- operands[1] = gen_rtx_MEM (BLKmode, addr);
- operands[5] = addr;
- operands[4] = gen_reg_rtx (HImode);
-}")
+ [(set (match_dup 4)
+ (unspec:HI [(match_operand:BLK 1 "memory_operand" "")
+ (match_operand:QI 2 "const_int_operand" "")
+ (match_operand:HI 3 "immediate_operand" "")]
+ UNSPEC_STRLEN))
+ (set (match_dup 4)
+ (plus:HI (match_dup 4)
+ (const_int -1)))
+ (set (match_operand:HI 0 "register_operand" "")
+ (minus:HI (match_dup 4)
+ (match_dup 5)))]
+ ""
+ {
+ rtx addr;
+ if (operands[2] != const0_rtx)
+ FAIL;
+ addr = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
+ operands[1] = gen_rtx_MEM (BLKmode, addr);
+ operands[5] = addr;
+ operands[4] = gen_reg_rtx (HImode);
+ })
(define_insn "*strlenhi"
- [(set (match_operand:HI 0 "register_operand" "=e")
- (unspec:HI [(mem:BLK (match_operand:HI 1 "register_operand" "%0"))
- (const_int 0)
- (match_operand:HI 2 "immediate_operand" "i")]
- UNSPEC_STRLEN))]
- ""
- "ld __tmp_reg__,%a0+
- tst __tmp_reg__
- brne .-6"
+ [(set (match_operand:HI 0 "register_operand" "=e")
+ (unspec:HI [(mem:BLK (match_operand:HI 1 "register_operand" "0"))
+ (const_int 0)
+ (match_operand:HI 2 "immediate_operand" "i")]
+ UNSPEC_STRLEN))]
+ ""
+ "0:\;ld __tmp_reg__,%a0+\;tst __tmp_reg__\;brne 0b"
[(set_attr "length" "3")
(set_attr "cc" "clobber")])
@@ -4503,25 +4660,25 @@
(define_insn "*cbi"
[(set (mem:QI (match_operand 0 "low_io_address_operand" "n"))
- (and:QI (mem:QI (match_dup 0))
- (match_operand:QI 1 "single_zero_operand" "n")))]
- "(optimize > 0)"
-{
- operands[2] = GEN_INT (exact_log2 (~INTVAL (operands[1]) & 0xff));
- return AS2 (cbi,%m0-0x20,%2);
-}
+ (and:QI (mem:QI (match_dup 0))
+ (match_operand:QI 1 "single_zero_operand" "n")))]
+ "optimize > 0"
+ {
+ operands[2] = GEN_INT (exact_log2 (~INTVAL (operands[1]) & 0xff));
+ return "cbi %i0,%2";
+ }
[(set_attr "length" "1")
(set_attr "cc" "none")])
(define_insn "*sbi"
[(set (mem:QI (match_operand 0 "low_io_address_operand" "n"))
- (ior:QI (mem:QI (match_dup 0))
- (match_operand:QI 1 "single_one_operand" "n")))]
- "(optimize > 0)"
-{
- operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1]) & 0xff));
- return AS2 (sbi,%m0-0x20,%2);
-}
+ (ior:QI (mem:QI (match_dup 0))
+ (match_operand:QI 1 "single_one_operand" "n")))]
+ "optimize > 0"
+ {
+ operands[2] = GEN_INT (exact_log2 (INTVAL (operands[1]) & 0xff));
+ return "sbi %i0,%2";
+ }
[(set_attr "length" "1")
(set_attr "cc" "none")])
@@ -5480,9 +5637,9 @@
(match_operand:QI 2 "nonmemory_operand" "L,P,r"))]
""
"@
- cbi %m0-0x20,%1
- sbi %m0-0x20,%1
- sbrc %2,0\;sbi %m0-0x20,%1\;sbrs %2,0\;cbi %m0-0x20,%1"
+ cbi %i0,%1
+ sbi %i0,%1
+ sbrc %2,0\;sbi %i0,%1\;sbrs %2,0\;cbi %i0,%1"
[(set_attr "length" "1,1,4")
(set_attr "cc" "none")])
@@ -5492,7 +5649,7 @@
(match_operand:QI 1 "const_0_to_7_operand" "n"))
(not:QI (match_operand:QI 2 "register_operand" "r")))]
""
- "sbrs %2,0\;sbi %m0-0x20,%1\;sbrc %2,0\;cbi %m0-0x20,%1"
+ "sbrs %2,0\;sbi %i0,%1\;sbrc %2,0\;cbi %i0,%1"
[(set_attr "length" "4")
(set_attr "cc" "none")])
diff --git a/gcc/config/avr/predicates.md b/gcc/config/avr/predicates.md
index 9f595cbfb29..fff34b58464 100644
--- a/gcc/config/avr/predicates.md
+++ b/gcc/config/avr/predicates.md
@@ -63,10 +63,11 @@
(match_test "!avr_mem_pgm_p (op)")))
;; Return 1 if OP is an "ordinary" general operand, i.e. a general
-;; operand whose load is not handled by a libgcc call.
+;; operand whose load is not handled by a libgcc call or ELPM.
(define_predicate "nox_general_operand"
(and (match_operand 0 "general_operand")
- (match_test "!avr_load_libgcc_p (op)")))
+ (not (match_test "avr_load_libgcc_p (op)"))
+ (not (match_test "avr_mem_pgmx_p (op)"))))
;; Return 1 if OP is the zero constant for MODE.
(define_predicate "const0_operand"
diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h
index 291981d5707..545f821ac0f 100644
--- a/gcc/config/cris/cris-protos.h
+++ b/gcc/config/cris/cris-protos.h
@@ -65,5 +65,3 @@ extern int cris_fatal (char *);
extern int cris_initial_elimination_offset (int, int);
extern void cris_init_expanders (void);
-
-extern bool cris_function_value_regno_p (const unsigned int);
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 06568023051..de9e26984ea 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -153,6 +153,7 @@ static void cris_trampoline_init (rtx, tree, rtx);
static rtx cris_function_value(const_tree, const_tree, bool);
static rtx cris_libcall_value (enum machine_mode, const_rtx);
+static bool cris_function_value_regno_p (const unsigned int);
/* This is the parsed result of the "-max-stack-stackframe=" option. If
it (still) is zero, then there was no such option given. */
@@ -252,6 +253,8 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#define TARGET_FUNCTION_VALUE cris_function_value
#undef TARGET_LIBCALL_VALUE
#define TARGET_LIBCALL_VALUE cris_libcall_value
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P cris_function_value_regno_p
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -3931,7 +3934,7 @@ cris_libcall_value (enum machine_mode mode,
/* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
time being. */
-bool
+static bool
cris_function_value_regno_p (const unsigned int regno)
{
return (regno == CRIS_FIRST_ARG_REG);
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 5a6ebda2e48..ff0be0041f0 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -712,12 +712,6 @@ struct cum_args {int regs;};
&& (REGNO) < CRIS_FIRST_ARG_REG + (CRIS_MAX_ARGS_IN_REGS))
-/* Node: Scalar Return */
-
-#define FUNCTION_VALUE_REGNO_P(N) cris_function_value_regno_p (N)
-
-
-
/* Node: Aggregate Return */
#define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 21092af66e2..e0220864fac 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -58,6 +58,7 @@ extern int machopic_reloc_rw_mask (void);
extern section *machopic_select_section (tree, int, unsigned HOST_WIDE_INT);
extern section *darwin_function_section (tree, enum node_frequency, bool, bool);
+extern section *darwin_tm_clone_table_section (void);
extern void darwin_function_switched_text_sections (FILE *, tree, bool);
extern void darwin_unique_section (tree decl, int reloc);
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 7c33a533fff..b1038f40660 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1265,6 +1265,14 @@ darwin_mergeable_constant_section (tree exp,
return readonly_data_section;
}
+section *
+darwin_tm_clone_table_section (void)
+{
+ return get_named_section (NULL,
+ "__DATA,__tm_clone_table,regular,no_dead_strip",
+ 3);
+}
+
int
machopic_reloc_rw_mask (void)
{
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 0c8f2769abe..29a24ddc6d6 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -359,8 +359,8 @@ extern GTY(()) int darwin_ms_struct;
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
- "%{Zdynamiclib: %(darwin_dylib1) } \
- %{!Zdynamiclib:%{Zbundle:%{!static:-lbundle1.o}} \
+ "%{Zdynamiclib: %(darwin_dylib1) %{fgnu-tm: -lcrttms.o}} \
+ %{!Zdynamiclib:%{Zbundle:%{!static:-lbundle1.o %{fgnu-tm: -lcrttms.o}}} \
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
@@ -372,10 +372,8 @@ extern GTY(()) int darwin_ms_struct;
%(darwin_crt2)}}}}}} \
%{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
-/* The native Darwin linker doesn't necessarily place files in the order
- that they're specified on the link line. Thus, it is pointless
- to put anything in ENDFILE_SPEC. */
-/* #define ENDFILE_SPEC "" */
+/* We want a destructor last in the list. */
+#define ENDFILE_SPEC "%{fgnu-tm: -lcrttme.o}"
#define DARWIN_EXTRA_SPECS \
{ "darwin_crt1", DARWIN_CRT1_SPEC }, \
@@ -388,13 +386,19 @@ extern GTY(()) int darwin_ms_struct;
#define DARWIN_CRT1_SPEC \
"%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o) \
- %:version-compare(>= 10.5 mmacosx-version-min= -lcrt1.10.5.o)"
+ %:version-compare(>= 10.5 mmacosx-version-min= -lcrt1.10.5.o) \
+ %{fgnu-tm: -lcrttms.o}"
/* Default Darwin ASM_SPEC, very simple. */
#define ASM_SPEC "-arch %(darwin_arch) \
%{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
%{static}"
+/* Default ASM_DEBUG_SPEC. Darwin's as cannot currently produce dwarf
+ debugging data. */
+
+#define ASM_DEBUG_SPEC "%{g*:%{!g0:%{!gdwarf*:--gstabs}}}"
+
/* We still allow output of STABS. */
#define DBX_DEBUGGING_INFO 1
@@ -692,6 +696,10 @@ extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS];
#define TARGET_ASM_UNIQUE_SECTION darwin_unique_section
#undef TARGET_ASM_FUNCTION_RODATA_SECTION
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
+
+#undef TARGET_ASM_TM_CLONE_TABLE_SECTION
+#define TARGET_ASM_TM_CLONE_TABLE_SECTION darwin_tm_clone_table_section
+
#undef TARGET_ASM_RELOC_RW_MASK
#define TARGET_ASM_RELOC_RW_MASK machopic_reloc_rw_mask
diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h
index 483a7e5269c..92429cae57c 100644
--- a/gcc/config/darwin9.h
+++ b/gcc/config/darwin9.h
@@ -41,6 +41,12 @@ along with GCC; see the file COPYING3. If not see
%{mdynamic-no-pic: %n'-mdynamic-no-pic' overrides '-pie', '-fpie' or '-fPIE'; \
:-pie}}"
+/* Only ask as for debug data if the debug style is stabs (since as doesn't
+ yet generate dwarf.) */
+
+#undef ASM_DEBUG_SPEC
+#define ASM_DEBUG_SPEC "%{g*:%{!g0:%{gstabs:--gstabs}}}"
+
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 705fe98c613..83da2932512 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -132,7 +132,8 @@ extern int darwin_emit_branch_islands;
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
%{mpc32:crtprec32.o%s} \
%{mpc64:crtprec64.o%s} \
- %{mpc80:crtprec80.o%s}"
+ %{mpc80:crtprec80.o%s} \
+ %{fgnu-tm: -lcrttme.o}"
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index fe4cd6abaea..07ac9f3d8ae 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -1418,6 +1418,14 @@ _mm_stream_si32 (int *__A, int __B)
__builtin_ia32_movnti (__A, __B);
}
+#ifdef __x86_64__
+extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_stream_si64 (long long int *__A, long long int __B)
+{
+ __builtin_ia32_movnti64 (__A, __B);
+}
+#endif
+
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_stream_si128 (__m128i *__A, __m128i __B)
{
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def
index 79fb1427787..d00b05341b9 100644
--- a/gcc/config/i386/i386-builtin-types.def
+++ b/gcc/config/i386/i386-builtin-types.def
@@ -111,6 +111,7 @@ DEF_POINTER_TYPE (PDOUBLE, DOUBLE)
DEF_POINTER_TYPE (PFLOAT, FLOAT)
DEF_POINTER_TYPE (PUSHORT, USHORT)
DEF_POINTER_TYPE (PINT, INT)
+DEF_POINTER_TYPE (PLONGLONG, LONGLONG)
DEF_POINTER_TYPE (PULONGLONG, ULONGLONG)
DEF_POINTER_TYPE (PUNSIGNED, UNSIGNED)
@@ -357,6 +358,7 @@ DEF_FUNCTION_TYPE (VOID, PDOUBLE, V4DF)
DEF_FUNCTION_TYPE (VOID, PFLOAT, V4SF)
DEF_FUNCTION_TYPE (VOID, PFLOAT, V8SF)
DEF_FUNCTION_TYPE (VOID, PINT, INT)
+DEF_FUNCTION_TYPE (VOID, PLONGLONG, LONGLONG)
DEF_FUNCTION_TYPE (VOID, PULONGLONG, ULONGLONG)
DEF_FUNCTION_TYPE (VOID, PV2SI, V2SI)
DEF_FUNCTION_TYPE (VOID, PV2DI, V2DI)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 993b767ee0b..34368203cd9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1783,18 +1783,18 @@ struct processor_costs atom_cost = {
/* stringop_algs for memcpy.
SSE loops works best on Atom, but fall back into non-SSE unrolled loop variant
if that fails. */
- {{{libcall, {{4096, sse_loop}, {4096, unrolled_loop}, {-1, libcall}}}, /* Known alignment. */
- {libcall, {{4096, sse_loop}, {4096, unrolled_loop}, {-1, libcall}}}},
- {{libcall, {{2048, sse_loop}, {2048, unrolled_loop}, {-1, libcall}}}, /* Unknown alignment. */
- {libcall, {{2048, sse_loop}, {2048, unrolled_loop},
+ {{{libcall, {{4096, unrolled_loop}, {-1, libcall}}}, /* Known alignment. */
+ {libcall, {{4096, unrolled_loop}, {-1, libcall}}}},
+ {{libcall, {{2048, unrolled_loop}, {-1, libcall}}}, /* Unknown alignment. */
+ {libcall, {{2048, unrolled_loop},
{-1, libcall}}}}},
/* stringop_algs for memset. */
- {{{libcall, {{4096, sse_loop}, {4096, unrolled_loop}, {-1, libcall}}}, /* Known alignment. */
- {libcall, {{4096, sse_loop}, {4096, unrolled_loop}, {-1, libcall}}}},
- {{libcall, {{1024, sse_loop}, {1024, unrolled_loop}, /* Unknown alignment. */
+ {{{libcall, {{4096, unrolled_loop}, {-1, libcall}}}, /* Known alignment. */
+ {libcall, {{4096, unrolled_loop}, {-1, libcall}}}},
+ {{libcall, {{1024, unrolled_loop}, /* Unknown alignment. */
{-1, libcall}}},
- {libcall, {{2048, sse_loop}, {2048, unrolled_loop},
+ {libcall, {{2048, unrolled_loop},
{-1, libcall}}}}},
1, /* scalar_stmt_cost. */
1, /* scalar load_cost. */
@@ -19619,8 +19619,12 @@ ix86_expand_int_vcond (rtx operands[])
cop0 = operands[4];
cop1 = operands[5];
- /* XOP supports all of the comparisons on all vector int types. */
- if (!TARGET_XOP)
+ /* XOP supports all of the comparisons on all 128-bit vector int types. */
+ if (TARGET_XOP
+ && (mode == V16QImode || mode == V8HImode
+ || mode == V4SImode || mode == V2DImode))
+ ;
+ else
{
/* Canonicalize the comparison to EQ, GT, GTU. */
switch (code)
@@ -25341,6 +25345,7 @@ enum ix86_builtins
IX86_BUILTIN_CVTTPS2DQ,
IX86_BUILTIN_MOVNTI,
+ IX86_BUILTIN_MOVNTI64,
IX86_BUILTIN_MOVNTPD,
IX86_BUILTIN_MOVNTDQ,
@@ -26414,7 +26419,7 @@ static const struct builtin_description bdesc_special_args[] =
/* SSE or 3DNow!A */
{ OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A, CODE_FOR_sse_sfence, "__builtin_ia32_sfence", IX86_BUILTIN_SFENCE, UNKNOWN, (int) VOID_FTYPE_VOID },
- { OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A, CODE_FOR_sse_movntdi, "__builtin_ia32_movntq", IX86_BUILTIN_MOVNTQ, UNKNOWN, (int) VOID_FTYPE_PULONGLONG_ULONGLONG },
+ { OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A, CODE_FOR_sse_movntq, "__builtin_ia32_movntq", IX86_BUILTIN_MOVNTQ, UNKNOWN, (int) VOID_FTYPE_PULONGLONG_ULONGLONG },
/* SSE2 */
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_lfence, "__builtin_ia32_lfence", IX86_BUILTIN_LFENCE, UNKNOWN, (int) VOID_FTYPE_VOID },
@@ -26423,7 +26428,8 @@ static const struct builtin_description bdesc_special_args[] =
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movdqu, "__builtin_ia32_storedqu", IX86_BUILTIN_STOREDQU, UNKNOWN, (int) VOID_FTYPE_PCHAR_V16QI },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntv2df, "__builtin_ia32_movntpd", IX86_BUILTIN_MOVNTPD, UNKNOWN, (int) VOID_FTYPE_PDOUBLE_V2DF },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntv2di, "__builtin_ia32_movntdq", IX86_BUILTIN_MOVNTDQ, UNKNOWN, (int) VOID_FTYPE_PV2DI_V2DI },
- { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntsi, "__builtin_ia32_movnti", IX86_BUILTIN_MOVNTI, UNKNOWN, (int) VOID_FTYPE_PINT_INT },
+ { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntisi, "__builtin_ia32_movnti", IX86_BUILTIN_MOVNTI, UNKNOWN, (int) VOID_FTYPE_PINT_INT },
+ { OPTION_MASK_ISA_SSE2 | OPTION_MASK_ISA_64BIT, CODE_FOR_sse2_movntidi, "__builtin_ia32_movnti64", IX86_BUILTIN_MOVNTI64, UNKNOWN, (int) VOID_FTYPE_PLONGLONG_LONGLONG },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movupd, "__builtin_ia32_loadupd", IX86_BUILTIN_LOADUPD, UNKNOWN, (int) V2DF_FTYPE_PCDOUBLE },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movdqu, "__builtin_ia32_loaddqu", IX86_BUILTIN_LOADDQU, UNKNOWN, (int) V16QI_FTYPE_PCCHAR },
@@ -29409,6 +29415,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case VOID_FTYPE_PFLOAT_V4SF:
case VOID_FTYPE_PDOUBLE_V4DF:
case VOID_FTYPE_PDOUBLE_V2DF:
+ case VOID_FTYPE_PLONGLONG_LONGLONG:
case VOID_FTYPE_PULONGLONG_ULONGLONG:
case VOID_FTYPE_PINT_INT:
nargs = 1;
@@ -30010,7 +30017,7 @@ rdrand_step:
icode = CODE_FOR_avx2_gatherdiv8sf;
goto gather_gen;
case IX86_BUILTIN_GATHERALTSIV4DI:
- icode = CODE_FOR_avx2_gathersiv4df;
+ icode = CODE_FOR_avx2_gathersiv4di;
goto gather_gen;
case IX86_BUILTIN_GATHERALTDIV8SI:
icode = CODE_FOR_avx2_gatherdiv8si;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index bc602532304..fa306ba79d8 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -62,8 +62,6 @@
;; ; -- print a semicolon (after prefixes due to bug in older gas).
;; @ -- print a segment register of thread base pointer load
-;; UNSPEC usage:
-
(define_c_enum "unspec" [
;; Relocation specifiers
UNSPEC_GOT
@@ -108,6 +106,7 @@
UNSPEC_LD_MPIC ; load_macho_picbase
UNSPEC_TRUNC_NOOP
UNSPEC_DIV_ALREADY_SPLIT
+ UNSPEC_MS_TO_SYSV_CALL
UNSPEC_CALL_NEEDS_VZEROUPPER
UNSPEC_PAUSE
@@ -115,21 +114,9 @@
UNSPEC_FIX_NOTRUNC
UNSPEC_MASKMOV
UNSPEC_MOVMSK
- UNSPEC_MOVNT
- UNSPEC_MOVU
UNSPEC_RCP
UNSPEC_RSQRT
- UNSPEC_SFENCE
- UNSPEC_PFRCP
- UNSPEC_PFRCPIT1
- UNSPEC_PFRCPIT2
- UNSPEC_PFRSQRT
- UNSPEC_PFRSQIT1
- UNSPEC_MFENCE
- UNSPEC_LFENCE
UNSPEC_PSADBW
- UNSPEC_LDDQU
- UNSPEC_MS_TO_SYSV_CALL
;; Generic math support
UNSPEC_COPYSIGN
@@ -177,105 +164,32 @@
UNSPEC_SP_TLS_SET
UNSPEC_SP_TLS_TEST
- ;; SSSE3
- UNSPEC_PSHUFB
- UNSPEC_PSIGN
- UNSPEC_PALIGNR
-
- ;; For SSE4A support
- UNSPEC_EXTRQI
- UNSPEC_EXTRQ
- UNSPEC_INSERTQI
- UNSPEC_INSERTQ
-
- ;; For SSE4.1 support
- UNSPEC_BLENDV
- UNSPEC_INSERTPS
- UNSPEC_DP
- UNSPEC_MOVNTDQA
- UNSPEC_MPSADBW
- UNSPEC_PHMINPOSUW
- UNSPEC_PTEST
+ ;; For ROUND support
UNSPEC_ROUND
- ;; For SSE4.2 support
+ ;; For CRC32 support
UNSPEC_CRC32
- UNSPEC_PCMPESTR
- UNSPEC_PCMPISTR
-
- ;; For FMA4 support
- UNSPEC_FMADDSUB
- UNSPEC_XOP_UNSIGNED_CMP
- UNSPEC_XOP_TRUEFALSE
- UNSPEC_XOP_PERMUTE
- UNSPEC_FRCZ
-
- ;; For AES support
- UNSPEC_AESENC
- UNSPEC_AESENCLAST
- UNSPEC_AESDEC
- UNSPEC_AESDECLAST
- UNSPEC_AESIMC
- UNSPEC_AESKEYGENASSIST
-
- ;; For PCLMUL support
- UNSPEC_PCLMUL
-
- ;; For AVX support
- UNSPEC_PCMP
- UNSPEC_VPERMIL
- UNSPEC_VPERMIL2
- UNSPEC_VPERMIL2F128
- UNSPEC_CAST
- UNSPEC_VTESTP
- UNSPEC_VCVTPH2PS
- UNSPEC_VCVTPS2PH
-
- ;; For AVX2 support
- UNSPEC_VPERMSI
- UNSPEC_VPERMDF
- UNSPEC_VPERMSF
- UNSPEC_VPERMTI
- UNSPEC_GATHER
- UNSPEC_VSIBADDR
-
- ;; For BMI support
- UNSPEC_BEXTR
;; For RDRAND support
UNSPEC_RDRAND
+ ;; For BMI support
+ UNSPEC_BEXTR
+
;; For BMI2 support
UNSPEC_PDEP
UNSPEC_PEXT
-
- ;; For __atomic support
- UNSPEC_MOVA
])
(define_c_enum "unspecv" [
UNSPECV_BLOCKAGE
UNSPECV_STACK_PROBE
UNSPECV_PROBE_STACK_RANGE
- UNSPECV_EMMS
- UNSPECV_LDMXCSR
- UNSPECV_STMXCSR
- UNSPECV_FEMMS
- UNSPECV_CLFLUSH
UNSPECV_ALIGN
- UNSPECV_MONITOR
- UNSPECV_MWAIT
- UNSPECV_CMPXCHG_1
- UNSPECV_CMPXCHG_2
- UNSPECV_CMPXCHG_3
- UNSPECV_CMPXCHG_4
- UNSPECV_XCHG
- UNSPECV_LOCK
UNSPECV_PROLOGUE_USE
+ UNSPECV_SPLIT_STACK_RETURN
UNSPECV_CLD
UNSPECV_NOPS
- UNSPECV_VZEROALL
- UNSPECV_VZEROUPPER
UNSPECV_RDTSC
UNSPECV_RDTSCP
UNSPECV_RDPMC
@@ -287,7 +201,6 @@
UNSPECV_RDGSBASE
UNSPECV_WRFSBASE
UNSPECV_WRGSBASE
- UNSPECV_SPLIT_STACK_RETURN
])
;; Constants to represent rounding modes in the ROUND instruction
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index f76834e5ab2..e859b9f1bed 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -30,6 +30,20 @@
;; means that we should never use any of these patterns except at the
;; direction of the user via a builtin.
+(define_c_enum "unspec" [
+ UNSPEC_MOVNTQ
+ UNSPEC_PFRCP
+ UNSPEC_PFRCPIT1
+ UNSPEC_PFRCPIT2
+ UNSPEC_PFRSQRT
+ UNSPEC_PFRSQIT1
+])
+
+(define_c_enum "unspecv" [
+ UNSPECV_EMMS
+ UNSPECV_FEMMS
+])
+
;; 8 byte integral modes handled by MMX (and by extension, SSE)
(define_mode_iterator MMXMODEI [V8QI V4HI V2SI])
(define_mode_iterator MMXMODEI8 [V8QI V4HI V2SI V1DI])
@@ -329,10 +343,10 @@
DONE;
})
-(define_insn "sse_movntdi"
+(define_insn "sse_movntq"
[(set (match_operand:DI 0 "memory_operand" "=m")
(unspec:DI [(match_operand:DI 1 "register_operand" "y")]
- UNSPEC_MOVNT))]
+ UNSPEC_MOVNTQ))]
"TARGET_SSE || TARGET_3DNOW_A"
"movntq\t{%1, %0|%0, %1}"
[(set_attr "type" "mmxmov")
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index d04902b6759..97fc333c253 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -18,6 +18,85 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
+(define_c_enum "unspec" [
+ ;; SSE
+ UNSPEC_MOVNT
+ UNSPEC_MOVU
+
+ ;; SSE3
+ UNSPEC_LDDQU
+
+ ;; SSSE3
+ UNSPEC_PSHUFB
+ UNSPEC_PSIGN
+ UNSPEC_PALIGNR
+
+ ;; For SSE4A support
+ UNSPEC_EXTRQI
+ UNSPEC_EXTRQ
+ UNSPEC_INSERTQI
+ UNSPEC_INSERTQ
+
+ ;; For SSE4.1 support
+ UNSPEC_BLENDV
+ UNSPEC_INSERTPS
+ UNSPEC_DP
+ UNSPEC_MOVNTDQA
+ UNSPEC_MPSADBW
+ UNSPEC_PHMINPOSUW
+ UNSPEC_PTEST
+
+ ;; For SSE4.2 support
+ UNSPEC_PCMPESTR
+ UNSPEC_PCMPISTR
+
+ ;; For FMA4 support
+ UNSPEC_FMADDSUB
+ UNSPEC_XOP_UNSIGNED_CMP
+ UNSPEC_XOP_TRUEFALSE
+ UNSPEC_XOP_PERMUTE
+ UNSPEC_FRCZ
+
+ ;; For AES support
+ UNSPEC_AESENC
+ UNSPEC_AESENCLAST
+ UNSPEC_AESDEC
+ UNSPEC_AESDECLAST
+ UNSPEC_AESIMC
+ UNSPEC_AESKEYGENASSIST
+
+ ;; For PCLMUL support
+ UNSPEC_PCLMUL
+
+ ;; For AVX support
+ UNSPEC_PCMP
+ UNSPEC_VPERMIL
+ UNSPEC_VPERMIL2
+ UNSPEC_VPERMIL2F128
+ UNSPEC_CAST
+ UNSPEC_VTESTP
+ UNSPEC_VCVTPH2PS
+ UNSPEC_VCVTPS2PH
+
+ ;; For AVX2 support
+ UNSPEC_VPERMSI
+ UNSPEC_VPERMDF
+ UNSPEC_VPERMSF
+ UNSPEC_VPERMTI
+ UNSPEC_GATHER
+ UNSPEC_VSIBADDR
+])
+
+(define_c_enum "unspecv" [
+ UNSPECV_LDMXCSR
+ UNSPECV_STMXCSR
+ UNSPECV_CLFLUSH
+ UNSPECV_MONITOR
+ UNSPECV_MWAIT
+ UNSPECV_VZEROALL
+ UNSPECV_VZEROUPPER
+])
+
;; All vector modes including V?TImode, used in move patterns.
(define_mode_iterator V16
[(V32QI "TARGET_AVX") V16QI
@@ -573,15 +652,15 @@
(set_attr "prefix" "maybe_vex")
(set_attr "mode" "<sseinsnmode>")])
-(define_insn "sse2_movntsi"
- [(set (match_operand:SI 0 "memory_operand" "=m")
- (unspec:SI [(match_operand:SI 1 "register_operand" "r")]
- UNSPEC_MOVNT))]
+(define_insn "sse2_movnti<mode>"
+ [(set (match_operand:SWI48 0 "memory_operand" "=m")
+ (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
+ UNSPEC_MOVNT))]
"TARGET_SSE2"
"movnti\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
(set_attr "prefix_data16" "0")
- (set_attr "mode" "V2DF")])
+ (set_attr "mode" "<MODE>")])
(define_insn "<sse>_movnt<mode>"
[(set (match_operand:VF 0 "memory_operand" "=m")
@@ -614,8 +693,9 @@
;; Modes handled by storent patterns.
(define_mode_iterator STORENT_MODE
- [(SI "TARGET_SSE2") (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
- (V2DI "TARGET_SSE2")
+ [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
+ (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
+ (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
(V8SF "TARGET_AVX") V4SF
(V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
@@ -8040,25 +8120,6 @@
(set_attr "prefix" "maybe_vex")
(set_attr "memory" "store")])
-(define_expand "sse_sfence"
- [(set (match_dup 0)
- (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
- "TARGET_SSE || TARGET_3DNOW_A"
-{
- operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (operands[0]) = 1;
-})
-
-(define_insn "*sse_sfence"
- [(set (match_operand:BLK 0 "" "")
- (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
- "TARGET_SSE || TARGET_3DNOW_A"
- "sfence"
- [(set_attr "type" "sse")
- (set_attr "length_address" "0")
- (set_attr "atom_sse_attr" "fence")
- (set_attr "memory" "unknown")])
-
(define_insn "sse2_clflush"
[(unspec_volatile [(match_operand 0 "address_operand" "p")]
UNSPECV_CLFLUSH)]
@@ -8068,43 +8129,6 @@
(set_attr "atom_sse_attr" "fence")
(set_attr "memory" "unknown")])
-(define_expand "sse2_mfence"
- [(set (match_dup 0)
- (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
- "TARGET_SSE2"
-{
- operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (operands[0]) = 1;
-})
-
-(define_insn "*sse2_mfence"
- [(set (match_operand:BLK 0 "" "")
- (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
- "TARGET_64BIT || TARGET_SSE2"
- "mfence"
- [(set_attr "type" "sse")
- (set_attr "length_address" "0")
- (set_attr "atom_sse_attr" "fence")
- (set_attr "memory" "unknown")])
-
-(define_expand "sse2_lfence"
- [(set (match_dup 0)
- (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
- "TARGET_SSE2"
-{
- operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (operands[0]) = 1;
-})
-
-(define_insn "*sse2_lfence"
- [(set (match_operand:BLK 0 "" "")
- (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
- "TARGET_SSE2"
- "lfence"
- [(set_attr "type" "sse")
- (set_attr "length_address" "0")
- (set_attr "atom_sse_attr" "lfence")
- (set_attr "memory" "unknown")])
(define_insn "sse3_mwait"
[(unspec_volatile [(match_operand:SI 0 "register_operand" "a")
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index 0ff17123f27..542d3b87882 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -18,26 +18,79 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_expand "mem_thread_fence"
- [(match_operand:SI 0 "const_int_operand" "")] ;; model
- ""
+(define_c_enum "unspec" [
+ UNSPEC_LFENCE
+ UNSPEC_SFENCE
+ UNSPEC_MFENCE
+ UNSPEC_MOVA ; For __atomic support
+])
+
+(define_c_enum "unspecv" [
+ UNSPECV_CMPXCHG_1
+ UNSPECV_CMPXCHG_2
+ UNSPECV_CMPXCHG_3
+ UNSPECV_CMPXCHG_4
+ UNSPECV_XCHG
+ UNSPECV_LOCK
+])
+
+(define_expand "sse2_lfence"
+ [(set (match_dup 0)
+ (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
+ "TARGET_SSE2"
{
- /* Unless this is a SEQ_CST fence, the i386 memory model is strong
- enough not to require barriers of any kind. */
- if (INTVAL (operands[0]) != MEMMODEL_SEQ_CST)
- DONE;
+ operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[0]) = 1;
+})
- if (TARGET_64BIT || TARGET_SSE2)
- emit_insn (gen_sse2_mfence ());
- else
- {
- rtx mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
- MEM_VOLATILE_P (mem) = 1;
- emit_insn (gen_mfence_nosse (mem));
- }
- DONE;
+(define_insn "*sse2_lfence"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0)] UNSPEC_LFENCE))]
+ "TARGET_SSE2"
+ "lfence"
+ [(set_attr "type" "sse")
+ (set_attr "length_address" "0")
+ (set_attr "atom_sse_attr" "lfence")
+ (set_attr "memory" "unknown")])
+
+(define_expand "sse_sfence"
+ [(set (match_dup 0)
+ (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
+ "TARGET_SSE || TARGET_3DNOW_A"
+{
+ operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[0]) = 1;
})
+(define_insn "*sse_sfence"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0)] UNSPEC_SFENCE))]
+ "TARGET_SSE || TARGET_3DNOW_A"
+ "sfence"
+ [(set_attr "type" "sse")
+ (set_attr "length_address" "0")
+ (set_attr "atom_sse_attr" "fence")
+ (set_attr "memory" "unknown")])
+
+(define_expand "sse2_mfence"
+ [(set (match_dup 0)
+ (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
+ "TARGET_SSE2"
+{
+ operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[0]) = 1;
+})
+
+(define_insn "mfence_sse2"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))]
+ "TARGET_64BIT || TARGET_SSE2"
+ "mfence"
+ [(set_attr "type" "sse")
+ (set_attr "length_address" "0")
+ (set_attr "atom_sse_attr" "fence")
+ (set_attr "memory" "unknown")])
+
(define_insn "mfence_nosse"
[(set (match_operand:BLK 0 "" "")
(unspec:BLK [(match_dup 0)] UNSPEC_MFENCE))
@@ -46,6 +99,30 @@
"lock{%;} or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"
[(set_attr "memory" "unknown")])
+(define_expand "mem_thread_fence"
+ [(match_operand:SI 0 "const_int_operand" "")] ;; model
+ ""
+{
+ /* Unless this is a SEQ_CST fence, the i386 memory model is strong
+ enough not to require barriers of any kind. */
+ if (INTVAL (operands[0]) == MEMMODEL_SEQ_CST)
+ {
+ rtx (*mfence_insn)(rtx);
+ rtx mem;
+
+ if (TARGET_64BIT || TARGET_SSE2)
+ mfence_insn = gen_mfence_sse2;
+ else
+ mfence_insn = gen_mfence_nosse;
+
+ mem = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (mem) = 1;
+
+ emit_insn (mfence_insn (mem));
+ }
+ DONE;
+})
+
;; ??? From volume 3 section 7.1.1 Guaranteed Atomic Operations,
;; Only beginning at Pentium family processors do we get any guarantee of
;; atomicity in aligned 64-bit quantities. Beginning at P6, we get a
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index ff72e28a35c..75e73bda2a1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -11218,9 +11218,13 @@ mips_init_libfuncs (void)
}
/* The MIPS16 ISA does not have an encoding for "sync", so we rely
- on an external non-MIPS16 routine to implement __sync_synchronize. */
+ on an external non-MIPS16 routine to implement __sync_synchronize.
+ Similarly for the rest of the ll/sc libfuncs. */
if (TARGET_MIPS16)
- synchronize_libfunc = init_one_libfunc ("__sync_synchronize");
+ {
+ synchronize_libfunc = init_one_libfunc ("__sync_synchronize");
+ init_sync_libfuncs (UNITS_PER_WORD);
+ }
}
/* Build up a multi-insn sequence that loads label TARGET into $AT. */
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index ccf20b1bcaa..10fa5edbb66 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -109,6 +109,8 @@ extern void sparc_expand_vector_init (rtx, rtx);
extern void sparc_expand_vec_perm_bmask(enum machine_mode, rtx);
extern bool sparc_expand_conditional_move (enum machine_mode, rtx *);
extern void sparc_expand_vcond (enum machine_mode, rtx *, int, int);
+unsigned int sparc_regmode_natural_size (enum machine_mode);
+bool sparc_modes_tieable_p (enum machine_mode, enum machine_mode);
#endif /* RTX_CODE */
#endif /* __SPARC_PROTOS_H__ */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 55759a03bd1..b315698bc94 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -11616,4 +11616,69 @@ sparc_expand_vcond (enum machine_mode mode, rtx *operands, int ccode, int fcode)
emit_insn (gen_rtx_SET (VOIDmode, operands[0], bshuf));
}
+/* On sparc, any mode which naturally allocates into the float
+ registers should return 4 here. */
+
+unsigned int
+sparc_regmode_natural_size (enum machine_mode mode)
+{
+ int size = UNITS_PER_WORD;
+
+ if (TARGET_ARCH64)
+ {
+ enum mode_class mclass = GET_MODE_CLASS (mode);
+
+ if (mclass == MODE_FLOAT || mclass == MODE_VECTOR_INT)
+ size = 4;
+ }
+
+ return size;
+}
+
+/* Return TRUE if it is a good idea to tie two pseudo registers
+ when one has mode MODE1 and one has mode MODE2.
+ If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
+ for any hard reg, then this must be FALSE for correct output.
+
+ For V9 we have to deal with the fact that only the lower 32 floating
+ point registers are 32-bit addressable. */
+
+bool
+sparc_modes_tieable_p (enum machine_mode mode1, enum machine_mode mode2)
+{
+ enum mode_class mclass1, mclass2;
+ unsigned short size1, size2;
+
+ if (mode1 == mode2)
+ return true;
+
+ mclass1 = GET_MODE_CLASS (mode1);
+ mclass2 = GET_MODE_CLASS (mode2);
+ if (mclass1 != mclass2)
+ return false;
+
+ if (! TARGET_V9)
+ return true;
+
+ /* Classes are the same and we are V9 so we have to deal with upper
+ vs. lower floating point registers. If one of the modes is a
+ 4-byte mode, and the other is not, we have to mark them as not
+ tieable because only the lower 32 floating point register are
+ addressable 32-bits at a time.
+
+ We can't just test explicitly for SFmode, otherwise we won't
+ cover the vector mode cases properly. */
+
+ if (mclass1 != MODE_FLOAT && mclass1 != MODE_VECTOR_INT)
+ return true;
+
+ size1 = GET_MODE_SIZE (mode1);
+ size2 = GET_MODE_SIZE (mode2);
+ if ((size1 > 4 && size2 == 4)
+ || (size2 > 4 && size1 == 4))
+ return false;
+
+ return true;
+}
+
#include "gt-sparc.h"
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index e8707f50577..32f8c1074ae 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -716,8 +716,7 @@ extern enum cmodel sparc_cmodel;
/* Due to the ARCH64 discrepancy above we must override this next
macro too. */
-#define REGMODE_NATURAL_SIZE(MODE) \
- ((TARGET_ARCH64 && FLOAT_MODE_P (MODE)) ? 4 : UNITS_PER_WORD)
+#define REGMODE_NATURAL_SIZE(MODE) sparc_regmode_natural_size (MODE)
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
See sparc.c for how we initialize this. */
@@ -735,20 +734,7 @@ extern int sparc_mode_class[];
register window instruction in the prologue. */
#define HARD_REGNO_RENAME_OK(FROM, TO) ((FROM) != 1)
-/* Value is 1 if it is a good idea to tie two pseudo registers
- when one has mode MODE1 and one has mode MODE2.
- If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
- for any hard reg, then this must be 0 for correct output.
-
- For V9: SFmode can't be combined with other float modes, because they can't
- be allocated to the %d registers. Also, DFmode won't fit in odd %f
- registers, but SFmode will. */
-#define MODES_TIEABLE_P(MODE1, MODE2) \
- ((MODE1) == (MODE2) \
- || (GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2) \
- && (! TARGET_V9 \
- || (GET_MODE_CLASS (MODE1) != MODE_FLOAT \
- || (MODE1 != SFmode && MODE2 != SFmode)))))
+#define MODES_TIEABLE_P(MODE1, MODE2) sparc_modes_tieable_p (MODE1, MODE2)
/* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */
diff --git a/gcc/configure b/gcc/configure
index 6bffb8f24ad..2da771427d7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -16312,7 +16312,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -17225,7 +17225,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -17243,7 +17243,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -19109,7 +19109,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -20884,7 +20884,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -20902,7 +20902,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 520652b1e71..65ceba22783 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -657,9 +657,8 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
}
/* Build a coverage variable of TYPE for function FN_DECL. If COUNTER
- >= 0 it is a counter array, and thus local. Otherwise it is the
- function structure and needs to be globalized. All cases must be
- in the same comdat group as FN_DECL. */
+ >= 0 it is a counter array, otherwise it is the function structure.
+ Propagate appropriate linkage and visibility from the function decl. */
static tree
build_var (tree fn_decl, tree type, int counter)
@@ -668,29 +667,29 @@ build_var (tree fn_decl, tree type, int counter)
tree fn_name = DECL_ASSEMBLER_NAME (fn_decl);
char *buf = (char *)alloca (IDENTIFIER_LENGTH (fn_name) + 10);
- if (counter >= 0)
- TREE_STATIC (var) = 1;
- else
- {
- TREE_PUBLIC (var) = TREE_PUBLIC (fn_decl);
- TREE_STATIC (var) = TREE_STATIC (fn_decl);
- }
- TREE_ADDRESSABLE (var) = 1;
- DECL_ALIGN (var) = TYPE_ALIGN (type);
-
if (counter < 0)
sprintf (buf, "__gcov__%s", IDENTIFIER_POINTER (fn_name));
else
sprintf (buf, "__gcov%u_%s", counter, IDENTIFIER_POINTER (fn_name));
DECL_NAME (var) = get_identifier (buf);
-
- /* Initialize assembler name so we can stream out. */
+ TREE_STATIC (var) = 1;
+ TREE_ADDRESSABLE (var) = 1;
+ DECL_ALIGN (var) = TYPE_ALIGN (type);
+ DECL_WEAK (var) = DECL_WEAK (fn_decl);
+ TREE_PUBLIC (var)
+ = TREE_PUBLIC (fn_decl) && (counter < 0 || DECL_WEAK (fn_decl));
+ if (DECL_ONE_ONLY (fn_decl))
+ make_decl_one_only (var, DECL_COMDAT_GROUP (fn_decl));
+
if (TREE_PUBLIC (var))
- DECL_ASSEMBLER_NAME (var);
+ {
+ DECL_VISIBILITY (var) = DECL_VISIBILITY (fn_decl);
+ DECL_VISIBILITY_SPECIFIED (var)
+ = DECL_VISIBILITY_SPECIFIED (fn_decl);
- DECL_WEAK (var) = TREE_PUBLIC (var) && DECL_WEAK (fn_decl);
- DECL_COMDAT (var) = DECL_COMDAT (fn_decl);
- DECL_COMDAT_GROUP (var) = DECL_COMDAT_GROUP (fn_decl);
+ /* Initialize assembler name so we can stream out. */
+ DECL_ASSEMBLER_NAME (var);
+ }
return var;
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c1d347d02bd..867c45c7b8f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,70 @@
+2011-11-22 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51143
+ * parser.c (cp_parser_alias_declaration): Don't allow type
+ definition in templates.
+
+2011-11-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51196
+ * typeck.c (cp_build_binary_op, [case EQ_EXPR]): For targets having
+ TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, do here
+ the -Wzero-as-null-pointer-constant warning for pmf == 0.
+
+2011-11-21 Torvald Riegel <triegel@redhat.com>
+
+ * pt.c (tsubst_copy_and_build): Handle TRANSACTION_EXPR.
+
+2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/50958
+ * parser.c (lookup_literal_operator): New.
+ (cp_parser_userdef_char_literal): Use it.
+ (cp_parser_userdef_numeric_literal): Use it.
+ (cp_parser_userdef_string_literal): Use lookup_name.
+
+2011-11-20 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst_pack_expansion): Fix SFINAE.
+
+ PR c++/48322
+ * cp-tree.h (PACK_EXPANSION_EXTRA_ARGS): New.
+ * cp-tree.def (EXPR_PACK_EXPANSION): Add an operand for it.
+ * pt.c (tsubst_pack_expansion): Set and use it.
+ (iterative_hash_template_arg): Hash it.
+ (template_args_equal): Compare it.
+ (comp_template_args_with_info): Handle nulls.
+ * tree.c (cp_walk_subtrees): Walk it.
+ * typeck.c (structural_comptypes): Compare it.
+ * ptree.c (cxx_print_type): Print it.
+
+ * pt.c (type_unification_real): Set input_location
+ during default arg instantiation.
+
+2011-11-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51230
+ * pt.c (unify_inconsistency): Handle non-type parameters better.
+ * error.c (dump_expr): Handle TEMPLATE_TEMPLATE_PARM.
+
+2011-11-20 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51194
+ * pt.c (lookup_template_class_1): Go out early if the type of the
+ template is error_mark_node.
+
+2011-11-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51216
+ * semantics.c (potential_constant_expression_1): Handle IF_STMT,
+ DO_STMT, FOR_STMT, and WHILE_STMT.
+
+2011-11-18 Fabien Chêne <fabien@gcc.gnu.org>
+
+ PR c++/51188
+ * search.c (lookup_field_1): Handle USING_DECLs for the storted
+ case.
+
2011-11-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51150
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 4eec9f97c7d..5fc5496ef9e 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -419,7 +419,7 @@ DEFTREECODE (TYPE_PACK_EXPANSION, "type_pack_expansion", tcc_type, 0)
EXPR_PACK_EXPANSION plays precisely the same role as TYPE_PACK_EXPANSION,
but will be used for expressions. */
-DEFTREECODE (EXPR_PACK_EXPANSION, "expr_pack_expansion", tcc_expression, 2)
+DEFTREECODE (EXPR_PACK_EXPANSION, "expr_pack_expansion", tcc_expression, 3)
/* Selects the Ith parameter out of an argument pack. This node will
be used when instantiating pack expansions; see
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index fe50e34e7d9..3f4f4081f38 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2813,7 +2813,14 @@ extern void decl_shadowed_for_var_insert (tree, tree);
#define PACK_EXPANSION_PARAMETER_PACKS(NODE) \
*(TREE_CODE (NODE) == EXPR_PACK_EXPANSION \
? &TREE_OPERAND (NODE, 1) \
- : &TREE_CHAIN (TYPE_PACK_EXPANSION_CHECK (NODE)))
+ : &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE)))
+
+/* Any additional template args to be applied when substituting into
+ the pattern, set by tsubst_pack_expansion for partial instantiations. */
+#define PACK_EXPANSION_EXTRA_ARGS(NODE) \
+ *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
+ ? &TYPE_MAXVAL (NODE) \
+ : &TREE_OPERAND ((NODE), 2))
/* Determine if this is an argument pack. */
#define ARGUMENT_PACK_P(NODE) \
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 602cb75236a..4940a783353 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2406,6 +2406,7 @@ dump_expr (tree t, int flags)
break;
case TEMPLATE_TYPE_PARM:
+ case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
dump_type (t, flags);
break;
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 5c20e32a79f..7e9ad54706f 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -598,7 +598,9 @@ perform_member_init (tree member, tree init)
init = digest_init (type, init, tf_warning_or_error);
if (init == error_mark_node)
return;
- /* Use 'this' as the decl, as it has the lifetime we want. */
+ /* A FIELD_DECL doesn't really have a suitable lifetime, but
+ make_temporary_var_for_ref_to_temp will treat it as automatic and
+ set_up_extended_ref_temp wants to use the decl in a warning. */
init = extend_ref_init_temps (member, init, &cleanups);
if (TREE_CODE (type) == ARRAY_TYPE
&& TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)))
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f839112d2a4..d0adaa03c03 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3547,40 +3547,79 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
return value;
}
+/* Look up a literal operator with the name and the exact arguments. */
+
+static tree
+lookup_literal_operator (tree name, VEC(tree,gc) *args)
+{
+ tree decl, fns;
+ decl = lookup_name (name);
+ if (!decl || decl == error_mark_node)
+ return error_mark_node;
+
+ for (fns = decl; fns; fns = OVL_NEXT (fns))
+ {
+ unsigned int ix;
+ bool found = true;
+ tree fn = OVL_CURRENT (fns);
+ tree argtypes = NULL_TREE;
+ argtypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ if (argtypes != NULL_TREE)
+ {
+ for (ix = 0; ix < VEC_length (tree, args) && argtypes != NULL_TREE;
+ ++ix, argtypes = TREE_CHAIN (argtypes))
+ {
+ tree targ = TREE_VALUE (argtypes);
+ tree tparm = TREE_TYPE (VEC_index (tree, args, ix));
+ bool ptr = TREE_CODE (targ) == POINTER_TYPE;
+ bool arr = TREE_CODE (tparm) == ARRAY_TYPE;
+ if ((ptr || arr || !same_type_p (targ, tparm))
+ && (!ptr || !arr
+ || !same_type_p (TREE_TYPE (targ),
+ TREE_TYPE (tparm))))
+ found = false;
+ }
+ if (found)
+ return fn;
+ }
+ }
+
+ return error_mark_node;
+}
+
/* Parse a user-defined char constant. Returns a call to a user-defined
literal operator taking the character as an argument. */
static tree
cp_parser_userdef_char_literal (cp_parser *parser)
{
- cp_token *token = NULL;
- tree literal, suffix_id, value;
- tree name, decl;
- tree result;
- VEC(tree,gc) *vec;
-
- token = cp_lexer_consume_token (parser->lexer);
- literal = token->u.value;
- suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
- value = USERDEF_LITERAL_VALUE (literal);
- name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
+ cp_token *token = cp_lexer_consume_token (parser->lexer);
+ tree literal = token->u.value;
+ tree suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
+ tree value = USERDEF_LITERAL_VALUE (literal);
+ tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
+ tree decl, result;
/* Build up a call to the user-defined operator */
/* Lookup the name we got back from the id-expression. */
- vec = make_tree_vector ();
- VEC_safe_push (tree, gc, vec, value);
- decl = lookup_function_nonclass (name, vec, /*block_p=*/false);
+ VEC(tree,gc) *args = make_tree_vector ();
+ VEC_safe_push (tree, gc, args, value);
+ decl = lookup_literal_operator (name, args);
if (!decl || decl == error_mark_node)
{
- error ("unable to find user-defined character literal operator %qD",
- name);
- release_tree_vector (vec);
+ error ("unable to find character literal operator %qD with %qT argument",
+ name, TREE_TYPE (value));
+ release_tree_vector (args);
return error_mark_node;
}
- result = finish_call_expr (decl, &vec, false, true, tf_warning_or_error);
- release_tree_vector (vec);
+ result = finish_call_expr (decl, &args, false, true, tf_warning_or_error);
+ release_tree_vector (args);
+ if (result != error_mark_node)
+ return result;
- return result;
+ error ("unable to find character literal operator %qD with %qT argument",
+ name, TREE_TYPE (value));
+ return error_mark_node;
}
/* A subroutine of cp_parser_userdef_numeric_literal to
@@ -3615,26 +3654,20 @@ make_char_string_pack (tree value)
static tree
cp_parser_userdef_numeric_literal (cp_parser *parser)
{
- cp_token *token = NULL;
- tree literal, suffix_id, value, num_string;
- tree name, decl;
- tree result = error_mark_node;
+ cp_token *token = cp_lexer_consume_token (parser->lexer);
+ tree literal = token->u.value;
+ tree suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
+ tree value = USERDEF_LITERAL_VALUE (literal);
+ tree num_string = USERDEF_LITERAL_NUM_STRING (literal);
+ tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
+ tree decl, result;
VEC(tree,gc) *args;
- token = cp_lexer_consume_token (parser->lexer);
- literal = token->u.value;
- suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
- value = USERDEF_LITERAL_VALUE (literal);
- num_string = USERDEF_LITERAL_NUM_STRING (literal);
- name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
-
- /* Build up a call to the user-defined operator */
- /* Lookup the name we got back from the id-expression. */
- /* Try to find the literal operator by finishing the call expression
- with the numeric argument. */
+ /* Look for a literal operator taking the exact type of numeric argument
+ as the literal value. */
args = make_tree_vector ();
VEC_safe_push (tree, gc, args, value);
- decl = lookup_function_nonclass (name, args, /*block_p=*/false);
+ decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
{
result = finish_call_expr (decl, &args, false, true, tf_none);
@@ -3651,7 +3684,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
in string format. */
args = make_tree_vector ();
VEC_safe_push (tree, gc, args, num_string);
- decl = lookup_function_nonclass (name, args, /*block_p=*/false);
+ decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
{
result = finish_call_expr (decl, &args, false, true, tf_none);
@@ -3667,7 +3700,7 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
function with parameter pack char.... Call the function with
template parameter characters representing the number. */
args = make_tree_vector ();
- decl = lookup_function_nonclass (name, args, /*block_p=*/false);
+ decl = lookup_literal_operator (name, args);
if (decl && decl != error_mark_node)
{
tree tmpl_args = make_char_string_pack (num_string);
@@ -3681,10 +3714,8 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
}
release_tree_vector (args);
- if (result == error_mark_node)
- error ("unable to find user-defined numeric literal operator %qD", name);
-
- return result;
+ error ("unable to find numeric literal operator %qD", name);
+ return error_mark_node;
}
/* Parse a user-defined string constant. Returns a call to a user-defined
@@ -3694,38 +3725,34 @@ cp_parser_userdef_numeric_literal (cp_parser *parser)
static tree
cp_parser_userdef_string_literal (cp_token *token)
{
- tree literal, suffix_id, value;
- tree name, decl;
- tree result;
- VEC(tree,gc) *vec;
- int len;
-
- literal = token->u.value;
- suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
- name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
- value = USERDEF_LITERAL_VALUE (literal);
- len = TREE_STRING_LENGTH (value)
+ tree literal = token->u.value;
+ tree suffix_id = USERDEF_LITERAL_SUFFIX_ID (literal);
+ tree name = cp_literal_operator_id (IDENTIFIER_POINTER (suffix_id));
+ tree value = USERDEF_LITERAL_VALUE (literal);
+ int len = TREE_STRING_LENGTH (value)
/ TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (value)))) - 1;
+ tree decl, result;
+
/* Build up a call to the user-defined operator */
/* Lookup the name we got back from the id-expression. */
- vec = make_tree_vector ();
- VEC_safe_push (tree, gc, vec, value);
- VEC_safe_push (tree, gc, vec, build_int_cst (size_type_node, len));
- decl = lookup_function_nonclass (name, vec, /*block_p=*/false);
+ VEC(tree,gc) *args = make_tree_vector ();
+ VEC_safe_push (tree, gc, args, value);
+ VEC_safe_push (tree, gc, args, build_int_cst (size_type_node, len));
+ decl = lookup_name (name);
if (!decl || decl == error_mark_node)
{
- error ("unable to find user-defined string literal operator %qD", name);
- release_tree_vector (vec);
+ error ("unable to find string literal operator %qD", name);
+ release_tree_vector (args);
return error_mark_node;
}
- result = finish_call_expr (decl, &vec, false, true, tf_none);
- if (result == error_mark_node)
- error ("unable to find valid user-defined string literal operator %qD."
- " Possible missing length argument in string literal operator.",
- name);
- release_tree_vector (vec);
+ result = finish_call_expr (decl, &args, false, true, tf_none);
+ release_tree_vector (args);
+ if (result != error_mark_node)
+ return result;
- return result;
+ error ("unable to find string literal operator %qD with %qT, %qT arguments",
+ name, TREE_TYPE (value), size_type_node);
+ return error_mark_node;
}
@@ -14940,6 +14967,7 @@ cp_parser_alias_declaration (cp_parser* parser)
cp_declarator *declarator;
cp_decl_specifier_seq decl_specs;
bool member_p;
+ const char *saved_message = NULL;
/* Look for the `using' keyword. */
cp_parser_require_keyword (parser, RID_USING, RT_USING);
@@ -14948,7 +14976,35 @@ cp_parser_alias_declaration (cp_parser* parser)
attributes = cp_parser_attributes_opt (parser);
cp_parser_require (parser, CPP_EQ, RT_EQ);
+ /* Now we are going to parse the type-id of the declaration. */
+
+ /*
+ [dcl.type]/3 says:
+
+ "A type-specifier-seq shall not define a class or enumeration
+ unless it appears in the type-id of an alias-declaration (7.1.3) that
+ is not the declaration of a template-declaration."
+
+ In other words, if we currently are in an alias template, the
+ type-id should not define a type.
+
+ So let's set parser->type_definition_forbidden_message in that
+ case; cp_parser_check_type_definition (called by
+ cp_parser_class_specifier) will then emit an error if a type is
+ defined in the type-id. */
+ if (parser->num_template_parameter_lists)
+ {
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message =
+ G_("types may not be defined in alias template declarations");
+ }
+
type = cp_parser_type_id (parser);
+
+ /* Restore the error message if need be. */
+ if (parser->num_template_parameter_lists)
+ parser->type_definition_forbidden_message = saved_message;
+
cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
if (cp_parser_error_occurred (parser))
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 987b70b7ba4..f817b6ffab6 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1534,7 +1534,8 @@ iterative_hash_template_arg (tree arg, hashval_t val)
case TYPE_PACK_EXPANSION:
case EXPR_PACK_EXPANSION:
- return iterative_hash_template_arg (PACK_EXPANSION_PATTERN (arg), val);
+ val = iterative_hash_template_arg (PACK_EXPANSION_PATTERN (arg), val);
+ return iterative_hash_template_arg (PACK_EXPANSION_EXTRA_ARGS (arg), val);
case TYPE_ARGUMENT_PACK:
case NONTYPE_ARGUMENT_PACK:
@@ -5501,7 +5502,7 @@ unify_inconsistency (bool explain_p, tree parm, tree first, tree second)
{
if (explain_p)
inform (input_location,
- " deduced conflicting types for parameter %qT (%qT and %qT)",
+ " conflicting deductions for parameter %qE (%qE and %qE)",
parm, first, second);
return 1;
}
@@ -6902,9 +6903,11 @@ template_args_equal (tree ot, tree nt)
/* For member templates */
return TREE_CODE (ot) == TREE_VEC && comp_template_args (ot, nt);
else if (PACK_EXPANSION_P (ot))
- return PACK_EXPANSION_P (nt)
- && template_args_equal (PACK_EXPANSION_PATTERN (ot),
- PACK_EXPANSION_PATTERN (nt));
+ return (PACK_EXPANSION_P (nt)
+ && template_args_equal (PACK_EXPANSION_PATTERN (ot),
+ PACK_EXPANSION_PATTERN (nt))
+ && template_args_equal (PACK_EXPANSION_EXTRA_ARGS (ot),
+ PACK_EXPANSION_EXTRA_ARGS (nt)));
else if (ARGUMENT_PACK_P (ot))
{
int i, len;
@@ -6954,6 +6957,12 @@ comp_template_args_with_info (tree oldargs, tree newargs,
{
int i;
+ if (oldargs == newargs)
+ return 1;
+
+ if (!oldargs || !newargs)
+ return 0;
+
if (TREE_VEC_LENGTH (oldargs) != TREE_VEC_LENGTH (newargs))
return 0;
@@ -7270,6 +7279,12 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
int is_dependent_type;
int use_partial_inst_tmpl = false;
+ if (template_type == error_mark_node)
+ /* An error occured while building the template TEMPL, and a
+ diagnostic has most certainly been emitted for that
+ already. Let's propagate that error. */
+ return error_mark_node;
+
gen_tmpl = most_general_template (templ);
parmlist = DECL_TEMPLATE_PARMS (gen_tmpl);
parm_depth = TMPL_PARMS_DEPTH (parmlist);
@@ -9235,13 +9250,21 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
tree pattern;
tree pack, packs = NULL_TREE;
bool unsubstituted_packs = false;
+ bool real_packs = false;
+ int missing_level = 0;
int i, len = -1;
tree result;
htab_t saved_local_specializations = NULL;
+ int levels;
gcc_assert (PACK_EXPANSION_P (t));
pattern = PACK_EXPANSION_PATTERN (t);
+ /* Add in any args remembered from an earlier partial instantiation. */
+ args = add_to_template_args (PACK_EXPANSION_EXTRA_ARGS (t), args);
+
+ levels = TMPL_ARGS_DEPTH (args);
+
/* Determine the argument packs that will instantiate the parameter
packs used in the expansion expression. While we're at it,
compute the number of arguments to be expanded and make sure it
@@ -9252,6 +9275,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
tree parm_pack = TREE_VALUE (pack);
tree arg_pack = NULL_TREE;
tree orig_arg = NULL_TREE;
+ int level = 0;
if (TREE_CODE (parm_pack) == BASES)
{
@@ -9284,10 +9308,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
}
else
{
- int level, idx, levels;
+ int idx;
template_parm_level_and_index (parm_pack, &level, &idx);
- levels = TMPL_ARGS_DEPTH (args);
if (level <= levels)
arg_pack = TMPL_ARG (args, level, idx);
}
@@ -9327,7 +9350,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
len = my_len;
else if (len != my_len)
{
- if (TREE_CODE (t) == TYPE_PACK_EXPANSION)
+ if (!(complain & tf_error))
+ /* Fail quietly. */;
+ else if (TREE_CODE (t) == TYPE_PACK_EXPANSION)
error ("mismatched argument pack lengths while expanding "
"%<%T%>",
pattern);
@@ -9338,6 +9363,13 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
return error_mark_node;
}
+ if (TREE_VEC_LENGTH (ARGUMENT_PACK_ARGS (arg_pack)) == 1
+ && PACK_EXPANSION_P (TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack),
+ 0)))
+ /* This isn't a real argument pack yet. */;
+ else
+ real_packs = true;
+
/* Keep track of the parameter packs and their corresponding
argument packs. */
packs = tree_cons (parm_pack, arg_pack, packs);
@@ -9345,25 +9377,57 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
}
else
{
- /* We can't substitute for this parameter pack. */
+ /* We can't substitute for this parameter pack. We use a flag as
+ well as the missing_level counter because function parameter
+ packs don't have a level. */
unsubstituted_packs = true;
- break;
+ if (!missing_level || missing_level > level)
+ missing_level = level;
}
}
/* We cannot expand this expansion expression, because we don't have
- all of the argument packs we need. Substitute into the pattern
- and return a PACK_EXPANSION_*. The caller will need to deal with
- that. */
+ all of the argument packs we need. */
if (unsubstituted_packs)
{
- tree new_pat;
- if (TREE_CODE (t) == EXPR_PACK_EXPANSION)
- new_pat = tsubst_expr (pattern, args, complain, in_decl,
- /*integral_constant_expression_p=*/false);
+ if (real_packs)
+ {
+ /* We got some full packs, but we can't substitute them in until we
+ have values for all the packs. So remember these until then. */
+ tree save_args;
+
+ t = make_pack_expansion (pattern);
+
+ /* The call to add_to_template_args above assumes no overlap
+ between saved args and new args, so prune away any fake
+ args, i.e. those that satisfied arg_from_parm_pack_p above. */
+ if (missing_level && levels >= missing_level)
+ {
+ gcc_assert (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args)
+ && missing_level > 1);
+ TREE_VEC_LENGTH (args) = missing_level - 1;
+ save_args = copy_node (args);
+ TREE_VEC_LENGTH (args) = levels;
+ }
+ else
+ save_args = args;
+
+ PACK_EXPANSION_EXTRA_ARGS (t) = save_args;
+ }
else
- new_pat = tsubst (pattern, args, complain, in_decl);
- return make_pack_expansion (new_pat);
+ {
+ /* There were no real arguments, we're just replacing a parameter
+ pack with another version of itself. Substitute into the
+ pattern and return a PACK_EXPANSION_*. The caller will need to
+ deal with that. */
+ if (TREE_CODE (t) == EXPR_PACK_EXPANSION)
+ t = tsubst_expr (pattern, args, complain, in_decl,
+ /*integral_constant_expression_p=*/false);
+ else
+ t = tsubst (pattern, args, complain, in_decl);
+ t = make_pack_expansion (t);
+ }
+ return t;
}
/* We could not find any argument packs that work. */
@@ -14226,6 +14290,10 @@ tsubst_copy_and_build (tree t,
return r;
}
+ case TRANSACTION_EXPR:
+ return tsubst_expr(t, args, complain, in_decl,
+ integral_constant_expression_p);
+
default:
/* Handle Objective-C++ constructs, if appropriate. */
{
@@ -15212,9 +15280,13 @@ type_unification_real (tree tparms,
{
tree parm = TREE_VALUE (TREE_VEC_ELT (tparms, i));
tree arg = TREE_PURPOSE (TREE_VEC_ELT (tparms, i));
+ location_t save_loc = input_location;
+ if (DECL_P (parm))
+ input_location = DECL_SOURCE_LOCATION (parm);
arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
arg = convert_template_argument (parm, arg, targs, complain,
i, NULL_TREE);
+ input_location = save_loc;
if (arg == error_mark_node)
return 1;
else
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index fb05e136045..a66e695c1f7 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -104,6 +104,10 @@ cxx_print_type (FILE *file, tree node, int indent)
indent + 4);
return;
+ case TYPE_PACK_EXPANSION:
+ print_node (file, "args", PACK_EXPANSION_EXTRA_ARGS (node), indent + 4);
+ return;
+
default:
return;
}
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 9f308e29d79..3894c685884 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -436,6 +436,14 @@ lookup_field_1 (tree type, tree name, bool want_type)
field = fields[i++];
while (i < hi && DECL_NAME (fields[i]) == name);
}
+
+ if (field)
+ {
+ field = strip_using_decl (field);
+ if (is_overloaded_fn (field))
+ field = NULL_TREE;
+ }
+
return field;
}
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index f70bdb377b5..fe685fa1527 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -8178,6 +8178,10 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
case EXPR_STMT:
case BIND_EXPR:
case TRANSACTION_EXPR:
+ case IF_STMT:
+ case DO_STMT:
+ case FOR_STMT:
+ case WHILE_STMT:
if (flags & tf_error)
error ("expression %qE is not a constant-expression", t);
return false;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 841029f3385..d206fd2ec24 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2993,11 +2993,13 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
case TYPE_PACK_EXPANSION:
WALK_SUBTREE (TREE_TYPE (*tp));
+ WALK_SUBTREE (PACK_EXPANSION_EXTRA_ARGS (*tp));
*walk_subtrees_p = 0;
break;
case EXPR_PACK_EXPANSION:
WALK_SUBTREE (TREE_OPERAND (*tp, 0));
+ WALK_SUBTREE (PACK_EXPANSION_EXTRA_ARGS (*tp));
*walk_subtrees_p = 0;
break;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b8d4c10c8ca..9a5365c612c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1329,8 +1329,10 @@ structural_comptypes (tree t1, tree t2, int strict)
break;
case TYPE_PACK_EXPANSION:
- return same_type_p (PACK_EXPANSION_PATTERN (t1),
- PACK_EXPANSION_PATTERN (t2));
+ return (same_type_p (PACK_EXPANSION_PATTERN (t1),
+ PACK_EXPANSION_PATTERN (t2))
+ && comp_template_args (PACK_EXPANSION_EXTRA_ARGS (t1),
+ PACK_EXPANSION_EXTRA_ARGS (t2)));
case DECLTYPE_TYPE:
if (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t1)
@@ -4054,6 +4056,13 @@ cp_build_binary_op (location_t location,
delta0,
integer_one_node,
complain);
+
+ if ((complain & tf_warning)
+ && c_inhibit_evaluation_warnings == 0
+ && !NULLPTR_TYPE_P (TREE_TYPE (op1)))
+ warning (OPT_Wzero_as_null_pointer_constant,
+ "zero as null pointer constant");
+
e2 = cp_build_binary_op (location,
EQ_EXPR, e2, integer_zero_node,
complain);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 15238c1b39e..de483a3d354 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -9384,6 +9384,7 @@ v2df __builtin_ia32_loadlpd (v2df, double const *)
int __builtin_ia32_movmskpd (v2df)
int __builtin_ia32_pmovmskb128 (v16qi)
void __builtin_ia32_movnti (int *, int)
+void __builtin_ia32_movnti64 (long long int *, long long int)
void __builtin_ia32_movntpd (double *, v2df)
void __builtin_ia32_movntdq (v2df *, v2df)
v4si __builtin_ia32_pshufd (v4si, int)
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1daddb865e4..46c5824cc71 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1298,8 +1298,7 @@ experimental option which may become the default in a later release.
@item --enable-build-poststage1-with-cxx
When bootstrapping, build stages 2 and 3 of GCC using a C++ compiler
rather than a C compiler. Stage 1 is still built with a C compiler.
-This is an experimental option which may become the default in a later
-release. This is enabled by default and may be disabled using
+This is enabled by default and may be disabled using
@option{--disable-build-poststage1-with-cxx}.
@item --enable-maintainer-mode
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 10fd876fd09..c079ce29b7e 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -7090,6 +7090,10 @@ section names for mergeable constant data. Define this macro to override
the string if a different section name should be used.
@end deftypevr
+@deftypefn {Target Hook} {section *} TARGET_ASM_TM_CLONE_TABLE_SECTION (void)
+Return the section that should be used for transactional memory clone tables.
+@end deftypefn
+
@deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
Return the section into which a constant @var{x}, of mode @var{mode},
should be placed. You can assume that @var{x} is some kind of
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index cebeb1fa777..d03d7f656a2 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7013,6 +7013,8 @@ otherwise.
@hook TARGET_ASM_MERGEABLE_RODATA_PREFIX
+@hook TARGET_ASM_TM_CLONE_TABLE_SECTION
+
@hook TARGET_ASM_SELECT_RTX_SECTION
Return the section into which a constant @var{x}, of mode @var{mode},
should be placed. You can assume that @var{x} is some kind of
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 6a9da64e37c..b3e6d6d1816 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -543,8 +543,7 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
is not allowed. */
fieldmode = GET_MODE (value);
if (fieldmode == VOIDmode)
- fieldmode = smallest_mode_for_size (nwords *
- BITS_PER_WORD, MODE_INT);
+ fieldmode = smallest_mode_for_size (nwords * BITS_PER_WORD, MODE_INT);
last = get_last_insn ();
for (i = 0; i < nwords; i++)
@@ -558,18 +557,9 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
0)
: (int) i * BITS_PER_WORD);
rtx value_word = operand_subword_force (value, wordnum, fieldmode);
- unsigned HOST_WIDE_INT new_bitsize =
- MIN (BITS_PER_WORD, bitsize - i * BITS_PER_WORD);
-
- /* If the remaining chunk doesn't have full wordsize we have
- to make sure that for big endian machines the higher order
- bits are used. */
- if (new_bitsize < BITS_PER_WORD && BYTES_BIG_ENDIAN)
- value_word = extract_bit_field (value_word, new_bitsize, 0,
- true, false, NULL_RTX,
- BLKmode, word_mode);
-
- if (!store_bit_field_1 (op0, new_bitsize,
+
+ if (!store_bit_field_1 (op0, MIN (BITS_PER_WORD,
+ bitsize - i * BITS_PER_WORD),
bitnum + bit_offset,
bitregion_start, bitregion_end,
word_mode,
diff --git a/gcc/expr.c b/gcc/expr.c
index 84cfe5c23ee..8d3a0f671a8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9740,11 +9740,16 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& modifier != EXPAND_CONST_ADDRESS
&& modifier != EXPAND_INITIALIZER)
/* If the field is volatile, we always want an aligned
- access. Only do this if the access is not already naturally
+ access. Do this in following two situations:
+ 1. the access is not already naturally
aligned, otherwise "normal" (non-bitfield) volatile fields
- become non-addressable. */
+ become non-addressable.
+ 2. the bitsize is narrower than the access size. Need
+ to extract bitfields from the access. */
|| (volatilep && flag_strict_volatile_bitfields > 0
- && (bitpos % GET_MODE_ALIGNMENT (mode) != 0))
+ && (bitpos % GET_MODE_ALIGNMENT (mode) != 0
+ || (mode1 != BLKmode
+ && bitsize < GET_MODE_SIZE (mode1) * BITS_PER_UNIT)))
/* If the field isn't aligned enough to fetch as a memref,
fetch it as a bit field. */
|| (mode1 != BLKmode
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e590377265e..8f31a5fdb0e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13483,10 +13483,12 @@ fold_binary_loc (location_t loc,
sel[i] = i * 2 + 1;
break;
case VEC_INTERLEAVE_HIGH_EXPR:
- sel[i] = (i + nelts) / 2 + ((i & 1) ? nelts : 0);
+ sel[i] = (i + (BYTES_BIG_ENDIAN ? 0 : nelts)) / 2
+ + ((i & 1) ? nelts : 0);
break;
case VEC_INTERLEAVE_LOW_EXPR:
- sel[i] = i / 2 + ((i & 1) ? nelts : 0);
+ sel[i] = (i + (BYTES_BIG_ENDIAN ? nelts : 0)) / 2
+ + ((i & 1) ? nelts : 0);
break;
default:
gcc_unreachable ();
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index cd452ab557f..83974b51ca0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,17 @@
+2011-11-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51207
+ * class.c (gfc_find_derived_vtab): Mark __def_init as PARAMETER
+ and hence as TREE_READONLY; add subroutine attribute to
+ __copy_ procedure.
+
+ PR fortran/50640
+ * trans.h (GFC_DECL_PUSH_TOPLEVEL): New DECL_LANG_FLAG_7.
+ * trans-decl.c (gfc_get_symbol_decl): Mark __def_init and vtab as
+ GFC_DECL_PUSH_TOPLEVEL.
+ (gfc_generate_function_code): If GFC_DECL_PUSH_TOPLEVEL, push it there.
+ (build_function_decl): Push __copy_ procedure to the toplevel.
+
2011-11-16 Tobias Burnus <burnus@net-b.de>
PR fortran/39427
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index dc76ad158bb..bcb2d0b76bc 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -522,7 +522,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
def_init->attr.target = 1;
def_init->attr.save = SAVE_IMPLICIT;
def_init->attr.access = ACCESS_PUBLIC;
- def_init->attr.flavor = FL_VARIABLE;
+ def_init->attr.flavor = FL_PARAMETER;
gfc_set_sym_referenced (def_init);
def_init->ts.type = BT_DERIVED;
def_init->ts.u.derived = derived;
@@ -552,6 +552,7 @@ gfc_find_derived_vtab (gfc_symbol *derived)
gfc_get_symbol (name, sub_ns, &copy);
sub_ns->proc_name = copy;
copy->attr.flavor = FL_PROCEDURE;
+ copy->attr.subroutine = 1;
copy->attr.if_source = IFSRC_DECL;
if (ns->proc_name->attr.flavor == FL_MODULE)
copy->module = ns->proc_name->name;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 02c0ed71802..fc8a9ed4e4b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1471,6 +1471,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
&& !sym->attr.proc_pointer)
DECL_BY_REFERENCE (decl) = 1;
+ if (sym->attr.vtab
+ || (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0))
+ GFC_DECL_PUSH_TOPLEVEL (decl) = 1;
+
return decl;
}
@@ -1891,7 +1895,8 @@ build_function_decl (gfc_symbol * sym, bool global)
/* Layout the function declaration and put it in the binding level
of the current function. */
- if (global)
+ if (global
+ || (sym->name[0] == '_' && strncmp ("__copy", sym->name, 6) == 0))
pushdecl_top_level (fndecl);
else
pushdecl (fndecl);
@@ -5316,7 +5321,10 @@ gfc_generate_function_code (gfc_namespace * ns)
next = DECL_CHAIN (decl);
DECL_CHAIN (decl) = NULL_TREE;
- pushdecl (decl);
+ if (GFC_DECL_PUSH_TOPLEVEL (decl))
+ pushdecl_top_level (decl);
+ else
+ pushdecl (decl);
decl = next;
}
saved_function_decls = NULL_TREE;
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 22033d38d15..8fc7599473d 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -802,6 +802,7 @@ struct GTY((variable_size)) lang_decl {
#define GFC_DECL_CRAY_POINTEE(node) DECL_LANG_FLAG_4(node)
#define GFC_DECL_RESULT(node) DECL_LANG_FLAG_5(node)
#define GFC_DECL_SUBREF_ARRAY_P(node) DECL_LANG_FLAG_6(node)
+#define GFC_DECL_PUSH_TOPLEVEL(node) DECL_LANG_FLAG_7(node)
/* An array descriptor. */
#define GFC_DESCRIPTOR_TYPE_P(node) TYPE_LANG_FLAG_1(node)
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 862c5b08e3a..1facb3296f6 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -238,6 +238,10 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
case GIMPLE_PREDICT:
break;
+ case GIMPLE_TRANSACTION:
+ gimple_transaction_set_label (stmt, stream_read_tree (ib, data_in));
+ break;
+
default:
internal_error ("bytecode stream: unknown GIMPLE statement tag %s",
lto_tag_name (tag));
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 78ed2815dde..a7e73fa8db2 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -151,6 +151,11 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
case GIMPLE_PREDICT:
break;
+ case GIMPLE_TRANSACTION:
+ gcc_assert (gimple_transaction_body (stmt) == NULL);
+ stream_write_tree (ob, gimple_transaction_label (stmt), true);
+ break;
+
default:
gcc_unreachable ();
}
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 98ae19b4aab..44a204977c0 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -522,6 +522,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->frequency, 2);
bp_pack_value (&bp, node->only_called_at_startup, 1);
bp_pack_value (&bp, node->only_called_at_exit, 1);
+ bp_pack_value (&bp, node->tm_clone, 1);
bp_pack_value (&bp, node->thunk.thunk_p && !boundary_p, 1);
bp_pack_enum (&bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN, node->resolution);
@@ -928,6 +929,7 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
node->only_called_at_startup = bp_unpack_value (bp, 1);
node->only_called_at_exit = bp_unpack_value (bp, 1);
+ node->tm_clone = bp_unpack_value (bp, 1);
node->thunk.thunk_p = bp_unpack_value (bp, 1);
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index d8bbd9ca8dd..af849540ea8 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * lto-lang.c (lto_attribute_table): Handle transaction_pure.
+ (handle_transaction_pure_attribute): New.
+
2011-11-03 Richard Guenther <rguenther@suse.de>
PR lto/44965
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index c702b9a2d24..2536f26ebf0 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -46,6 +46,7 @@ static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
+static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_format_attribute (tree *, tree, tree, int, bool *);
static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
@@ -75,6 +76,8 @@ const struct attribute_spec lto_attribute_table[] =
handle_sentinel_attribute, false },
{ "type generic", 0, 0, false, true, true,
handle_type_generic_attribute, false },
+ { "transaction_pure", 0, 0, false, true, true,
+ handle_transaction_pure_attribute, false },
{ NULL, 0, 0, false, false, false, NULL, false }
};
@@ -402,6 +405,20 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
return NULL_TREE;
}
+/* Handle a "transaction_pure" attribute. */
+
+static tree
+handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags),
+ bool * ARG_UNUSED (no_add_attrs))
+{
+ /* Ensure we have a function type. */
+ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
+
+ return NULL_TREE;
+}
+
/* Handle a "format" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 2468efd273b..647805b3923 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -6932,9 +6932,9 @@ can_vec_perm_for_code_p (enum tree_code code, enum machine_mode mode,
break;
case VEC_INTERLEAVE_HIGH_EXPR:
- alt = nelt / 2;
- /* FALLTHRU */
case VEC_INTERLEAVE_LOW_EXPR:
+ if ((BYTES_BIG_ENDIAN != 0) ^ (code == VEC_INTERLEAVE_HIGH_EXPR))
+ alt = nelt / 2;
for (i = 0; i < nelt / 2; ++i)
{
data[i * 2] = i + alt;
diff --git a/gcc/opts.c b/gcc/opts.c
index 9fdb22631d0..3153fe50274 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -784,8 +784,6 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
#endif
if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
- if (opts->x_flag_tm)
- error_at (loc, "LTO is currently not supported with transactional memory");
}
if ((opts->x_flag_lto_partition_balanced != 0) + (opts->x_flag_lto_partition_1to1 != 0)
+ (opts->x_flag_lto_partition_none != 0) >= 1)
diff --git a/gcc/output.h b/gcc/output.h
index 2cabaaa4499..bc8c9d97825 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -638,6 +638,7 @@ extern section *default_elf_select_section (tree, int, unsigned HOST_WIDE_INT);
extern void default_unique_section (tree, int);
extern section *default_function_rodata_section (tree);
extern section *default_no_function_rodata_section (tree);
+extern section *default_clone_table_section (void);
extern section *default_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
extern section *default_elf_select_rtx_section (enum machine_mode, rtx,
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 886d024926c..5c189129445 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1312,11 +1312,21 @@ reload_combine (void)
is and then later disable any optimization that would cross it. */
if (LABEL_P (insn))
last_label_ruid = reload_combine_ruid;
- else if (BARRIER_P (insn)
- || (INSN_P (insn) && volatile_insn_p (PATTERN (insn))))
- for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
- if (! fixed_regs[r])
+ else if (BARRIER_P (insn))
+ {
+ /* Crossing a barrier resets all the use information. */
+ for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+ if (! fixed_regs[r])
reg_state[r].use_index = RELOAD_COMBINE_MAX_USES;
+ }
+ else if (INSN_P (insn) && volatile_insn_p (PATTERN (insn)))
+ /* Optimizations across insns being marked as volatile must be
+ prevented. All the usage information is invalidated
+ here. */
+ for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
+ if (! fixed_regs[r]
+ && reg_state[r].use_index != RELOAD_COMBINE_MAX_USES)
+ reg_state[r].use_index = -1;
if (! NONDEBUG_INSN_P (insn))
continue;
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 40d73a76a71..0b90550add5 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -3600,9 +3600,11 @@ relax_delay_slots (rtx first)
}
}
+ /* See if we have a simple (conditional) jump that is useless. */
if (! INSN_ANNULLED_BRANCH_P (delay_insn)
- && prev_active_insn (target_label) == insn
&& ! condjump_in_parallel_p (delay_insn)
+ && prev_active_insn (target_label) == insn
+ && ! BARRIER_P (prev_nonnote_insn (target_label))
#ifdef HAVE_cc0
/* If the last insn in the delay slot sets CC0 for some insn,
various code assumes that it is in a delay slot. We could
diff --git a/gcc/target.def b/gcc/target.def
index 62bd06e976f..f5a5d54904a 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -305,6 +305,13 @@ section names for mergeable constant data. Define this macro to override\n\
the string if a different section name should be used.",
const char *, ".rodata")
+/* Return the section to be used for transactional memory clone tables. */
+DEFHOOK
+(tm_clone_table_section,
+ "Return the section that should be used for transactional memory clone\
+ tables.",
+ section *, (void), default_clone_table_section)
+
/* Output a constructor for a symbol with a given priority. */
DEFHOOK
(constructor,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b22ebc6c861..c21ee616c75 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,145 @@
+2011-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51074
+ * gcc.dg/vect/pr51074.c: New test.
+
+2011-11-22 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51143
+ * g++.dg/cpp0x/alias-decl-16.C: New test.
+
+2011-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/50765
+ * gcc.dg/pr50765.c: New test.
+
+2011-11-22 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+
+ * gcc.dg/vshift-1.c (main): Call rand instead of random.
+ * gcc.dg/vshift-3.c (main): Likewise.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * gcc.dg/tm/20100615.c: Adjust for Darwin tm_clone_table section name.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * gcc.misc-tests/gcov-16.c: Adjust scan-assembler for Darwin.
+ * gcc.misc-tests/gcov-17.c: Likewise.
+ * g++.dg/gcov/gcov-8.C: Likewise.
+ * g++.dg/gcov/gcov-9.C: Likewise.
+
+2011-11-21 Torvald Riegel <triegel@redhat.com>
+
+ * g++.dg/tm/pr47747.C: New test.
+
+2011-11-21 Torvald Riegel <triegel@redhat.com>
+
+ * g++.dg/tm/template-2.C: New test.
+
+2011-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/50827
+ * gcc.dg/pr50827.c: New test.
+
+2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/50958
+ * g++.dg/cpp0x/udlit-declare-neg.C: Adjust.
+ * g++.dg/cpp0x/udlit-implicit-conv-neg.C: New.
+ * g++.dg/cpp0x/udlit-member.C: Adjust.
+ * g++.dg/cpp0x/udlit-raw-length.C: New.
+ * g++.dg/cpp0x/udlit-raw-op-string-neg.C: Adjust.
+ * g++.dg/cpp0x/udlit-resolve.C: New.
+ * c-c++-common/dfp/pr33466.c: Adjust.
+
+2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/target-supports.exp
+ (check_effective_target_ultrasparc_vis2_hw): Call check_runtime
+ with ultrasparc_vis2_hw.
+ (check_effective_target_ultrasparc_vis3_hw): Call check_runtime
+ with ultrasparc_vis3_hw.
+
+2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * c-c++-common/tm/malloc.c: Scan tree dumps for std::malloc if
+ *-*-solaris2* && c++.
+
+2011-11-20 Joey Ye <joey.ye@arm.com>
+
+ * gcc.dg/volatile-bitfields-1.c: New.
+
+2011-11-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/48322
+ * g++.dg/cpp0x/variadic120.C: New.
+ * g++.dg/cpp0x/sfinae26.C: Adjust.
+
+ * g++.dg/cpp0x/sfinae11.C: Adjust.
+ * g++.dg/cpp0x/sfinae26.C: Adjust.
+ * g++.dg/template/unify11.C: Adjust.
+
+2011-11-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51230
+ * g++.dg/template/error46.C: New.
+
+2011-11-20 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/51235
+ * gcc.target/i386/pr51235.c: New test.
+
+ PR target/51236
+ * gcc.target/i386/pr51236.c: New test.
+
+2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr32.adb: New test.
+ * gnat.dg/discr32_pkg.ads: New helper.
+
+2011-11-20 Nathan Sidwell <nathan@acm.org>
+
+ PR gcov-profile/51113
+ * gcc.misc-tests/gcov-13.c: Check gcovpart-13b coverage
+ * gcc.misc-tests/gcov-16.c: New.
+ * gcc.misc-tests/gcov-17.c: New.
+ * g++.dg/gcov/gcov-8.C: New.
+ * g++.dg/gcov/gcov-9.C: New.
+ * g++.dg/gcov/gcov-10.C: New.
+
+2011-11-20 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51194
+ * g++.dg/cpp0x/alias-decl-15.C: New test.
+
+2011-11-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/51216
+ * g++.dg/cpp0x/pr51216.C: New.
+
+2011-11-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/delay-slot-2.c: New test.
+
+2011-11-18 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/assert4.c: Test __linux__, not __gnu_linux__.
+
+2011-11-18 Fabien Chêne <fabien@gcc.gnu.org>
+
+ PR c++/51188
+ * g++.dg/lookup/using46.C: New.
+ * g++.dg/lookup/using47.C: New.
+ * g++.dg/lookup/using48.C: New.
+ * g++.dg/lookup/using49.C: New.
+ * g++.dg/lookup/using50.C: New.
+
+2011-11-18 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gcc.c-torture/compile/pr44707.c: Do not assume assembler
+ supports /* ... */ comments.
+
2011-11-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51150
diff --git a/gcc/testsuite/c-c++-common/dfp/pr33466.c b/gcc/testsuite/c-c++-common/dfp/pr33466.c
index 8c73cef4856..9b10a092b91 100644
--- a/gcc/testsuite/c-c++-common/dfp/pr33466.c
+++ b/gcc/testsuite/c-c++-common/dfp/pr33466.c
@@ -5,9 +5,9 @@
These are invalid for all targets, not just those that support
decimal float. */
-long double dF = 4.5dF; /* { dg-error "invalid suffix|user-defined" } */
-long double Df = 4.5Df; /* { dg-error "invalid suffix|user-defined" } */
-long double dD = 4.5dD; /* { dg-error "invalid suffix|user-defined" } */
-long double Dd = 4.5Dd; /* { dg-error "invalid suffix|user-defined" } */
-long double dL = 4.5dL; /* { dg-error "invalid suffix|user-defined" } */
-long double Dl = 4.5Dl; /* { dg-error "invalid suffix|user-defined" } */
+long double dF = 4.5dF; /* { dg-error "invalid suffix|literal operator" } */
+long double Df = 4.5Df; /* { dg-error "invalid suffix|literal operator" } */
+long double dD = 4.5dD; /* { dg-error "invalid suffix|literal operator" } */
+long double Dd = 4.5Dd; /* { dg-error "invalid suffix|literal operator" } */
+long double dL = 4.5dL; /* { dg-error "invalid suffix|literal operator" } */
+long double Dl = 4.5Dl; /* { dg-error "invalid suffix|literal operator" } */
diff --git a/gcc/testsuite/c-c++-common/tm/malloc.c b/gcc/testsuite/c-c++-common/tm/malloc.c
index de7a766e36c..81bcc56fc41 100644
--- a/gcc/testsuite/c-c++-common/tm/malloc.c
+++ b/gcc/testsuite/c-c++-common/tm/malloc.c
@@ -17,7 +17,9 @@ void foobar(void)
z = (char *)malloc (666);
}
-/* { dg-final { scan-tree-dump-times " malloc .666" 1 "tmmark" } } */
+/* { dg-final { scan-tree-dump-times " malloc .666" 1 "tmmark" { target { ! { *-*-solaris2* && c++ } } } } } */
+/* Solaris 2 headers are C++-aware and declare std::malloc. */
+/* { dg-final { scan-tree-dump-times " std::malloc .666" 1 "tmmark" { target { *-*-solaris2* && c++ } } } } */
/* { dg-final { scan-tree-dump-times "__builtin__ITM_malloc" 1 "tmmark" } } */
/* { dg-final { scan-tree-dump-times "__builtin__ITM_calloc" 1 "tmmark" } } */
/* { dg-final { scan-tree-dump-times "__builtin__ITM_free" 2 "tmmark" } } */
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C
new file mode 100644
index 00000000000..2bc9b11843d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C
@@ -0,0 +1,17 @@
+// Origin PR c++/51194
+// { dg-options "-std=c++0x" }
+
+template<class U, class V> //#1
+struct foo {}; // { dg-error "provided for|foo" }
+
+template<class U, class V=char>
+struct P {};
+
+template<template<class... U> class... TT>
+struct bar {
+ template<class... Args>
+ using mem = P<TT<Args...>...>;//#2 { dg-error "wrong number of|arguments" }
+};
+
+bar<foo>::mem<int, char> b;//#3 { dg-error "invalid type" }
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C
new file mode 100644
index 00000000000..d66660a5f4e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C
@@ -0,0 +1,28 @@
+// Origin PR c++/51143
+// { dg-options "-std=c++11" }
+
+using A0 = struct B0 { void f() {} };
+
+template<int N>
+using A1 =
+ struct B1 { // { dg-error "types may not be defined in alias template" }
+ static auto constexpr value = N;
+ };
+
+A1<0> a1;
+
+template<class T>
+using A2 =
+ struct B2 { // { dg-error "types may not be defined in alias template" }
+ void f(T){}
+ };
+
+A2<bool> a2;
+
+template<class T>
+using A3 =
+ enum B3 {b = 0;}; //{ dg-error "types may not be defined in alias template" }
+
+A3<int> a3;
+
+int main() { }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51216.C b/gcc/testsuite/g++.dg/cpp0x/pr51216.C
new file mode 100644
index 00000000000..4bdd071475e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr51216.C
@@ -0,0 +1,10 @@
+// PR c++/51216
+// { dg-options "-std=c++0x" }
+
+void foo()
+{
+ int i = ({ if (1) ; }); // { dg-error "ignored" }
+ int j = ({ for (;;) ; }); // { dg-error "ignored" }
+ int k = ({ while (1) ; }); // { dg-error "ignored" }
+ int l = ({ do { } while (1); }); // { dg-error "ignored" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C
index 25902cbd65e..2e8408d8f4d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C
@@ -12,7 +12,8 @@ inline void f1( T& x ) noexcept( noexcept( declval<T&>().foo() ) ) // { dg-error
}
template< class T,
- bool Noexcept = noexcept( declval<T&>().foo() )
+ bool Noexcept = noexcept( declval<T&>().foo() ) // { dg-error "no member|not convert" }
+
>
inline void f2( T& x ) noexcept( Noexcept )
{
@@ -51,7 +52,6 @@ int main()
// static_assert( noexcept( f3(y) ), "shall be ill-formed(OK)." );
noexcept( f1(z) ); // { dg-message "required" }
- static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match|could not convert" }
- // { dg-error "no member" "" { target *-*-* } 54 }
+ static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match" }
noexcept( f3(z) ); // { dg-message "required" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C
index 42b48eb5a6b..374f9976b2c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C
@@ -30,9 +30,9 @@ struct is_same<T, T> {
template<class... T>
struct S {
template<class... U,
- typename enable_if<and_<is_same<T, U>...>::value>::type*& = enabler
+ typename enable_if<and_<is_same<T, U>...>::value>::type*& = enabler // { dg-error "no type" }
>
- S(U...){} // { dg-error "no type named 'type'" }
+ S(U...){}
};
S<bool> s(0); // { dg-error "no match" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae30.C b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C
new file mode 100644
index 00000000000..6fcf5f75609
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C
@@ -0,0 +1,25 @@
+// { dg-do compile { target c++11 } }
+
+template <class... T> struct tuple;
+template <class T> struct tuple<T> { T t; };
+
+template <class T, class U> struct pair;
+template<> struct pair<int,double> { };
+
+template <class... Ts>
+struct A
+{
+ template <class... Us,
+ class V = tuple<pair<Ts,Us>...> >
+ static void f(Us...)
+ {
+ V v;
+ }
+ template <class U>
+ static void f(bool);
+};
+
+int main()
+{
+ A<int,float>::f<double>(1.0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C
index 7b50c017f01..9060abba494 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C
@@ -3,13 +3,13 @@
// Check that undeclared literal operator calls and literals give appropriate errors.
int i = operator"" _Bar('x'); // { dg-error "was not declared in this scope" }
-int j = 'x'_Bar; // { dg-error "unable to find user-defined character literal operator" }
+int j = 'x'_Bar; // { dg-error "unable to find character literal operator|with|argument" }
int ii = operator"" _BarCharStr("Howdy, Pardner!"); // { dg-error "was not declared in this scope" }
-int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find user-defined string literal operator" }
+int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find string literal operator|Possible missing length argument" }
unsigned long long iULL = operator"" _BarULL(666ULL); // { dg-error "was not declared in this scope" }
-unsigned long long jULL = 666_BarULL; // { dg-error "unable to find user-defined numeric literal operator" }
+unsigned long long jULL = 666_BarULL; // { dg-error "unable to find numeric literal operator" }
long double iLD = operator"" _BarLD(666.0L); // { dg-error "was not declared in this scope" }
-long double jLD = 666.0_BarLD; // { dg-error "unable to find user-defined numeric literal operator" }
+long double jLD = 666.0_BarLD; // { dg-error "unable to find numeric literal operator" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C
new file mode 100644
index 00000000000..998ad155bf7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C
@@ -0,0 +1,63 @@
+// { dg-options -std=c++0x }
+
+#include <cstdint>
+
+int operator"" _bar (long double);
+
+double operator"" _foo (long long unsigned);
+
+int i = 12_bar; // { dg-error "unable to find numeric literal operator|with|argument" }
+
+double d = 1.2_foo; // { dg-error "unable to find numeric literal operator|with|argument" }
+
+int operator"" _char(char);
+
+int operator"" _wchar_t(wchar_t);
+
+int operator"" _char16_t(char16_t);
+
+int operator"" _char32_t(char32_t);
+
+int cwcx = 'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" }
+int cc16 = 'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" }
+int cc32 = 'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" }
+
+int wccx = L'c'_char; // { dg-error "unable to find character literal operator|with|argument" }
+int wcc16 = L'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" }
+int wcc32 = L'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" }
+
+int c16c = u'c'_char; // { dg-error "unable to find character literal operator|with|argument" }
+int c16wc = u'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" }
+int c16c32 = u'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" }
+
+int c32c = U'c'_char; // { dg-error "unable to find character literal operator|with|argument" }
+int c32wc = U'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" }
+int c32c16 = U'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" }
+
+int operator"" _char_str(const char*, std::size_t);
+
+int operator"" _wchar_t_str(const wchar_t*, std::size_t);
+
+int operator"" _char16_t_str(const char16_t*, std::size_t);
+
+int operator"" _char32_t_str(const char32_t*, std::size_t);
+
+int strwstr = "str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int strstr16 = "str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int strstr32 = "str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+
+int str8wstr = u8"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str8str16 = u8"str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str8str32 = u8"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+
+int wstrstr = L"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int wstrstr16 = L"str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int wstrstr32 = L"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+
+int str16str = u"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str16wstr = u"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str16str32 = u"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+
+int str32str = U"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str32wstr = U"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" }
+int str32str16 = U"str"_char16_t_str; // { dg-error "unable to find string literal operator string operator|with|arguments" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C
index 809df254c0e..a6220c4c0fc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C
@@ -8,7 +8,7 @@ public:
};
int i = operator"" _Bar(U'x'); // { dg-error "was not declared in this scope" }
-int j = U'x'_Bar; // { dg-error "unable to find user-defined character literal operator" }
+int j = U'x'_Bar; // { dg-error "unable to find character literal operator" }
int
Foo::operator"" _Bar(char32_t) // { dg-error "must be a non-member function" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C
new file mode 100644
index 00000000000..2d910624a7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C
@@ -0,0 +1,27 @@
+// { dg-options "-std=c++0x" }
+// PR c++/50958
+
+typedef decltype(sizeof(0)) size_type;
+
+constexpr size_type
+cstrlen_impl(const char* s, size_type i)
+{
+ return s[i] ? cstrlen_impl(s, i + 1) : i;
+}
+
+constexpr size_type
+cstrlen(const char* s)
+{
+ return s ? cstrlen_impl(s, 0) : throw 0;
+}
+
+constexpr size_type
+operator "" _lenraw(const char* digits)
+{
+ return cstrlen(digits);
+}
+
+static_assert(123_lenraw == 3, "Ouch");
+static_assert(1_lenraw == 1, "Ouch");
+static_assert(012_lenraw == 3, "Ouch");
+static_assert(0_lenraw == 1, "Ouch");
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C
index 5c399aff599..58ad0e609d0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C
@@ -5,4 +5,4 @@
int operator"" _embedraw(const char*)
{ return 41; };
-int k = "Boo!"_embedraw; // { dg-error "unable to find valid user-defined string literal operator" }
+int k = "Boo!"_embedraw; // { dg-error "unable to find string literal operator" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C b/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C
new file mode 100644
index 00000000000..a25516220c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C
@@ -0,0 +1,40 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+#include <cstdint>
+#include <cassert>
+
+int operator"" _foo(const char*) { return 0; }
+int operator"" _foo(unsigned long long int) { return 1; }
+int operator"" _foo(long double) { return 2; }
+int operator"" _foo(char) { return 3; }
+int operator"" _foo(wchar_t) { return 4; }
+int operator"" _foo(char16_t) { return 5; }
+int operator"" _foo(char32_t) { return 6; }
+int operator"" _foo(const char*, std::size_t) { return 7; }
+int operator"" _foo(const wchar_t*, std::size_t) { return 8; }
+int operator"" _foo(const char16_t*, std::size_t) { return 9; }
+int operator"" _foo(const char32_t*, std::size_t) { return 10; }
+template<char...> int operator"" _foo2() { return 20; }
+int operator"" _foo2(unsigned long long int) { return 21; }
+
+namespace bar {
+int operator"" _foo(unsigned long long int) { return 101; }
+}
+using namespace bar;
+
+int
+main()
+{
+ assert(123_foo == 101);
+ assert(0.123_foo == 2);
+ assert('c'_foo == 3);
+ assert(L'c'_foo == 4);
+ assert(u'c'_foo == 5);
+ assert(U'c'_foo == 6);
+ assert("abc"_foo == 7);
+ assert(L"abc"_foo == 8);
+ assert(u"abc"_foo == 9);
+ assert(U"abc"_foo == 10);
+ assert(123_foo2 == 21);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic120.C b/gcc/testsuite/g++.dg/cpp0x/variadic120.C
new file mode 100644
index 00000000000..e26ee4e9abe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic120.C
@@ -0,0 +1,24 @@
+// PR c++/48322
+// { dg-do compile { target c++11 } }
+
+template <class... T> struct tuple;
+template <class T> struct tuple<T> { T t; };
+
+template <class T, class U> struct pair;
+template<> struct pair<int,double> { };
+
+template <class... Ts>
+struct A
+{
+ template <class... Us,
+ class V = tuple<pair<Ts,Us>...> >
+ static void f()
+ {
+ V v;
+ }
+};
+
+int main()
+{
+ A<int>::f<double>();
+}
diff --git a/gcc/testsuite/g++.dg/debug/using6.C b/gcc/testsuite/g++.dg/debug/using6.C
new file mode 100644
index 00000000000..8f73d37ffa0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/using6.C
@@ -0,0 +1,22 @@
+// PR c++/51189
+// { dg-do compile }
+
+struct A
+{
+ int i1, i2, i3, i4, i5, i6;
+};
+
+struct B : A
+{
+ using A::i1;
+ using A::i2;
+ using A::i3;
+ using A::i4;
+ using A::i5;
+ using A::i6;
+};
+
+struct C : B
+{
+ using B::i1;
+};
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-10.C b/gcc/testsuite/g++.dg/gcov/gcov-10.C
new file mode 100644
index 00000000000..4c91be94ee4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/gcov-10.C
@@ -0,0 +1,20 @@
+/* Ensure PIC sequence used for comdat functions */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage -fpic" } */
+/* { dg-do run { target native } } */
+/* { dg-require-effective-target fpic } */
+
+inline int __attribute__ ((noinline)) Foo ()
+{
+ static int x[1];
+
+ return x[0]++; /* count (1) */
+}
+
+int main ()
+{
+ Foo (); /* count (1) */
+ return 0; /* count (1) */
+}
+
+/* { dg-final { run-gcov gcov-10.C } } */
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-11.C b/gcc/testsuite/g++.dg/gcov/gcov-11.C
new file mode 100644
index 00000000000..fa0890206f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/gcov-11.C
@@ -0,0 +1,42 @@
+/* Check that unexecuted exception processing regions are shown
+ distinct from unexecuted normal regions. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-do run { target native } } */
+
+void Baz (int i)
+{
+ if (i)
+ throw 1;
+}
+
+void Boz () throw ()
+{
+}
+
+int main ()
+{
+ try
+ {
+ Baz (0); /* count (1) */
+ Baz (0); /* count (1) */
+ }
+ catch (...)
+ {
+ Boz (); /* count (=====) */
+ }
+
+ try
+ {
+ Baz (1); /* count (1) */
+ Baz (0); /* count (#####) */
+ }
+ catch (...)
+ {
+ Boz (); /* count (1) */
+ }
+
+ return 0; /* count (1) */
+}
+
+/* { dg-final { run-gcov gcov-11.C } } */
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-8.C b/gcc/testsuite/g++.dg/gcov/gcov-8.C
new file mode 100644
index 00000000000..272cefc373b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/gcov-8.C
@@ -0,0 +1,14 @@
+/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */
+/* { dg-require-visibility "" } */
+
+struct __attribute__((visibility ("hidden"))) X
+{
+ void Fink ();
+};
+
+void X::Fink ()
+{
+}
+
+/* { dg-final { scan-assembler "\\.hidden\t__gcov___ZN1X4FinkEv" { target { ! *-*-darwin* } } } } */
+/* { dg-final { scan-assembler "\\.private_extern ___gcov___ZN1X4FinkEv" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-9.C b/gcc/testsuite/g++.dg/gcov/gcov-9.C
new file mode 100644
index 00000000000..b9c64d22e56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/gcov-9.C
@@ -0,0 +1,17 @@
+/* { dg-options "-fprofile-arcs -fvisibility-inlines-hidden" } */
+/* { dg-require-visibility "" } */
+
+inline void Boo ()
+{
+}
+
+extern "C" void (*Foo ()) ()
+{
+ return Boo;
+}
+
+/* { dg-final { scan-assembler "\\.hidden\t__gcov___Z3Boov" { target { ! *-*-darwin* } } } } */
+/* { dg-final { scan-assembler "\\.private_extern ___gcov___Z3Boov" { target *-*-darwin* } } } */
+/* { dg-final { scan-assembler "__gcov__Foo:" } } */
+/* { dg-final { scan-assembler-not "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
+/* { dg-final { scan-assembler-not "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/g++.dg/lookup/using46.C b/gcc/testsuite/g++.dg/lookup/using46.C
new file mode 100644
index 00000000000..6f0f5bca090
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using46.C
@@ -0,0 +1,62 @@
+// PR c++/51141
+// { dg-do compile }
+// { dg-options "-fpermissive -w -Werror" }
+
+typedef int size_t;
+template < size_t, size_t > struct AlignedBuffer {};
+
+template < typename > class VectorBufferBase
+{
+public:
+ allocateBuffer (size_t) {
+ }
+ buffer () {
+ }
+ *m_buffer;
+ size_t m_capacity;
+};
+
+template < typename T, size_t > class VectorBuffer:VectorBufferBase < T >
+{
+ typedef VectorBufferBase < T > Base;
+
+public:
+ VectorBuffer () {
+ }
+ allocateBuffer (size_t) {
+ m_capacity = 0;
+ }
+ Base::buffer;
+ Base::m_buffer;
+ Base::m_capacity;
+ size_t m_inlineBufferSize;
+
+ AlignedBuffer < 0, __alignof__ (T) > m_inlineBuffer;
+};
+
+template < typename T, size_t > class Vector
+{
+ typedef VectorBuffer < T,
+ 0 > Buffer;
+public:
+ void shrinkCapacity (size_t);
+
+ clear () {
+ shrinkCapacity (0);
+ }
+ Buffer m_buffer;
+};
+
+template < typename T, size_t inlineCapacity > void Vector < T,
+ inlineCapacity >::shrinkCapacity (size_t)
+{
+ m_buffer.allocateBuffer (0);
+}
+
+struct PatternDisjunction;
+struct YarrPattern {
+ reset () {
+ m_disjunctions.clear ();
+ }
+ Vector < PatternDisjunction *, 0 > m_disjunctions;
+};
diff --git a/gcc/testsuite/g++.dg/lookup/using47.C b/gcc/testsuite/g++.dg/lookup/using47.C
new file mode 100644
index 00000000000..c81864705c4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using47.C
@@ -0,0 +1,29 @@
+// PR c++/51152
+// { dg-do compile }
+
+struct A
+{
+ int a;
+};
+
+struct B
+{
+ int b1;
+ int b2;
+ A b3;
+};
+
+struct C : B
+{
+ typedef int R;
+ typedef int S;
+ typedef int T;
+ using B::b1;
+ using B::b2;
+ using B::b3;
+ void f()
+ {
+ b3.a;
+ b3.~A();
+ }
+};
diff --git a/gcc/testsuite/g++.dg/lookup/using48.C b/gcc/testsuite/g++.dg/lookup/using48.C
new file mode 100644
index 00000000000..e6dc3fab77c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using48.C
@@ -0,0 +1,23 @@
+// PR c++/51190
+// { dg-do compile }
+
+struct A
+{
+ int i;
+};
+
+template<typename> struct B
+{
+ A* p;
+};
+
+template<typename T> struct C : B<T>
+{
+ using B<T>::p;
+
+ C() { p->i; }
+
+ int i1, i2, i3, i4, i5;
+};
+
+C<A> c;
diff --git a/gcc/testsuite/g++.dg/lookup/using49.C b/gcc/testsuite/g++.dg/lookup/using49.C
new file mode 100644
index 00000000000..391476ac472
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using49.C
@@ -0,0 +1,20 @@
+// PR c++/51188
+// { dg-do compile }
+
+#include <utility>
+class XBase {
+public:
+ virtual ~XBase() = 0;
+ enum ImpMode { Imp1, Imp2, Imp3 };
+};
+class X : public XBase {
+ class XBlock {};
+ using XBase::ImpMode;
+ using XBase::Imp3;
+ using XBase::Imp1;
+ using XBase::Imp2;
+ int _XBlocked;
+ std::pair<int,int> getImp(void) const {
+ return (std::make_pair(0, static_cast<int>(X::Imp1)));
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/error46.C b/gcc/testsuite/g++.dg/template/error46.C
new file mode 100644
index 00000000000..0f4bdafb8a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error46.C
@@ -0,0 +1,11 @@
+// PR c++/51230
+
+template<int> struct A {};
+
+template<int N> void foo(A<N>, A<N>); // { dg-message "template" }
+
+void bar()
+{
+ foo(A<0>(), A<1>()); // { dg-error "no matching" }
+}
+// { dg-message "candidate|parameter 'N' ('0' and '1')" { target *-*-* } 9 }
diff --git a/gcc/testsuite/g++.dg/template/unify11.C b/gcc/testsuite/g++.dg/template/unify11.C
index 25606dc4af8..85bdbbc940a 100644
--- a/gcc/testsuite/g++.dg/template/unify11.C
+++ b/gcc/testsuite/g++.dg/template/unify11.C
@@ -6,9 +6,10 @@ struct A
{
};
-template <typename S, typename T, typename U, typename S::v = &S::v::s>
+template <typename S, typename T, typename U,
+ typename S::v = &S::v::s> // { dg-error "is not a" }
typename S::A
-foo (S c, T t, U u) // { dg-message "note" }
+foo (S c, T t, U u)
{
}
@@ -20,8 +21,7 @@ struct B
C (U t)
{
A a;
- A b = foo (this, a, t); // { dg-error "(no matching function|is not a)" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 23 }
+ A b = foo (this, a, t); // { dg-error "no matching function" }
}
} c;
B () : c (A ())
diff --git a/gcc/testsuite/g++.dg/tm/pr47747.C b/gcc/testsuite/g++.dg/tm/pr47747.C
new file mode 100644
index 00000000000..3b50904b5d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tm/pr47747.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O" }
+
+class InputStream
+{
+ public:
+// __attribute__((transaction_safe))
+ virtual unsigned int readUint32 () = 0;
+};
+
+class Building
+{
+ public:
+ __attribute__((transaction_safe))
+ Building (InputStream *stream);
+};
+
+Building::Building (InputStream *stream)
+{
+ stream->readUint32 (); /* { dg-error "InputStream::readUint32" } */
+}
diff --git a/gcc/testsuite/g++.dg/tm/template-2.C b/gcc/testsuite/g++.dg/tm/template-2.C
new file mode 100644
index 00000000000..53870246a58
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tm/template-2.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O -std=c++0x -fdump-tree-tmmark" }
+
+struct TrueFalse
+{
+};
+
+int global;
+
+template<typename T> int foo()
+{
+ return __transaction_atomic (global + 2)
+ + __transaction_atomic (global + 3);
+}
+
+int f1()
+{
+ return foo<TrueFalse>();
+}
+
+/* { dg-final { scan-tree-dump-times "ITM_RU" 2 "tmmark" } } */
+/* { dg-final { cleanup-tree-dump "tmmark" } } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44707.c b/gcc/testsuite/gcc.c-torture/compile/pr44707.c
index 9031f0042c9..d5d39fc83c8 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr44707.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44707.c
@@ -9,6 +9,6 @@ foo (void)
int e3 = v.b;
int e4 = v.c;
int e5 = v.d;
- __asm__ volatile ("/* %0 %1 %2 %3 %4 */" : : "nro" (e1), "nro" (e2), "nro" (e3), "nro" (e4), "nro" (e5));
+ __asm__ volatile ("" : : "nro" (e1), "nro" (e2), "nro" (e3), "nro" (e4), "nro" (e5));
}
diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c
index a05ef130206..514195313b3 100644
--- a/gcc/testsuite/gcc.dg/cpp/assert4.c
+++ b/gcc/testsuite/gcc.dg/cpp/assert4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
Test builtin preprocessor assertions.
By Kaveh Ghazi <ghazi@caip.rutgers.edu>. */
@@ -7,7 +7,7 @@
/* Check for #system assertions. */
-#if defined __gnu_linux__
+#if defined __linux__
# if !#system(linux) || !#system(unix) || !#system(posix)
# error
# endif
diff --git a/gcc/testsuite/gcc.dg/delay-slot-2.c b/gcc/testsuite/gcc.dg/delay-slot-2.c
new file mode 100644
index 00000000000..79faf81c798
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/delay-slot-2.c
@@ -0,0 +1,116 @@
+/* PR rtl-optimization/51187 */
+/* Reported by Jurij Smakov <jurij@wooyd.org> */
+
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+extern int printf (__const char *__restrict __format, ...);
+extern void print_c_condition (const char *);
+
+enum decision_type
+{
+ DT_num_insns,
+ DT_mode, DT_code, DT_veclen,
+ DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe,
+ DT_const_int,
+ DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
+ DT_accept_op, DT_accept_insn
+};
+
+struct decision_test
+{
+ struct decision_test *next;
+ enum decision_type type;
+
+ union
+ {
+ int num_insns;
+
+ struct
+ {
+ const char *name;
+ } pred;
+
+ const char *c_test;
+ int veclen;
+ int dup;
+ long intval;
+ int opno;
+
+ struct {
+ int code_number;
+ int lineno;
+ int num_clobbers_to_add;
+ } insn;
+ } u;
+};
+
+enum routine_type {
+ RECOG, SPLIT, PEEPHOLE2
+};
+
+void
+write_cond (struct decision_test *p, int depth,
+ enum routine_type subroutine_type)
+{
+ switch (p->type)
+ {
+ case DT_num_insns:
+ printf ("peep2_current_count >= %d", p->u.num_insns);
+ break;
+
+ case DT_code:
+ printf ("GET_CODE (x%d) == ", depth);
+ break;
+
+ case DT_veclen:
+ printf ("XVECLEN (x%d, 0) == %d", depth, p->u.veclen);
+ break;
+
+ case DT_elt_zero_int:
+ printf ("XINT (x%d, 0) == %d", depth, (int) p->u.intval);
+ break;
+
+ case DT_elt_one_int:
+ printf ("XINT (x%d, 1) == %d", depth, (int) p->u.intval);
+ break;
+
+ case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
+ printf ("XWINT (x%d, 0) == ", depth);
+ print_host_wide_int (p->u.intval);
+ break;
+
+ case DT_const_int:
+ printf ("x%d == const_int_rtx[MAX_SAVED_CONST_INT + (%d)]",
+ depth, (int) p->u.intval);
+ break;
+
+ case DT_veclen_ge:
+ printf ("XVECLEN (x%d, 0) >= %d", depth, p->u.veclen);
+ break;
+
+ case DT_dup:
+ printf ("rtx_equal_p (x%d, operands[%d])", depth, p->u.dup);
+ break;
+
+ case DT_pred:
+ printf ("%s (x%d)", p->u.pred.name, depth);
+ break;
+
+ case DT_c_test:
+ print_c_condition (p->u.c_test);
+ break;
+
+ case DT_accept_insn:
+ ((void)(__builtin_expect(!(subroutine_type == RECOG), 0) ? __builtin_unreachable(), 0 : 0));
+ ((void)(__builtin_expect(!(p->u.insn.num_clobbers_to_add), 0) ? __builtin_unreachable(), 0 : 0));
+ printf ("pnum_clobbers != NULL");
+ break;
+
+ default:
+ __builtin_unreachable();
+ }
+}
+
+/* { dg-final { scan-assembler "printf" } } */
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
new file mode 100644
index 00000000000..aedf06379ce
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
@@ -0,0 +1,11 @@
+/* { dg-lto-options {{-flto -fgnu-tm}} } */
+
+int i;
+
+main()
+{
+ __transaction_atomic
+ {
+ i = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
new file mode 100644
index 00000000000..948effacc4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
@@ -0,0 +1,7 @@
+#define dummy(func) \
+ __attribute__((noinline,noclone,used)) void func() { asm (""); }
+
+dummy(_ITM_beginTransaction)
+dummy(_ITM_commitTransaction)
+dummy(_ITM_WU4)
+dummy(_ITM_WU8)
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
new file mode 100644
index 00000000000..f7e8d04bf7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
@@ -0,0 +1,19 @@
+/* { dg-lto-options {{-flto -fgnu-tm}} } */
+
+extern void foobar() __attribute__((transaction_callable));
+
+#define dummy(func) \
+ __attribute__((noinline,noclone,used)) void func() { asm (""); }
+
+dummy(_ITM_beginTransaction)
+dummy(_ITM_commitTransaction)
+dummy(_ITM_WU4)
+dummy(_ITM_WU8)
+
+main()
+{
+ __transaction_relaxed
+ {
+ foobar();
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
new file mode 100644
index 00000000000..fb6918d6584
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
@@ -0,0 +1,4 @@
+__attribute__((transaction_callable,noinline))
+void foobar()
+{
+}
diff --git a/gcc/testsuite/gcc.dg/pr50765.c b/gcc/testsuite/gcc.dg/pr50765.c
new file mode 100644
index 00000000000..6e1c6974750
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50765.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/50765 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-dce" } */
+
+void
+foo (long *w, long *x, unsigned char *y, int z)
+{
+ for (; z < 429; z++)
+ w[z] = (-19 ^ y[z]) & x[z];
+}
diff --git a/gcc/testsuite/gcc.dg/pr50827.c b/gcc/testsuite/gcc.dg/pr50827.c
new file mode 100644
index 00000000000..5d258bfcf0a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr50827.c
@@ -0,0 +1,17 @@
+/* PR debug/50827 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2 -funroll-loops" } */
+
+void
+foo (int w, int x, int *y, int *z)
+{
+ float f;
+ while (w--)
+ {
+ f = x;
+ if (y)
+ *y = (__INTPTR_TYPE__) y + w;
+ if (z)
+ *z = w;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tm/20100615.c b/gcc/testsuite/gcc.dg/tm/20100615.c
index 3d9e4684e5d..26964d43367 100644
--- a/gcc/testsuite/gcc.dg/tm/20100615.c
+++ b/gcc/testsuite/gcc.dg/tm/20100615.c
@@ -3,7 +3,8 @@
/* Since the non TM version of new_node() gets optimized away, it
shouldn't appear in the clone table either. */
-/* { dg-final { scan-assembler-not "tm_clone_table" } } */
+/* { dg-final { scan-assembler-not "tm_clone_table" { target { ! *-*-darwin* } } } } */
+/* { dg-final { scan-assembler-not "__DATA,__tm_clone_table" { target *-*-darwin* } } } */
#define NULL 0
extern void *malloc (__SIZE_TYPE__);
diff --git a/gcc/testsuite/gcc.dg/vect/pr51074.c b/gcc/testsuite/gcc.dg/vect/pr51074.c
new file mode 100644
index 00000000000..30913999400
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr51074.c
@@ -0,0 +1,24 @@
+/* PR tree-optimization/51074 */
+
+#include "tree-vect.h"
+
+struct S { int a, b; } s[8];
+
+int
+main ()
+{
+ int i;
+ check_vect ();
+ for (i = 0; i < 8; i++)
+ {
+ s[i].b = 0;
+ s[i].a = i;
+ }
+ asm volatile ("" : : : "memory");
+ for (i = 0; i < 8; i++)
+ if (s[i].b != 0 || s[i].a != i)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/volatile-bitfields-1.c b/gcc/testsuite/gcc.dg/volatile-bitfields-1.c
new file mode 100644
index 00000000000..6adda27fea4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/volatile-bitfields-1.c
@@ -0,0 +1,23 @@
+/* { dg-options "-fstrict-volatile-bitfields" } */
+/* { dg-do run } */
+
+extern int puts(const char *);
+extern void abort(void) __attribute__((noreturn));
+
+typedef struct {
+ volatile unsigned short a:8, b:8;
+} BitStruct;
+
+BitStruct bits = {1, 2};
+
+void check(int i, int j)
+{
+ if (i != 1 || j != 2) puts("FAIL"), abort();
+}
+
+int main ()
+{
+ check(bits.a, bits.b);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vshift-1.c b/gcc/testsuite/gcc.dg/vshift-1.c
index 2a237aa2bbe..2220ad5a4fd 100644
--- a/gcc/testsuite/gcc.dg/vshift-1.c
+++ b/gcc/testsuite/gcc.dg/vshift-1.c
@@ -94,10 +94,10 @@ main ()
for (i = 0; i < N; i++)
{
asm ("");
- c[i] = (random () << 1) | (random () & 1);
+ c[i] = (rand () << 1) | (rand () & 1);
b[i] = (i * 85) & (sizeof (TYPE1) * __CHAR_BIT__ - 1);
a[i] = c[i];
- d[i] = (random () << 1) | (random () & 1);
+ d[i] = (rand () << 1) | (rand () & 1);
d[i] |= (unsigned long long) c[i] << 32;
e[i] = (i * 85) & (sizeof (TYPE2) * __CHAR_BIT__ - 1);
f[i] = d[i];
diff --git a/gcc/testsuite/gcc.dg/vshift-3.c b/gcc/testsuite/gcc.dg/vshift-3.c
index e62c76b469f..367e6606551 100644
--- a/gcc/testsuite/gcc.dg/vshift-3.c
+++ b/gcc/testsuite/gcc.dg/vshift-3.c
@@ -100,9 +100,9 @@ main ()
for (i = 0; i < N; i++)
{
asm ("");
- c[i] = (random () << 1) | (random () & 1);
+ c[i] = (rand () << 1) | (rand () & 1);
a[i] = c[i];
- d[i] = (random () << 1) | (random () & 1);
+ d[i] = (rand () << 1) | (rand () & 1);
d[i] |= (unsigned long long) c[i] << 32;
f[i] = d[i];
}
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-13.c b/gcc/testsuite/gcc.misc-tests/gcov-13.c
index 605d4d4b382..14be8f9e103 100644
--- a/gcc/testsuite/gcc.misc-tests/gcov-13.c
+++ b/gcc/testsuite/gcc.misc-tests/gcov-13.c
@@ -16,3 +16,4 @@ int main ()
}
/* { dg-final { run-gcov { -a gcov-13.c } } } */
+/* { dg-final { run-gcov { -a gcovpart-13b.c } } } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-16.c b/gcc/testsuite/gcc.misc-tests/gcov-16.c
new file mode 100644
index 00000000000..478f44a367d
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-16.c
@@ -0,0 +1,12 @@
+/* Test visibility is copied */
+
+/* { dg-options "-fprofile-arcs -fvisibility=hidden" } */
+/* { dg-require-visibility "" } */
+/* { dg-require-weak "" } */
+
+void Foo ()
+{
+}
+
+ /* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
+ /* { dg-final { scan-assembler "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-17.c b/gcc/testsuite/gcc.misc-tests/gcov-17.c
new file mode 100644
index 00000000000..f8ff794215c
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-17.c
@@ -0,0 +1,12 @@
+/* Test visibility is copied */
+
+/* { dg-options "-fprofile-arcs" } */
+/* { dg-require-visibility "" } */
+/* { dg-require-weak "" } */
+
+void __attribute__ ((visibility ("hidden"), weak)) Foo ()
+{
+}
+
+/* { dg-final { scan-assembler "\\.hidden\t__gcov__Foo" { target { ! *-*-darwin* } } } } */
+/* { dg-final { scan-assembler "\\.private_extern ___gcov__Foo" { target *-*-darwin* } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr51235.c b/gcc/testsuite/gcc.target/i386/pr51235.c
new file mode 100644
index 00000000000..c99d5c0e733
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr51235.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -mxop -mavx2" } */
+
+void *foo (int count, void **list)
+{
+ void *minaddr = list[0];
+ int i;
+
+ for (i = 1; i < count; i++)
+ {
+ void *addr = list[i];
+ if (addr < minaddr)
+ minaddr = addr;
+ }
+
+ return minaddr;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr51236.c b/gcc/testsuite/gcc.target/i386/pr51236.c
new file mode 100644
index 00000000000..63bfaeeb0eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr51236.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-vectorize -mavx2" } */
+
+long foo (long *p, int i)
+{
+ long x = 0;
+
+ while (--i)
+ x ^= p[i];
+
+ return x;
+}
diff --git a/gcc/testsuite/gnat.dg/discr32.adb b/gcc/testsuite/gnat.dg/discr32.adb
new file mode 100644
index 00000000000..830a6dfd59a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr32.adb
@@ -0,0 +1,21 @@
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+with Discr32_Pkg; use Discr32_Pkg;
+
+procedure Discr32 is
+begin
+
+ if R1'Object_Size /= 32 then
+ raise Program_Error;
+ end if;
+
+ if R2'Object_Size /= R'Object_Size then
+ raise Program_Error;
+ end if;
+
+ if R3'Object_Size /= 64 then
+ raise Program_Error;
+ end if;
+
+end;
diff --git a/gcc/testsuite/gnat.dg/discr32_pkg.ads b/gcc/testsuite/gnat.dg/discr32_pkg.ads
new file mode 100644
index 00000000000..f1761e4b5e5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr32_pkg.ads
@@ -0,0 +1,24 @@
+package Discr32_Pkg is
+
+ type Enum is (One, Two, Three);
+
+ type R (D : Enum) is record
+ case D is
+ when One => B : Boolean;
+ when Two => I : Integer;
+ when Three => F : Float;
+ end case;
+ end record;
+
+ for R use record
+ D at 0 range 0 .. 1;
+ B at 1 range 0 .. 0;
+ I at 4 range 0 .. 31 + 128;
+-- F at 4 range 0 .. 31;
+ end record;
+
+ subtype R1 is R (One);
+ subtype R2 is R (Two);
+ subtype R3 is R (Three);
+
+end Discr32_Pkg;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 94309102034..cd013336bda 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2476,7 +2476,7 @@ proc check_effective_target_ultrasparc_hw { } {
# instructions. We check this by attempting: "bmask %g0, %g0, %g0"
proc check_effective_target_ultrasparc_vis2_hw { } {
- return [check_runtime ultrasparc_hw {
+ return [check_runtime ultrasparc_vis2_hw {
int main() { __asm__(".word 0x81b00320"); return 0; }
} "-mcpu=ultrasparc3"]
}
@@ -2485,7 +2485,7 @@ proc check_effective_target_ultrasparc_vis2_hw { } {
# instructions. We check this by attempting: "addxc %g0, %g0, %g0"
proc check_effective_target_ultrasparc_vis3_hw { } {
- return [check_runtime ultrasparc_hw {
+ return [check_runtime ultrasparc_vis3_hw {
int main() { __asm__(".word 0x81b00220"); return 0; }
} "-mcpu=niagara3"]
}
diff --git a/gcc/tracer.c b/gcc/tracer.c
index d3523b985b1..602e7580d99 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -90,10 +90,19 @@ bb_seen_p (basic_block bb)
static bool
ignore_bb_p (const_basic_block bb)
{
+ gimple g;
+
if (bb->index < NUM_FIXED_BLOCKS)
return true;
if (optimize_bb_for_size_p (bb))
return true;
+
+ /* A transaction is a single entry multiple exit region. It must be
+ duplicated in its entirety or not at all. */
+ g = last_stmt (CONST_CAST_BB (bb));
+ if (g && gimple_code (g) == GIMPLE_TRANSACTION)
+ return true;
+
return false;
}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 3c0bd600943..751572c4fb4 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -659,13 +659,27 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool *handled_ops_p,
if (TREE_CODE (fn) == ADDR_EXPR)
fn = TREE_OPERAND (fn, 0);
if (d->block_flags & DIAG_TM_SAFE)
- error_at (gimple_location (stmt),
- "unsafe function call %qD within "
- "atomic transaction", fn);
+ {
+ if (direct_call_p)
+ error_at (gimple_location (stmt),
+ "unsafe function call %qD within "
+ "atomic transaction", fn);
+ else
+ error_at (gimple_location (stmt),
+ "unsafe function call %qE within "
+ "atomic transaction", fn);
+ }
else
- error_at (gimple_location (stmt),
- "unsafe function call %qD within "
- "%<transaction_safe%> function", fn);
+ {
+ if (direct_call_p)
+ error_at (gimple_location (stmt),
+ "unsafe function call %qD within "
+ "%<transaction_safe%> function", fn);
+ else
+ error_at (gimple_location (stmt),
+ "unsafe function call %qE within "
+ "%<transaction_safe%> function", fn);
+ }
}
}
}
@@ -2319,7 +2333,8 @@ expand_block_tm (struct tm_region *region, basic_block bb)
{
case GIMPLE_ASSIGN:
/* Only memory reads/writes need to be instrumented. */
- if (gimple_assign_single_p (stmt))
+ if (gimple_assign_single_p (stmt)
+ && !gimple_clobber_p (stmt))
{
expand_assign_tm (region, &gsi);
continue;
diff --git a/gcc/tree.c b/gcc/tree.c
index ba6c2e1ef8a..72603b59945 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6994,7 +6994,6 @@ iterative_hash_expr (const_tree t, hashval_t val)
val = iterative_hash_expr (TREE_OPERAND (t, i), val);
}
return val;
- break;
}
}
diff --git a/gcc/tree.def b/gcc/tree.def
index 2a2363e7037..11ce8b5b756 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -900,8 +900,7 @@ DEFTREECODE (CATCH_EXPR, "catch_expr", tcc_statement, 2)
/* Used to represent an exception specification. EH_FILTER_TYPES is a list
of allowed types, and EH_FILTER_FAILURE is an expression to evaluate on
- failure. EH_FILTER_MUST_NOT_THROW controls which range type to use when
- expanding. */
+ failure. */
DEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", tcc_statement, 2)
/* Node used for describing a property that is known at compile
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 95bc02b183c..4e07d25b54a 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -3008,7 +3008,7 @@ loc_cmp (rtx x, rtx y)
if (GET_CODE (y) != ENTRY_VALUE)
return 1;
gcc_assert (GET_MODE (x) == GET_MODE (y));
- return loc_cmp (XEXP (x, 0), XEXP (y, 0));
+ return loc_cmp (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
}
if (GET_CODE (y) == ENTRY_VALUE)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index cfbb9ca1f2e..2c31af91b9a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5961,7 +5961,7 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_alias_pairs)
if (!switched)
{
- switch_to_section (get_named_section (NULL, ".tm_clone_table", 3));
+ switch_to_section (targetm.asm_out.tm_clone_table_section ());
assemble_align (POINTER_SIZE);
switched = true;
}
@@ -5973,6 +5973,14 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_alias_pairs)
}
}
+/* Provide a default for the tm_clone_table section. */
+
+section *
+default_clone_table_section (void)
+{
+ return get_named_section (NULL, ".tm_clone_table", 3);
+}
+
/* Helper comparison function for qsorting by the DECL_UID stored in
alias_pair->emitted_diags. */
diff --git a/libada/ChangeLog b/libada/ChangeLog
index 921b1bd7789..17269228d3e 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,6 +1,6 @@
2011-11-12 Iain Sandoe <iains@gcc.gnu.org>
- Makefile.in: Change dependency on oscons to depend on the generator
+ * Makefile.in: Change dependency on oscons to depend on the generator
tool.
2011-10-12 Eric Botcazou <ebotcazou@adacore.com>
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 8f7d494fc91..1df9e080268 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-22 Diego Novillo <dnovillo@google.com>
+
+ * include/line-map.h (linemap_dump): Declare.
+ (line_table_dump): Declare.
+ * line-map.c (linemap_dump): New.
+ (line_table_dump): New.
+
+2011-11-21 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/50958
+ * expr.c (cpp_userdef_char_remove_type): Fix typo.
+
2011-11-03 Michael Matz <matz@suse.de>
PR bootstrap/50857
diff --git a/libcpp/expr.c b/libcpp/expr.c
index 7bbc72d6f26..d56e56a6311 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -284,9 +284,9 @@ cpp_userdef_char_remove_type (enum cpp_ttype type)
else if (type == CPP_WCHAR_USERDEF)
return CPP_WCHAR;
else if (type == CPP_CHAR16_USERDEF)
- return CPP_STRING16;
+ return CPP_CHAR16;
else if (type == CPP_CHAR32_USERDEF)
- return CPP_STRING32;
+ return CPP_CHAR32;
else
return type;
}
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 112bc020309..4e30742596c 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -705,4 +705,14 @@ void linemap_get_statistics (struct line_maps *, struct linemap_stats *);
stream STREAM. SET is the line map set LOC comes from. */
void linemap_dump_location (struct line_maps *, source_location, FILE *);
+/* Dump line map at index IX in line table SET to STREAM. If STREAM
+ is NULL, use stderr. IS_MACRO is true if the caller wants to
+ dump a macro map, false otherwise. */
+void linemap_dump (FILE *, struct line_maps *, unsigned, bool);
+
+/* Dump line table SET to STREAM. If STREAM is NULL, stderr is used.
+ NUM_ORDINARY specifies how many ordinary maps to dump. NUM_MACRO
+ specifies how many macro maps to dump. */
+void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int);
+
#endif /* !LIBCPP_LINE_MAP_H */
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 23a0347cb5f..d7752bb4e61 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1153,6 +1153,57 @@ linemap_expand_location (struct line_maps *set,
return xloc;
}
+
+/* Dump line map at index IX in line table SET to STREAM. If STREAM
+ is NULL, use stderr. IS_MACRO is true if the caller wants to
+ dump a macro map, false otherwise. */
+
+void
+linemap_dump (FILE *stream, struct line_maps *set, unsigned ix, bool is_macro)
+{
+ const char *lc_reasons_v[LC_ENTER_MACRO + 1]
+ = { "LC_ENTER", "LC_LEAVE", "LC_RENAME", "LC_RENAME_VERBATIM",
+ "LC_ENTER_MACRO" };
+ const char *reason;
+ struct line_map *map;
+
+ if (stream == NULL)
+ stream = stderr;
+
+ if (!is_macro)
+ map = LINEMAPS_ORDINARY_MAP_AT (set, ix);
+ else
+ map = LINEMAPS_MACRO_MAP_AT (set, ix);
+
+ reason = (map->reason <= LC_ENTER_MACRO) ? lc_reasons_v[map->reason] : "???";
+
+ fprintf (stream, "Map #%u [%p] - LOC: %u - REASON: %s - SYSP: %s\n",
+ ix, (void *) map, map->start_location, reason,
+ (!is_macro && ORDINARY_MAP_IN_SYSTEM_HEADER_P (map)) ? "yes" : "no");
+ if (!is_macro)
+ {
+ unsigned includer_ix;
+ struct line_map *includer_map;
+
+ includer_ix = ORDINARY_MAP_INCLUDER_FILE_INDEX (map);
+ includer_map = includer_ix < LINEMAPS_ORDINARY_USED (set)
+ ? LINEMAPS_ORDINARY_MAP_AT (set, includer_ix)
+ : NULL;
+
+ fprintf (stream, "File: %s:%d\n", ORDINARY_MAP_FILE_NAME (map),
+ ORDINARY_MAP_STARTING_LINE_NUMBER (map));
+ fprintf (stream, "Included from: [%d] %s\n", includer_ix,
+ includer_map ? ORDINARY_MAP_FILE_NAME (includer_map) : "None");
+ }
+ else
+ fprintf (stream, "Macro: %s (%u tokens)\n",
+ linemap_map_get_macro_name (map),
+ MACRO_MAP_NUM_MACRO_TOKENS (map));
+
+ fprintf (stream, "\n");
+}
+
+
/* Dump debugging information about source location LOC into the file
stream STREAM. SET is the line map set LOC comes from. */
@@ -1254,3 +1305,42 @@ linemap_get_statistics (struct line_maps *set,
s->duplicated_macro_maps_locations_size =
duplicated_macro_maps_locations_size;
}
+
+
+/* Dump line table SET to STREAM. If STREAM is NULL, stderr is used.
+ NUM_ORDINARY specifies how many ordinary maps to dump. NUM_MACRO
+ specifies how many macro maps to dump. */
+
+void
+line_table_dump (FILE *stream, struct line_maps *set, unsigned int num_ordinary,
+ unsigned int num_macro)
+{
+ unsigned int i;
+
+ if (set == NULL)
+ return;
+
+ if (stream == NULL)
+ stream = stderr;
+
+ fprintf (stream, "# of ordinary maps: %d\n", LINEMAPS_ORDINARY_USED (set));
+ fprintf (stream, "# of macro maps: %d\n", LINEMAPS_MACRO_USED (set));
+ fprintf (stream, "Include stack depth: %d\n", set->depth);
+ fprintf (stream, "Highest location: %u\n", set->highest_location);
+
+ if (num_ordinary)
+ {
+ fprintf (stream, "\nOrdinary line maps\n");
+ for (i = 0; i < num_ordinary && i < LINEMAPS_ORDINARY_USED (set); i++)
+ linemap_dump (stream, set, i, false);
+ fprintf (stream, "\n");
+ }
+
+ if (num_macro)
+ {
+ fprintf (stream, "\nMacro line maps\n");
+ for (i = 0; i < num_macro && i < LINEMAPS_MACRO_USED (set); i++)
+ linemap_dump (stream, set, i, true);
+ fprintf (stream, "\n");
+ }
+}
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 2c34801a354..113a1617cbe 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-11-10 Richard Henderson <rth@redhat.com>
* configure.ac (GCC_AS_CFI_PSEUDO_OP): Use it instead of inline check.
diff --git a/libffi/configure b/libffi/configure
index 57ccc55f4ad..3abd665a6f7 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -9001,7 +9001,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9914,7 +9914,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9932,7 +9932,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 57fcc540019..305e8ad3c3c 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,66 @@
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * config/darwin-crt-tm.c: New file.
+ * config.host (darwin): Build crttms.o crttme.o to provide
+ startup and shutdown for tm clones.
+ * config/t-darwin (crttms.o): New build rule.
+ (crttme.o): Likewise.
+
+2011-11-21 Hans-Peter Nilsson <hp@axis.com>
+
+ * Makefile.in ($(srcdir)/emutls.c): Explain why it's in LIB2ADDEH
+ et al.
+
+2011-11-21 Richard Henderson <rth@redhat.com>
+
+ * crtstuff.c (USE_TM_CLONE_REGISTRY): Default to 1 on ELF.
+ (__TMC_LIST__, __TMC_END__): New.
+ (__do_global_dtors_aux): Call _ITM_deregisterTMCloneTable.
+ (__do_global_dtors): Likewise.
+ (frame_dummy): Call _ITM_registerTMCloneTable.
+ (__do_global_ctors_1): Likewise.
+
+2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.host (iq2000*-*-elf*): Add iq2000/t-iq2000 to tmake_file.
+ (powerpc-*-netbsd*): Add rs6000/t-netbsd to tmake_file.
+ (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Add to tmake_file.
+ (powerpc-*-lynxos*): Add rs6000/t-lynx to tmake_file.
+ * config/i386/t-darwin64: Remove.
+ * config/sh/t-netbsd (LIB2ADD): Remove.
+
+2011-11-21 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/49313
+ * config/avr/t-avr (LIB2FUNCS_EXCLUDE): Add _moddi3, _umoddi3.
+ (LIB1ASMFUNCS): Add _divdi3, _udivdi3, _udivmod64, _negdi2.
+ * config/avr/lib1funcs.S (wmov): New assembler macro.
+ (__umoddi3, __udivdi3, __udivdi3_umoddi3): New functions.
+ (__moddi3, __divdi3, __divdi3_moddi3): New functions.
+ (__udivmod64): New function.
+ (__negdi2): New function.
+
+2011-11-21 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * config.host (*-*-freebsd[12], *-*-freebsd[12].*,
+ *-*-freebsd*aout*): Remove.
+
+2011-11-20 Hans-Peter Nilsson <hp@axis.com>
+
+ * static-object.mk (c_flags-$o): Save c_flags.
+ ($(base)$(objext)): Use it.
+
+2011-11-18 Steve Ellcey <sje@cup.hp.com>
+
+ * Makefile.in (c_flags): Set to -fno-exceptions to build libunwind.
+
+2011-11-18 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/49868
+ * config/avr/t-avr (LIB1ASMFUNCS): Add _xload_2 _xload_3 _xload_4.
+ * config/avr/lib1funcs.S (__xload_2, __xload_3, __xload_4):
+ New functions.
+
2011-11-16 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* config/arm/lib1funcs.asm (udivsi3): Add support for divide
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 3a8509d118c..23b72b92475 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -394,6 +394,9 @@ endif
LIB2ADD += enable-execute-stack.c
+# While emutls.c has nothing to do with EH, it is in LIB2ADDEH*
+# instead of LIB2ADD because that's the way to be sure on some targets
+# (e.g. *-*-darwin*) only one copy of it is linked.
LIB2ADDEH += $(srcdir)/emutls.c
LIB2ADDEHSTATIC += $(srcdir)/emutls.c
LIB2ADDEHSHARED += $(srcdir)/emutls.c
@@ -827,9 +830,10 @@ include $(iterator)
endif
-# Build LIBUNWIND.
+# Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
+# not generate calls to __gcc_personality_v0.
-c_flags := -fexceptions
+c_flags := -fno-exceptions
libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
diff --git a/libgcc/config.host b/libgcc/config.host
index 342d60c6be7..447c41c46a0 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -170,16 +170,7 @@ case ${host} in
*-*-darwin*)
asm_hidden_op=.private_extern
tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
- extra_parts=crt3.o
- ;;
-*-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
- # This is the place-holder for the generic a.out configuration
- # of FreeBSD. No actual configuration resides here since
- # there was only ever a bare-bones ix86 configuration for
- # a.out and it exists solely in the machine-specific section.
- # This place-holder must exist to avoid dropping into
- # the generic ELF configuration of FreeBSD (i.e. it must be
- # ordered before that section).
+ extra_parts="crt3.o crttms.o crttme.o"
;;
*-*-freebsd*)
# This is the generic ELF configuration of FreeBSD. Later
@@ -672,7 +663,7 @@ ia64-hp-*vms*)
md_unwind_header=ia64/vms-unwind.h
;;
iq2000*-*-elf*)
- tmake_file=t-fdpbit
+ tmake_file="iq2000/t-iq2000 t-fdpbit"
# Don't use default.
extra_parts=
;;
@@ -856,7 +847,7 @@ powerpc-*-freebsd*)
extra_parts="$extra_parts crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc-*-netbsd*)
- tmake_file="$tmake_file rs6000/t-crtstuff"
+ tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff"
;;
powerpc-*-eabispe*)
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic"
@@ -896,10 +887,10 @@ powerpc-*-linux* | powerpc64-*-linux*)
md_unwind_header=rs6000/linux-unwind.h
;;
powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
- tmake_file="rs6000/t-ppccomm-ldbl t-fdpbit"
+ tmake_file="$tmake_file rs6000/t-ppccomm-ldbl t-fdpbit"
;;
powerpc-*-lynxos*)
- tmake_file="$tmake_file t-fdpbit"
+ tmake_file="$tmake_file rs6000/t-lynx t-fdpbit"
;;
powerpcle-*-elf*)
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ppccomm-ldbl rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
diff --git a/libgcc/config/avr/lib1funcs.S b/libgcc/config/avr/lib1funcs.S
index 573761b619a..c592c4caa5d 100644
--- a/libgcc/config/avr/lib1funcs.S
+++ b/libgcc/config/avr/lib1funcs.S
@@ -61,6 +61,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
.endm
+.macro wmov r_dest, r_src
+#if defined (__AVR_HAVE_MOVW__)
+ movw \r_dest, \r_src
+#else
+ mov \r_dest, \r_src
+ mov \r_dest+1, \r_src+1
+#endif
+.endm
+
#if defined (__AVR_HAVE_JMP_CALL__)
#define XCALL call
#define XJMP jmp
@@ -846,6 +855,352 @@ __divmodsi4_exit:
ENDF __divmodsi4
#endif /* defined (L_divmodsi4) */
+
+/*******************************************************
+ Division 64 / 64
+ Modulo 64 % 64
+*******************************************************/
+
+;; Use Speed-optimized Version on "big" Devices, i.e. Devices with
+;; at least 16k of Program Memory. For smaller Devices, depend
+;; on MOVW.
+
+#if defined (__AVR_HAVE_JMP_CALL__)
+# define SPEED_DIV 8
+#elif defined (__AVR_HAVE_MOVW__)
+# define SPEED_DIV 16
+#else
+# define SPEED_DIV 0
+#endif
+
+;; A[0..7]: In: Dividend;
+;; Out: Quotient (T = 0)
+;; Out: Remainder (T = 1)
+#define A0 18
+#define A1 A0+1
+#define A2 A0+2
+#define A3 A0+3
+#define A4 A0+4
+#define A5 A0+5
+#define A6 A0+6
+#define A7 A0+7
+
+;; B[0..7]: In: Divisor; Out: Clobber
+#define B0 10
+#define B1 B0+1
+#define B2 B0+2
+#define B3 B0+3
+#define B4 B0+4
+#define B5 B0+5
+#define B6 B0+6
+#define B7 B0+7
+
+;; C[0..7]: Expand remainder; Out: Remainder (unused)
+#define C0 8
+#define C1 C0+1
+#define C2 30
+#define C3 C2+1
+#define C4 28
+#define C5 C4+1
+#define C6 26
+#define C7 C6+1
+
+;; Holds Signs during Division Routine
+#define SS __tmp_reg__
+
+;; Bit-Counter in Division Routine
+#define R_cnt __zero_reg__
+
+;; Scratch Register for Negation
+#define NN r31
+
+#if defined (L_udivdi3)
+
+;; R25:R18 = R24:R18 umod R17:R10
+;; Ordinary ABI-Function
+
+DEFUN __umoddi3
+ set
+ rjmp __udivdi3_umoddi3
+ENDF __umoddi3
+
+;; R25:R18 = R24:R18 udiv R17:R10
+;; Ordinary ABI-Function
+
+DEFUN __udivdi3
+ clt
+ENDF __udivdi3
+
+DEFUN __udivdi3_umoddi3
+ push C0
+ push C1
+ push C4
+ push C5
+ XCALL __udivmod64
+ pop C5
+ pop C4
+ pop C1
+ pop C0
+ ret
+ENDF __udivdi3_umoddi3
+#endif /* L_udivdi3 */
+
+#if defined (L_udivmod64)
+
+;; Worker Routine for 64-Bit unsigned Quotient and Remainder Computation
+;; No Registers saved/restored; the Callers will take Care.
+;; Preserves B[] and T-flag
+;; T = 0: Compute Quotient in A[]
+;; T = 1: Compute Remainder in A[] and shift SS one Bit left
+
+DEFUN __udivmod64
+
+ ;; Clear Remainder (C6, C7 will follow)
+ clr C0
+ clr C1
+ wmov C2, C0
+ wmov C4, C0
+ ldi C7, 64
+
+#if SPEED_DIV == 0 || SPEED_DIV == 16
+ ;; Initialize Loop-Counter
+ mov R_cnt, C7
+ wmov C6, C0
+#endif /* SPEED_DIV */
+
+#if SPEED_DIV == 8
+
+ push A7
+ clr C6
+
+1: ;; Compare shifted Devidend against Divisor
+ ;; If -- even after Shifting -- it is smaller...
+ CP A7,B0 $ cpc C0,B1 $ cpc C1,B2 $ cpc C2,B3
+ cpc C3,B4 $ cpc C4,B5 $ cpc C5,B6 $ cpc C6,B7
+ brcc 2f
+
+ ;; ...then we can subtract it. Thus, it is legal to shift left
+ $ mov C6,C5 $ mov C5,C4 $ mov C4,C3
+ mov C3,C2 $ mov C2,C1 $ mov C1,C0 $ mov C0,A7
+ mov A7,A6 $ mov A6,A5 $ mov A5,A4 $ mov A4,A3
+ mov A3,A2 $ mov A2,A1 $ mov A1,A0 $ clr A0
+
+ ;; 8 Bits are done
+ subi C7, 8
+ brne 1b
+
+ ;; Shifted 64 Bits: A7 has traveled to C7
+ pop C7
+ ;; Divisor is greater than Dividend. We have:
+ ;; A[] % B[] = A[]
+ ;; A[] / B[] = 0
+ ;; Thus, we can return immediately
+ rjmp 5f
+
+2: ;; Initialze Bit-Counter with Number of Bits still to be performed
+ mov R_cnt, C7
+
+ ;; Push of A7 is not needed because C7 is still 0
+ pop C7
+ clr C7
+
+#elif SPEED_DIV == 16
+
+ ;; Compare shifted Dividend against Divisor
+ cp A7, B3
+ cpc C0, B4
+ cpc C1, B5
+ cpc C2, B6
+ cpc C3, B7
+ brcc 2f
+
+ ;; Divisor is greater than shifted Dividen: We can shift the Dividend
+ ;; and it is still smaller than the Divisor --> Shift one 32-Bit Chunk
+ wmov C2,A6 $ wmov C0,A4
+ wmov A6,A2 $ wmov A4,A0
+ wmov A2,C6 $ wmov A0,C4
+
+ ;; Set Bit Counter to 32
+ lsr R_cnt
+2:
+#elif SPEED_DIV
+#error SPEED_DIV = ?
+#endif /* SPEED_DIV */
+
+;; The very Division + Remainder Routine
+
+3: ;; Left-shift Dividend...
+ lsl A0 $ rol A1 $ rol A2 $ rol A3
+ rol A4 $ rol A5 $ rol A6 $ rol A7
+
+ ;; ...into Remainder
+ rol C0 $ rol C1 $ rol C2 $ rol C3
+ rol C4 $ rol C5 $ rol C6 $ rol C7
+
+ ;; Compare Remainder and Divisor
+ CP C0,B0 $ cpc C1,B1 $ cpc C2,B2 $ cpc C3,B3
+ cpc C4,B4 $ cpc C5,B5 $ cpc C6,B6 $ cpc C7,B7
+
+ brcs 4f
+
+ ;; Divisor fits into Remainder: Subtract it from Remainder...
+ SUB C0,B0 $ sbc C1,B1 $ sbc C2,B2 $ sbc C3,B3
+ sbc C4,B4 $ sbc C5,B5 $ sbc C6,B6 $ sbc C7,B7
+
+ ;; ...and set according Bit in the upcoming Quotient
+ ;; The Bit will travel to its final Position
+ ori A0, 1
+
+4: ;; This Bit is done
+ dec R_cnt
+ brne 3b
+ ;; __zero_reg__ is 0 again
+
+ ;; T = 0: We are fine with the Quotient in A[]
+ ;; T = 1: Copy Remainder to A[]
+5: brtc 6f
+ wmov A0, C0
+ wmov A2, C2
+ wmov A4, C4
+ wmov A6, C6
+ ;; Move the Sign of the Result to SS.7
+ lsl SS
+
+6: ret
+
+ENDF __udivmod64
+#endif /* L_udivmod64 */
+
+
+#if defined (L_divdi3)
+
+;; R25:R18 = R24:R18 mod R17:R10
+;; Ordinary ABI-Function
+
+DEFUN __moddi3
+ set
+ rjmp __divdi3_moddi3
+ENDF __moddi3
+
+;; R25:R18 = R24:R18 div R17:R10
+;; Ordinary ABI-Function
+
+DEFUN __divdi3
+ clt
+ENDF __divdi3
+
+DEFUN __divdi3_moddi3
+#if SPEED_DIV
+ mov r31, A7
+ or r31, B7
+ brmi 0f
+ ;; Both Signs are 0: the following Complexitiy is not needed
+ XJMP __udivdi3_umoddi3
+#endif /* SPEED_DIV */
+
+0: ;; The Prologue
+ ;; Save Z = 12 Registers: Y, 17...8
+ ;; No Frame needed (X = 0)
+ clr r26
+ clr r27
+ ldi r30, lo8(gs(1f))
+ ldi r31, hi8(gs(1f))
+ XJMP __prologue_saves__ + ((18 - 12) * 2)
+
+1: ;; SS.7 will contain the Sign of the Quotient (A.sign * B.sign)
+ ;; SS.6 will contain the Sign of the Remainder (A.sign)
+ mov SS, A7
+ asr SS
+ ;; Adjust Dividend's Sign as needed
+#if SPEED_DIV
+ ;; Compiling for Speed we know that at least one Sign must be < 0
+ ;; Thus, if A[] >= 0 then we know B[] < 0
+ brpl 22f
+#else
+ brpl 21f
+#endif /* SPEED_DIV */
+
+ XCALL __negdi2
+
+ ;; Adjust Divisor's Sign and SS.7 as needed
+21: tst B7
+ brpl 3f
+22: ldi NN, 1 << 7
+ eor SS, NN
+
+ ldi NN, -1
+ com B4 $ com B5 $ com B6 $ com B7
+ $ com B1 $ com B2 $ com B3
+ NEG B0
+ $ sbc B1,NN $ sbc B2,NN $ sbc B3,NN
+ sbc B4,NN $ sbc B5,NN $ sbc B6,NN $ sbc B7,NN
+
+3: ;; Do the unsigned 64-Bit Division/Modulo (depending on T-flag)
+ XCALL __udivmod64
+
+ ;; Adjust Result's Sign
+#ifdef __AVR_ERRATA_SKIP_JMP_CALL__
+ tst SS
+ brpl 4f
+#else
+ sbrc SS, 7
+#endif /* __AVR_HAVE_JMP_CALL__ */
+ XCALL __negdi2
+
+4: ;; Epilogue: Restore the Z = 12 Registers and return
+ in r28, __SP_L__
+ in r29, __SP_H__
+ ldi r30, 12
+ XJMP __epilogue_restores__ + ((18 - 12) * 2)
+
+ENDF __divdi3_moddi3
+
+#undef R_cnt
+#undef SS
+#undef NN
+
+#endif /* L_divdi3 */
+
+#if defined (L_negdi2)
+DEFUN __negdi2
+
+ com A4 $ com A5 $ com A6 $ com A7
+ $ com A1 $ com A2 $ com A3
+ NEG A0
+ $ sbci A1,-1 $ sbci A2,-1 $ sbci A3,-1
+ sbci A4,-1 $ sbci A5,-1 $ sbci A6,-1 $ sbci A7,-1
+ ret
+
+ENDF __negdi2
+#endif /* L_negdi2 */
+
+#undef C7
+#undef C6
+#undef C5
+#undef C4
+#undef C3
+#undef C2
+#undef C1
+#undef C0
+
+#undef B7
+#undef B6
+#undef B5
+#undef B4
+#undef B3
+#undef B2
+#undef B1
+#undef B0
+
+#undef A7
+#undef A6
+#undef A5
+#undef A4
+#undef A3
+#undef A2
+#undef A1
+#undef A0
+
.section .text.libgcc.prologue, "ax", @progbits
@@ -854,6 +1209,7 @@ ENDF __divmodsi4
**********************************/
#if defined (L_prologue)
+;; This function does not clobber T-flag; 64-bit division relies on it
DEFUN __prologue_saves__
push r2
push r3
@@ -1227,6 +1583,73 @@ ENDF __load_4
#endif /* L_load_3 || L_load_3 */
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Loading n bytes from Flash; n = 2,3,4
+;; R22... = Flash[R21:Z]
+;; Clobbers: __tmp_reg__, R21, R30, R31
+
+#if (defined (L_xload_2) \
+ || defined (L_xload_3) \
+ || defined (L_xload_4)) \
+ && defined (__AVR_HAVE_ELPM__) \
+ && !defined (__AVR_HAVE_ELPMX__)
+
+#if !defined (__AVR_HAVE_RAMPZ__)
+#error Need RAMPZ
+#endif /* have RAMPZ */
+
+;; Destination
+#define D0 22
+#define D1 D0+1
+#define D2 D0+2
+#define D3 D0+3
+
+;; Register containing bits 16+ of the address
+
+#define HHI8 21
+
+.macro .xload dest, n
+ elpm
+ mov \dest, r0
+.if \dest != D0+\n-1
+ adiw r30, 1
+ adc HHI8, __zero_reg__
+ out __RAMPZ__, HHI8
+.endif
+.endm
+
+#if defined (L_xload_2)
+DEFUN __xload_2
+ out __RAMPZ__, HHI8
+ .xload D0, 2
+ .xload D1, 2
+ ret
+ENDF __xload_2
+#endif /* L_xload_2 */
+
+#if defined (L_xload_3)
+DEFUN __xload_3
+ out __RAMPZ__, HHI8
+ .xload D0, 3
+ .xload D1, 3
+ .xload D2, 3
+ ret
+ENDF __xload_3
+#endif /* L_xload_3 */
+
+#if defined (L_xload_4)
+DEFUN __xload_4
+ out __RAMPZ__, HHI8
+ .xload D0, 4
+ .xload D1, 4
+ .xload D2, 4
+ .xload D3, 4
+ ret
+ENDF __xload_4
+#endif /* L_xload_4 */
+
+#endif /* L_xload_{2|3|4} && ELPM */
+
.section .text.libgcc.builtins, "ax", @progbits
diff --git a/libgcc/config/avr/t-avr b/libgcc/config/avr/t-avr
index 486214cf31b..b5c8d05186a 100644
--- a/libgcc/config/avr/t-avr
+++ b/libgcc/config/avr/t-avr
@@ -15,6 +15,9 @@ LIB1ASMFUNCS = \
_divmodpsi4 _udivmodpsi4 \
_udivmodsi4 \
_divmodsi4 \
+ _divdi3 _udivdi3 \
+ _udivmod64 \
+ _negdi2 \
_prologue \
_epilogue \
_exit \
@@ -22,6 +25,7 @@ LIB1ASMFUNCS = \
_tablejump \
_tablejump_elpm \
_load_3 _load_4 \
+ _xload_2 _xload_3 _xload_4 \
_copy_data \
_clear_bss \
_ctors \
@@ -49,6 +53,7 @@ LIB1ASMFUNCS = \
_fmul _fmuls _fmulsu
LIB2FUNCS_EXCLUDE = \
+ _moddi3 _umoddi3 \
_clz
# We do not have the DF type.
diff --git a/libgcc/config/darwin-crt-tm.c b/libgcc/config/darwin-crt-tm.c
new file mode 100644
index 00000000000..cfb66147662
--- /dev/null
+++ b/libgcc/config/darwin-crt-tm.c
@@ -0,0 +1,83 @@
+/* Provide the runtime intrastructure the transactional memory lib.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Iain Sandoe <iains@gcc.gnu.org>
+
+ This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include <mach-o/dyld.h>
+
+/* not listed in mach-o/dyld.h for some reason. */
+extern char * getsectdata (const char*,const char*,unsigned long*);
+
+#define WEAK __attribute__((weak))
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
+
+extern void _ITM_registerTMCloneTable (void *, size_t) WEAK;
+extern void _ITM_deregisterTMCloneTable (void *) WEAK;
+
+#ifdef START
+
+void __doTMRegistrations (void) __attribute__ ((constructor));
+
+void __doTMRegistrations (void)
+{
+ char * tm_clone_table_sect_data;
+ unsigned long tmct_siz;
+
+ tm_clone_table_sect_data = getsectdata ("__DATA",
+ "__tm_clone_table",
+ &tmct_siz);
+ tmct_siz /= (sizeof (size_t) * 2);
+ if (_ITM_registerTMCloneTable != NULL
+ && tm_clone_table_sect_data != NULL
+ && tmct_siz > 0)
+ _ITM_registerTMCloneTable (tm_clone_table_sect_data, (size_t)tmct_siz);
+}
+
+#endif
+
+#ifdef END
+
+void __doTMdeRegistrations (void) __attribute__ ((destructor));
+
+void __doTMdeRegistrations (void)
+{
+ char * tm_clone_table_sect_data;
+ unsigned long tmct_siz;
+
+ tm_clone_table_sect_data = getsectdata ("__DATA",
+ "__tm_clone_table",
+ &tmct_siz);
+
+ if (_ITM_deregisterTMCloneTable != NULL
+ && tm_clone_table_sect_data != NULL
+ && tmct_siz > 0)
+ _ITM_deregisterTMCloneTable (tm_clone_table_sect_data);
+
+}
+
+/* Provide dumy funcs for the weak ones - needed on most Darwin versions
+ for now. */
+
+void _ITM_registerTMCloneTable (void *n ATTRIBUTE_UNUSED, size_t s ATTRIBUTE_UNUSED)
+{}
+void _ITM_deregisterTMCloneTable (void *n ATTRIBUTE_UNUSED)
+{}
+#endif
diff --git a/libgcc/config/i386/t-darwin64 b/libgcc/config/i386/t-darwin64
deleted file mode 100644
index 30cf58b38f9..00000000000
--- a/libgcc/config/i386/t-darwin64
+++ /dev/null
@@ -1,2 +0,0 @@
-LIB2_SIDITI_CONV_FUNCS = yes
-LIB2ADD = $(srcdir)/config/darwin-64.c
diff --git a/libgcc/config/sh/t-netbsd b/libgcc/config/sh/t-netbsd
index d4df407fa16..3c5739e2ffc 100644
--- a/libgcc/config/sh/t-netbsd
+++ b/libgcc/config/sh/t-netbsd
@@ -1,5 +1,3 @@
LIB1ASMFUNCS_CACHE = _ic_invalidate
-LIB2ADD =
-
HOST_LIBGCC2_CFLAGS += -mieee
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
index e32127e9d8a..3365f010225 100644
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -3,6 +3,12 @@ crt3.o: $(srcdir)/config/darwin-crt3.c
$(crt_compile) \
-fno-tree-dominator-opts $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+crttms.o: $(srcdir)/config/darwin-crt-tm.c
+ $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -DSTART -c $<
+
+crttme.o: $(srcdir)/config/darwin-crt-tm.c
+ $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -DEND -c $<
+
# -pipe because there's an assembler bug, 4077127, which causes
# it to not properly process the first # directive, causing temporary
# file names to appear in stabs, causing the bootstrap to fail. Using -pipe
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index 66b2cdf2446..6f06b629602 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -127,6 +127,10 @@ call_ ## FUNC (void) \
# define HIDDEN_DTOR_LIST_END
#endif
+#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
+# define USE_TM_CLONE_REGISTRY 1
+#endif
+
/* We do not want to add the weak attribute to the declarations of these
routines in unwind-dw2-fde.h because that will cause the definition of
these symbols to be weak as well.
@@ -163,6 +167,10 @@ extern void __do_global_ctors_1 (void);
/* Likewise for _Jv_RegisterClasses. */
extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK;
+/* Likewise for transactional memory clone tables. */
+extern void _ITM_registerTMCloneTable (void *, size_t) TARGET_ATTRIBUTE_WEAK;
+extern void _ITM_deregisterTMCloneTable (void *) TARGET_ATTRIBUTE_WEAK;
+
#ifdef OBJECT_FORMAT_ELF
/* Declare a pointer to void function type. */
@@ -242,6 +250,13 @@ STATIC void *__JCR_LIST__[]
= { };
#endif /* JCR_SECTION_NAME */
+#if USE_TM_CLONE_REGISTRY
+STATIC func_ptr __TMC_LIST__[]
+ __attribute__((unused, section(".tm_clone_table"), aligned(sizeof(void*))))
+ = { };
+extern func_ptr __TMC_END__[] __attribute__((__visibility__ ("hidden")));
+#endif /* USE_TM_CLONE_REGISTRY */
+
#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
#ifdef OBJECT_FORMAT_ELF
@@ -331,6 +346,16 @@ __do_global_dtors_aux (void)
}
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
+#if USE_TM_CLONE_REGISTRY
+ if (__TMC_END__ - __TMC_LIST__ > 0)
+ {
+ void (*deregister_clones) (void *) = _ITM_deregisterTMCloneTable;
+ __asm ("" : "+r" (deregister_clones));
+ if (deregister_clones)
+ deregister_clones (__TMC_LIST__);
+ }
+#endif /* USE_TM_CLONE_REGISTRY */
+
#ifdef USE_EH_FRAME_REGISTRY
#ifdef CRT_GET_RFIB_DATA
/* If we used the new __register_frame_info_bases interface,
@@ -362,7 +387,9 @@ __do_global_dtors_aux_1 (void)
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
#endif
-#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
+#if defined(USE_EH_FRAME_REGISTRY) \
+ || defined(JCR_SECTION_NAME) \
+ || defined(USE_TM_CLONE_REGISTRY)
/* Stick a call to __register_frame_info into the .init section. For some
reason calls with no arguments work more reliably in .init, so stick the
call in another function. */
@@ -383,6 +410,7 @@ frame_dummy (void)
__register_frame_info (__EH_FRAME_BEGIN__, &object);
#endif /* CRT_GET_RFIB_DATA */
#endif /* USE_EH_FRAME_REGISTRY */
+
#ifdef JCR_SECTION_NAME
if (__JCR_LIST__[0])
{
@@ -392,6 +420,19 @@ frame_dummy (void)
register_classes (__JCR_LIST__);
}
#endif /* JCR_SECTION_NAME */
+
+#if USE_TM_CLONE_REGISTRY
+ if (__TMC_END__ - __TMC_LIST__ > 0)
+ {
+ void (*register_clones) (void *, size_t) = _ITM_registerTMCloneTable;
+ __asm ("" : "+r" (register_clones));
+ if (register_clones)
+ {
+ size_t size = (size_t)(__TMC_END__ - __TMC_LIST__) / 2;
+ _ITM_registerTMCloneTable (__TMC_LIST__, size);
+ }
+ }
+#endif /* USE_TM_CLONE_REGISTRY */
}
#ifdef INIT_SECTION_ASM_OP
@@ -401,7 +442,7 @@ static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array")))
= { frame_dummy };
#endif /* !defined(INIT_SECTION_ASM_OP) */
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */
+#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
#else /* OBJECT_FORMAT_ELF */
@@ -458,13 +499,25 @@ __do_global_dtors (void)
for (p = __DTOR_LIST__ + 1; (f = *p); p++)
f ();
+#if USE_TM_CLONE_REGISTRY
+ if (__TMC_END__ - __TMC_LIST__ > 0)
+ {
+ void (*deregister_clones) (void *) = _ITM_deregisterTMCloneTable;
+ __asm ("" : "+r" (deregister_clones));
+ if (deregister_clones)
+ deregister_clones (__TMC_LIST__);
+ }
+#endif /* USE_TM_CLONE_REGISTRY */
+
#ifdef USE_EH_FRAME_REGISTRY
if (__deregister_frame_info)
__deregister_frame_info (__EH_FRAME_BEGIN__);
#endif
}
-#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
+#if defined(USE_EH_FRAME_REGISTRY) \
+ || defined(JCR_SECTION_NAME) \
+ || defined(USE_TM_CLONE_REGISTRY)
/* A helper function for __do_global_ctors, which is in crtend.o. Here
in crtbegin.o, we can reference a couple of symbols not visible there.
Plus, since we're before libgcc.a, we have no problems referencing
@@ -477,6 +530,7 @@ __do_global_ctors_1(void)
if (__register_frame_info)
__register_frame_info (__EH_FRAME_BEGIN__, &object);
#endif
+
#ifdef JCR_SECTION_NAME
if (__JCR_LIST__[0])
{
@@ -486,8 +540,21 @@ __do_global_ctors_1(void)
register_classes (__JCR_LIST__);
}
#endif
+
+#if USE_TM_CLONE_REGISTRY
+ if (__TMC_END__ - __TMC_LIST__ > 0)
+ {
+ void (*register_clones) (void *, size_t) = _ITM_registerTMCloneTable;
+ __asm ("" : "+r" (register_clones));
+ if (register_clones)
+ {
+ size_t size = (size_t)(__TMC_END__ - __TMC_LIST__) / 2;
+ register_clones (__TMC_LIST__, size);
+ }
+ }
+#endif /* USE_TM_CLONE_REGISTRY */
}
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */
+#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
#else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
#error "What are you doing with crtstuff.c, then?"
@@ -571,6 +638,13 @@ STATIC void *__JCR_END__[1]
= { 0 };
#endif /* JCR_SECTION_NAME */
+#if USE_TM_CLONE_REGISTRY
+func_ptr __TMC_END__[]
+ __attribute__((unused, section(".tm_clone_table"), aligned(sizeof(void *)),
+ __visibility__ ("hidden")))
+ = { };
+#endif /* USE_TM_CLONE_REGISTRY */
+
#ifdef INIT_ARRAY_SECTION_ASM_OP
/* If we are using .init_array, there is nothing to do. */
@@ -635,7 +709,9 @@ void
__do_global_ctors (void)
{
func_ptr *p;
-#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
+#if defined(USE_EH_FRAME_REGISTRY) \
+ || defined(JCR_SECTION_NAME) \
+ || defined(USE_TM_CLONE_REGISTRY)
__do_global_ctors_1();
#endif
for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
diff --git a/libgcc/static-object.mk b/libgcc/static-object.mk
index ab75d3288c3..930f009cd42 100644
--- a/libgcc/static-object.mk
+++ b/libgcc/static-object.mk
@@ -6,10 +6,15 @@ iter-items := $(filter-out $o,$(iter-items))
base := $(basename $(notdir $o))
+# Copy c_flags to a rule-specific copy and use the copy, to avoid the
+# following rules being affected by later changes to c_flags in the
+# including file.
+c_flags-$o := $(c_flags)
+
ifeq ($(suffix $o),.c)
$(base)$(objext): $o
- $(gcc_compile) $(c_flags) -c $< $(vis_hide)
+ $(gcc_compile) $(c_flags-$<) -c $< $(vis_hide)
else
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6c253b0d0cc..750428fec7a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-11-11 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/51090
diff --git a/libgfortran/configure b/libgfortran/configure
index c39b003e9e4..6ae1f09f48c 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -10532,7 +10532,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -11448,7 +11448,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -11466,7 +11466,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -14368,7 +14368,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct_FC=yes
hardcode_minus_L_FC=yes
@@ -15076,7 +15076,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -15094,7 +15094,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6858636c1ab..b52de1a1aea 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-10-10 Matthias Klose <doko@ubuntu.com>
* config/posix95: Remove empty directory.
diff --git a/libgomp/configure b/libgomp/configure
index 50dc29a6201..6f25c6f5eb9 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -9317,7 +9317,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -10230,7 +10230,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -10248,7 +10248,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -13164,7 +13164,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct_FC=yes
hardcode_minus_L_FC=yes
@@ -13869,7 +13869,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -13887,7 +13887,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 642c42a01b7..ab21cc5b99d 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,44 @@
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * configure.ac: Use GCC_CHECK_ELF_STYLE_WEAKREF.
+ * alloc_cpp.cc: Generate dummy functions if we don't
+ HAVE_ELF_STYLE_WEAKREF.
+ * eh_cpp.cc: Likewise.
+ * configure: Regenerate.
+ * aclocal.m4: Likewise.
+ * config.h.in: Likewise.
+ * Makefile.in: Likewise.
+ * testsuite/Makefile.in: Likewise.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * config/x86/sjlj.S (CONCAT1, CONCAT2, SYM): Respond to
+ __USER_LABEL_PREFIX__ for targets that use it.
+ (TYPE, SIZE, HIDDEN): New macros to assist on non-elf targets.
+ (_ITM_beginTransaction): Use SYM, TYPE, SIZE macros to assist
+ in portability to non-elf targets.
+ (GTM_longjmp): Likewise.
+ * libitm_i.h (begin_transaction): Apply __USER_LABEL_PREFIX__
+ where required.
+
+2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
+
+ * testsuite/libitm.c/memcpy-1.c: Allow for MAP_ANON spelling.
+ * testsuite/libitm.c/memset-1.c: Likewise.
+
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
+2011-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * acinclude.m4 (LIBITM_CHECK_LINKER_FEATURES): Handle gold.
+ (LIBITM_ENABLE_SYMVERS): Handle sun style.
+ * Makefile.am: Handle sun style versioning.
+ (libitm_la_LINK): Add $(libitm_la_LDFLAGS).
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
2011-11-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/generic/asmcfi.h: Fix comment.
diff --git a/libitm/Makefile.am b/libitm/Makefile.am
index b4674a572fc..7df807eaee4 100644
--- a/libitm/Makefile.am
+++ b/libitm/Makefile.am
@@ -27,15 +27,33 @@ toolexeclib_LTLIBRARIES = libitm.la
nodist_toolexeclib_HEADERS = libitm.spec
if LIBITM_BUILD_VERSIONED_SHLIB
+if LIBITM_BUILD_VERSIONED_SHLIB_GNU
libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+libitm_version_dep = $(top_srcdir)/libitm.map
+endif
+if LIBITM_BUILD_VERSIONED_SHLIB_SUN
+libitm_version_script = -Wl,-M,libitm.map-sun
+libitm_version_dep = libitm.map-sun
+libitm.map-sun : $(top_srcdir)/libitm.map \
+ $(top_srcdir)/../contrib/make_sunver.pl \
+ $(libitm_la_OBJECTS) $(libitm_la_LIBADD)
+ perl $(top_srcdir)/../contrib/make_sunver.pl \
+ $(top_srcdir)/libitm.map \
+ $(libitm_la_OBJECTS:%.lo=.libs/%.o) \
+ `echo $(libitm_la_LIBADD) | \
+ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
+ > $@ || (rm -f $@ ; exit 1)
+endif
else
libitm_version_script =
+libitm_version_dep =
endif
libitm_version_info = -version-info $(libtool_VERSION)
# Force link with C, not C++. For now, while we're using C++ we don't
# want or need libstdc++.
-libitm_la_LINK = $(LINK)
+libitm_la_DEPENDENCIES = $(libitm_version_dep)
+libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
-no-undefined
diff --git a/libitm/Makefile.in b/libitm/Makefile.in
index 74261463ebf..a1bc47645e0 100644
--- a/libitm/Makefile.in
+++ b/libitm/Makefile.in
@@ -57,10 +57,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
- $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
- $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
- $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/tls.m4 \
+ $(top_srcdir)/../config/weakref.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -359,12 +361,17 @@ AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
toolexeclib_LTLIBRARIES = libitm.la
nodist_toolexeclib_HEADERS = libitm.spec
@LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_script =
-@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,--version-script,$(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_script = -Wl,-M,libitm.map-sun
+@LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_dep =
+@LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_dep = $(top_srcdir)/libitm.map
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm_version_dep = libitm.map-sun
libitm_version_info = -version-info $(libtool_VERSION)
# Force link with C, not C++. For now, while we're using C++ we don't
# want or need libstdc++.
-libitm_la_LINK = $(LINK)
+libitm_la_DEPENDENCIES = $(libitm_version_dep)
+libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS)
libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) \
-no-undefined
@@ -1258,6 +1265,15 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
vpath % $(strip $(search_path))
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@libitm.map-sun : $(top_srcdir)/libitm.map \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ $(top_srcdir)/../contrib/make_sunver.pl \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ $(libitm_la_OBJECTS) $(libitm_la_LIBADD)
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ perl $(top_srcdir)/../contrib/make_sunver.pl \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ $(top_srcdir)/libitm.map \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ $(libitm_la_OBJECTS:%.lo=.libs/%.o) \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ `echo $(libitm_la_LIBADD) | \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
+@LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@ > $@ || (rm -f $@ ; exit 1)
@ARCH_X86_TRUE@x86_sse.lo : XCFLAGS += -msse
@ARCH_X86_AVX_TRUE@x86_avx.lo : XCFLAGS += -mavx
diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4
index 9ff1393db97..069738d8e80 100644
--- a/libitm/acinclude.m4
+++ b/libitm/acinclude.m4
@@ -169,6 +169,7 @@ dnl OPT_LDFLAGS='-Wl,-O1' if possible
dnl LD (as a side effect of testing)
dnl Sets:
dnl with_gnu_ld
+dnl libitm_ld_is_gold (possibly)
dnl libitm_gnu_ld_version (possibly)
dnl
dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
@@ -200,9 +201,13 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
+ libitm_ld_is_gold=no
+ if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+ libitm_ld_is_gold=yes
+ fi
changequote(,)
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
changequote([,])
libitm_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
@@ -272,16 +277,46 @@ AC_DEFUN([LIBITM_ENABLE_SYMVERS], [
LIBITM_ENABLE(symvers,yes,[=STYLE],
[enables symbol versioning of the shared library],
- [permit yes|no|gnu])
+ [permit yes|no|gnu*|sun])
# If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
AC_REQUIRE([LIBITM_CHECK_LINKER_FEATURES])
-# FIXME The following test is too strict, in theory.
-if test $enable_shared = no ||
- test "x$LD" = x ||
- test x$libitm_gnu_ld_version = x; then
- enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+ # FIXME The following test is too strict, in theory.
+ if test $enable_shared = no || test "x$LD" = x; then
+ enable_symvers=no
+ else
+ if test $with_gnu_ld = yes ; then
+ enable_symvers=gnu
+ else
+ case ${target_os} in
+ # Sun symbol versioning exists since Solaris 2.5.
+ solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
+ enable_symvers=sun ;;
+ *)
+ enable_symvers=no ;;
+ esac
+ fi
+ fi
+fi
+
+# Check if 'sun' was requested on non-Solaris 2 platforms.
+if test x$enable_symvers = xsun ; then
+ case ${target_os} in
+ solaris2*)
+ # All fine.
+ ;;
+ *)
+ # Unlikely to work.
+ AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
+ AC_MSG_WARN([=== you are not targetting Solaris 2.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ ;;
+ esac
fi
# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
@@ -318,12 +353,12 @@ libitm_min_gnu_ld_version=21400
# Check to see if unspecified "yes" value can win, given results above.
# Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
- if test $with_gnu_ld = yes &&
- test $libitm_shared_libgcc = yes;
- then
+if test $enable_symvers != no && test $libitm_shared_libgcc = yes; then
+ if test $with_gnu_ld = yes; then
if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
enable_symvers=gnu
+ elif test $libitm_ld_is_gold = yes ; then
+ enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
AC_MSG_WARN(=== Linker version $libitm_gnu_ld_version is too old for)
@@ -342,6 +377,8 @@ if test $enable_symvers = yes; then
enable_symvers=no
fi
fi
+ elif test $enable_symvers = sun; then
+ : All interesting versions of Sun ld support sun style symbol versioning.
else
# just fail for now
AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
@@ -353,5 +390,7 @@ if test $enable_symvers = yes; then
fi
AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_GNU, test $enable_symvers = gnu)
+AM_CONDITIONAL(LIBITM_BUILD_VERSIONED_SHLIB_SUN, test $enable_symvers = sun)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
])
diff --git a/libitm/aclocal.m4 b/libitm/aclocal.m4
index 96617e6e4db..625404e06f6 100644
--- a/libitm/aclocal.m4
+++ b/libitm/aclocal.m4
@@ -1001,6 +1001,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/tls.m4])
+m4_include([../config/weakref.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
diff --git a/libitm/alloc_cpp.cc b/libitm/alloc_cpp.cc
index d298bd49e82..0789b2e5342 100644
--- a/libitm/alloc_cpp.cc
+++ b/libitm/alloc_cpp.cc
@@ -60,7 +60,7 @@ extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak));
extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
-#ifdef __osf__ /* Really: !HAVE_WEAKDEF */
+#if !defined (HAVE_ELF_STYLE_WEAKREF)
void *_ZnwX (size_t) { return NULL; }
void _ZdlPv (void *) { return; }
void *_ZnaX (size_t) { return NULL; }
@@ -70,7 +70,7 @@ void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; }
void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) { return; }
void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; }
void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) { return; }
-#endif /* __osf__ */
+#endif /* HAVE_ELF_STYLE_WEAKREF */
/* Wrap the delete nothrow symbols for usage with a single argument.
Perhaps should have a configure type check for this, because the
diff --git a/libitm/config.h.in b/libitm/config.h.in
index 52db1a6fdc1..1c3469cd5f9 100644
--- a/libitm/config.h.in
+++ b/libitm/config.h.in
@@ -30,6 +30,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if target has a weakref that works like the ELF one. */
+#undef HAVE_ELF_STYLE_WEAKREF
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S
index ed755daa8a0..39e0c758d6d 100644
--- a/libitm/config/x86/sjlj.S
+++ b/libitm/config/x86/sjlj.S
@@ -25,12 +25,39 @@
#include "asmcfi.h"
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+#ifdef __USER_LABEL_PREFIX__
+# define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+#else
+# define SYM(x) x
+#endif
+
+#ifdef __ELF__
+# define TYPE(x) .type SYM(x), @function
+# define SIZE(x) .size SYM(x), . - SYM(x)
+# ifdef HAVE_ATTRIBUTE_VISIBILITY
+# define HIDDEN(x) .hidden SYM(x)
+# else
+# define HIDDEN(x)
+# endif
+#else
+# define TYPE(x)
+# define SIZE(x)
+# ifdef __MACH__
+# define HIDDEN(x) .private_extern SYM(x)
+# else
+# define HIDDEN(x)
+# endif
+#endif
+
.text
.align 4
- .globl _ITM_beginTransaction
+ .globl SYM(_ITM_beginTransaction)
-_ITM_beginTransaction:
+SYM(_ITM_beginTransaction):
cfi_startproc
#ifdef __x86_64__
leaq 8(%rsp), %rax
@@ -46,7 +73,7 @@ _ITM_beginTransaction:
movq %r14, 48(%rsp)
movq %r15, 56(%rsp)
movq %rsp, %rsi
- call GTM_begin_transaction
+ call SYM(GTM_begin_transaction)
addq $72, %rsp
cfi_def_cfa_offset(8)
ret
@@ -61,12 +88,12 @@ _ITM_beginTransaction:
movl %ebp, 24(%esp)
leal 8(%esp), %edx
#if defined HAVE_ATTRIBUTE_VISIBILITY || !defined __PIC__
- call GTM_begin_transaction
+ call SYM(GTM_begin_transaction)
#elif defined __ELF__
call 1f
1: popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
- call GTM_begin_transaction@PLT
+ call SYM(GTM_begin_transaction)@PLT
movl 12(%esp), %ebx
#else
# error "Unsupported PIC sequence"
@@ -77,15 +104,13 @@ _ITM_beginTransaction:
#endif
cfi_endproc
-#ifdef __ELF__
- .type _ITM_beginTransaction, @function
- .size _ITM_beginTransaction, .-_ITM_beginTransaction
-#endif
+ TYPE(_ITM_beginTransaction)
+ SIZE(_ITM_beginTransaction)
.align 4
- .globl GTM_longjmp
+ .globl SYM(GTM_longjmp)
-GTM_longjmp:
+SYM(GTM_longjmp):
cfi_startproc
#ifdef __x86_64__
movq (%rdi), %rcx
@@ -116,13 +141,9 @@ GTM_longjmp:
#endif
cfi_endproc
-#ifdef __ELF__
- .type GTM_longjmp, @function
-#ifdef HAVE_ATTRIBUTE_VISIBILITY
- .hidden GTM_longjmp
-#endif
- .size GTM_longjmp, .-GTM_longjmp
-#endif
+ TYPE(GTM_longjmp)
+ HIDDEN(GTM_longjmp)
+ SIZE(GTM_longjmp)
#ifdef __linux__
.section .note.GNU-stack, "", @progbits
diff --git a/libitm/configure b/libitm/configure
index 5fafca3c899..9b063594111 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -611,6 +611,10 @@ link_itm
XLDFLAGS
XCFLAGS
config_path
+LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE
+LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE
+LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE
+LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE
LIBITM_BUILD_VERSIONED_SHLIB_FALSE
LIBITM_BUILD_VERSIONED_SHLIB_TRUE
OPT_LDFLAGS
@@ -9951,7 +9955,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -10864,7 +10868,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -10882,7 +10886,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -11716,7 +11720,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11719 "configure"
+#line 11723 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11822,7 +11826,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11825 "configure"
+#line 11829 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12748,7 +12752,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -14523,7 +14527,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -14541,7 +14545,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -16688,9 +16692,13 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
+ libitm_ld_is_gold=no
+ if $LD --version 2>/dev/null | grep 'GNU gold'> /dev/null 2>&1; then
+ libitm_ld_is_gold=yes
+ fi
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'`
+ ldver=`$LD --version 2>/dev/null |
+ sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
libitm_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -16764,7 +16772,7 @@ $as_echo "$ac_sectionLDflags" >&6; }
if test "${enable_symvers+set}" = set; then :
enableval=$enable_symvers;
case "$enableval" in
- yes|no|gnu) ;;
+ yes|no|gnu*|sun) ;;
*) as_fn_error "Unknown argument to enable/disable symvers" "$LINENO" 5 ;;
esac
@@ -16777,11 +16785,44 @@ fi
# If we never went through the LIBITM_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
-# FIXME The following test is too strict, in theory.
-if test $enable_shared = no ||
- test "x$LD" = x ||
- test x$libitm_gnu_ld_version = x; then
- enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+ # FIXME The following test is too strict, in theory.
+ if test $enable_shared = no || test "x$LD" = x; then
+ enable_symvers=no
+ else
+ if test $with_gnu_ld = yes ; then
+ enable_symvers=gnu
+ else
+ case ${target_os} in
+ # Sun symbol versioning exists since Solaris 2.5.
+ solaris2.[5-9]* | solaris2.1[0-9]*)
+ enable_symvers=sun ;;
+ *)
+ enable_symvers=no ;;
+ esac
+ fi
+ fi
+fi
+
+# Check if 'sun' was requested on non-Solaris 2 platforms.
+if test x$enable_symvers = xsun ; then
+ case ${target_os} in
+ solaris2*)
+ # All fine.
+ ;;
+ *)
+ # Unlikely to work.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You have requested Sun symbol versioning, but" >&5
+$as_echo "$as_me: WARNING: === You have requested Sun symbol versioning, but" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === you are not targetting Solaris 2." >&5
+$as_echo "$as_me: WARNING: === you are not targetting Solaris 2." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Symbol versioning will be disabled." >&5
+$as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ ;;
+ esac
fi
# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
@@ -16850,12 +16891,12 @@ libitm_min_gnu_ld_version=21400
# Check to see if unspecified "yes" value can win, given results above.
# Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
- if test $with_gnu_ld = yes &&
- test $libitm_shared_libgcc = yes;
- then
+if test $enable_symvers != no && test $libitm_shared_libgcc = yes; then
+ if test $with_gnu_ld = yes; then
if test $libitm_gnu_ld_version -ge $libitm_min_gnu_ld_version ; then
enable_symvers=gnu
+ elif test $libitm_ld_is_gold = yes ; then
+ enable_symvers=gnu
else
# The right tools, the right setup, but too old. Fallbacks?
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === Linker version $libitm_gnu_ld_version is too old for" >&5
@@ -16878,6 +16919,8 @@ $as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
enable_symvers=no
fi
fi
+ elif test $enable_symvers = sun; then
+ : All interesting versions of Sun ld support sun style symbol versioning.
else
# just fail for now
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: === You have requested some kind of symbol versioning, but" >&5
@@ -16900,6 +16943,22 @@ else
LIBITM_BUILD_VERSIONED_SHLIB_FALSE=
fi
+ if test $enable_symvers = gnu; then
+ LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE=
+ LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE='#'
+else
+ LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE='#'
+ LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE=
+fi
+
+ if test $enable_symvers = sun; then
+ LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE=
+ LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE='#'
+else
+ LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE='#'
+ LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE=
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: versioning on shared library symbols is $enable_symvers" >&5
$as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
@@ -17154,6 +17213,57 @@ $as_echo "#define HAVE_AS_AVX 1" >>confdefs.h
;;
esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether weak refs work like ELF" >&5
+$as_echo_n "checking whether weak refs work like ELF... " >&6; }
+if test "${ac_cv_have_elf_style_weakref+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ weakref_m4_saved_CFLAGS="$CFLAGS"
+ case "${host}" in
+ *-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
+ *) ;;
+ esac
+ if test "$cross_compiling" = yes; then :
+
+case "${host}" in
+ alpha*-dec-osf*) ac_cv_have_elf_style_weakref=no ;;
+ *-apple-darwin[89]*) ac_cv_have_elf_style_weakref=no ;;
+ *) ac_cv_have_elf_style_weakref=yes;;
+esac
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+extern void fNotToBeFound(void) __attribute__((weak));
+int main ()
+{
+ if (fNotToBeFound)
+ return 1;
+ else
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_have_elf_style_weakref=yes
+else
+ ac_cv_have_elf_style_weakref=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+CFLAGS="$weakref_m4_saved_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_elf_style_weakref" >&5
+$as_echo "$ac_cv_have_elf_style_weakref" >&6; }
+if test x"$ac_cv_have_elf_style_weakref" = xyes; then
+
+$as_echo "#define HAVE_ELF_STYLE_WEAKREF 1" >>confdefs.h
+
+fi
+
# Cleanup and exit.
CFLAGS="$save_CFLAGS"
cat >confcache <<\_ACEOF
@@ -17424,6 +17534,14 @@ if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBITM_BUILD_VER
as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_GNU_TRUE}" && test -z "${LIBITM_BUILD_VERSIONED_SHLIB_GNU_FALSE}"; then
+ as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB_GNU\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE}" && test -z "${LIBITM_BUILD_VERSIONED_SHLIB_SUN_FALSE}"; then
+ as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB_SUN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ARCH_X86_TRUE}" && test -z "${ARCH_X86_FALSE}"; then
as_fn_error "conditional \"ARCH_X86\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 672b71279e3..45ee8701e38 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -239,6 +239,8 @@ LIBITM_CHECK_SYNC_BUILTINS
LIBITM_CHECK_64BIT_SYNC_BUILTINS
LIBITM_CHECK_AS_AVX
+GCC_CHECK_ELF_STYLE_WEAKREF
+
# Cleanup and exit.
CFLAGS="$save_CFLAGS"
AC_CACHE_SAVE
diff --git a/libitm/eh_cpp.cc b/libitm/eh_cpp.cc
index 7a378622772..6f302cdc4ae 100644
--- a/libitm/eh_cpp.cc
+++ b/libitm/eh_cpp.cc
@@ -39,13 +39,13 @@ extern void *__cxa_begin_catch (void *) WEAK;
extern void *__cxa_end_catch (void) WEAK;
extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
-#ifdef __osf__ /* Really: !HAVE_WEAKDEF */
+#if !defined (HAVE_ELF_STYLE_WEAKREF)
void *__cxa_allocate_exception (size_t) { return NULL; }
void __cxa_throw (void *, void *, void *) { return; }
void *__cxa_begin_catch (void *) { return NULL; }
void *__cxa_end_catch (void) { return NULL; }
void __cxa_tm_cleanup (void *, void *, unsigned int) { return; }
-#endif
+#endif /* HAVE_ELF_STYLE_WEAKREF */
}
diff --git a/libitm/libitm_i.h b/libitm/libitm_i.h
index 58e43b01281..ba1afb4710c 100644
--- a/libitm/libitm_i.h
+++ b/libitm/libitm_i.h
@@ -240,9 +240,15 @@ struct gtm_thread
// Invoked from assembly language, thus the "asm" specifier on
// the name, avoiding complex name mangling.
+#ifdef __USER_LABEL_PREFIX__
+#define UPFX1(t) UPFX(t)
+#define UPFX(t) #t
+ static uint32_t begin_transaction(uint32_t, const gtm_jmpbuf *)
+ __asm__(UPFX1(__USER_LABEL_PREFIX__) "GTM_begin_transaction") ITM_REGPARM;
+#else
static uint32_t begin_transaction(uint32_t, const gtm_jmpbuf *)
__asm__("GTM_begin_transaction") ITM_REGPARM;
-
+#endif
// In eh_cpp.cc
void revert_cpp_exceptions (gtm_transaction_cp *cp = 0);
diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in
index 6990cfeb681..8066a2a0388 100644
--- a/libitm/testsuite/Makefile.in
+++ b/libitm/testsuite/Makefile.in
@@ -47,10 +47,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
- $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
- $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
- $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/tls.m4 \
+ $(top_srcdir)/../config/weakref.m4 \
+ $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
+ $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
diff --git a/libitm/testsuite/libitm.c/memcpy-1.c b/libitm/testsuite/libitm.c/memcpy-1.c
index e4b56573b26..03b381285df 100644
--- a/libitm/testsuite/libitm.c/memcpy-1.c
+++ b/libitm/testsuite/libitm.c/memcpy-1.c
@@ -84,6 +84,12 @@ do_test (size_t align1, size_t align2, size_t len)
}
}
+#ifndef MAP_ANONYMOUS
+# ifdef MAP_ANON
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+#endif
+
int main()
{
size_t i, j;
diff --git a/libitm/testsuite/libitm.c/memset-1.c b/libitm/testsuite/libitm.c/memset-1.c
index 87bf6c62322..11aea458ca1 100644
--- a/libitm/testsuite/libitm.c/memset-1.c
+++ b/libitm/testsuite/libitm.c/memset-1.c
@@ -33,6 +33,12 @@ static unsigned char *buf;
static size_t bufsize, page_size;
static int fail;
+#ifndef MAP_ANONYMOUS
+# ifdef MAP_ANON
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+#endif
+
static void
do_test (size_t align, size_t len)
{
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 7ff941e459f..af2622d955c 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure.ac: Fix FreeBSD 10 detection.
+ * configure: Regenerate.
+
2011-10-17 Paul Brook <paul@codesourcery.com>
* exception.cc (parse_lsda_header): hardcode ttype_encoding for older
diff --git a/libjava/configure b/libjava/configure
index b38728e1957..e6c5b0cf66c 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -11573,7 +11573,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -12489,7 +12489,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -12507,7 +12507,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -14397,7 +14397,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -16172,7 +16172,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -16190,7 +16190,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -18533,7 +18533,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct_GCJ=yes
hardcode_minus_L_GCJ=yes
@@ -20731,7 +20731,7 @@ case "$THREADS" in
*-*-cygwin*)
# Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
;;
- *-*-freebsd[1234]*)
+ *-*-freebsd[34].*)
# Before FreeBSD 5, it didn't have -lpthread (or any library which
# merely adds pthread_* functions) but it does have a -pthread switch
# which is required at link-time to select -lc_r *instead* of -lc.
diff --git a/libjava/configure.ac b/libjava/configure.ac
index f0ed99ca248..d308c4f1a6b 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -1075,7 +1075,7 @@ case "$THREADS" in
*-*-cygwin*)
# Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
;;
- *-*-freebsd[[1234]]*)
+ *-*-freebsd[[34]].*)
# Before FreeBSD 5, it didn't have -lpthread (or any library which
# merely adds pthread_* functions) but it does have a -pthread switch
# which is required at link-time to select -lc_r *instead* of -lc.
diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog
index 708cb383578..df5ce43462d 100644
--- a/libjava/libltdl/ChangeLog
+++ b/libjava/libltdl/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * acinclude.m4: Additional FreeBSD 10 fixes.
+ * configure: Regenerate.
+
2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* acinclude.m4 (AC_LIBTOOL_PROG_LD_SHLIBS)
diff --git a/libjava/libltdl/acinclude.m4 b/libjava/libltdl/acinclude.m4
index 55beab162e7..d77a1a3990d 100644
--- a/libjava/libltdl/acinclude.m4
+++ b/libjava/libltdl/acinclude.m4
@@ -1377,7 +1377,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -3035,7 +3035,7 @@ case $host_os in
;;
esac
;;
- freebsd[[12]]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before switch to ELF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
@@ -5669,7 +5669,7 @@ EOF
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
diff --git a/libjava/libltdl/configure b/libjava/libltdl/configure
index f47d95f7369..35b89dc5551 100755
--- a/libjava/libltdl/configure
+++ b/libjava/libltdl/configure
@@ -7355,7 +7355,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -7968,7 +7968,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index e4754d5701b..355286092e5 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-07-31 Tom de Vries <tom@codesourcery.com>
PR middle-end/43513
diff --git a/libmudflap/configure b/libmudflap/configure
index 3ce3979bda2..f1c74a1f5ee 100755
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -8842,7 +8842,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9755,7 +9755,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9773,7 +9773,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 474849480e0..3999b439b9d 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.in (INCLUDES): Add -I$(MULTIBUILDTOP)../libgcc.
diff --git a/libobjc/configure b/libobjc/configure
index 59e3d98a7a5..8c07356af0c 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -8808,7 +8808,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9724,7 +9724,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9742,7 +9742,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 73c2c420f00..96c61861f24 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-11-07 Kai Tietz <ktietz@redhat.com>
PR target/51007
diff --git a/libquadmath/configure b/libquadmath/configure
index 7f78ea15868..9d979337d18 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -8727,7 +8727,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9643,7 +9643,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9661,7 +9661,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index d8f42a94dab..308f6fa7c0a 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-03-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR bootstrap/48135
diff --git a/libssp/configure b/libssp/configure
index b1edcb4295b..bd3f5662c4b 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -8864,7 +8864,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9780,7 +9780,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9798,7 +9798,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 235aa0578d4..3cdc64d9e93 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,81 @@
+2011-11-21 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/functional (is_placeholder, is_bind_expression): Add
+ partial specializations for cv-qualified types.
+ * include/tr1/functional (is_placeholder, is_bind_expression): Add
+ partial specializations for std::bind and std::placeholders and for
+ cv-qualified types.
+ * testsuite/20_util/bind/cv_quals_3.cc: New.
+ * testsuite/tr1/3_function_objects/bind/cv_quals.cc: New.
+ * testsuite/tr1/3_function_objects/bind/mixed.cc: New.
+
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
+2011-11-21 Daniel Krugler <daniel.kruegler@googlemail.com>
+
+ PR libstdc++/51185
+ * include/std/type_traits (__is_base_to_derived_ref,
+ __is_lvalue_to_rvalue_ref): Fix.
+ * testsuite/20_util/is_constructible/51185.cc: New.
+ * testsuite/20_util/is_constructible/value-2.cc: Extend.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
+ line number.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+ Likewise.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+ Likewise.
+
+2011-11-21 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/tuple (__conv_types, __one_by_one_convertible,
+ __all_convertible): Remove.
+ (tuple<>::tuple(_UElements&&...),
+ tuple<>::tuple(const tuple<_UElements...>&),
+ tuple<>::tuple(tuple<_UElements...>&&)): Remove wa for c++/48322.
+ * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error
+ line number.
+
+2011-11-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/48322
+ * include/std/tuple (tuple(_UElements&&...)): Fix SFINAE.
+
+ * testsuite/20_util/bind/ref_neg.cc: Adjust error markings.
+
+2011-11-20 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/backward/binders.h: Fix examples in doxygen comments and
+ suggest using std::bind instead.
+
+2011-11-20 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/manual/status_cxx2011.xml: Fix docbook markup.
+
+2011-11-20 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * doc/xml/manual/appendix_contributing.xml: Do not use "here" as link
+ text.
+ * doc/xml/faq.xml: Likewise. Do not request standard library issues
+ to be reported to the libstdc++ mailing list.
+ * doc/xml/manual/status_cxx2011.xml: Document implementation-defined
+ behaviour.
+ * doc/xml/manual/status_cxxtr1.xml: Likewise.
+ * doc/xml/manual/utilities.xml: Fix grammar, probably caused by a
+ global search and replace of "part" by "chapter".
+ * doc/xml/manual/shared_ptr.xml: Remove outdated information.
+ * doc/xml/manual/messages.xml: Be more specific about systems where
+ using 'int' for catalog handle is not a problem, mention LWG issue.
+
+2011-11-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/debug/bitset (operator[](size_t) const): Declare constexpr.
+ * include/profile/bitset: Likewise.
+ * testsuite/23_containers/bitset/operations/constexpr.cc: Split out
+ non portable bits to...
+ * testsuite/23_containers/bitset/operations/constexpr-2.cc: ... here.
+
2011-11-18 Harti Brandt <hartmut.brandt@dlr.de>
PR libstdc++/51209
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fa755b47236..52218367919 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -9702,7 +9702,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -10618,7 +10618,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -10636,7 +10636,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -12526,7 +12526,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
- freebsd[12]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
ld_shlibs_CXX=no
@@ -14301,7 +14301,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -14319,7 +14319,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
index af9b6da82fe..86142ec9c46 100644
--- a/libstdc++-v3/doc/xml/faq.xml
+++ b/libstdc++-v3/doc/xml/faq.xml
@@ -713,14 +713,15 @@
For those people who are not part of the ISO Library Group
(i.e., nearly all of us needing to read this page in the first
place), a public list of the library defects is occasionally
- published <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/">here</link>.
+ published on <link xmlns:xlink="http://www.w3.org/1999/xlink"
+ xlink:href="http://www.open-std.org/jtc1/sc22/wg21/">the WG21
+ website</link>.
Some of these issues have resulted in code changes in libstdc++.
</para>
<para>
If you think you've discovered a new bug that is not listed,
- please post a message describing your problem
- to <email>libstdc++@gcc.gnu.org</email> or the Usenet group
- comp.lang.c++.moderated.
+ please post a message describing your problem to the author of
+ the library issues list or the Usenet group comp.lang.c++.moderated.
</para>
</answer>
</qandaentry>
diff --git a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
index 49cbcab9ba3..d060f45a6d3 100644
--- a/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
+++ b/libstdc++-v3/doc/xml/manual/appendix_contributing.xml
@@ -45,10 +45,10 @@
two meeting commitment for voting rights, may get a copy of
the standard from their respective national standards
organization. In the USA, this national standards
- organization is ANSI and their web-site is right
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.ansi.org">here.</link>
- (And if you've already registered with them, clicking this link will take you to directly to the place where you can
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC+14882:2003">buy the standard on-line</link>.)
+ organization is
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.ansi.org">ANSI</link>.
+ (And if you've already registered with them you can
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+14882-2003">buy the standard on-line</link>.)
</para>
</listitem>
@@ -56,17 +56,16 @@
<para>
The library working group bugs, and known defects, can
be obtained here:
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/">http://www.open-std.org/jtc1/sc22/wg21 </link>
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/">http://www.open-std.org/jtc1/sc22/wg21</link>
</para>
</listitem>
<listitem>
<para>
The newsgroup dedicated to standardization issues is
- comp.std.c++: this FAQ for this group is quite useful and
- can be
- found <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.comeaucomputing.com/csc/faq.html">
- here </link>.
+ comp.std.c++: the
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.comeaucomputing.com/csc/faq.html">FAQ</link>
+ for this group is quite useful.
</para>
</listitem>
@@ -83,15 +82,15 @@
<para>
Be familiar with the extensions that preceded these
general GNU rules. These style issues for libstdc++ can be
- found <link linkend="contrib.coding_style">here</link>.
+ found in <link linkend="contrib.coding_style">Coding Style</link>.
</para>
</listitem>
<listitem>
<para>
And last but certainly not least, read the
- library-specific information
- found <link linkend="appendix.porting"> here</link>.
+ library-specific information found in
+ <link linkend="appendix.porting">Porting and Maintenance</link>.
</para>
</listitem>
</itemizedlist>
@@ -271,7 +270,7 @@ It has subdirectories:
Files that are used in constructing the library, but are not
installed.
- testsuites/[backward, demangle, ext, performance, thread, 17_* to 27_*]
+ testsuites/[backward, demangle, ext, performance, thread, 17_* to 30_*]
Test programs are here, and may be used to begin to exercise the
library. Support for "make check" and "make check-install" is
complete, and runs through all the subdirectories here when this
diff --git a/libstdc++-v3/doc/xml/manual/messages.xml b/libstdc++-v3/doc/xml/manual/messages.xml
index d6ce1f7f7a3..4dea4b3738b 100644
--- a/libstdc++-v3/doc/xml/manual/messages.xml
+++ b/libstdc++-v3/doc/xml/manual/messages.xml
@@ -119,8 +119,9 @@ A couple of notes on the standard.
<para>
First, why is <code>messages_base::catalog</code> specified as a typedef
to int? This makes sense for implementations that use
-<code>catopen</code>, but not for others. Fortunately, it's not heavily
-used and so only a minor irritant.
+<code>catopen</code> and define <code>nl_catd</code> as int, but not for
+others. Fortunately, it's not heavily used and so only a minor irritant.
+This has been reported as a possible defect in the standard (LWG 2028).
</para>
<para>
diff --git a/libstdc++-v3/doc/xml/manual/shared_ptr.xml b/libstdc++-v3/doc/xml/manual/shared_ptr.xml
index 6e3392f88ee..be1aaf655f2 100644
--- a/libstdc++-v3/doc/xml/manual/shared_ptr.xml
+++ b/libstdc++-v3/doc/xml/manual/shared_ptr.xml
@@ -95,13 +95,13 @@ until the last weak reference is dropped.
<term><classname>_Sp_counted_base_impl&lt;Ptr, Deleter, Lp&gt;</classname></term>
<listitem>
<para>
-Inherits from _Sp_counted_base and stores a pointer of type <type>Ptr</type>
-and a deleter of type <code>Deleter</code>. <code>_Sp_deleter</code> is
+Inherits from _Sp_counted_base and stores a pointer of type <code>Ptr</code>
+and a deleter of type <code>Deleter</code>. <classname>_Sp_deleter</classname> is
used when the user doesn't supply a custom deleter. Unlike Boost's, this
default deleter is not "checked" because GCC already issues a warning if
<function>delete</function> is used with an incomplete type.
-This is the only derived type used by <classname>shared_ptr&lt;Ptr&gt;</classname>
-and it is never used by <classname>shared_ptr</classname>, which uses one of
+This is the only derived type used by <classname>tr1::shared_ptr&lt;Ptr&gt;</classname>
+and it is never used by <classname>std::shared_ptr</classname>, which uses one of
the following types, depending on how the shared_ptr is constructed.
</para>
</listitem>
@@ -149,11 +149,6 @@ that simplifies the implementation slightly.
</variablelist>
- </section>
-
- <section><info><title>Thread Safety</title></info>
-
-
<para>
C++11-only features are: rvalue-ref/move support, allocator support,
aliasing constructor, make_shared &amp; allocate_shared. Additionally,
@@ -161,6 +156,11 @@ the constructors taking <classname>auto_ptr</classname> parameters are
deprecated in C++11 mode.
</para>
+
+ </section>
+
+ <section><info><title>Thread Safety</title></info>
+
<para>
The
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://boost.org/libs/smart_ptr/shared_ptr.htm#ThreadSafety">Thread
@@ -243,7 +243,7 @@ available policies are:
<orderedlist>
<listitem>
<para>
- <type>_S_Atomic</type>
+ <constant>_S_Atomic</constant>
</para>
<para>
Selected when GCC supports a builtin atomic compare-and-swap operation
@@ -256,7 +256,7 @@ synchronisation.
<listitem>
<para>
- <type>_S_Mutex</type>
+ <constant>_S_Mutex</constant>
</para>
<para>
The _Sp_counted_base specialization for this policy contains a mutex,
@@ -267,7 +267,7 @@ builtins aren't available so explicit memory barriers are needed in places.
<listitem>
<para>
- <type>_S_Single</type>
+ <constant>_S_Single</constant>
</para>
<para>
This policy uses a non-reentrant add_ref_lock() with no locking. It is
@@ -285,32 +285,6 @@ used when libstdc++ is built without <literal>--enable-threads</literal>.
</para>
</section>
- <section><info><title>Dual C++11 and TR1 Implementation</title></info>
-
-
-<para>
-The interface of <classname>tr1::shared_ptr</classname> was extended for C++11
-with support for rvalue-references and the other features from N2351.
-The <classname>_Sp_counted_base</classname> base class is implemented in
-<filename>tr1/boost_sp_shared_count.h</filename> and is common to the TR1
-and C++11 versions of <classname>shared_ptr</classname>.
-</para>
-
-<para>
-The classes derived from <classname>_Sp_counted_base</classname> (see Class Hierarchy
-above) and <classname>__shared_count</classname> are implemented separately for C++11
-and TR1, in <filename>bits/shared_ptr.h</filename> and
-<filename>tr1/shared_ptr.h</filename> respectively.
-</para>
-
-<para>
-The TR1 implementation is considered relatively stable, so is unlikely to
-change unless bug fixes require it. If the code that is common to both
-C++11 and TR1 versions needs to diverge further then it might be necessary to
-duplicate <classname>_Sp_counted_base</classname> and only make changes to
-the C++11 version.
-</para>
-</section>
<section><info><title>Related functions and classes</title></info>
@@ -377,34 +351,6 @@ be private.
</section>
-<!--- XXX
- <listitem>
- <type>_Sp_counted_base&lt;Lp&gt;</type>
- <para>
-The base of the hierarchy is parameterized on the lock policy alone.
-_Sp_counted_base doesn't depend on the type of pointer being managed,
-it only maintains the reference counts and calls virtual functions when
-the counts drop to zero. The managed object is destroyed when the last
-strong reference is dropped, but the _Sp_counted_base itself must exist
-until the last weak reference is dropped.
- </para>
- </listitem>
-
- <listitem>
- <type>_Sp_counted_base_impl&lt;Ptr, Deleter, Lp&gt;</type>
- <para>
-Inherits from _Sp_counted_base and stores a pointer of type <code>Ptr</code>
-and a deleter of type <code>Deleter</code>. <code>_Sp_deleter</code> is
-used when the user doesn't supply a custom deleter. Unlike Boost's, this
-default deleter is not "checked" because GCC already issues a warning if
-<code>delete</code> is used with an incomplete type.
-This is the only derived type used by <code>tr1::shared_ptr&lt;Ptr&gt;</code>
-and it is never used by <code>std::shared_ptr</code>, which uses one of
-the following types, depending on how the shared_ptr is constructed.
- </para>
- </listitem>
--->
-
<section xml:id="shared_ptr.using"><info><title>Use</title></info>
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
index 6f53a73348c..f47710e3b90 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml
@@ -2409,7 +2409,8 @@ particular release.
<entry>30.4.1.3</entry>
<entry>Timed mutex types</entry>
<entry/>
- <entry/>
+ <entry>On POSIX sytems these types are only defined if the OS
+ supports the POSIX Timeouts option. </entry>
</row>
<row>
<entry>30.4.1.3.1</entry>
@@ -2627,5 +2628,59 @@ particular release.
</tgroup>
</table>
+<section xml:id="iso.2011.specific" xreflabel="Implementation Specific"><info><title>Implementation Specific Behavior</title></info>
+
+ <para>For behaviour which is also specified by the 1998 and 2003 standards,
+ see <link linkend="iso.1998.specific">C++ 1998/2003 Implementation
+ Specific Behavior</link>. This section only documents behaviour which
+ is new in the 2011 standard.
+ </para>
+
+ <para>
+ <emphasis>20.8.9.1.3 [func.bind.place]/1</emphasis> There are 29
+ placeholders defined and the placeholder types are
+ <literal>CopyAssignable</literal>.
+ </para>
+
+ <para>
+ <emphasis>30.2.3 [thread.req.native]/1</emphasis>
+ <classname>native_handle_type</classname> and
+ <methodname>native_handle</methodname> are provided. The handle types
+ are defined in terms of the Gthreads abstraction layer.
+ <itemizedlist>
+ <listitem><para><classname>thread</classname>: The native handle type is
+ a typedef for <code>__gthread_t</code> i.e. <code>pthread_t</code>
+ when GCC is configured with the <literal>posix</literal> thread
+ model. The value of the native handle is undefined for a thread
+ which is not joinable.
+ </para></listitem>
+ <listitem><para><classname>mutex</classname> and
+ <classname>timed_mutex</classname>:
+ The native handle type is <code>__gthread_mutex_t*</code> i.e.
+ <code>pthread_mutex_t*</code> for the <literal>posix</literal>
+ thread model.
+ </para></listitem>
+ <listitem><para><classname>recursive_mutex</classname> and
+ <classname>recursive_timed_mutex</classname>:
+ The native handle type is <code>__gthread_recursive_mutex_t*</code>
+ i.e. <code>pthread_mutex_t*</code> for the <literal>posix</literal>
+ thread model.
+ </para></listitem>
+ <listitem><para><classname>condition_variable</classname>: The native
+ handle type is <code>__gthread_cond_t*</code> i.e.
+ <code>pthread_cond_t*</code> for the <literal>posix</literal>
+ thread model.
+ </para></listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ <emphasis>30.6.1 [futures.overview]/2</emphasis>
+ <code>launch</code> is a scoped enumeration type with
+ overloaded operators to support bitmask operations. There are no
+ additional bitmask elements defined.
+ </para>
+
+</section>
</section>
diff --git a/libstdc++-v3/doc/xml/manual/status_cxxtr1.xml b/libstdc++-v3/doc/xml/manual/status_cxxtr1.xml
index 321c4ba269c..58571f2dde7 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxxtr1.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxxtr1.xml
@@ -1779,4 +1779,20 @@ release.
</tgroup>
</table>
+<section xml:id="iso.tr1.specific" xreflabel="Implementation Specific"><info><title>Implementation Specific Behavior</title></info>
+
+ <para>For behaviour which is specified by the 1998 and 2003 standards,
+ see <link linkend="iso.1998.specific">C++ 1998/2003 Implementation
+ Specific Behavior</link>. This section documents behaviour which
+ is required by TR1.
+ </para>
+
+ <para>
+ <emphasis>3.6.4 [tr.func.bind.place]/1</emphasis> There are 29
+ placeholders defined and the placeholder types are
+ <literal>Assignable</literal>.
+ </para>
+
+</section>
+
</section>
diff --git a/libstdc++-v3/doc/xml/manual/utilities.xml b/libstdc++-v3/doc/xml/manual/utilities.xml
index 5c3a8fd4864..a60bd34c6d4 100644
--- a/libstdc++-v3/doc/xml/manual/utilities.xml
+++ b/libstdc++-v3/doc/xml/manual/utilities.xml
@@ -25,7 +25,7 @@
<para>If you don't know what functors are, you're not alone. Many people
get slightly the wrong idea. In the interest of not reinventing
the wheel, we will refer you to the introduction to the functor
- concept written by SGI as chapter of their STL, in
+ concept written by SGI as part of their STL, in
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.sgi.com/tech/stl/functors.html">their
http://www.sgi.com/tech/stl/functors.html</link>.
</para>
diff --git a/libstdc++-v3/include/backward/binders.h b/libstdc++-v3/include/backward/binders.h
index f98b56aaede..076f8d2e219 100644
--- a/libstdc++-v3/include/backward/binders.h
+++ b/libstdc++-v3/include/backward/binders.h
@@ -80,7 +80,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*
* The type @c binder2nd and its creator function @c bind2nd do the same
* thing, but the stored argument is passed as the second parameter instead
- * of the first, e.g., @c bind2nd(std::minus<float>,1.3) will create a
+ * of the first, e.g., @c bind2nd(std::minus<float>(),1.3) will create a
* functor whose @c operator() accepts a floating-point number, subtracts
* 1.3 from it, and returns the result. (If @c bind1st had been used,
* the functor would perform <em>1.3 - x</em> instead.
@@ -89,10 +89,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* calling algorithms. Their return values will be temporary objects.
* (The goal is to not require you to type names like
* @c std::binder1st<std::plus<int>> for declaring a variable to hold the
- * return value from @c bind1st(std::plus<int>,5).
+ * return value from @c bind1st(std::plus<int>(),5).
*
* These become more useful when combined with the composition functions.
*
+ * These functions are deprecated in C++11 and can be replaced by
+ * @c std::bind (or @c std::tr1::bind) which is more powerful and flexible,
+ * supporting functions with any number of arguments. Uses of @c bind1st
+ * can be replaced by @c std::bind(f, x, std::placeholders::_1) and
+ * @c bind2nd by @c std::bind(f, std::placeholders::_1, x).
* @{
*/
/// One of the @link binders binder functors@endlink.
diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset
index f44bbcddefd..3d865c1c1c2 100644
--- a/libstdc++-v3/include/debug/bitset
+++ b/libstdc++-v3/include/debug/bitset
@@ -51,7 +51,7 @@ namespace __debug
public:
// In C++0x we rely on normal reference type to preserve the property
// of bitset to be use as a literal.
- // TODO: Find an other solution.
+ // TODO: Find another solution.
#ifdef __GXX_EXPERIMENTAL_CXX0X__
typedef typename _Base::reference reference;
#else
@@ -272,11 +272,14 @@ namespace __debug
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 11. Bitset minor problems
- bool
+ _GLIBCXX_CONSTEXPR bool
operator[](size_t __pos) const
{
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // TODO: Check in debug-mode too.
__glibcxx_check_subscript(__pos);
- return _M_base()[__pos];
+#endif
+ return _Base::operator[](__pos);
}
using _Base::to_ulong;
diff --git a/libstdc++-v3/include/profile/bitset b/libstdc++-v3/include/profile/bitset
index a2cba5efe80..17ee49b5a60 100644
--- a/libstdc++-v3/include/profile/bitset
+++ b/libstdc++-v3/include/profile/bitset
@@ -232,10 +232,10 @@ namespace __profile
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 11. Bitset minor problems
- bool
+ _GLIBCXX_CONSTEXPR bool
operator[](size_t __pos) const
{
- return _M_base()[__pos];
+ return _Base::operator[](__pos);
}
using _Base::to_ulong;
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 4a04eca8969..465fc569b23 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -843,22 +843,24 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
: public integral_constant<int, 0>
{ };
- /// The type of placeholder objects defined by libstdc++.
+ /** @brief The type of placeholder objects defined by libstdc++.
+ * @ingroup binders
+ */
template<int _Num> struct _Placeholder { };
_GLIBCXX_END_NAMESPACE_VERSION
/** @namespace std::placeholders
- * @brief ISO C++ 0x entities sub namespace for functional.
+ * @brief ISO C++11 entities sub-namespace for functional.
* @ingroup binders
- *
- * Define a large number of placeholders. There is no way to
- * simplify this with variadic templates, because we're introducing
- * unique names for each.
*/
namespace placeholders
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ /* Define a large number of placeholders. There is no way to
+ * simplify this with variadic templates, because we're introducing
+ * unique names for each.
+ */
extern const _Placeholder<1> _1;
extern const _Placeholder<2> _2;
extern const _Placeholder<3> _3;
@@ -903,6 +905,11 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
: public integral_constant<int, _Num>
{ };
+ template<int _Num>
+ struct is_placeholder<const _Placeholder<_Num> >
+ : public integral_constant<int, _Num>
+ { };
+
/**
* Used by _Safe_tuple_element to indicate that there is no tuple
* element at this position.
@@ -1424,8 +1431,56 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* @brief Class template _Bind is always a bind expression.
* @ingroup binders
*/
+ template<typename _Signature>
+ struct is_bind_expression<const _Bind<_Signature> >
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Signature>
+ struct is_bind_expression<volatile _Bind<_Signature> >
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Signature>
+ struct is_bind_expression<const volatile _Bind<_Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<_Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const _Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<volatile _Bind_result<_Result, _Signature>>
+ : public true_type { };
+
+ /**
+ * @brief Class template _Bind_result is always a bind expression.
+ * @ingroup binders
+ */
template<typename _Result, typename _Signature>
- struct is_bind_expression<_Bind_result<_Result, _Signature> >
+ struct is_bind_expression<const volatile _Bind_result<_Result, _Signature>>
: public true_type { };
// Trait type used to remove std::bind() from overload set via SFINAE
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 51be289d506..282d4509d3a 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -69,35 +69,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __add_r_ref<_Tp&>
{ typedef _Tp& type; };
- // To work around c++/49225 aka c++/48322.
- template<typename...>
- struct __conv_types { };
-
- template<typename _Tuple1, typename _Tuple2>
- struct __one_by_one_convertible
- : public false_type { };
-
- template<typename _Tp, typename _Up>
- struct __one_by_one_convertible<__conv_types<_Tp>, __conv_types<_Up>>
- : public is_convertible<_Tp, _Up>::type { };
-
- template<typename _T1, typename... _TR, typename _U1, typename... _UR>
- struct __one_by_one_convertible<__conv_types<_T1, _TR...>,
- __conv_types<_U1, _UR...>>
- : public __and_<is_convertible<_T1, _U1>,
- __one_by_one_convertible<__conv_types<_TR...>,
- __conv_types<_UR...>>>::type
- { };
-
- template<typename _Tuple1, typename _Tuple2>
- struct __all_convertible;
-
- template<typename... _TTypes, typename... _UTypes>
- struct __all_convertible<__conv_types<_TTypes...>,
- __conv_types<_UTypes...>>
- : public __one_by_one_convertible<__conv_types<_TTypes...>,
- __conv_types<_UTypes...>>::type { };
-
template<std::size_t _Idx, typename _Head, bool _IsEmpty>
struct _Head_base;
@@ -408,11 +379,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Inherited(__elements...) { }
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<_UElements...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<_UElements,
+ _Elements>...>::value>::type>
explicit
constexpr tuple(_UElements&&... __elements)
: _Inherited(std::forward<_UElements>(__elements)...) { }
@@ -422,21 +390,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr tuple(tuple&&) = default;
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<const _UElements&...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<const _UElements&,
+ _Elements>...>::value>::type>
constexpr tuple(const tuple<_UElements...>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
template<typename... _UElements, typename = typename
- enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
- == sizeof...(_Elements)>,
- __all_convertible<__conv_types<_UElements...>,
- __conv_types<_Elements...>>
- >::value>::type>
+ enable_if<__and_<is_convertible<_UElements,
+ _Elements>...>::value>::type>
constexpr tuple(tuple<_UElements...>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index a0208590bb5..46e3f800cab 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -745,6 +745,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Implementation for non-reference types. To meet the proper
// variable definition semantics, we also need to test for
// is_destructible in this case.
+ // This form should be simplified by a single expression:
+ // ::delete ::new _Tp(declval<_Arg>()), see c++/51222.
struct __do_is_direct_constructible_impl
{
template<typename _Tp, typename _Arg, typename
@@ -778,9 +780,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct remove_reference;
template<typename _From, typename _To, bool
- = is_reference<_From>::value>
+ = __not_<__or_<is_void<_From>,
+ is_function<_From>>>::value>
struct __is_base_to_derived_ref;
+ // Detect whether we have a downcast situation during
+ // reference binding.
template<typename _From, typename _To>
struct __is_base_to_derived_ref<_From, _To, true>
{
@@ -803,6 +808,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is_rvalue_reference<_To>>::value>
struct __is_lvalue_to_rvalue_ref;
+ // Detect whether we have an lvalue of non-function type
+ // bound to a reference-compatible rvalue-reference.
template<typename _From, typename _To>
struct __is_lvalue_to_rvalue_ref<_From, _To, true>
{
@@ -810,8 +817,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_From>::type>::type __src_t;
typedef typename remove_cv<typename remove_reference<
_To>::type>::type __dst_t;
- typedef __or_<is_same<__src_t, __dst_t>,
- is_base_of<__dst_t, __src_t>> type;
+ typedef __and_<__not_<is_function<__src_t>>,
+ __or_<is_same<__src_t, __dst_t>,
+ is_base_of<__dst_t, __src_t>>> type;
static constexpr bool value = type::value;
};
@@ -823,9 +831,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Here we handle direct-initialization to a reference type as
// equivalent to a static_cast modulo overshooting conversions.
// These are restricted to the following conversions:
- // a) A glvalue of a base class to a derived class reference
+ // a) A base class value to a derived class reference
// b) An lvalue to an rvalue-reference of reference-compatible
- // types
+ // types that are not functions
template<typename _Tp, typename _Arg>
struct __is_direct_constructible_ref_cast
: public __and_<__is_static_castable<_Arg, _Tp>,
@@ -850,7 +858,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Since default-construction and binary direct-initialization have
// been handled separately, the implementation of the remaining
- // n-ary construction cases is rather straightforward.
+ // n-ary construction cases is rather straightforward. We can use
+ // here a functional cast, because array types are excluded anyway
+ // and this form is never interpreted as a C cast.
struct __do_is_nary_constructible_impl
{
template<typename _Tp, typename... _Args, typename
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 7651326955a..ff2bd2a7134 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -43,9 +43,20 @@
#include <tr1/functional_hash.h>
#include <ext/type_traits.h>
#include <bits/move.h> // for std::__addressof
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <type_traits> // for integral_constant, true_type, false_type
+#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ template<int> struct _Placeholder;
+ template<typename> class _Bind;
+ template<typename, typename> class _Bind_result;
+_GLIBCXX_END_NAMESPACE_VERSION
+#endif
+
namespace tr1
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -847,16 +858,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
- /** @namespace std::placeholders
- * @brief ISO C++ 0x entities sub namespace for functional.
- *
- * Define a large number of placeholders. There is no way to
- * simplify this with variadic templates, because we're introducing
- * unique names for each.
+ /** @namespace std::tr1::placeholders
+ * @brief Sub-namespace for tr1/functional.
*/
namespace placeholders
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ /* Define a large number of placeholders. There is no way to
+ * simplify this with variadic templates, because we're introducing
+ * unique names for each.
+ */
namespace
{
_Placeholder<1> _1;
@@ -904,6 +915,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<int _Num>
const int is_placeholder<_Placeholder<_Num> >::value;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<int _Num>
+ struct is_placeholder<std::_Placeholder<_Num>>
+ : std::integral_constant<int, _Num>
+ { };
+
+ template<int _Num>
+ struct is_placeholder<const std::_Placeholder<_Num>>
+ : std::integral_constant<int, _Num>
+ { };
+#endif
+
/**
* Stores a tuple of indices. Used by bind() to extract the elements
* in a tuple.
@@ -1347,6 +1370,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Signature>
const bool is_bind_expression<_Bind<_Signature> >::value;
+ /// Class template _Bind is always a bind expression.
+ template<typename _Signature>
+ struct is_bind_expression<const _Bind<_Signature> >
+ { static const bool value = true; };
+
+ template<typename _Signature>
+ const bool is_bind_expression<const _Bind<_Signature> >::value;
+
+ /// Class template _Bind is always a bind expression.
+ template<typename _Signature>
+ struct is_bind_expression<volatile _Bind<_Signature> >
+ { static const bool value = true; };
+
+ template<typename _Signature>
+ const bool is_bind_expression<volatile _Bind<_Signature> >::value;
+
+ /// Class template _Bind is always a bind expression.
+ template<typename _Signature>
+ struct is_bind_expression<const volatile _Bind<_Signature> >
+ { static const bool value = true; };
+
+ template<typename _Signature>
+ const bool is_bind_expression<const volatile _Bind<_Signature> >::value;
+
/// Class template _Bind_result is always a bind expression.
template<typename _Result, typename _Signature>
struct is_bind_expression<_Bind_result<_Result, _Signature> >
@@ -1355,6 +1402,70 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Result, typename _Signature>
const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value;
+ /// Class template _Bind_result is always a bind expression.
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const _Bind_result<_Result, _Signature> >
+ { static const bool value = true; };
+
+ template<typename _Result, typename _Signature>
+ const bool
+ is_bind_expression<const _Bind_result<_Result, _Signature> >::value;
+
+ /// Class template _Bind_result is always a bind expression.
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<volatile _Bind_result<_Result, _Signature> >
+ { static const bool value = true; };
+
+ template<typename _Result, typename _Signature>
+ const bool
+ is_bind_expression<volatile _Bind_result<_Result, _Signature> >::value;
+
+ /// Class template _Bind_result is always a bind expression.
+ template<typename _Result, typename _Signature>
+ struct
+ is_bind_expression<const volatile _Bind_result<_Result, _Signature> >
+ { static const bool value = true; };
+
+ template<typename _Result, typename _Signature>
+ const bool
+ is_bind_expression<const volatile _Bind_result<_Result,
+ _Signature> >::value;
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Signature>
+ struct is_bind_expression<std::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<const std::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<volatile std::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<const volatile std::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<std::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const std::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<volatile std::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const volatile std::_Bind_result<_Result,
+ _Signature>>
+ : true_type { };
+#endif
+
/// bind
template<typename _Functor, typename... _ArgTypes>
inline
@@ -2147,6 +2258,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template<typename> struct is_placeholder;
+
+ template<int _Num>
+ struct is_placeholder<tr1::_Placeholder<_Num>>
+ : integral_constant<int, _Num>
+ { };
+
+ template<int _Num>
+ struct is_placeholder<const tr1::_Placeholder<_Num>>
+ : integral_constant<int, _Num>
+ { };
+
+ template<typename> struct is_bind_expression;
+
+ template<typename _Signature>
+ struct is_bind_expression<tr1::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<const tr1::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<volatile tr1::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Signature>
+ struct is_bind_expression<const volatile tr1::_Bind<_Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<tr1::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const tr1::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<volatile tr1::_Bind_result<_Result, _Signature>>
+ : true_type { };
+
+ template<typename _Result, typename _Signature>
+ struct is_bind_expression<const volatile tr1::_Bind_result<_Result,
+ _Signature>>
+ : true_type { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+#endif
}
#endif // _GLIBCXX_TR1_FUNCTIONAL
diff --git a/libstdc++-v3/testsuite/20_util/bind/cv_quals_3.cc b/libstdc++-v3/testsuite/20_util/bind/cv_quals_3.cc
new file mode 100644
index 00000000000..6affa1168e2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bind/cv_quals_3.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+#include <functional>
+
+struct X
+{
+ int operator()() const { return 0; }
+ int operator()() volatile { return 1; }
+ int operator()() const volatile { return 2; }
+ void operator()() { };
+};
+
+void test01()
+{
+ static_assert( std::is_placeholder<decltype(std::placeholders::_1)>::value,
+ "decltype(_1) is a placeholder type" );
+
+ const auto b0 = std::bind(X());
+ static_assert( std::is_bind_expression<decltype(b0)>::value,
+ "const-qualified wrapper is a bind expression" );
+
+ volatile auto b1 = std::bind(X());
+ static_assert( std::is_bind_expression<decltype(b1)>::value,
+ "volatile-qualified wrapper is a bind expression" );
+
+ const volatile auto b2 = std::bind(X());
+ static_assert( std::is_bind_expression<decltype(b2)>::value,
+ "const-volatile-qualified wrapper is a bind expression" );
+
+ const auto b3 = std::bind<int>(X());
+ static_assert( std::is_bind_expression<decltype(b3)>::value,
+ "const-qualified wrapper is a bind expression" );
+
+ volatile auto b4 = std::bind<int>(X());
+ static_assert( std::is_bind_expression<decltype(b4)>::value,
+ "volatile-qualified wrapper is a bind expression" );
+
+ const volatile auto b5 = std::bind<int>(X());
+ static_assert( std::is_bind_expression<decltype(b5)>::value,
+ "const-volatile-qualified wrapper is a bind expression" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc
index f5a08c2630a..fa2123114d5 100644
--- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc
@@ -29,8 +29,12 @@ int inc(int& i) { return ++i; }
void test01()
{
const int dummy = 0;
- std::bind(&inc, _1)(0); // { dg-error "no match|rvalue" }
- std::bind(&inc, std::ref(dummy))(); // { dg-error "no match|const" }
+ std::bind(&inc, _1)(0); // { dg-error "no match" }
+ // { dg-error "rvalue|const" "" { target *-*-* } 1206 }
+ // { dg-error "rvalue|const" "" { target *-*-* } 1219 }
+ // { dg-error "rvalue|const" "" { target *-*-* } 1233 }
+ // { dg-error "rvalue|const" "" { target *-*-* } 1247 }
+ std::bind(&inc, std::ref(dummy))(); // { dg-error "no match" }
}
struct Inc
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index 1f4065b92a8..33ab45b4bbc 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 1759 }
+// { dg-error "static assertion failed" "" { target *-*-* } 1769 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/is_constructible/51185.cc b/libstdc++-v3/testsuite/20_util/is_constructible/51185.cc
new file mode 100644
index 00000000000..faf3969fe83
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_constructible/51185.cc
@@ -0,0 +1,39 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <type_traits>
+
+struct A { };
+struct B : A { };
+
+// libstdc++/51185
+void f()
+{
+ static_assert(!std::is_constructible<B &&, A>(), "");
+ static_assert(!std::is_constructible<B const &&, A>(), "");
+ static_assert(!std::is_constructible<B const &&, A const>(), "");
+ static_assert(!std::is_constructible<B volatile &&, A>(), "");
+ static_assert(!std::is_constructible<B volatile &&, A volatile>(), "");
+ static_assert(!std::is_constructible<B const volatile &&, A>(), "");
+ static_assert(!std::is_constructible<B const volatile &&, A const>(), "");
+ static_assert(!std::is_constructible<B const volatile &&, A volatile>(), "");
+ static_assert(!std::is_constructible<B const volatile &&,
+ A const volatile>(), "");
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
index 24fde938988..06895e32bb0 100644
--- a/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
+++ b/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
@@ -817,3 +817,5 @@ static_assert(!std::is_constructible<const int&, ExplicitTo<double&&>>::value,
"Error");
static_assert(!std::is_constructible<int&&, ExplicitTo<double&&>>::value,
"Error");
+
+static_assert(std::is_constructible<void(&&)(), void(&)()>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index d61daf35853..b8bd23f841f 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1545 }
-// { dg-error "declaration of" "" { target *-*-* } 1509 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1555 }
+// { dg-error "declaration of" "" { target *-*-* } 1519 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index ee74be9f267..96940119ed9 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1463 }
-// { dg-error "declaration of" "" { target *-*-* } 1427 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1473 }
+// { dg-error "declaration of" "" { target *-*-* } 1437 }
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
index ad998356c83..73a0d0f7029 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -44,4 +44,4 @@ void test01()
tuple<Type> t(allocator_arg, a, 1);
}
-// { dg-error "no matching function" "" { target *-*-* } 141 }
+// { dg-error "no matching function" "" { target *-*-* } 112 }
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr-2.cc b/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr-2.cc
new file mode 100644
index 00000000000..14ab8e71275
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr-2.cc
@@ -0,0 +1,36 @@
+// { dg-do compile }
+// { dg-require-normal-mode "" }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bitset>
+
+int main()
+{
+ // bitset base type
+ typedef std::_Base_bitset<6> bitset_base;
+ constexpr bitset_base base = bitset_base();
+
+ constexpr auto r1 __attribute__((unused)) = base._M_getword(2);
+ // constexpr auto r2 = base._M_getdata(); // error, pointer to this
+ auto r2 __attribute__((unused)) = base._M_getdata();
+ constexpr auto r3 __attribute__((unused)) = base._M_hiword();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr.cc b/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr.cc
index fc171c8238f..384f01a5dff 100644
--- a/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr.cc
+++ b/libstdc++-v3/testsuite/23_containers/bitset/operations/constexpr.cc
@@ -22,15 +22,6 @@
int main()
{
- // bitset base type
- typedef std::_Base_bitset<6> bitset_base;
- constexpr bitset_base base = bitset_base();
-
- constexpr auto r1 __attribute__((unused)) = base._M_getword(2);
- // constexpr auto r2 = base._M_getdata(); // error, pointer to this
- auto r2 __attribute__((unused)) = base._M_getdata();
- constexpr auto r3 __attribute__((unused)) = base._M_hiword();
-
// bitset operators
typedef std::bitset<6> bitset_type;
constexpr bitset_type a = bitset_type();
diff --git a/libstdc++-v3/testsuite/tr1/3_function_objects/bind/cv_quals.cc b/libstdc++-v3/testsuite/tr1/3_function_objects/bind/cv_quals.cc
new file mode 100644
index 00000000000..5ea373647fc
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/3_function_objects/bind/cv_quals.cc
@@ -0,0 +1,53 @@
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+#include <tr1/functional>
+
+struct X
+{
+ int operator()() const { return 0; }
+ int operator()() volatile { return 1; }
+ int operator()() const volatile { return 2; }
+ void operator()() { };
+};
+
+void test01()
+{
+ static_assert( std::tr1::is_placeholder<__typeof(std::tr1::placeholders::_1)>::value,
+ "decltype(_1) is a placeholder type" );
+
+ const auto b0 = std::tr1::bind(X());
+ static_assert( std::tr1::is_bind_expression<__typeof(b0)>::value,
+ "const-qualified wrapper is a bind expression" );
+
+ volatile auto b1 = std::tr1::bind(X());
+ static_assert( std::tr1::is_bind_expression<__typeof(b1)>::value,
+ "volatile-qualified wrapper is a bind expression" );
+
+ const volatile auto b2 = std::tr1::bind(X());
+ static_assert( std::tr1::is_bind_expression<__typeof(b2)>::value,
+ "const-volatile-qualified wrapper is a bind expression" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/3_function_objects/bind/mixed.cc b/libstdc++-v3/testsuite/tr1/3_function_objects/bind/mixed.cc
new file mode 100644
index 00000000000..2d96bb7ec86
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/3_function_objects/bind/mixed.cc
@@ -0,0 +1,139 @@
+// { dg-options "-std=gnu++11" }
+// 2011-11-20 Jonathan Wakely <jwakely.gcc -at- gmail.com>
+//
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library 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 library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 3.6 function object binders
+#include <tr1/functional>
+#include <functional>
+#include <testsuite_hooks.h>
+
+// std::tr1::bind and std::bind should work together
+
+namespace p1 = std::placeholders;
+namespace p2 = std::tr1::placeholders;
+
+using std::multiplies;
+using std::minus;
+
+void test01()
+{
+ static_assert( std::is_placeholder<decltype(p2::_2)>::value == 2,
+ "TR1 placeholder is a std placeholder" );
+ static_assert( std::tr1::is_placeholder<decltype(p1::_1)>::value == 1,
+ "std placeholder is a TR2 placeholder" );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ auto b1 = std::bind(minus<int>(), 6, p2::_2);
+ auto b2 = std::tr1::bind(minus<int>(), 6, p1::_2);
+
+ int five = 5;
+ int seven = 7;
+
+ VERIFY( std::tr1::bind(multiplies<int>(), p1::_1, b1)(five, seven) == -5 );
+ VERIFY( std::bind(multiplies<int>(), p2::_1, b2)(seven, five) == 7 );
+
+ VERIFY( std::tr1::bind<int>(multiplies<int>(), p1::_1, b1)(five, seven) == -5 );
+ VERIFY( std::bind<int>(multiplies<int>(), p2::_1, b2)(seven, five) == 7 );
+
+ static_assert( std::is_bind_expression<decltype(b2)>::value,
+ "TR1 bind expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(b1)>::value,
+ "std bind expression is a TR2 bind expression" );
+
+ const auto c1 = b1;
+ const auto c2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(c2)>::value,
+ "const TR1 bind expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(c1)>::value,
+ "const std bind expression is a TR2 bind expression" );
+
+ volatile auto v1 = b1;
+ volatile auto v2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(v2)>::value,
+ "volatile TR1 bind expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(v1)>::value,
+ "volatile std bind expression is a TR2 bind expression" );
+
+ const volatile auto cv1 = b1;
+ const volatile auto cv2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(cv2)>::value,
+ "const volatile TR1 bind expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(cv1)>::value,
+ "const volatile std bind expression is a TR2 bind expression" );
+}
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+
+ auto b1 = std::bind<int>(minus<int>(), 6, p2::_2);
+ auto b2 = std::tr1::bind<int>(minus<int>(), 6, p1::_2);
+
+ int five = 5;
+ int seven = 7;
+ VERIFY( std::tr1::bind(multiplies<int>(), p1::_1, b1)(five, seven) == -5 );
+ VERIFY( std::bind(multiplies<int>(), p2::_1, b2)(seven, five) == 7 );
+
+ VERIFY( std::tr1::bind<int>(multiplies<int>(), p1::_1, b1)(five, seven) == -5 );
+ VERIFY( std::bind<int>(multiplies<int>(), p2::_1, b2)(seven, five) == 7 );
+
+ static_assert( std::is_bind_expression<decltype(b2)>::value,
+ "TR1 bind<R> expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(b1)>::value,
+ "std bind<R> expression is a TR2 bind expression" );
+
+ const auto c1 = b1;
+ const auto c2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(c2)>::value,
+ "const TR1 bind<R> expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(c1)>::value,
+ "const std bind<R> expression is a TR2 bind expression" );
+
+ volatile auto v1 = b1;
+ volatile auto v2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(v2)>::value,
+ "volatile TR1 bind<R> expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(v1)>::value,
+ "volatile std bind<R> expression is a TR2 bind expression" );
+
+ const volatile auto cv1 = b1;
+ const volatile auto cv2 = b2;
+
+ static_assert( std::is_bind_expression<decltype(cv2)>::value,
+ "const volatile TR1 bind<R> expression is a std bind expression" );
+ static_assert( std::tr1::is_bind_expression<decltype(cv1)>::value,
+ "const volatile std bind<R> expression is a TR2 bind expression" );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ return 0;
+}
diff --git a/libtool.m4 b/libtool.m4
index 71bcee83c87..67321a7d070 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -2273,7 +2273,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[[123]]*) objformat=aout ;;
+ freebsd[[23]].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -2291,7 +2291,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -4804,7 +4804,7 @@ _LT_EOF
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5751,7 +5751,7 @@ if test "$_lt_caught_CXX_error" != yes; then
esac
;;
- freebsd[[12]]*)
+ freebsd2.*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
_LT_TAGVAR(ld_shlibs, $1)=no
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index bf149e4b880..aa98f64f5a3 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-10-02 Jan Hubicka <jh@suse.cz>
PR lto/47247
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 9815917f8fd..48b414e99f7 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -8773,7 +8773,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9686,7 +9686,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9704,7 +9704,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index b0c363860e2..e98f0af5086 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-21 Gerald Pfeifer <gerald@pfeifer.com>
+
+ * update_web_docs_svn: Make $DOCSDIR group writable after
+ creating it.
+
2011-06-27 Richard Guenther <rguenther@suse.de>
* update_version_svn (IGNORE_BRANCHES): Add gcc-4_3-branch.
diff --git a/maintainer-scripts/update_web_docs_svn b/maintainer-scripts/update_web_docs_svn
index a0551615d7d..cfc33c42bf5 100755
--- a/maintainer-scripts/update_web_docs_svn
+++ b/maintainer-scripts/update_web_docs_svn
@@ -93,6 +93,7 @@ fi
if [ ! -d $DOCSDIR ]; then
mkdir $DOCSDIR
+ chmod g+w $DOCSDIR
fi
if [ -z "$RELEASE" ]; then
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index d3b34b5fb52..7afe93793c2 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,7 @@
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * configure: Regenerate.
+
2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/zlib/configure b/zlib/configure
index 8be4e40c82c..f7fe2b7bd51 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -8600,7 +8600,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
+ freebsd2.*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -9516,7 +9516,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[123]*) objformat=aout ;;
+ freebsd[23].*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -9534,7 +9534,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2*)
+ freebsd2.*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)