aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-01-15 13:28:44 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-01-15 13:28:44 +0000
commitf6f4fd6642d6452f2c92f4cb790a3f82676bf0b1 (patch)
tree0ed3dd53c526e8ed8e7b196c540b5f7f75780fc3
parent5b1987e296900f85e8ca69e26e90020d9735ac16 (diff)
Merge branches/gcc-7-branch rev 256695.
Change-Id: Ia2ebad962c498631850b39690c1a3d67ae887c5c
-rw-r--r--gcc/ChangeLog896
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog37
-rw-r--r--gcc/ada/gcc-interface/Makefile.in2
-rw-r--r--gcc/ada/gcc-interface/decl.c9
-rw-r--r--gcc/ada/gcc-interface/trans.c11
-rw-r--r--gcc/ada/s-osinte-rtems.ads24
-rw-r--r--gcc/ada/s-osprim-rtems.adb172
-rw-r--r--gcc/asan.c4
-rw-r--r--gcc/bb-reorder.c6
-rw-r--r--gcc/c-family/ChangeLog9
-rw-r--r--gcc/c-family/c-common.c15
-rw-r--r--gcc/c/ChangeLog16
-rw-r--r--gcc/c/c-decl.c16
-rw-r--r--gcc/c/c-parser.c9
-rw-r--r--gcc/cfgrtl.c3
-rw-r--r--gcc/cgraphunit.c1
-rw-r--r--gcc/combine.c15
-rw-r--r--gcc/config.gcc22
-rw-r--r--gcc/config/alpha/alpha.c8
-rw-r--r--gcc/config/alpha/alpha.md130
-rw-r--r--gcc/config/alpha/predicates.md5
-rw-r--r--gcc/config/arc/linux.h2
-rw-r--r--gcc/config/arm/arm.c14
-rw-r--r--gcc/config/arm/arm.h8
-rw-r--r--gcc/config/arm/thumb2.md2
-rw-r--r--gcc/config/arm/vfp.md5
-rw-r--r--gcc/config/epiphany/rtems.h28
-rw-r--r--gcc/config/i386/i386.c157
-rw-r--r--gcc/config/i386/i386.h58
-rw-r--r--gcc/config/i386/i386.md12
-rw-r--r--gcc/config/i386/sse.md2
-rw-r--r--gcc/config/i386/x86-tune.def4
-rw-r--r--gcc/config/i386/xm-mingw32.h5
-rw-r--r--gcc/config/mips/frame-header-opt.c3
-rw-r--r--gcc/config/pa/pa.c9
-rw-r--r--gcc/config/riscv/linux.h13
-rw-r--r--gcc/config/riscv/pic.md11
-rw-r--r--gcc/config/riscv/riscv.c60
-rw-r--r--gcc/config/riscv/riscv.h10
-rw-r--r--gcc/config/riscv/riscv.md9
-rw-r--r--gcc/config/riscv/riscv.opt4
-rw-r--r--gcc/config/rs6000/altivec.md2
-rw-r--r--gcc/config/rs6000/power6.md18
-rw-r--r--gcc/config/rs6000/ppc-asm.h4
-rw-r--r--gcc/config/rs6000/ppc-auxv.h1
-rw-r--r--gcc/config/rs6000/rs6000-protos.h2
-rw-r--r--gcc/config/rs6000/rs6000.c272
-rw-r--r--gcc/config/rs6000/rs6000.md12
-rw-r--r--gcc/config/rs6000/t-rtems1
-rw-r--r--gcc/config/rx/rx.c3
-rw-r--r--gcc/config/rx/rx.md3
-rw-r--r--gcc/config/sh/sh.md51
-rw-r--r--gcc/config/sol2.h4
-rw-r--r--gcc/config/sparc/sparc.c241
-rw-r--r--gcc/config/sparc/sparc.md28
-rw-r--r--gcc/config/sparc/sparc.opt4
-rw-r--r--gcc/config/sparc/sync.md30
-rw-r--r--gcc/config/xtensa/xtensa-protos.h1
-rw-r--r--gcc/config/xtensa/xtensa.c36
-rw-r--r--gcc/config/xtensa/xtensa.h20
-rwxr-xr-xgcc/configure2
-rw-r--r--gcc/configure.ac2
-rw-r--r--gcc/convert.c6
-rw-r--r--gcc/cp/ChangeLog87
-rw-r--r--gcc/cp/constexpr.c47
-rw-r--r--gcc/cp/cp-gimplify.c30
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/decl.c51
-rw-r--r--gcc/cp/decl2.c15
-rw-r--r--gcc/cp/mangle.c57
-rw-r--r--gcc/cp/parser.c21
-rw-r--r--gcc/cp/pt.c31
-rw-r--r--gcc/cp/tree.c11
-rw-r--r--gcc/doc/gcov.texi7
-rw-r--r--gcc/doc/invoke.texi80
-rw-r--r--gcc/expmed.c5
-rw-r--r--gcc/expr.c84
-rw-r--r--gcc/file-find.c35
-rw-r--r--gcc/file-find.h1
-rw-r--r--gcc/fold-const.c60
-rw-r--r--gcc/fortran/ChangeLog84
-rw-r--r--gcc/fortran/interface.c9
-rw-r--r--gcc/fortran/match.c30
-rw-r--r--gcc/fortran/parse.c1
-rw-r--r--gcc/fortran/resolve.c26
-rw-r--r--gcc/fortran/simplify.c17
-rw-r--r--gcc/fortran/trans-expr.c2
-rw-r--r--gcc/fortran/trans-openmp.c1
-rw-r--r--gcc/fortran/trans-stmt.c7
-rw-r--r--gcc/gcc-ar.c8
-rw-r--r--gcc/ggc-page.c5
-rw-r--r--gcc/gimple-fold.c22
-rw-r--r--gcc/gimple-ssa-sprintf.c16
-rw-r--r--gcc/gimplify.c4
-rw-r--r--gcc/hwint.h1
-rw-r--r--gcc/ipa-cp.c26
-rw-r--r--gcc/ipa-inline.c64
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/po/ChangeLog8
-rw-r--r--gcc/po/es.po201
-rw-r--r--gcc/print-rtl.c2
-rw-r--r--gcc/rtlanal.c27
-rw-r--r--gcc/testsuite/ChangeLog465
-rw-r--r--gcc/testsuite/c-c++-common/dwarf2/pr83550.c10
-rw-r--r--gcc/testsuite/c-c++-common/pr83059.c10
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr83553.c29
-rw-r--r--gcc/testsuite/g++.dg/asan/pr82792.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr80259.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr83556.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-83116.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp10.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp3.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp30.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp31.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp32.C32
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp33.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp34.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/constexpr-pr82781.C12
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr82801.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/pr82027_0.C73
-rw-r--r--gcc/testsuite/g++.dg/opt/pr83084.C16
-rw-r--r--gcc/testsuite/g++.dg/opt/pr83608.C28
-rw-r--r--gcc/testsuite/g++.dg/opt/pr83609.C28
-rw-r--r--gcc/testsuite/g++.dg/pr82128.C20
-rw-r--r--gcc/testsuite/g++.dg/template/pr79650.C20
-rw-r--r--gcc/testsuite/g++.dg/torture/pr82060.C32
-rw-r--r--gcc/testsuite/g++.dg/torture/pr82902.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr83471.C21
-rw-r--r--gcc/testsuite/g++.dg/torture/pr83713.C12
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr83523.C25
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr81212.C16
-rw-r--r--gcc/testsuite/g++.dg/warn/pr81675.C15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr81553.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr83448.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20180112-1.c32
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr83269.c14
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr82545.c17
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-18.c15
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr82808.c27
-rw-r--r--gcc/testsuite/gcc.dg/opts-8.c6
-rw-r--r--gcc/testsuite/gcc.dg/pr80747.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr82765.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr82975.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr83198.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr83512.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr83521.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr83609.c29
-rw-r--r--gcc/testsuite/gcc.dg/pr83623.c12
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr60092.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82102.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82402.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr82697.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-4.c46
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr82726.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr83198.c23
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/pr83014.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr80631-1.c76
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr80631-2.c73
-rw-r--r--gcc/testsuite/gcc.target/alpha/pr83628-1.c19
-rw-r--r--gcc/testsuite/gcc.target/alpha/pr83628-2.c29
-rw-r--r--gcc/testsuite/gcc.target/alpha/pr83628-3.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-pr80631.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr80583.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr80819-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr80819-2.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81906.c37
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82941-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82941-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82942-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82942-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-3.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-4.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-5.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-6.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82990-7.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83467-1.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83467-2.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr77687.c20
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr80101-1.c22
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr80210-2.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr81959.c25
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83677.c166
-rw-r--r--gcc/testsuite/gcc.target/riscv/riscv.exp41
-rw-r--r--gcc/testsuite/gcc.target/riscv/save-restore-1.c25
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_type_22.f0329
-rw-r--r--gcc/testsuite/gfortran.dg/class_result_5.f9038
-rw-r--r--gcc/testsuite/gfortran.dg/class_result_6.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/deferred_character_18.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_e.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/interface_40.f908
-rw-r--r--gcc/testsuite/gfortran.dg/internal_readwrite_4.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_95.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/pr78686.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr82253.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/simplify_cshift_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_simplify_11.f908
-rw-r--r--gcc/testsuite/gnat.dg/alignment13.adb21
-rw-r--r--gcc/testsuite/lib/target-supports.exp4
-rw-r--r--gcc/tree-cfg.c32
-rw-r--r--gcc/tree-object-size.c1
-rw-r--r--gcc/tree-predcom.c200
-rw-r--r--gcc/tree-ssa-math-opts.c11
-rw-r--r--gcc/tree-ssa-phiopt.c25
-rw-r--r--gcc/tree-ssa-phiprop.c2
-rw-r--r--gcc/tree-ssa-pre.c105
-rw-r--r--gcc/tree-vect-loop-manip.c2
-rw-r--r--gcc/tree-vect-loop.c82
-rw-r--r--gcc/tree.c44
-rw-r--r--gcc/tree.h1
-rw-r--r--gcc/ubsan.c6
-rw-r--r--gcc/valtrack.c13
-rw-r--r--gcc/varasm.c7
-rw-r--r--libcpp/ChangeLog10
-rw-r--r--libcpp/lex.c2
-rw-r--r--libgcc/ChangeLog23
-rw-r--r--libgcc/config.host8
-rw-r--r--libgcc/config/sol2/crtpg.c9
-rw-r--r--libgcc/configure2
-rw-r--r--libgcc/configure.ac2
-rw-r--r--libgfortran/ChangeLog87
-rw-r--r--libgfortran/io/inquire.c5
-rw-r--r--libgfortran/io/io.h8
-rw-r--r--libgfortran/io/list_read.c25
-rw-r--r--libgfortran/io/transfer.c62
-rw-r--r--libgfortran/io/unit.c15
-rw-r--r--libgfortran/io/unix.c54
-rw-r--r--libgfortran/io/write.c15
-rw-r--r--libgo/Makefile.am2
-rw-r--r--libgo/Makefile.in2
-rwxr-xr-xlibgo/configure6
-rw-r--r--libgo/configure.ac2
-rwxr-xr-xlibgo/mkrsysinfo.sh8
-rwxr-xr-xlibgo/mksysinfo.sh8
-rw-r--r--libgomp/ChangeLog21
-rw-r--r--libgomp/testsuite/libgomp.c/pr81875.c46
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr81304.f9017
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr81841.f9026
-rw-r--r--libstdc++-v3/ChangeLog223
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml6
-rw-r--r--libstdc++-v3/include/bits/locale_conv.h2
-rw-r--r--libstdc++-v3/include/bits/node_handle.h25
-rw-r--r--libstdc++-v3/include/bits/range_access.h14
-rw-r--r--libstdc++-v3/include/bits/refwrap.h111
-rw-r--r--libstdc++-v3/include/bits/regex.h6
-rw-r--r--libstdc++-v3/include/bits/stl_map.h17
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h16
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h22
-rw-r--r--libstdc++-v3/include/debug/map.h18
-rw-r--r--libstdc++-v3/include/debug/multimap.h15
-rw-r--r--libstdc++-v3/include/debug/unordered_map60
-rw-r--r--libstdc++-v3/include/experimental/bits/fs_ops.h7
-rw-r--r--libstdc++-v3/include/experimental/string_view8
-rw-r--r--libstdc++-v3/include/std/complex10
-rw-r--r--libstdc++-v3/include/std/future4
-rw-r--r--libstdc++-v3/include/std/optional2
-rw-r--r--libstdc++-v3/include/std/string_view8
-rw-r--r--libstdc++-v3/include/std/type_traits37
-rw-r--r--libstdc++-v3/include/std/utility2
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/printers.py12
-rw-r--r--libstdc++-v3/src/filesystem/ops.cc148
-rw-r--r--libstdc++-v3/testsuite/20_util/bind/83427.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_invocable/83395.cc28
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_invocable/83395.cc28
-rw-r--r--libstdc++-v3/testsuite/20_util/logical_traits/83134.cc32
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc39
-rw-r--r--libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc58
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/modifiers/insert/dr2354.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/dr2354.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/insert/dr2354.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/dr2354.cc39
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc191
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc37
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc4
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc4
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc19
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc1
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc100
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc34
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc2
289 files changed, 7668 insertions, 1232 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e826bd216bb..029582575d8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,885 @@
+2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ * config/i386/i386.c (ix86_expand_prologue): Use reference of
+ struct ix86_frame.
+ (ix86_expand_epilogue): Likewise.
+
+2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ * config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
+ of struct ix86_frame.
+ (ix86_initial_elimination_offset): Likewise.
+ (ix86_expand_split_stack_prologue): Likewise.
+
+2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ * config/i386/i386.c (ix86_frame): Moved to ...
+ * config/i386/i386.h (ix86_frame): Here.
+ (machine_function): Add frame.
+ * config/i386/i386.c (ix86_compute_frame_layout): Repace the
+ frame argument with &cfun->machine->frame.
+ (ix86_can_use_return_insn_p): Don't pass &frame to
+ ix86_compute_frame_layout. Copy frame from cfun->machine->frame.
+ (ix86_can_eliminate): Likewise.
+ (ix86_expand_prologue): Likewise.
+ (ix86_expand_epilogue): Likewise.
+ (ix86_expand_split_stack_prologue): Likewise.
+
+2018-01-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/83677
+ * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
+ Reverse order of second and third operands in first alternative.
+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
+ of first and second elements in UNSPEC_VPERMR vector.
+ (altivec_expand_vec_perm_le): Likewise.
+
+2018-01-14 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2018-01-12 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83628
+ * config/alpha/alpha.md (*saddsi_1): New insn_ans_split pattern.
+ (*saddl_se_1): Ditto.
+ (*ssubsi_1): Ditto.
+ (*ssubl_se_1): Ditto.
+
+ Backport from mainline
+ 2018-01-09 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83628
+ * combine.c (force_int_to_mode) <case ASHIFT>: Use mode instead of
+ op_mode in the force_to_mode call.
+
+2018-01-12 Oleg Endo <olegendo@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-01-12 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/81819
+ * config/rx/rx.c (rx_is_restricted_memory_address):
+ Handle SUBREG case.
+
+2018-01-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/83565
+ * rtlanal.c (nonzero_bits1): On WORD_REGISTER_OPERATIONS machines, do
+ not extend the result to a larger mode for rotate operations.
+ (num_sign_bit_copies1): Likewise.
+
+2018-01-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2018-01-04 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR bootstrap/81926
+ * cgraphunit.c (symbol_table::compile): Switch to text_section
+ before calling assembly_start debug hook.
+
+2018-01-11 Oleg Endo <olegendo@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-01-11 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/81821
+ * config/rx/rx.md (BW): New mode attribute.
+ (sync_lock_test_and_setsi): Add mode suffix to insn output.
+
+2018-01-09 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-01-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/83713
+ * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.
+
+2018-01-08 Jim Wilson <jimw@sifive.com>
+
+ Backport from mainline
+ 2018-01-08 Monk Chiang <sh.chiang04@gmail.com>
+ Kito Cheng <kito.cheng@gmail.com>
+
+ * config/riscv/riscv.c (machine_function::is_leaf): Remove field.
+ (riscv_leaf_function_p): Delete.
+ (riscv_function_ok_for_sibcall): Return false when TARGET_SAVE_RESTORE.
+
+2018-01-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * config/arm/arm.h (TEST_REGNO): Adjust comment as expected in r255830.
+
+2018-01-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backported from mainline
+ 2018-01-05 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.gcc (epiphany-*-elf*): Add (epiphany-*-rtems*) configuration.
+ * config/epiphany/rtems.h: New file.
+
+2018-01-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83628
+ * config/alpha/alpha.md (*sadd<modesuffix>): Use ASHIFT
+ instead of MULT rtx. Update all corresponding splitters.
+ (*saddl_se): Ditto.
+ (*ssub<modesuffix>): Ditto.
+ (*ssubl_se): Ditto.
+ (*cmp_sadd_di): Update split patterns.
+ (*cmp_sadd_si): Ditto.
+ (*cmp_sadd_sidi): Ditto.
+ (*cmp_ssub_di): Ditto.
+ (*cmp_ssub_si): Ditto.
+ (*cmp_ssub_sidi): Ditto.
+ * config/alpha/predicates.md (const23_operand): New predicate.
+ * config/alpha/alpha.c (alpha_rtx_costs) [PLUS, MINUS]:
+ Look for ASHIFT, not MULT inner operand.
+ (alpha_split_conditional_move): Update for *sadd<modesuffix> change.
+
+2018-01-02 Andrew Waterman <andrew@sifive.com>
+
+ * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
+ * config/riscv/riscv.md (clear_cache): Use it.
+
+2018-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83608
+ * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
+ convert_modes if target mode has the right side, but different mode
+ class.
+
+ PR middle-end/83609
+ * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
+ last argument when extracting from CONCAT. If either from_real or
+ from_imag is NULL, use expansion through memory. If result is not
+ a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
+ the parts directly to inner mode, if even that fails, use expansion
+ through memory.
+
+ PR middle-end/83623
+ * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
+ check for bswap in mode rather than HImode and use that in expand_unop
+ too.
+
+2017-12-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83553
+ * fold-const.c (struct contains_label_data): New type.
+ (contains_label_1): Return non-NULL even for CASE_LABEL_EXPR, unless
+ inside of a SWITCH_BODY seen during the walk.
+ (contains_label_p): Use walk_tree instead of
+ walk_tree_without_duplicates, prepare data for contains_label_1 and
+ provide own pset.
+
+2017-12-22 Martin Jambor <mjambor@suse.cz>
+
+ PR lto/82027
+ * lto-cgraph.c (output_cgraph_opt_summary_p): Also check former
+ clones.
+
+2017-12-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/83448
+ * gimple-ssa-sprintf.c (maybe_warn): Don't call set_caret_index
+ if navail is >= dir.len.
+
+ PR rtl-optimization/80747
+ PR rtl-optimization/83512
+ * cfgrtl.c (force_nonfallthru_and_redirect): When splitting
+ succ edge from ENTRY, copy partition from e->dest to the newly
+ created bb.
+ * bb-reorder.c (reorder_basic_blocks_simple): If last_tail is
+ ENTRY, use BB_PARTITION of its successor block as current_partition.
+ Don't copy partition when splitting succ edge from ENTRY.
+
+ PR tree-optimization/83523
+ * tree-ssa-math-opts.c (is_widening_mult_p): Return false if
+ for INTEGER_TYPE TYPE_OVERFLOW_TRAPS.
+ (convert_mult_to_fma): Likewise.
+
+ PR tree-optimization/83521
+ * tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
+ gimple_build_assign without code on result of
+ fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
+ a VIEW_CONVERT_EXPR.
+
+ 2017-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/82801
+ PR ipa/83346
+ * ipa-inline.c (flatten_remove_node_hook): New function.
+ (ipa_inline): Keep only nodes with flatten attribute at the end of
+ the array in the order from ipa_reverse_postorder, only walk that
+ portion of array for flattening, if there is more than one such
+ node, temporarily register a removal hook and ignore removed nodes.
+
+2017-12-21 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83467
+ * config/i386/i386.md (*ashl<mode>3_mask): Add operand
+ constraints to operand 2.
+ (*<shift_insn><mode>3_mask): Ditto.
+ (*<rotate_insn><mode>3_mask): Ditto.
+
+2017-12-19 Bin Cheng <bin.cheng@arm.com>
+
+ Backport from mainline
+ 2017-11-15 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/82726
+ PR tree-optimization/70754
+ * tree-predcom.c (order_drefs_by_pos): New function.
+ (combine_chains): Move code setting has_max_use_after to...
+ (try_combine_chains): ...here. New parameter. Sort combined chains
+ according to position information.
+ (tree_predictive_commoning_loop): Update call to above function.
+ (update_pos_for_combined_chains, pcom_stmt_dominates_stmt_p): New.
+
+ 2017-11-15 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/82726
+ Revert
+ 2017-01-23 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/70754
+ * tree-predcom.c (stmt_combining_refs): New parameter INSERT_BEFORE.
+ (reassociate_to_the_same_stmt): New parameter INSERT_BEFORE. Insert
+ combined stmt before it if not NULL.
+ (combine_chains): Process refs reversely and compute dominance point
+ for root ref.
+
+ Revert
+ 2017-02-23 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/79663
+ * tree-predcom.c (combine_chains): Process refs in reverse order
+ only for ZERO length chains, and add explaining comment.
+
+2017-12-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline
+ 2017-12-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ PR target/83387
+ * config/rs6000/t-rtems (MULTILIB_REQUIRED): Remove 64-bit soft-float
+ multilib.
+
+2017-12-19 Daniel Cederman <cederman@gaisler.com>
+
+ Backport from mainline
+ 2017-12-19 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sparc.c (sparc_do_work_around_errata): Make sure
+ the jump is to a label.
+
+2017-12-17 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2017-12-03 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.c (pa_legitimate_address_p): For scaled indexing,
+ require base operand is a REG_POINTER prior to reload on targets
+ with non-equivalent space registers.
+
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83269
+ * fold-const.c (fold_binary_loc): Perform (-A) - B -> (-B) - A
+ subtraction in arg0's type if type is signed and arg0 is unsigned.
+ Formatting fix.
+
+ Backported from mainline
+ 2017-12-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83198
+ * gimple-ssa-sprintf.c (format_floating): Set type solely based on
+ dir.modifier, regardless of TREE_TYPE (arg). Assume non-REAL_CST
+ value if arg is a REAL_CST with incompatible type.
+
+ 2017-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/80631
+ * tree-vect-loop.c (get_initial_def_for_reduction): Fix comment typo.
+ (vect_create_epilog_for_reduction): Add INDUC_VAL argument, for
+ INTEGER_INDUC_COND_REDUCTION use INDUC_VAL instead of
+ hardcoding zero as the value if COND_EXPR is never true. For
+ INTEGER_INDUC_COND_REDUCTION don't emit the final COND_EXPR if
+ INDUC_VAL is equal to INITIAL_DEF.
+ (vectorizable_reduction): Compute INDUC_VAL for
+ vect_create_epilog_for_reduction, if no value is suitable, don't
+ use INTEGER_INDUC_COND_REDUCTION for now. Formatting fixes.
+
+ 2017-12-08 Joseph Myers <joseph@codesourcery.com>
+ Alexander Monakov <amonakov@ispras.ru>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81906
+ * config/i386/i386.c (ix86_expand_rint): Handle flag_rounding_math.
+
+ 2017-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81212
+ * tree-cfg.c (pass_warn_function_return::execute): Handle
+ __builtin_ubsan_handle_missing_return like __builtin_unreachable
+ with BUILTINS_LOCATION.
+
+ PR target/78643
+ PR target/80583
+ * expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
+ is BLKmode for vector field with vector raw mode, use TYPE_MODE
+ instead of DECL_MODE.
+
+ 2017-11-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/80819
+ * config/i386/sse.md (vec_concatv2di): Remove * from (=Yr,0,*rm)
+ alternative.
+
+ 2017-11-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/81553
+ * combine.c (simplify_if_then_else): In (if_then_else COND (OP Z C1) Z)
+ to (OP Z (mult COND (C1 * STORE_FLAG_VALUE))) optimization, if OP
+ is a shift where C1 has different mode than the whole shift, use C1's
+ mode for MULT rather than the shift's mode.
+
+ 2017-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83014
+ * ubsan.c (ubsan_type_descriptor): Use pp_unsigned_wide_integer
+ instead of pp_printf with HOST_WIDE_INT_PRINT_DEC. Avoid calling
+ tree_to_uhwi twice.
+
+ * tree-object-size.c (pass_through_call): Do not handle
+ BUILT_IN_STPNCPY_CHK which is not a pass through call.
+
+ 2017-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/82253
+ * expr.c (expand_assignment): For CONCAT to_rtx, complex type from and
+ bitpos/bitsize covering the whole destination, use store_expr only if
+ the complex mode is the same. Otherwise, use expand_normal and if
+ it returns CONCAT, subreg each part separately instead of trying to
+ subreg the whole result.
+
+ 2017-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83084
+ * valtrack.c (propagate_for_debug_subst, propagate_for_debug): Reset
+ debug insns if they would contain UNSPEC_VOLATILE or volatile asm.
+ (dead_debug_insert_temp): Likewise, but also ignore even non-volatile
+ asm.
+
+ 2017-11-21 James Cowgill <James.Cowgill@imgtec.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR target/82880
+ * config/mips/frame-header-opt.c (mips_register_frame_header_opt):
+ Remove static keyword from f variable.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/83439
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Adjust remaining gimple_set_modified to use the modified
+ variable instead.
+
+2017-12-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/66488
+ * ggc-page.c (HOST_BITS_PER_PTR): Do not define here...
+ * hwint.h (HOST_BITS_PER_PTR): ...but here instead.
+ * config/i386/xm-mingw32.h (HOST_BITS_PER_PTR): Delete.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ PR tree-optimization/82060
+ * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
+ Move devirtualization after stmt folding and before EH/AB/noreturn
+ cleanup to get the stmt refs canonicalized. Use a bool instead
+ of gimple_modified_p since that doesn't work for NOPs. Schedule
+ NOPs generated by folding for removal.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82102
+ * tree-ssa-pre.c (eliminate): Check if lhs is NULL.
+
+ 2017-09-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82128
+ * gimple-fold.c (gimple_fold_call): Update SSA name in-place to
+ default-def to avoid breaking iterator update with the weird
+ interaction with cgraph_update_edges_for_call_stmt_node.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82402
+ * tree-vect-loop-manip.c (create_lcssa_for_virtual_phi): Properly
+ set SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
+
+ 2017-10-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82697
+ * tree-ssa-phiopt.c (cond_store_replacement): Use alias-set
+ zero for conditional load and unconditional store.
+
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82765
+ * varasm.c (decode_addr_const): Make offset HOST_WIDE_INT.
+ Truncate ARRAY_REF index and element size.
+
+ 2017-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82902
+ * tree-ssa-phiprop.c (propagate_with_phi): Test proper type.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-10-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80210
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Rewrite
+ function to not use the have_cpu variable. Do not set cpu_index,
+ rs6000_cpu_index or rs6000_tune_index if we end up using TARGET_DEFAULT
+ or the default cpu.
+ (rs6000_valid_attribute_p): Remove duplicate initializations of
+ old_optimize and func_optimize.
+ (rs6000_pragma_target_parse): Call rs6000_activate_target_options ().
+ (rs6000_activate_target_options): Make global.
+ * config/rs6000/rs6000-protos.h (rs6000_activate_target_options): Add
+ prototype.
+
+2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ * config/rs6000/ppc-auxv.h (PPC_FEATURE2_HTM_NO_SUSPEND): New define.
+ * config/rs6000/rs6000.c (cpu_supports_info): Use it.
+
+2017-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2017-12-01 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/81959
+ * config/rs6000/rs6000.c (rs6000_address_for_fpconvert): Check for
+ whether we can allocate pseudos before trying to fix an address.
+ * config/rs6000/rs6000.md (float_<mode>si2_hw): Make sure the
+ memory address is indexed or indirect.
+ (floatuns_<mode>si2_hw2): Likewise.
+
+2017-12-11 Sudakshina Das <sudi.das@arm.com>
+
+ Backported from trunk
+ 2017-12-01 Sudakshina Das <sudi.das@arm.com>
+
+ * config/arm/vfp.md (*movhf_vfp_fp16): Add conds attribute.
+
+2017-12-07 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ Backport from trunk
+ 2017-05-08 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ PR target/80101
+ * config/rs6000/power6.md: Replace store_data_bypass_p calls with
+ rs6000_store_data_bypass_p in seven define_bypass directives and
+ in several comments.
+ * config/rs6000/rs6000-protos.h: Add prototype for
+ rs6000_store_data_bypass_p function.
+ * config/rs6000/rs6000.c (rs6000_store_data_bypass_p): New
+ function implements slightly different (rs6000-specific) semantics
+ than store_data_bypass_p, returning false rather than aborting
+ with assertion error when arguments do not satisfy the
+ requirements of store data bypass.
+ (rs6000_adjust_cost): Replace six calls of store_data_bypass_p with
+ rs6000_store_data_bypass_p.
+
+2017-12-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ Revert
+ 2017-11-29 Martin Aberg <maberg@gaisler.com>
+
+ * config/sparc/sparc.md (divdf3_fix): Add NOP and adjust length
+ to prevent b2bst errata sequence.
+ (sqrtdf2_fix): Likewise.
+
+2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
+ 2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
+ * config/xtensa/xtensa.c (xtensa_asan_shadow_offset): New
+ function.
+ (TARGET_ASAN_SHADOW_OFFSET): New macro definition.
+ * config/xtensa/xtensa.h (FRAME_GROWS_DOWNWARD): Set to 1 if
+ ASAN is enabled.
+
+2017-12-05 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
+ 2017-05-08 Max Filippov <jcmvbkbc@gmail.com>
+ * config/xtensa/xtensa-protos.h
+ (xtensa_initial_elimination_offset): New declaration.
+ * config/xtensa/xtensa.c (xtensa_initial_elimination_offset):
+ New function. Move its body from the INITIAL_ELIMINATION_OFFSET
+ macro definition, add case for FRAME_POINTER_REGNUM when
+ FRAME_GROWS_DOWNWARD.
+ * config/xtensa/xtensa.h (FRAME_GROWS_DOWNWARD): New macro
+ definition.
+ (INITIAL_ELIMINATION_OFFSET): Replace body with call to
+ xtensa_initial_elimination_offset.
+
+2017-12-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/sparc/sparc.c (sparc_do_work_around_errata): Use mem_ref
+ instead of MEM_P in a couple more places. Fix formatting issues.
+
+2017-12-04 Sebastian Peryt <sebastian.peryt@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ Bakcported from trunk
+ PR target/82941
+ PR target/82942
+ PR target/82990
+ * config/i386/i386.c (pass_insert_vzeroupper): Remove
+ TARGET_AVX512F check from gate condition.
+ (ix86_check_avx256_register): Changed to ...
+ (ix86_check_avx_upper_register): ... this. Add extra check for
+ VALID_AVX512F_REG_OR_XI_MODE.
+ (ix86_avx_u128_mode_needed): Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_check_avx256_stores): Changed to ...
+ (ix86_check_avx_upper_stores): ... this. Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_avx_u128_mode_after): Changed
+ avx_reg256_found to avx_upper_reg_found. Changed
+ ix86_check_avx256_stores to ix86_check_avx_upper_stores.
+ (ix86_avx_u128_mode_entry): Changed
+ ix86_check_avx256_register to ix86_check_avx_upper_register.
+ (ix86_avx_u128_mode_exit): Ditto.
+ (ix86_option_override_internal): Set MASK_VZEROUPPER if
+ neither -mzeroupper nor -mno-zeroupper is used and
+ TARGET_EMIT_VZEROUPPER is set.
+ * config/i386/i386.h: (host_detect_local_cpu): New define.
+ (TARGET_EMIT_VZEROUPPER): New.
+ * config/i386/x86-tune.def: Add X86_TUNE_EMIT_VZEROUPPER
+
+2017-12-01 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-11-28 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR 81288/target
+ * config/rs6000/rs6000.c (rs6000_rtx_costs): Do not handle
+ TARGET_ISEL && !TARGET_MFCRF differently. Simplify code.
+
+2017-11-30 Jim Wilson <jimw@sifive.com>
+
+ Backport from mainline
+ 2017-11-30 Jim Wilson <jimw@sifive.com>
+ * doc/invoke.texi (RISC-V Options): Delete nonexistent -mmemcpy and
+ -mno-memcpy options. For -mplt, -mfdiv, -mdiv, -msave-restore, and
+ -mstrict-align, add info on default value. Delete redundant lines for
+ -mabi. Add missing -mexplicit-relocs docs.
+
+ Backport from mainline
+ 2017-11-01 Palmer Dabbelt <palmer@dabbelt.com>
+ * doc/invoke.texi (RISC-V Options): Use "@minus{}2 GB", not "-2 GB".
+ * doc/invoke.texi (RISC-V Options): Explicitly name the medlow
+ and medany code models, and describe what they do.
+
+ 2017-10-27 Palmer Dabbelt <palmer@dabbelt.com>
+ PR target/82717
+ * doc/invoke.texi (RISC-V) <-mabi>: Correct and improve.
+
+2017-11-29 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/82808
+ * tree.c (expr_type_first_operand_type_p): New function.
+ * tree.h (expr_type_first_operand_type_p): Declare it.
+ * ipa-cp.c (ipa_get_jf_pass_through_result): Use it.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sparc.c (sparc_do_work_around_errata): Treat the
+ movsi_pic_gotdata_op instruction as a load for the UT699 errata
+ workaround.
+
+2017-11-29 Martin Aberg <maberg@gaisler.com>
+
+ * config/sparc/sparc.md (divdf3_fix): Add NOP and adjust length
+ to prevent b2bst errata sequence.
+ (sqrtdf2_fix): Likewise.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sparc.c (fpop_reg_depend_p): New function.
+ (div_sqrt_insn_p): New function.
+ (sparc_do_work_around_errata): Insert NOP instructions to
+ prevent sequences that could trigger the TN-0013 errata for
+ certain LEON3 processors.
+ (pass_work_around_errata::gate): Also test sparc_fix_lost_divsqrt.
+ (sparc_option_override): Set sparc_fix_lost_divsqrt appropriately.
+ * config/sparc/sparc.md (fix_lost_divsqrt): New attribute.
+ (in_branch_delay): Prevent div and sqrt in delay slot if
+ fix_lost_divsqrt.
+ * config/sparc/sparc.opt (sparc_fix_lost_divsqrt): New variable.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sparc.c (atomic_insn_p): New function.
+ (sparc_do_work_around_errata): Insert NOP instructions to
+ prevent sequences that could trigger the TN-0010 errata for
+ UT700.
+ * config/sparc/sync.md (atomic_compare_and_swap_leon3_1): Make
+ instruction referable in atomic_insns_p.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sync.md (swapsi): 16-byte align if sparc_fix_gr712rc.
+ (atomic_compare_and_swap_leon3_1): Likewise.
+ (ldstub): Likewise.
+
+2017-11-29 Daniel Cederman <cederman@gaisler.com>
+
+ * config/sparc/sparc.c (fpop_insn_p): New function.
+ (sparc_do_work_around_errata): Insert NOP instructions to
+ prevent sequences that could trigger the TN-0012 errata for
+ GR712RC.
+ (pass_work_around_errata::gate): Also test sparc_fix_gr712rc.
+ * config/sparc/sparc.md (fix_gr712rc): New attribute.
+ (in_branch_annul_delay): Prevent floating-point instructions
+ in delay slot of annulled integer branch.
+
+2017-11-28 Jim Wilson <jimw@sifive.com>
+
+ Backport from mainline
+ 2017-11-04 Andrew Waterman <andrew@sifive.com>
+
+ * config/riscv/riscv.c (riscv_option_override): Conditionally set
+ TARGET_STRICT_ALIGN based upon -mtune argument.
+
+ Backport from mainline
+ 2017-05-04 Andrew Waterman <andrew@sifive.com>
+
+ * config/riscv/riscv.opt (mstrict-align): New option.
+ * config/riscv/riscv.h (STRICT_ALIGNMENT): Use it. Update comment.
+ (SLOW_UNALIGNED_ACCESS): Define.
+ (riscv_slow_unaligned_access): Declare.
+ * config/riscv/riscv.c (riscv_tune_info): Add slow_unaligned_access
+ field.
+ (riscv_slow_unaligned_access): New variable.
+ (rocket_tune_info): Set slow_unaligned_access to true.
+ (optimize_size_tune_info): Set slow_unaligned_access to false.
+ (riscv_cpu_info_table): Add entry for optimize_size_tune_info.
+ (riscv_valid_lo_sum_p): Use TARGET_STRICT_ALIGN.
+ (riscv_option_override): Set riscv_slow_unaligned_access.
+ * doc/invoke.texi: Add -mstrict-align to RISC-V.
+
+ Backport from mainline
+ 2017-11-07 Michael Clark <michaeljclark@mac.com>
+
+ * config/riscv/linux.h (MUSL_ABI_SUFFIX): New define.
+ (MUSL_DYNAMIC_LINKER): Likewise.
+
+2017-11-27 Jim Wilson <jimw@sifive.com>
+
+ Backport from mainline
+ 2017-10-25 Palmer Dabbelt <palmer@dabbelt.com>
+
+ * config/riscv/riscv.md (ZERO_EXTEND_LOAD): Define.
+ * config/riscv/pic.md (local_pic_load): Rename to local_pic_load_s,
+ mark as a sign-extending load.
+ (local_pic_load_u): Define.
+
+ Backport from mainline
+ 2017-11-03 Kito Cheng <kito.cheng@gmail.com>
+
+ * config/riscv/riscv.c (riscv_legitimize_move): Handle
+ non-legitimate address.
+
+2017-11-24 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-11-17 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/82621
+ * combine.c (try_combine): Do not split PARALLELs of two SETs if the
+ dest of one of those SETs is unused.
+
+2017-11-23 Oleg Endo <olegendo@gcc.gnu.org>
+
+ Backport from mainline
+ 2017-11-23 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/83111
+ * config/sh/sh.md (udivsi3, divsi3, sibcall_value_pcrel,
+ sibcall_value_pcrel_fdpic): Use local variable instead of
+ operands[3].
+ (calli_tbr_rel): Add missing operand 2.
+ (call_valuei_tbr_rel): Add missing operand 3.
+
+2017-11-22 Richard Biener <rguenther@suse.de>
+
+ Revert
+ 2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-11-21 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/82044
+ PR tree-optimization/82042
+ * dse.c (check_mem_read_rtx): Check for overflow.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-27 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/82457
+ * doc/invoke.texi: Document that one needs a non-strict ISO mode
+ for fork-like functions to be properly instrumented.
+
+2017-11-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline
+ 2017-11-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ * config/rs6000/ppc-asm.h (f50, vs50): Fix values.
+
+2017-11-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2017-11-09 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/arm/arm.c (output_return_instruction): Add comments to
+ indicate requirement for cmse_nonsecure_entry return to account
+ for the size of clearing instruction output here.
+ (thumb_exit): Likewise.
+ * config/arm/thumb2.md (thumb2_cmse_entry_return): Fix length for
+ return in hardfloat mode.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-11-21 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/82044
+ PR tree-optimization/82042
+ * dse.c (check_mem_read_rtx): Check for overflow.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-11-08 Martin Liska <mliska@suse.cz>
+
+ * gimplify.c (expand_FALLTHROUGH_r): Simplify usage
+ of gimple_call_internal_p.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-11-08 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/82792
+ * gimplify.c (expand_FALLTHROUGH_r): Skip IFN_ASAN_MARK.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-31 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/82633
+ * doc/gcov.texi: Document -fkeep-{static,inline}-functions and
+ their interaction with GCOV infrastructure.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-19 Martin Liska <mliska@suse.cz>
+
+ PR driver/81829
+ * file-find.c (remove_prefix): Remove.
+ * file-find.h (remove_prefix): Likewise.
+ * gcc-ar.c: Remove smartness of lookup.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-18 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/82545
+ * asan.c (asan_expand_poison_ifn): Do not put gimple stmt
+ on an abnormal edge.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-11 Martin Liska <mliska@suse.cz>
+
+ * print-rtl.c (print_insn): Move declaration of idbuf
+ to same scope as name.
+
+2017-11-21 Claudiu Zissulescu <claziss@synopsys.com>
+
+ Backport from mainline
+ 2017-11-17 Vineet Gupta <vgupta@synopsys.com>
+
+ * config/arc/linux.h: GLIBC_DYNAMIC_LINKER update per glibc
+ upstreaming review comments.
+
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.gcc (*-*-solaris2*): Enable default_use_cxa_atexit since
+ Solaris 11. Update comment.
+ * configure.ac (gcc_cv_ld_pid): Adapt comment for Solaris 12
+ renaming.
+ * config/sol2.h (STARTFILE_SPEC): Likewise.
+ * configure: Regenerate.
+
+2017-11-20 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-09-20 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/77687
+ * config/rs6000/rs6000.md (stack_restore_tie): Store to a scratch
+ address instead of to r1 and r11.
+
+2017-11-17 Vineet Gupta <vgupta@synopsys.com>
+
+ * config.gcc: Remove uclibc from arc target spec.
+
+2017-11-16 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (x86_print_call_or_nop): Emit 5 byte nop
+ explicitly as a stream of bytes.
+
2017-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/82985
@@ -47,7 +929,7 @@
Backport from mainline
2017-10-31 Matthew Fortune <matthew.fortune@imgtec.com>
- Eric Botcazou <ebotcazou@adacore.com>
+ Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/81803
* lra-constraints.c (curr_insn_transform): Also reload the whole
@@ -116,8 +998,8 @@
2017-10-24 Qing Zhao <qing.zhao@oracle.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
- * builtins.c (expand_builtin_update_setjmp_buf): Add a
- converstion to Pmode from the buf_addr.
+ * builtins.c (expand_builtin_update_setjmp_buf): Add a
+ converstion to Pmode from the buf_addr.
2017-10-20 Richard Biener <rguenther@suse.de>
@@ -265,7 +1147,7 @@
2017-09-27 Christophe Lyon <christophe.lyon@linaro.org>
Backport from trunk r249639.
- 2017-06-26 Christophe Lyon <christophe.lyon@linaro.org>
+ 2017-06-26 Christophe Lyon <christophe.lyon@linaro.org>
* doc/sourcebuild.texi (ARM-specific attributes): Document new
arm_neon_ok_no_float_abi effective target.
@@ -363,7 +1245,7 @@
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com>
-
+
PR target/81325
* cfgbuild.c (find_bb_boundaries): Ignore debug insns in decisions
if and where to split a bb, except for splitting before debug insn
@@ -669,7 +1551,7 @@
PR sanitizer/80932
* fold-const.c (extract_muldiv_1) <case MINUS_EXPR>: Add
- TYPE_OVERFLOW_WRAPS check.
+ TYPE_OVERFLOW_WRAPS check.
2017-08-28 Richard Biener <rguenther@suse.de>
@@ -681,7 +1563,7 @@
at struct end conservatively when comparing common bases.
2017-05-04 Richard Biener <rguenther@suse.de>
-
+
* tree.c (array_at_struct_end_p): Handle arrays at struct
end with flexarrays more conservatively. Refactor and treat
arrays of arrays or aggregates more strict. Fix
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 49bbb3c7bd9..a384ad6e140 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20171116
+20180115
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2378c3e2af0..7f3f1d711a2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,40 @@
+2017-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
+ of the enclosing record type if it is not already set.
+
+2017-12-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Initialize locus.
+
+2017-12-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (process_freeze_entity): Be prepared for a
+ package without body.
+
+2017-12-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Robustify test for types
+ descendant of System.Address.
+ (gnat_to_gnu_subprog_type): Likewise.
+
+2017-12-04 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * gcc-interface/Makefile.in (RTEMS): Use s-osprim.adb.
+ * s-osprim-rtems.adb: New file.
+ * s-osinte-rtems.adb (pthread_cond_t): Fix alignment.
+ (pthread_mutexattr_t): Likewise.
+ (pthread_rwlockattr_t): Likewise.
+ (pthread_rwlock_t): Likewise.
+ (time_t): Use 64-bit integer.
+
+2017-12-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * s-osinte-rtems.ads (pthread_cond_t): Use correct size and
+ alignment.
+ (pthread_mutex_t): Likewise.
+ (pthread_rwlock_t): Likewise.
+
2017-11-10 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (convert) <RECORD_TYPE>: Add comment and do
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index d94fadf508b..7a570196a88 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1726,7 +1726,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-rtems.adb \
s-osinte.ads<s-osinte-rtems.ads \
- s-osprim.adb<s-osprim-posix.adb \
+ s-osprim.adb<s-osprim-rtems.adb \
s-parame.adb<s-parame-rtems.adb \
s-taprop.adb<s-taprop-posix.adb \
s-taspri.ads<s-taspri-posix.ads \
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index e057749e956..e226f256b47 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -653,7 +653,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* Get the type after elaborating the renamed object. */
if (Has_Foreign_Convention (gnat_entity)
- && Is_Descendant_Of_Address (gnat_type))
+ && Is_Descendant_Of_Address (Underlying_Type (gnat_type)))
gnu_type = ptr_type_node;
else
{
@@ -5807,7 +5807,7 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition,
/* For foreign convention subprograms, return System.Address as void *
or equivalent. Note that this comprises GCC builtins. */
if (Has_Foreign_Convention (gnat_subprog)
- && Is_Descendant_Of_Address (gnat_return_type))
+ && Is_Descendant_Of_Address (Underlying_Type (gnat_return_type)))
gnu_return_type = ptr_type_node;
else
gnu_return_type = gnat_to_gnu_profile_type (gnat_return_type);
@@ -5974,7 +5974,7 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition,
/* For foreign convention subprograms, pass System.Address as void *
or equivalent. Note that this comprises GCC builtins. */
if (Has_Foreign_Convention (gnat_subprog)
- && Is_Descendant_Of_Address (gnat_param_type))
+ && Is_Descendant_Of_Address (Underlying_Type (gnat_param_type)))
gnu_param_type = ptr_type_node;
else
gnu_param_type = gnat_to_gnu_profile_type (gnat_param_type);
@@ -7127,7 +7127,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
{
const unsigned int type_align = TYPE_ALIGN (gnu_field_type);
- if (TYPE_ALIGN (gnu_record_type) < type_align)
+ if (TYPE_ALIGN (gnu_record_type)
+ && TYPE_ALIGN (gnu_record_type) < type_align)
SET_TYPE_ALIGN (gnu_record_type, type_align);
/* If the position is not a multiple of the alignment of the type,
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index ae35bf42bf3..bef7f8121f3 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -3757,7 +3757,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
}
/* Set the line number in the decl to correspond to that of the body. */
- Sloc_to_locus (Sloc (gnat_node), &locus);
+ if (!Sloc_to_locus (Sloc (gnat_node), &locus))
+ locus = input_location;
DECL_SOURCE_LOCATION (gnu_subprog_decl) = locus;
/* Initialize the information structure for the function. */
@@ -8625,12 +8626,12 @@ process_freeze_entity (Node_Id gnat_node)
const Entity_Kind kind = Ekind (gnat_entity);
tree gnu_old, gnu_new;
- /* If this is a package, we need to generate code for the package. */
+ /* If this is a package, generate code for the package body, if any. */
if (kind == E_Package)
{
- insert_code_for
- (Parent (Corresponding_Body
- (Parent (Declaration_Node (gnat_entity)))));
+ const Node_Id gnat_decl = Parent (Declaration_Node (gnat_entity));
+ if (Present (Corresponding_Body (gnat_decl)))
+ insert_code_for (Parent (Corresponding_Body (gnat_decl)));
return;
}
diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads
index a658bbe8b0d..d127024cf3b 100644
--- a/gcc/ada/s-osinte-rtems.ads
+++ b/gcc/ada/s-osinte-rtems.ads
@@ -620,7 +620,7 @@ private
type pid_t is new int;
- type time_t is new long;
+ type time_t is new Long_Long_Integer;
type timespec is record
tv_sec : time_t;
@@ -649,21 +649,33 @@ private
Data : char_array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE);
end record;
pragma Convention (C, pthread_mutexattr_t);
- for pthread_mutexattr_t'Alignment use Interfaces.C.double'Alignment;
+ for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment;
type pthread_rwlockattr_t is record
Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCKATTR_SIZE);
end record;
pragma Convention (C, pthread_rwlockattr_t);
- for pthread_rwlockattr_t'Alignment use Interfaces.C.double'Alignment;
+ for pthread_rwlockattr_t'Alignment use Interfaces.C.int'Alignment;
type pthread_t is new rtems_id;
- type pthread_mutex_t is new rtems_id;
+ type pthread_mutex_t is record
+ Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE);
+ end record;
+ pragma Convention (C, pthread_mutex_t);
+ for pthread_mutex_t'Alignment use Interfaces.C.double'Alignment;
- type pthread_rwlock_t is new rtems_id;
+ type pthread_rwlock_t is record
+ Data : char_array (1 .. OS_Constants.PTHREAD_RWLOCK_SIZE);
+ end record;
+ pragma Convention (C, pthread_rwlock_t);
+ for pthread_rwlock_t'Alignment use Interfaces.C.size_t'Alignment;
- type pthread_cond_t is new rtems_id;
+ type pthread_cond_t is record
+ Data : char_array (1 .. OS_Constants.PTHREAD_COND_SIZE);
+ end record;
+ pragma Convention (C, pthread_cond_t);
+ for pthread_cond_t'Alignment use Interfaces.C.size_t'Alignment;
type pthread_key_t is new rtems_id;
diff --git a/gcc/ada/s-osprim-rtems.adb b/gcc/ada/s-osprim-rtems.adb
new file mode 100644
index 00000000000..df8754baa69
--- /dev/null
+++ b/gcc/ada/s-osprim-rtems.adb
@@ -0,0 +1,172 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . O S _ P R I M I T I V E S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1998-2015, Free Software Foundation, Inc. --
+-- --
+-- GNARL 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- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This version is for POSIX-like operating systems
+
+package body System.OS_Primitives is
+
+ -- ??? These definitions are duplicated from System.OS_Interface
+ -- because we don't want to depend on any package. Consider removing
+ -- these declarations in System.OS_Interface and move these ones in
+ -- the spec.
+
+ type time_t is new Long_Long_Integer;
+
+ type timespec is record
+ tv_sec : time_t;
+ tv_nsec : Long_Integer;
+ end record;
+ pragma Convention (C, timespec);
+
+ function nanosleep (rqtp, rmtp : not null access timespec) return Integer;
+ pragma Import (C, nanosleep, "nanosleep");
+
+ -----------
+ -- Clock --
+ -----------
+
+ function Clock return Duration is
+
+ type timeval is record
+ tv_sec : time_t;
+ tv_usec : Long_Integer;
+ end record;
+ pragma Convention (C, timeval);
+
+ procedure timeval_to_duration
+ (T : not null access timeval;
+ sec : not null access Long_Long_Integer;
+ usec : not null access Long_Integer);
+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
+
+ Micro : constant := 10**6;
+ sec : aliased Long_Long_Integer;
+ usec : aliased Long_Integer;
+ TV : aliased timeval;
+ Result : Integer;
+ pragma Unreferenced (Result);
+
+ function gettimeofday
+ (Tv : access timeval;
+ Tz : System.Address := System.Null_Address) return Integer;
+ pragma Import (C, gettimeofday, "gettimeofday");
+
+ begin
+ -- The return codes for gettimeofday are as follows (from man pages):
+ -- EPERM settimeofday is called by someone other than the superuser
+ -- EINVAL Timezone (or something else) is invalid
+ -- EFAULT One of tv or tz pointed outside accessible address space
+
+ -- None of these codes signal a potential clock skew, hence the return
+ -- value is never checked.
+
+ Result := gettimeofday (TV'Access, System.Null_Address);
+ timeval_to_duration (TV'Access, sec'Access, usec'Access);
+ return Duration (sec) + Duration (usec) / Micro;
+ end Clock;
+
+ -----------------
+ -- To_Timespec --
+ -----------------
+
+ function To_Timespec (D : Duration) return timespec;
+
+ function To_Timespec (D : Duration) return timespec is
+ S : time_t;
+ F : Duration;
+
+ begin
+ S := time_t (Long_Long_Integer (D));
+ F := D - Duration (S);
+
+ -- If F has negative value due to a round-up, adjust for positive F
+ -- value.
+
+ if F < 0.0 then
+ S := S - 1;
+ F := F + 1.0;
+ end if;
+
+ return
+ timespec'(tv_sec => S,
+ tv_nsec => Long_Integer (Long_Long_Integer (F * 10#1#E9)));
+ end To_Timespec;
+
+ -----------------
+ -- Timed_Delay --
+ -----------------
+
+ procedure Timed_Delay
+ (Time : Duration;
+ Mode : Integer)
+ is
+ Request : aliased timespec;
+ Remaind : aliased timespec;
+ Rel_Time : Duration;
+ Abs_Time : Duration;
+ Base_Time : constant Duration := Clock;
+ Check_Time : Duration := Base_Time;
+
+ Result : Integer;
+ pragma Unreferenced (Result);
+
+ begin
+ if Mode = Relative then
+ Rel_Time := Time;
+ Abs_Time := Time + Check_Time;
+ else
+ Rel_Time := Time - Check_Time;
+ Abs_Time := Time;
+ end if;
+
+ if Rel_Time > 0.0 then
+ loop
+ Request := To_Timespec (Rel_Time);
+ Result := nanosleep (Request'Access, Remaind'Access);
+ Check_Time := Clock;
+
+ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
+
+ Rel_Time := Abs_Time - Check_Time;
+ end loop;
+ end if;
+ end Timed_Delay;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize is
+ begin
+ null;
+ end Initialize;
+
+end System.OS_Primitives;
diff --git a/gcc/asan.c b/gcc/asan.c
index fa48f789082..ddac31b9db6 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -3161,6 +3161,10 @@ asan_expand_poison_ifn (gimple_stmt_iterator *iter,
{
edge e = gimple_phi_arg_edge (phi, i);
+ /* Do not insert on an edge we can't split. */
+ if (e->flags & EDGE_ABNORMAL)
+ continue;
+
if (call_to_insert == NULL)
call_to_insert = gimple_copy (call);
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index b297fea5de8..4376d5e0b2c 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2405,7 +2405,10 @@ reorder_basic_blocks_simple (void)
basic_block last_tail = (basic_block) ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux;
- int current_partition = BB_PARTITION (last_tail);
+ int current_partition
+ = BB_PARTITION (last_tail == ENTRY_BLOCK_PTR_FOR_FN (cfun)
+ ? EDGE_SUCC (ENTRY_BLOCK_PTR_FOR_FN (cfun), 0)->dest
+ : last_tail);
bool need_another_pass = true;
for (int pass = 0; pass < 2 && need_another_pass; pass++)
@@ -2446,7 +2449,6 @@ reorder_basic_blocks_simple (void)
{
force_nonfallthru (e);
e->src->aux = ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux;
- BB_COPY_PARTITION (e->src, e->dest);
}
}
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index ac51bacebd8..1d6d4d54940 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,12 @@
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83059
+ * c-common.c (get_atomic_generic_size): Use TREE_INT_CST_LOW
+ instead of tree_to_uhwi, formatting fix.
+
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index bc8c051bedb..e272488b39b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -6823,13 +6823,14 @@ get_atomic_generic_size (location_t loc, tree function,
tree p = (*params)[x];
if (TREE_CODE (p) == INTEGER_CST)
{
- int i = tree_to_uhwi (p);
- if (i < 0 || (memmodel_base (i) >= MEMMODEL_LAST))
- {
- warning_at (loc, OPT_Winvalid_memory_model,
- "invalid memory model argument %d of %qE", x + 1,
- function);
- }
+ /* memmodel_base masks the low 16 bits, thus ignore any bits above
+ it by using TREE_INT_CST_LOW instead of tree_to_*hwi. Those high
+ bits will be checked later during expansion in target specific
+ way. */
+ if (memmodel_base (TREE_INT_CST_LOW (p)) >= MEMMODEL_LAST)
+ warning_at (loc, OPT_Winvalid_memory_model,
+ "invalid memory model argument %d of %qE", x + 1,
+ function);
}
else
if (!INTEGRAL_TYPE_P (TREE_TYPE (p)))
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 20492cfbbfe..e4446e9582f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,19 @@
+2017-12-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83550
+ * c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on
+ TYPE_STUB_DECL and call rest_of_type_compilation before processing
+ incomplete vars rather than after it.
+
+2017-12-10 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ PR c/81875
+ 2017-09-16 Tom de Vries <tom@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_for_loop): Fold only operands of cond, not
+ cond itself.
+
2017-09-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index fa678261bed..ed609d29f96 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -8123,6 +8123,14 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
warning_at (loc, 0, "union cannot be made transparent");
}
+ /* Update type location to the one of the definition, instead of e.g.
+ a forward declaration. */
+ if (TYPE_STUB_DECL (t))
+ DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc;
+
+ /* Finish debugging output for this type. */
+ rest_of_type_compilation (t, toplevel);
+
/* If this structure or union completes the type of any previous
variable declaration, lay it out and output its rtl. */
for (x = incomplete_vars; x; x = TREE_CHAIN (x))
@@ -8139,14 +8147,6 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
}
}
- /* Update type location to the one of the definition, instead of e.g.
- a forward declaration. */
- if (TYPE_STUB_DECL (t))
- DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc;
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (t, toplevel);
-
/* If we're inside a function proper, i.e. not file-scope and not still
parsing parameters, then arrange for the size of a variable sized type
to be bound now. */
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 988369e4193..101afb8e35f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -15032,7 +15032,14 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code,
cond = cond_expr.value;
cond = c_objc_common_truthvalue_conversion (cond_loc, cond);
- cond = c_fully_fold (cond, false, NULL);
+ if (COMPARISON_CLASS_P (cond))
+ {
+ tree op0 = TREE_OPERAND (cond, 0), op1 = TREE_OPERAND (cond, 1);
+ op0 = c_fully_fold (op0, false, NULL);
+ op1 = c_fully_fold (op1, false, NULL);
+ TREE_OPERAND (cond, 0) = op0;
+ TREE_OPERAND (cond, 1) = op1;
+ }
switch (cond_expr.original_code)
{
case GT_EXPR:
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index cafa38d35b0..87783928bc4 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1542,6 +1542,9 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
basic_block bb = create_basic_block (BB_HEAD (e->dest), NULL,
ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ /* Make sure new block ends up in correct hot/cold section. */
+ BB_COPY_PARTITION (bb, e->dest);
+
/* Change the existing edge's source to be the new block, and add
a new edge from the entry block to the new block. */
e->src = bb;
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4a949ca9d73..7c1276d0be9 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2487,6 +2487,7 @@ symbol_table::compile (void)
timevar_pop (TV_CGRAPHOPT);
/* Output everything. */
+ switch_to_section (text_section);
(*debug_hooks->assembly_start) ();
if (!quiet_flag)
fprintf (stderr, "Assembling functions:\n");
diff --git a/gcc/combine.c b/gcc/combine.c
index fff1c7e7bd4..ff250aad6a1 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2964,7 +2964,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
&& is_parallel_of_n_reg_sets (PATTERN (i2), 2)
&& can_split_parallel_of_n_reg_sets (i2, 2)
&& !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 0)), i2, i3)
- && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3))
+ && !reg_used_between_p (SET_DEST (XVECEXP (PATTERN (i2), 0, 1)), i2, i3)
+ && !find_reg_note (i2, REG_UNUSED, 0))
{
/* If there is no I1, there is no I0 either. */
i0 = i1;
@@ -6540,11 +6541,15 @@ simplify_if_then_else (rtx x)
if (z)
{
- temp = subst (simplify_gen_relational (true_code, m, VOIDmode,
+ machine_mode cm = m;
+ if ((op == ASHIFT || op == LSHIFTRT || op == ASHIFTRT)
+ && GET_MODE (c1) != VOIDmode)
+ cm = GET_MODE (c1);
+ temp = subst (simplify_gen_relational (true_code, cm, VOIDmode,
cond_op0, cond_op1),
pc_rtx, pc_rtx, 0, 0, 0);
- temp = simplify_gen_binary (MULT, m, temp,
- simplify_gen_binary (MULT, m, c1,
+ temp = simplify_gen_binary (MULT, cm, temp,
+ simplify_gen_binary (MULT, cm, c1,
const_true_rtx));
temp = subst (temp, pc_rtx, pc_rtx, 0, 0, 0);
temp = simplify_gen_binary (op, m, gen_lowpart (m, z), temp);
@@ -8780,7 +8785,7 @@ force_to_mode (rtx x, machine_mode mode, unsigned HOST_WIDE_INT mask,
mask = fuller_mask;
op0 = gen_lowpart_or_truncate (op_mode,
- force_to_mode (XEXP (x, 0), op_mode,
+ force_to_mode (XEXP (x, 0), mode,
mask, next_select));
if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0))
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 56e7791e0d4..b189ba66b0f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -858,8 +858,8 @@ case ${target} in
sol2_tm_file_tail="${cpu_type}/sol2.h sol2.h"
sol2_tm_file="${sol2_tm_file_head} ${sol2_tm_file_tail}"
case ${target} in
- *-*-solaris2.1[2-9]*)
- # __cxa_atexit was introduced in Solaris 12.
+ *-*-solaris2.1[1-9]*)
+ # __cxa_atexit was introduced in Solaris 11.4.
default_use_cxa_atexit=yes
;;
esac
@@ -1038,7 +1038,7 @@ arc*-*-elf*)
big*) tm_file="arc/big.h ${tm_file}"
esac
;;
-arc*-*-linux-uclibc*)
+arc*-*-linux*)
tm_file="arc/arc-arch.h dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arc/linux.h ${tm_file}"
tmake_file="${tmake_file} arc/t-arc"
extra_gcc_objs="driver-arc.o"
@@ -1235,11 +1235,19 @@ crisv32-*-linux* | cris-*-linux*)
;;
esac
;;
-epiphany-*-elf )
- tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
- tmake_file="epiphany/t-epiphany"
+epiphany-*-elf | epiphany-*-rtems*)
+ tm_file="${tm_file} dbxelf.h elfos.h"
+ tmake_file="${tmake_file} epiphany/t-epiphany"
+ case ${target} in
+ epiphany-*-rtems*)
+ tm_file="${tm_file} rtems.h epiphany/rtems.h newlib-stdint.h"
+ ;;
+ *)
+ tm_file="${tm_file} newlib-stdint.h"
+ ;;
+ esac
extra_options="${extra_options} fused-madd.opt"
- extra_objs="$extra_objs mode-switch-use.o resolve-sw-modes.o"
+ extra_objs="${extra_objs} mode-switch-use.o resolve-sw-modes.o"
tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}"
extra_headers="epiphany_intrinsics.h"
;;
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 00a69c1a08d..15011aabcc7 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -1430,8 +1430,8 @@ alpha_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *total,
case MINUS:
if (float_mode_p)
*total = cost_data->fp_add;
- else if (GET_CODE (XEXP (x, 0)) == MULT
- && const48_operand (XEXP (XEXP (x, 0), 1), VOIDmode))
+ else if (GET_CODE (XEXP (x, 0)) == ASHIFT
+ && const23_operand (XEXP (XEXP (x, 0), 1), VOIDmode))
{
*total = (rtx_cost (XEXP (XEXP (x, 0), 0), mode,
(enum rtx_code) outer_code, opno, speed)
@@ -2929,8 +2929,8 @@ alpha_split_conditional_move (enum rtx_code code, rtx dest, rtx cond,
add_op = GEN_INT (f);
if (sext_add_operand (add_op, mode))
{
- tmp = gen_rtx_MULT (DImode, copy_rtx (subtarget),
- GEN_INT (diff));
+ tmp = gen_rtx_ASHIFT (DImode, copy_rtx (subtarget),
+ GEN_INT (exact_log2 (diff)));
tmp = gen_rtx_PLUS (DImode, tmp, add_op);
emit_insn (gen_rtx_SET (target, tmp));
}
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 4e213f812e9..97838a5083a 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -337,8 +337,8 @@
"! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
&& INTVAL (operands[2]) % 4 == 0"
[(set (match_dup 3) (match_dup 4))
- (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
- (match_dup 5))
+ (set (match_dup 0) (sign_extend:DI (plus:SI (ashift:SI (match_dup 3)
+ (match_dup 5))
(match_dup 1))))]
{
HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
@@ -348,7 +348,7 @@
val /= 2, mult = 8;
operands[4] = GEN_INT (val);
- operands[5] = GEN_INT (mult);
+ operands[5] = GEN_INT (exact_log2 (mult));
})
(define_split
@@ -519,38 +519,71 @@
(define_insn "*sadd<modesuffix>"
[(set (match_operand:I48MODE 0 "register_operand" "=r,r")
(plus:I48MODE
- (mult:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r,r")
- (match_operand:I48MODE 2 "const48_operand" "I,I"))
+ (ashift:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r,r")
+ (match_operand:I48MODE 2 "const23_operand" "I,I"))
(match_operand:I48MODE 3 "sext_add_operand" "rI,O")))]
""
"@
- s%2add<modesuffix> %1,%3,%0
- s%2sub<modesuffix> %1,%n3,%0")
+ s%P2add<modesuffix> %1,%3,%0
+ s%P2sub<modesuffix> %1,%n3,%0")
+
+(define_insn_and_split "*saddsi_1"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (plus:SI
+ (subreg:SI
+ (ashift:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
+ (match_operand:DI 2 "const23_operand" "I,I")) 0)
+ (match_operand:SI 3 "sext_add_operand" "rI,O")))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0)
+ (plus:SI (ashift:SI (match_dup 1) (match_dup 2))
+ (match_dup 3)))]
+ "operands[1] = gen_lowpart (SImode, operands[1]);")
(define_insn "*saddl_se"
[(set (match_operand:DI 0 "register_operand" "=r,r")
(sign_extend:DI
- (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
- (match_operand:SI 2 "const48_operand" "I,I"))
- (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
+ (plus:SI
+ (ashift:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
+ (match_operand:SI 2 "const23_operand" "I,I"))
+ (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
""
"@
- s%2addl %1,%3,%0
- s%2subl %1,%n3,%0")
+ s%P2addl %1,%3,%0
+ s%P2subl %1,%n3,%0")
+
+(define_insn_and_split "*saddl_se_1"
+ [(set (match_operand:DI 0 "register_operand" "=r,r")
+ (sign_extend:DI
+ (plus:SI
+ (subreg:SI
+ (ashift:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
+ (match_operand:DI 2 "const23_operand" "I,I")) 0)
+ (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0)
+ (sign_extend:DI
+ (plus:SI (ashift:SI (match_dup 1) (match_dup 2))
+ (match_dup 3))))]
+ "operands[1] = gen_lowpart (SImode, operands[1]);")
(define_split
[(set (match_operand:DI 0 "register_operand")
(sign_extend:DI
- (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
+ (plus:SI (ashift:SI (match_operator:SI 1 "comparison_operator"
[(match_operand 2)
(match_operand 3)])
- (match_operand:SI 4 "const48_operand"))
+ (match_operand:SI 4 "const23_operand"))
(match_operand:SI 5 "sext_add_operand"))))
(clobber (match_operand:DI 6 "reg_not_elim_operand"))]
""
[(set (match_dup 6) (match_dup 7))
(set (match_dup 0)
- (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
+ (sign_extend:DI (plus:SI (ashift:SI (match_dup 8) (match_dup 4))
(match_dup 5))))]
{
operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
@@ -621,20 +654,53 @@
(define_insn "*ssub<modesuffix>"
[(set (match_operand:I48MODE 0 "register_operand" "=r")
(minus:I48MODE
- (mult:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r")
- (match_operand:I48MODE 2 "const48_operand" "I"))
+ (ashift:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r")
+ (match_operand:I48MODE 2 "const23_operand" "I"))
(match_operand:I48MODE 3 "reg_or_8bit_operand" "rI")))]
""
- "s%2sub<modesuffix> %1,%3,%0")
+ "s%P2sub<modesuffix> %1,%3,%0")
+
+(define_insn_and_split "*ssubsi_1"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (minus:SI
+ (subreg:SI
+ (ashift:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
+ (match_operand:DI 2 "const23_operand" "I")) 0)
+ (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
+ ""
+ "#"
+ ""
+ [(set (match_dup 0)
+ (minus:SI (ashift:SI (match_dup 1) (match_dup 2))
+ (match_dup 3)))]
+ "operands[1] = gen_lowpart (SImode, operands[1]);")
(define_insn "*ssubl_se"
[(set (match_operand:DI 0 "register_operand" "=r")
(sign_extend:DI
- (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
- (match_operand:SI 2 "const48_operand" "I"))
- (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
+ (minus:SI
+ (ashift:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
+ (match_operand:SI 2 "const23_operand" "I"))
+ (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
+ ""
+ "s%P2subl %1,%3,%0")
+
+(define_insn_and_split "*ssubl_se_1"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (sign_extend:DI
+ (minus:SI
+ (subreg:SI
+ (ashift:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
+ (match_operand:DI 2 "const23_operand" "I")) 0)
+ (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
""
- "s%2subl %1,%3,%0")
+ "#"
+ ""
+ [(set (match_dup 0)
+ (sign_extend:DI
+ (minus:SI (ashift:SI (match_dup 1) (match_dup 2))
+ (match_dup 3))))]
+ "operands[1] = gen_lowpart (SImode, operands[1]);")
(define_insn "subv<mode>3"
[(set (match_operand:I48MODE 0 "register_operand" "=r")
@@ -1200,7 +1266,7 @@
(subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
(match_operand:DI 2 "const_int_operand" "P"))
0)))]
- "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
+ "IN_RANGE (INTVAL (operands[2]), 1, 3)"
{
if (operands[2] == const1_rtx)
return "addl %r1,%r1,%0";
@@ -3139,9 +3205,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (plus:DI (mult:DI (match_dup 5) (match_dup 3))
+ (plus:DI (ashift:DI (match_dup 5) (match_dup 3))
(match_dup 4)))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
@@ -3164,9 +3231,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (plus:SI (mult:SI (match_dup 6) (match_dup 3))
+ (plus:SI (ashift:SI (match_dup 6) (match_dup 3))
(match_dup 4)))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
@@ -3192,9 +3260,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (sign_extend:DI (plus:SI (mult:SI (match_dup 6) (match_dup 3))
+ (sign_extend:DI (plus:SI (ashift:SI (match_dup 6) (match_dup 3))
(match_dup 4))))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
@@ -3219,9 +3288,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (minus:DI (mult:DI (match_dup 5) (match_dup 3))
+ (minus:DI (ashift:DI (match_dup 5) (match_dup 3))
(match_dup 4)))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
@@ -3244,9 +3314,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (minus:SI (mult:SI (match_dup 6) (match_dup 3))
+ (minus:SI (ashift:SI (match_dup 6) (match_dup 3))
(match_dup 4)))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
@@ -3272,9 +3343,10 @@
[(set (match_dup 5)
(match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
(set (match_dup 0)
- (sign_extend:DI (minus:SI (mult:SI (match_dup 6) (match_dup 3))
+ (sign_extend:DI (minus:SI (ashift:SI (match_dup 6) (match_dup 3))
(match_dup 4))))]
{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands [3])));
if (can_create_pseudo_p ())
operands[5] = gen_reg_rtx (DImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
diff --git a/gcc/config/alpha/predicates.md b/gcc/config/alpha/predicates.md
index 102451ee80c..6fc359ec053 100644
--- a/gcc/config/alpha/predicates.md
+++ b/gcc/config/alpha/predicates.md
@@ -74,6 +74,11 @@
(and (match_code "const_int,const_wide_int,const_double,const_vector")
(not (match_test "op == CONST0_RTX (mode)"))))
+;; Return 1 if OP is the constant 2 or 3.
+(define_predicate "const23_operand"
+ (and (match_code "const_int")
+ (match_test "INTVAL (op) == 2 || INTVAL (op) == 3")))
+
;; Return 1 if OP is the constant 4 or 8.
(define_predicate "const48_operand"
(and (match_code "const_int")
diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
index 83e5a1d61f2..6127a026fb3 100644
--- a/gcc/config/arc/linux.h
+++ b/gcc/config/arc/linux.h
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-arc.so.2"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
/* Note that the default is to link against dynamic libraries, if they are
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 246c464be7b..2856b1afd5c 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -19331,7 +19331,12 @@ arm_get_vfp_saved_size (void)
/* Generate a function exit sequence. If REALLY_RETURN is false, then do
everything bar the final return instruction. If simple_return is true,
- then do not output epilogue, because it has already been emitted in RTL. */
+ then do not output epilogue, because it has already been emitted in RTL.
+
+ Note: do not forget to update length attribute of corresponding insn pattern
+ when changing assembly output (eg. length attribute of
+ thumb2_cmse_entry_return when updating Armv8-M Mainline Security Extensions
+ register clearing sequences). */
const char *
output_return_instruction (rtx operand, bool really_return, bool reverse,
bool simple_return)
@@ -23829,7 +23834,12 @@ thumb_pop (FILE *f, unsigned long mask)
/* Generate code to return from a thumb function.
If 'reg_containing_return_addr' is -1, then the return address is
- actually on the stack, at the stack pointer. */
+ actually on the stack, at the stack pointer.
+
+ Note: do not forget to update length attribute of corresponding insn pattern
+ when changing assembly output (eg. length attribute of epilogue_insns when
+ updating Armv8-M Baseline Security Extensions register clearing
+ sequences). */
static void
thumb_exit (FILE *f, int reg_containing_return_addr)
{
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index f9e4356756a..ac1a49f8705 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1662,12 +1662,10 @@ enum arm_auto_incmodes
/* These assume that REGNO is a hard or pseudo reg number.
They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in reginfo.c during register
- allocation. */
+ or a pseudo reg currently allocated to a suitable hard reg. */
#define TEST_REGNO(R, TEST, VALUE) \
- ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
+ ((R TEST VALUE) \
+ || (reg_renumber && ((unsigned) reg_renumber[R] TEST VALUE)))
/* Don't allow the pc to be used. */
#define ARM_REGNO_OK_FOR_BASE_P(REGNO) \
diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
index 2e7580f220e..35f8e9bbf24 100644
--- a/gcc/config/arm/thumb2.md
+++ b/gcc/config/arm/thumb2.md
@@ -1132,7 +1132,7 @@
; we adapt the length accordingly.
(set (attr "length")
(if_then_else (match_test "TARGET_HARD_FLOAT")
- (const_int 12)
+ (const_int 34)
(const_int 8)))
; We do not support predicate execution of returns from cmse_nonsecure_entry
; functions because we need to clear the APSR. Since predicable has to be
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index d8f77e2ffe4..9f06c3da952 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -456,7 +456,10 @@
gcc_unreachable ();
}
}
- [(set_attr "predicable" "yes, yes, no, yes, no, no, no, no, no, no")
+ [(set_attr "conds" "*, *, unconditional, *, unconditional, unconditional,\
+ unconditional, unconditional, unconditional,\
+ unconditional")
+ (set_attr "predicable" "yes, yes, no, yes, no, no, no, no, no, no")
(set_attr "predicable_short_it" "no, no, no, yes,\
no, no, no, no,\
no, no")
diff --git a/gcc/config/epiphany/rtems.h b/gcc/config/epiphany/rtems.h
new file mode 100644
index 00000000000..a9971f8c0b6
--- /dev/null
+++ b/gcc/config/epiphany/rtems.h
@@ -0,0 +1,28 @@
+/* Definitions for RTEMS based EPIPHANY systems.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#define HAS_INIT_SECTION
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define ("__rtems__"); \
+ builtin_define ("__USE_INIT_FINI__"); \
+ builtin_assert ("system=rtems"); \
+ } while (0)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index cd9153efe57..2af4e9a2859 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2444,53 +2444,6 @@ struct GTY(()) stack_local_entry {
struct stack_local_entry *next;
};
-/* Structure describing stack frame layout.
- Stack grows downward:
-
- [arguments]
- <- ARG_POINTER
- saved pc
-
- saved static chain if ix86_static_chain_on_stack
-
- saved frame pointer if frame_pointer_needed
- <- HARD_FRAME_POINTER
- [saved regs]
- <- regs_save_offset
- [padding0]
-
- [saved SSE regs]
- <- sse_regs_save_offset
- [padding1] |
- | <- FRAME_POINTER
- [va_arg registers] |
- |
- [frame] |
- |
- [padding2] | = to_allocate
- <- STACK_POINTER
- */
-struct ix86_frame
-{
- int nsseregs;
- int nregs;
- int va_arg_size;
- int red_zone_size;
- int outgoing_arguments_size;
-
- /* The offsets relative to ARG_POINTER. */
- HOST_WIDE_INT frame_pointer_offset;
- HOST_WIDE_INT hard_frame_pointer_offset;
- HOST_WIDE_INT stack_pointer_offset;
- HOST_WIDE_INT hfp_save_offset;
- HOST_WIDE_INT reg_save_offset;
- HOST_WIDE_INT sse_reg_save_offset;
-
- /* When save_regs_using_mov is set, emit prologue using
- move instead of push instructions. */
- bool save_regs_using_mov;
-};
-
/* Which cpu are we scheduling for. */
enum attr_cpu ix86_schedule;
@@ -2582,7 +2535,7 @@ static unsigned int ix86_function_arg_boundary (machine_mode,
const_tree);
static rtx ix86_static_chain (const_tree, bool);
static int ix86_function_regparm (const_tree, const_tree);
-static void ix86_compute_frame_layout (struct ix86_frame *);
+static void ix86_compute_frame_layout (void);
static bool ix86_expand_vector_init_one_nonzero (bool, machine_mode,
rtx, rtx, int);
static void ix86_add_new_builtins (HOST_WIDE_INT, HOST_WIDE_INT);
@@ -2686,7 +2639,7 @@ rest_of_handle_insert_vzeroupper (void)
int i;
/* vzeroupper instructions are inserted immediately after reload to
- account for possible spills from 256bit registers. The pass
+ account for possible spills from 256bit or 512bit registers. The pass
reuses mode switching infrastructure by re-running mode insertion
pass, so disable entities that have already been processed. */
for (i = 0; i < MAX_386_ENTITIES; i++)
@@ -4185,7 +4138,7 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return TARGET_AVX && !TARGET_AVX512F
+ return TARGET_AVX
&& TARGET_VZEROUPPER && flag_expensive_optimizations
&& !optimize_size;
}
@@ -6203,7 +6156,8 @@ ix86_option_override_internal (bool main_args_p,
#endif
}
- if (!(opts_set->x_target_flags & MASK_VZEROUPPER))
+ if (!(opts_set->x_target_flags & MASK_VZEROUPPER)
+ && TARGET_EMIT_VZEROUPPER)
opts->x_target_flags |= MASK_VZEROUPPER;
if (!(opts_set->x_target_flags & MASK_STV))
opts->x_target_flags |= MASK_STV;
@@ -11889,8 +11843,6 @@ symbolic_reference_mentioned_p (rtx op)
bool
ix86_can_use_return_insn_p (void)
{
- struct ix86_frame frame;
-
/* Don't use `ret' instruction in interrupt handler. */
if (! reload_completed
|| frame_pointer_needed
@@ -11902,7 +11854,8 @@ ix86_can_use_return_insn_p (void)
if (crtl->args.pops_args && crtl->args.size >= 32768)
return 0;
- ix86_compute_frame_layout (&frame);
+ ix86_compute_frame_layout ();
+ struct ix86_frame &frame = cfun->machine->frame;
return (frame.stack_pointer_offset == UNITS_PER_WORD
&& (frame.nregs + frame.nsseregs) == 0);
}
@@ -12388,8 +12341,8 @@ ix86_can_eliminate (const int from, const int to)
HOST_WIDE_INT
ix86_initial_elimination_offset (int from, int to)
{
- struct ix86_frame frame;
- ix86_compute_frame_layout (&frame);
+ ix86_compute_frame_layout ();
+ struct ix86_frame &frame = cfun->machine->frame;
if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
return frame.hard_frame_pointer_offset;
@@ -12428,8 +12381,9 @@ ix86_builtin_setjmp_frame_value (void)
/* Fill structure ix86_frame about frame of currently computed function. */
static void
-ix86_compute_frame_layout (struct ix86_frame *frame)
+ix86_compute_frame_layout (void)
{
+ struct ix86_frame *frame = &cfun->machine->frame;
unsigned HOST_WIDE_INT stack_alignment_needed;
HOST_WIDE_INT offset;
unsigned HOST_WIDE_INT preferred_alignment;
@@ -13713,7 +13667,6 @@ ix86_expand_prologue (void)
{
struct machine_function *m = cfun->machine;
rtx insn, t;
- struct ix86_frame frame;
HOST_WIDE_INT allocate;
bool int_registers_saved;
bool sse_registers_saved;
@@ -13736,7 +13689,8 @@ ix86_expand_prologue (void)
m->fs.sp_offset = INCOMING_FRAME_SP_OFFSET;
m->fs.sp_valid = true;
- ix86_compute_frame_layout (&frame);
+ ix86_compute_frame_layout ();
+ struct ix86_frame &frame = cfun->machine->frame;
if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
{
@@ -14399,12 +14353,12 @@ ix86_expand_epilogue (int style)
{
struct machine_function *m = cfun->machine;
struct machine_frame_state frame_state_save = m->fs;
- struct ix86_frame frame;
bool restore_regs_via_mov;
bool using_drap;
ix86_finalize_stack_realign_flags ();
- ix86_compute_frame_layout (&frame);
+ ix86_compute_frame_layout ();
+ struct ix86_frame &frame = cfun->machine->frame;
m->fs.sp_valid = (!frame_pointer_needed
|| (crtl->sp_is_unchanging
@@ -14902,7 +14856,6 @@ static GTY(()) rtx split_stack_fn_large;
void
ix86_expand_split_stack_prologue (void)
{
- struct ix86_frame frame;
HOST_WIDE_INT allocate;
unsigned HOST_WIDE_INT args_size;
rtx_code_label *label;
@@ -14914,7 +14867,8 @@ ix86_expand_split_stack_prologue (void)
gcc_assert (flag_split_stack && reload_completed);
ix86_finalize_stack_realign_flags ();
- ix86_compute_frame_layout (&frame);
+ ix86_compute_frame_layout ();
+ struct ix86_frame &frame = cfun->machine->frame;
allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET;
/* This is the label we will branch to if we have enough stack
@@ -19147,16 +19101,17 @@ ix86_dirflag_mode_needed (rtx_insn *insn)
return X86_DIRFLAG_ANY;
}
-/* Check if a 256bit AVX register is referenced inside of EXP. */
+/* Check if a 256bit or 512 bit AVX register is referenced inside of EXP. */
static bool
-ix86_check_avx256_register (const_rtx exp)
+ix86_check_avx_upper_register (const_rtx exp)
{
if (SUBREG_P (exp))
exp = SUBREG_REG (exp);
return (REG_P (exp)
- && VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp)));
+ && (VALID_AVX256_REG_OR_OI_MODE (GET_MODE (exp))
+ || VALID_AVX512F_REG_OR_XI_MODE (GET_MODE (exp))));
}
/* Return needed mode for entity in optimize_mode_switching pass. */
@@ -19169,7 +19124,7 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
rtx link;
/* Needed mode is set to AVX_U128_CLEAN if there are
- no 256bit modes used in function arguments. */
+ no 256bit or 512bit modes used in function arguments. */
for (link = CALL_INSN_FUNCTION_USAGE (insn);
link;
link = XEXP (link, 1))
@@ -19178,7 +19133,7 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
{
rtx arg = XEXP (XEXP (link, 0), 0);
- if (ix86_check_avx256_register (arg))
+ if (ix86_check_avx_upper_register (arg))
return AVX_U128_DIRTY;
}
}
@@ -19186,13 +19141,13 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
return AVX_U128_CLEAN;
}
- /* Require DIRTY mode if a 256bit AVX register is referenced. Hardware
- changes state only when a 256bit register is written to, but we need
- to prevent the compiler from moving optimal insertion point above
- eventual read from 256bit register. */
+ /* Require DIRTY mode if a 256bit or 512bit AVX register is referenced.
+ Hardware changes state only when a 256bit register is written to,
+ but we need to prevent the compiler from moving optimal insertion
+ point above eventual read from 256bit or 512 bit register. */
subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
- if (ix86_check_avx256_register (*iter))
+ if (ix86_check_avx_upper_register (*iter))
return AVX_U128_DIRTY;
return AVX_U128_ANY;
@@ -19274,12 +19229,12 @@ ix86_mode_needed (int entity, rtx_insn *insn)
return 0;
}
-/* Check if a 256bit AVX register is referenced in stores. */
+/* Check if a 256bit or 512bit AVX register is referenced in stores. */
static void
-ix86_check_avx256_stores (rtx dest, const_rtx, void *data)
+ix86_check_avx_upper_stores (rtx dest, const_rtx, void *data)
{
- if (ix86_check_avx256_register (dest))
+ if (ix86_check_avx_upper_register (dest))
{
bool *used = (bool *) data;
*used = true;
@@ -19298,18 +19253,18 @@ ix86_avx_u128_mode_after (int mode, rtx_insn *insn)
return AVX_U128_CLEAN;
/* We know that state is clean after CALL insn if there are no
- 256bit registers used in the function return register. */
+ 256bit or 512bit registers used in the function return register. */
if (CALL_P (insn))
{
- bool avx_reg256_found = false;
- note_stores (pat, ix86_check_avx256_stores, &avx_reg256_found);
+ bool avx_upper_reg_found = false;
+ note_stores (pat, ix86_check_avx_upper_stores, &avx_upper_reg_found);
- return avx_reg256_found ? AVX_U128_DIRTY : AVX_U128_CLEAN;
+ return avx_upper_reg_found ? AVX_U128_DIRTY : AVX_U128_CLEAN;
}
/* Otherwise, return current mode. Remember that if insn
- references AVX 256bit registers, the mode was already changed
- to DIRTY from MODE_NEEDED. */
+ references AVX 256bit or 512bit registers, the mode was already
+ changed to DIRTY from MODE_NEEDED. */
return mode;
}
@@ -19352,13 +19307,13 @@ ix86_avx_u128_mode_entry (void)
tree arg;
/* Entry mode is set to AVX_U128_DIRTY if there are
- 256bit modes used in function arguments. */
+ 256bit or 512bit modes used in function arguments. */
for (arg = DECL_ARGUMENTS (current_function_decl); arg;
arg = TREE_CHAIN (arg))
{
rtx incoming = DECL_INCOMING_RTL (arg);
- if (incoming && ix86_check_avx256_register (incoming))
+ if (incoming && ix86_check_avx_upper_register (incoming))
return AVX_U128_DIRTY;
}
@@ -19392,9 +19347,9 @@ ix86_avx_u128_mode_exit (void)
{
rtx reg = crtl->return_rtx;
- /* Exit mode is set to AVX_U128_DIRTY if there are
- 256bit modes used in the function return register. */
- if (reg && ix86_check_avx256_register (reg))
+ /* Exit mode is set to AVX_U128_DIRTY if there are 256bit
+ or 512 bit modes used in the function return register. */
+ if (reg && ix86_check_avx_upper_register (reg))
return AVX_U128_DIRTY;
return AVX_U128_CLEAN;
@@ -41878,7 +41833,8 @@ static void
x86_print_call_or_nop (FILE *file, const char *target)
{
if (flag_nop_mcount)
- fprintf (file, "1:\tnopl 0x00(%%eax,%%eax,1)\n"); /* 5 byte nop. */
+ /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */
+ fprintf (file, "1:" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n");
else
fprintf (file, "1:\tcall\t%s\n", target);
}
@@ -45305,8 +45261,7 @@ ix86_expand_lfloorceil (rtx op0, rtx op1, bool do_floor)
emit_move_insn (op0, ireg);
}
-/* Expand rint (IEEE round to nearest) rounding OPERAND1 and storing the
- result in OPERAND0. */
+/* Expand rint rounding OPERAND1 and storing the result in OPERAND0. */
void
ix86_expand_rint (rtx operand0, rtx operand1)
{
@@ -45314,11 +45269,17 @@ ix86_expand_rint (rtx operand0, rtx operand1)
xa = fabs (operand1);
if (!isless (xa, 2**52))
return operand1;
- xa = xa + 2**52 - 2**52;
+ two52 = 2**52;
+ if (flag_rounding_math)
+ {
+ two52 = copysign (two52, operand1);
+ xa = operand1;
+ }
+ xa = xa + two52 - two52;
return copysign (xa, operand1);
*/
machine_mode mode = GET_MODE (operand0);
- rtx res, xa, TWO52, mask;
+ rtx res, xa, TWO52, two52, mask;
rtx_code_label *label;
res = gen_reg_rtx (mode);
@@ -45331,8 +45292,16 @@ ix86_expand_rint (rtx operand0, rtx operand1)
TWO52 = ix86_gen_TWO52 (mode);
label = ix86_expand_sse_compare_and_jump (UNLE, TWO52, xa, false);
- xa = expand_simple_binop (mode, PLUS, xa, TWO52, NULL_RTX, 0, OPTAB_DIRECT);
- xa = expand_simple_binop (mode, MINUS, xa, TWO52, xa, 0, OPTAB_DIRECT);
+ two52 = TWO52;
+ if (flag_rounding_math)
+ {
+ two52 = gen_reg_rtx (mode);
+ ix86_sse_copysign_to_positive (two52, TWO52, res, mask);
+ xa = res;
+ }
+
+ xa = expand_simple_binop (mode, PLUS, xa, two52, NULL_RTX, 0, OPTAB_DIRECT);
+ xa = expand_simple_binop (mode, MINUS, xa, two52, xa, 0, OPTAB_DIRECT);
ix86_sse_copysign_to_positive (res, xa, res, mask);
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 9e5f4d857d9..f9b91286a01 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -508,6 +508,8 @@ extern unsigned char ix86_tune_features[X86_TUNE_LAST];
ix86_tune_features[X86_TUNE_AVOID_FALSE_DEP_FOR_BMI]
#define TARGET_ONE_IF_CONV_INSN \
ix86_tune_features[X86_TUNE_ONE_IF_CONV_INSN]
+#define TARGET_EMIT_VZEROUPPER \
+ ix86_tune_features[X86_TUNE_EMIT_VZEROUPPER]
/* Feature tests against the various architecture variations. */
enum ix86_arch_indices {
@@ -1121,6 +1123,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
|| (MODE) == V16SImode || (MODE) == V16SFmode || (MODE) == V32HImode \
|| (MODE) == V4TImode)
+#define VALID_AVX512F_REG_OR_XI_MODE(MODE) \
+ (VALID_AVX512F_REG_MODE (MODE) || (MODE) == XImode)
+
#define VALID_AVX512VL_128_REG_MODE(MODE) \
((MODE) == V2DImode || (MODE) == V2DFmode || (MODE) == V16QImode \
|| (MODE) == V4SImode || (MODE) == V4SFmode || (MODE) == V8HImode \
@@ -2446,9 +2451,56 @@ enum avx_u128_state
#define FASTCALL_PREFIX '@'
+#ifndef USED_FOR_TARGET
+/* Structure describing stack frame layout.
+ Stack grows downward:
+
+ [arguments]
+ <- ARG_POINTER
+ saved pc
+
+ saved static chain if ix86_static_chain_on_stack
+
+ saved frame pointer if frame_pointer_needed
+ <- HARD_FRAME_POINTER
+ [saved regs]
+ <- regs_save_offset
+ [padding0]
+
+ [saved SSE regs]
+ <- sse_regs_save_offset
+ [padding1] |
+ | <- FRAME_POINTER
+ [va_arg registers] |
+ |
+ [frame] |
+ |
+ [padding2] | = to_allocate
+ <- STACK_POINTER
+ */
+struct GTY(()) ix86_frame
+{
+ int nsseregs;
+ int nregs;
+ int va_arg_size;
+ int red_zone_size;
+ int outgoing_arguments_size;
+
+ /* The offsets relative to ARG_POINTER. */
+ HOST_WIDE_INT frame_pointer_offset;
+ HOST_WIDE_INT hard_frame_pointer_offset;
+ HOST_WIDE_INT stack_pointer_offset;
+ HOST_WIDE_INT hfp_save_offset;
+ HOST_WIDE_INT reg_save_offset;
+ HOST_WIDE_INT sse_reg_save_offset;
+
+ /* When save_regs_using_mov is set, emit prologue using
+ move instead of push instructions. */
+ bool save_regs_using_mov;
+};
+
/* Machine specific frame tracking during prologue/epilogue generation. */
-#ifndef USED_FOR_TARGET
struct GTY(()) machine_frame_state
{
/* This pair tracks the currently active CFA as reg+offset. When reg
@@ -2507,6 +2559,9 @@ struct GTY(()) machine_function {
int varargs_fpr_size;
int optimize_mode_switching[MAX_386_ENTITIES];
+ /* Cached initial frame layout for the current function. */
+ struct ix86_frame frame;
+
/* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE
has been computed for. */
int use_fast_prologue_epilogue_nregs;
@@ -2589,6 +2644,7 @@ struct GTY(()) machine_function {
#define ix86_current_function_calls_tls_descriptor \
(ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG))
#define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack)
+#define ix86_red_zone_size (cfun->machine->frame.red_zone_size)
/* Control behavior of x86_file_start. */
#define X86_FILE_START_VERSION_DIRECTIVE false
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 0281bb5f06c..dbe88f40c8f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -9641,7 +9641,7 @@
(match_operand:SWI48 1 "nonimmediate_operand")
(subreg:QI
(and:SI
- (match_operand:SI 2 "register_operand")
+ (match_operand:SI 2 "register_operand" "c,r")
(match_operand:SI 3 "const_int_operand")) 0)))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (ASHIFT, <MODE>mode, operands)
@@ -9655,7 +9655,8 @@
(ashift:SWI48 (match_dup 1)
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[2] = gen_lowpart (QImode, operands[2]);")
+ "operands[2] = gen_lowpart (QImode, operands[2]);"
+ [(set_attr "isa" "*,bmi2")])
(define_insn "*bmi2_ashl<mode>3_1"
[(set (match_operand:SWI48 0 "register_operand" "=r")
@@ -10141,7 +10142,7 @@
(match_operand:SWI48 1 "nonimmediate_operand")
(subreg:QI
(and:SI
- (match_operand:SI 2 "register_operand")
+ (match_operand:SI 2 "register_operand" "c,r")
(match_operand:SI 3 "const_int_operand")) 0)))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
@@ -10155,7 +10156,8 @@
(any_shiftrt:SWI48 (match_dup 1)
(match_dup 2)))
(clobber (reg:CC FLAGS_REG))])]
- "operands[2] = gen_lowpart (QImode, operands[2]);")
+ "operands[2] = gen_lowpart (QImode, operands[2]);"
+ [(set_attr "isa" "*,bmi2")])
(define_insn_and_split "*<shift_insn><mode>3_doubleword"
[(set (match_operand:DWI 0 "register_operand" "=&r")
@@ -10600,7 +10602,7 @@
(match_operand:SWI48 1 "nonimmediate_operand")
(subreg:QI
(and:SI
- (match_operand:SI 2 "register_operand")
+ (match_operand:SI 2 "register_operand" "c")
(match_operand:SI 3 "const_int_operand")) 0)))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index a95f529d6a9..80cda39bacf 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -13852,7 +13852,7 @@
(match_operand:DI 1 "nonimmediate_operand"
" 0, 0,x ,Yv,r ,vm,?!*Yn,0,Yv,0,0,v")
(match_operand:DI 2 "vector_move_operand"
- "*rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
+ " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
"TARGET_SSE"
"@
pinsrq\t{$1, %2, %0|%0, %2, 1}
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index c642f452e00..3b2701bb5f2 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -551,3 +551,7 @@ DEF_TUNE (X86_TUNE_ADJUST_UNROLL, "adjust_unroll_factor", m_BDVER3 | m_BDVER4)
if-converted sequence to one. */
DEF_TUNE (X86_TUNE_ONE_IF_CONV_INSN, "one_if_conv_insn",
m_SILVERMONT | m_KNL | m_INTEL | m_CORE_ALL | m_GENERIC)
+
+/* X86_TUNE_EMIT_VZEROUPPER: This enables vzeroupper instruction insertion
+ before a transfer of control flow out of the function. */
+DEF_TUNE (X86_TUNE_EMIT_VZEROUPPER, "emit_vzeroupper", ~m_KNL)
diff --git a/gcc/config/i386/xm-mingw32.h b/gcc/config/i386/xm-mingw32.h
index 6eb3a626f0c..d4d63f58322 100644
--- a/gcc/config/i386/xm-mingw32.h
+++ b/gcc/config/i386/xm-mingw32.h
@@ -37,8 +37,3 @@ along with GCC; see the file COPYING3. If not see
"long long" values. Instead, we use "I64". */
#define HOST_LONG_LONG_FORMAT "I64"
#endif
-
-/* this is to prevent gcc-heap.c from assuming sizeof(long) == sizeof(intptr_t) */
-#ifdef __x86_64__
-# define HOST_BITS_PER_PTR 64
-#endif
diff --git a/gcc/config/mips/frame-header-opt.c b/gcc/config/mips/frame-header-opt.c
index 7e42dca3832..029f1759f06 100644
--- a/gcc/config/mips/frame-header-opt.c
+++ b/gcc/config/mips/frame-header-opt.c
@@ -98,8 +98,7 @@ void
mips_register_frame_header_opt (void)
{
opt_pass *p = make_pass_ipa_frame_header_opt (g);
- static struct register_pass_info f =
- {p, "comdats", 1, PASS_POS_INSERT_AFTER };
+ struct register_pass_info f = { p, "comdats", 1, PASS_POS_INSERT_AFTER };
register_pass (&f);
}
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 3e65ba1db59..27dcdeab3d2 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -10511,9 +10511,16 @@ pa_legitimate_address_p (machine_mode mode, rtx x, bool strict)
if (!TARGET_DISABLE_INDEXING
&& GET_CODE (index) == MULT
- && MODE_OK_FOR_SCALED_INDEXING_P (mode)
+ /* Only accept base operands with the REG_POINTER flag prior to
+ reload on targets with non-equivalent space registers. */
+ && (TARGET_NO_SPACE_REGS
+ || (base == XEXP (x, 1)
+ && (reload_completed
+ || (reload_in_progress && HARD_REGISTER_P (base))
+ || REG_POINTER (base))))
&& REG_P (XEXP (index, 0))
&& GET_MODE (XEXP (index, 0)) == Pmode
+ && MODE_OK_FOR_SCALED_INDEXING_P (mode)
&& (strict ? STRICT_REG_OK_FOR_INDEX_P (XEXP (index, 0))
: REG_OK_FOR_INDEX_P (XEXP (index, 0)))
&& GET_CODE (XEXP (index, 1)) == CONST_INT
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index ecf424d1a2b..4b2f7b6e1fd 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -24,6 +24,17 @@ along with GCC; see the file COPYING3. If not see
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
+#define MUSL_ABI_SUFFIX \
+ "%{mabi=ilp32:-sf}" \
+ "%{mabi=ilp32f:-sp}" \
+ "%{mabi=ilp32d:}" \
+ "%{mabi=lp64:-sf}" \
+ "%{mabi=lp64f:-sp}" \
+ "%{mabi=lp64d:}" \
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
+
/* Because RISC-V only has word-sized atomics, it requries libatomic where
others do not. So link libatomic by default, as needed. */
#undef LIB_SPEC
@@ -34,6 +45,8 @@ along with GCC; see the file COPYING3. If not see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
#endif
+#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
+
#define LINK_SPEC "\
-melf" XLEN_SPEC "lriscv \
%{shared} \
diff --git a/gcc/config/riscv/pic.md b/gcc/config/riscv/pic.md
index 6a29ead32d3..03b8f9bc669 100644
--- a/gcc/config/riscv/pic.md
+++ b/gcc/config/riscv/pic.md
@@ -22,13 +22,20 @@
;; Simplify PIC loads to static variables.
;; These should go away once we figure out how to emit auipc discretely.
-(define_insn "*local_pic_load<mode>"
+(define_insn "*local_pic_load_s<mode>"
[(set (match_operand:ANYI 0 "register_operand" "=r")
- (mem:ANYI (match_operand 1 "absolute_symbolic_operand" "")))]
+ (sign_extend:ANYI (mem:ANYI (match_operand 1 "absolute_symbolic_operand" ""))))]
"USE_LOAD_ADDRESS_MACRO (operands[1])"
"<load>\t%0,%1"
[(set (attr "length") (const_int 8))])
+(define_insn "*local_pic_load_u<mode>"
+ [(set (match_operand:ZERO_EXTEND_LOAD 0 "register_operand" "=r")
+ (zero_extend:ZERO_EXTEND_LOAD (mem:ZERO_EXTEND_LOAD (match_operand 1 "absolute_symbolic_operand" ""))))]
+ "USE_LOAD_ADDRESS_MACRO (operands[1])"
+ "<load>u\t%0,%1"
+ [(set (attr "length") (const_int 8))])
+
(define_insn "*local_pic_load<mode>"
[(set (match_operand:ANYF 0 "register_operand" "=f")
(mem:ANYF (match_operand 1 "absolute_symbolic_operand" "")))
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index d5928c334de..5f53819eb36 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -1,5 +1,5 @@
/* Subroutines used for code generation for RISC-V.
- Copyright (C) 2011-2017 Free Software Foundation, Inc.
+ Copyright (C) 2011-2018 Free Software Foundation, Inc.
Contributed by Andrew Waterman (andrew@sifive.com).
Based on MIPS target for GNU compiler.
@@ -177,9 +177,6 @@ struct GTY(()) machine_function {
This area is allocated by the callee at the very top of the frame. */
int varargs_size;
- /* Memoized return value of leaf_function_p. <0 if false, >0 if true. */
- int is_leaf;
-
/* The current frame information, calculated by riscv_compute_frame_info. */
struct riscv_frame_info frame;
};
@@ -255,6 +252,7 @@ struct riscv_tune_info
unsigned short issue_rate;
unsigned short branch_cost;
unsigned short memory_cost;
+ bool slow_unaligned_access;
};
/* Information about one CPU we know about. */
@@ -268,6 +266,9 @@ struct riscv_cpu_info {
/* Global variables for machine-dependent things. */
+/* Whether unaligned accesses execute very slowly. */
+bool riscv_slow_unaligned_access;
+
/* Which tuning parameters to use. */
static const struct riscv_tune_info *tune_info;
@@ -301,7 +302,8 @@ static const struct riscv_tune_info rocket_tune_info = {
{COSTS_N_INSNS (6), COSTS_N_INSNS (6)}, /* int_div */
1, /* issue_rate */
3, /* branch_cost */
- 5 /* memory_cost */
+ 5, /* memory_cost */
+ true, /* slow_unaligned_access */
};
/* Costs to use when optimizing for size. */
@@ -313,12 +315,14 @@ static const struct riscv_tune_info optimize_size_tune_info = {
{COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* int_div */
1, /* issue_rate */
1, /* branch_cost */
- 2 /* memory_cost */
+ 2, /* memory_cost */
+ false, /* slow_unaligned_access */
};
/* A table describing all the processors GCC knows about. */
static const struct riscv_cpu_info riscv_cpu_info_table[] = {
{ "rocket", &rocket_tune_info },
+ { "size", &optimize_size_tune_info },
};
/* Return the riscv_cpu_info entry for the given name string. */
@@ -726,7 +730,8 @@ riscv_valid_lo_sum_p (enum riscv_symbol_type sym_type, enum machine_mode mode)
/* We may need to split multiword moves, so make sure that each word
can be accessed without inducing a carry. */
if (GET_MODE_SIZE (mode) > UNITS_PER_WORD
- && GET_MODE_BITSIZE (mode) > GET_MODE_ALIGNMENT (mode))
+ && (!TARGET_STRICT_ALIGN
+ || GET_MODE_BITSIZE (mode) > GET_MODE_ALIGNMENT (mode)))
return false;
return true;
@@ -1377,6 +1382,22 @@ riscv_legitimize_move (enum machine_mode mode, rtx dest, rtx src)
return true;
}
+ /* RISC-V GCC may generate non-legitimate address due to we provide some
+ pattern for optimize access PIC local symbol and it's make GCC generate
+ unrecognizable instruction during optmizing. */
+
+ if (MEM_P (dest) && !riscv_legitimate_address_p (mode, XEXP (dest, 0),
+ reload_completed))
+ {
+ XEXP (dest, 0) = riscv_force_address (XEXP (dest, 0), mode);
+ }
+
+ if (MEM_P (src) && !riscv_legitimate_address_p (mode, XEXP (src, 0),
+ reload_completed))
+ {
+ XEXP (src, 0) = riscv_force_address (XEXP (src, 0), mode);
+ }
+
return false;
}
@@ -3773,6 +3794,16 @@ riscv_option_override (void)
RISCV_TUNE_STRING_DEFAULT);
tune_info = optimize_size ? &optimize_size_tune_info : cpu->tune_info;
+ /* Use -mtune's setting for slow_unaligned_access, even when optimizing
+ for size. For architectures that trap and emulate unaligned accesses,
+ the performance cost is too great, even for -Os. Similarly, if
+ -m[no-]strict-align is left unspecified, heed -mtune's advice. */
+ riscv_slow_unaligned_access = (cpu->tune_info->slow_unaligned_access
+ || TARGET_STRICT_ALIGN);
+ if ((target_flags_explicit & MASK_STRICT_ALIGN) == 0
+ && cpu->tune_info->slow_unaligned_access)
+ target_flags |= MASK_STRICT_ALIGN;
+
/* If the user hasn't specified a branch cost, use the processor's
default. */
if (riscv_branch_cost == 0)
@@ -3960,26 +3991,15 @@ riscv_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
emit_insn (gen_clear_cache (addr, end_addr));
}
-/* Return leaf_function_p () and memoize the result. */
-
-static bool
-riscv_leaf_function_p (void)
-{
- if (cfun->machine->is_leaf == 0)
- cfun->machine->is_leaf = leaf_function_p () ? 1 : -1;
-
- return cfun->machine->is_leaf > 0;
-}
-
/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL. */
static bool
riscv_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED,
tree exp ATTRIBUTE_UNUSED)
{
- /* When optimzing for size, don't use sibcalls in non-leaf routines */
+ /* Don't use sibcalls when use save-restore routine. */
if (TARGET_SAVE_RESTORE)
- return riscv_leaf_function_p ();
+ return false;
return true;
}
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 8d4c75e6770..c5d134cbe57 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -126,10 +126,11 @@ along with GCC; see the file COPYING3. If not see
/* There is no point aligning anything to a rounder boundary than this. */
#define BIGGEST_ALIGNMENT 128
-/* The user-level ISA permits misaligned accesses, but they may execute
- extremely slowly and non-atomically. Some privileged architectures
- do not permit them at all. It is best to enforce strict alignment. */
-#define STRICT_ALIGNMENT 1
+/* The user-level ISA permits unaligned accesses, but they are not required
+ of the privileged architecture. */
+#define STRICT_ALIGNMENT TARGET_STRICT_ALIGN
+
+#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) riscv_slow_unaligned_access
/* Define this if you wish to imitate the way many other C compilers
handle alignment of bitfields and the structures that contain
@@ -864,6 +865,7 @@ while (0)
#ifndef USED_FOR_TARGET
extern const enum reg_class riscv_regno_to_class[];
extern bool riscv_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
+extern bool riscv_slow_unaligned_access;
#endif
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index 4cbb2431335..5f216d3255b 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -259,6 +259,9 @@
;; Iterator for QImode extension patterns.
(define_mode_iterator SUPERQI [HI SI (DI "TARGET_64BIT")])
+;; Iterator for extending loads.
+(define_mode_iterator ZERO_EXTEND_LOAD [QI HI (SI "TARGET_64BIT")])
+
;; Iterator for hardware integer modes narrower than XLEN.
(define_mode_iterator SUBX [QI HI (SI "TARGET_64BIT")])
@@ -1426,7 +1429,13 @@
(match_operand 1 "pmode_register_operand")]
""
{
+#ifdef ICACHE_FLUSH_FUNC
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, ICACHE_FLUSH_FUNC),
+ LCT_NORMAL, VOIDmode, 3, operands[0], Pmode,
+ operands[1], Pmode, const0_rtx, Pmode);
+#else
emit_insn (gen_fence_i ());
+#endif
DONE;
})
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 0466bb29d14..cfd0335d082 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -84,6 +84,10 @@ mcmodel=
Target Report RejectNegative Joined Enum(code_model) Var(riscv_cmodel) Init(TARGET_DEFAULT_CMODEL)
Specify the code model.
+mstrict-align
+Target Report Mask(STRICT_ALIGN) Save
+Do not generate unaligned memory accesses.
+
Enum
Name(code_model) Type(enum riscv_code_model)
Known code models (for use with the -mcmodel= option):
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 2ad21619df9..06c7582c5a5 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -2117,7 +2117,7 @@
UNSPEC_VPERMR))]
"TARGET_P9_VECTOR"
"@
- vpermr %0,%2,%1,%3
+ vpermr %0,%1,%2,%3
xxpermr %x0,%x1,%x3"
[(set_attr "type" "vecperm")
(set_attr "length" "4")])
diff --git a/gcc/config/rs6000/power6.md b/gcc/config/rs6000/power6.md
index eb53246a40e..0d81cdebda5 100644
--- a/gcc/config/rs6000/power6.md
+++ b/gcc/config/rs6000/power6.md
@@ -108,7 +108,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-load-ext" 4 ; fx
(and (eq_attr "type" "load")
@@ -128,7 +128,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-load-update" 2 ; fx
(and (eq_attr "type" "load")
@@ -276,7 +276,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-cntlz" 2
(and (eq_attr "type" "cntlz")
@@ -289,7 +289,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-var-rotate" 4
(and (eq_attr "type" "shift")
@@ -355,7 +355,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-delayed-compare" 2 ; N/A
(and (eq_attr "type" "shift")
@@ -420,7 +420,7 @@
power6-store-update-indexed,\
power6-fpstore,\
power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-idiv" 44
(and (eq_attr "type" "div")
@@ -436,7 +436,7 @@
; power6-store-update-indexed,\
; power6-fpstore,\
; power6-fpstore-update"
-; "store_data_bypass_p")
+; "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-ldiv" 56
(and (eq_attr "type" "div")
@@ -452,7 +452,7 @@
; power6-store-update-indexed,\
; power6-fpstore,\
; power6-fpstore-update"
-; "store_data_bypass_p")
+; "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-mtjmpr" 2
(and (eq_attr "type" "mtjmpr,mfjmpr")
@@ -510,7 +510,7 @@
(define_bypass 1 "power6-fp"
"power6-fpstore,power6-fpstore-update"
- "store_data_bypass_p")
+ "rs6000_store_data_bypass_p")
(define_insn_reservation "power6-fpcompare" 8
(and (eq_attr "type" "fpcompare")
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 33925e558b0..080be3f7ba0 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -120,7 +120,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define f47 47
#define f48 48
#define f49 49
-#define f50 30
+#define f50 50
#define f51 51
#define f52 52
#define f53 53
@@ -222,7 +222,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define vs47 47
#define vs48 48
#define vs49 49
-#define vs50 30
+#define vs50 50
#define vs51 51
#define vs52 52
#define vs53 53
diff --git a/gcc/config/rs6000/ppc-auxv.h b/gcc/config/rs6000/ppc-auxv.h
index dcee28a8152..0bd3bc4332f 100644
--- a/gcc/config/rs6000/ppc-auxv.h
+++ b/gcc/config/rs6000/ppc-auxv.h
@@ -91,6 +91,7 @@
#define PPC_FEATURE2_HAS_IEEE128 0x00400000
#define PPC_FEATURE2_DARN 0x00200000
#define PPC_FEATURE2_SCV 0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000
/* Thread Control Block (TCB) offsets of the AT_PLATFORM, AT_HWCAP and
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 74ad733d1b9..0692510b98e 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -226,6 +226,7 @@ extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
extern void get_ppc476_thunk_name (char name[32]);
extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
extern const char *rs6000_overloaded_builtin_name (enum rs6000_builtins);
+extern int rs6000_store_data_bypass_p (rtx_insn *, rtx_insn *);
extern HOST_WIDE_INT rs6000_builtin_mask_calculate (void);
extern void rs6000_asm_output_dwarf_pcrel (FILE *file, int size,
const char *label);
@@ -239,6 +240,7 @@ extern void rs6000_cpu_cpp_builtins (struct cpp_reader *);
#ifdef TREE_CODE
extern bool rs6000_pragma_target_parse (tree, tree);
#endif
+extern void rs6000_activate_target_options (tree new_tree);
extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT);
extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT,
HOST_WIDE_INT);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d5213627f8f..323b218d229 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -375,6 +375,7 @@ static const struct
{ "ebb", PPC_FEATURE2_HAS_EBB, 1 },
{ "htm", PPC_FEATURE2_HAS_HTM, 1 },
{ "htm-nosc", PPC_FEATURE2_HTM_NOSC, 1 },
+ { "htm-no-suspend", PPC_FEATURE2_HTM_NO_SUSPEND, 1 },
{ "isel", PPC_FEATURE2_HAS_ISEL, 1 },
{ "tar", PPC_FEATURE2_HAS_TAR, 1 },
{ "vcrypto", PPC_FEATURE2_HAS_VEC_CRYPTO, 1 },
@@ -510,6 +511,91 @@ mode_supports_pre_modify_p (machine_mode mode)
!= 0);
}
+/* Given that there exists at least one variable that is set (produced)
+ by OUT_INSN and read (consumed) by IN_INSN, return true iff
+ IN_INSN represents one or more memory store operations and none of
+ the variables set by OUT_INSN is used by IN_INSN as the address of a
+ store operation. If either IN_INSN or OUT_INSN does not represent
+ a "single" RTL SET expression (as loosely defined by the
+ implementation of the single_set function) or a PARALLEL with only
+ SETs, CLOBBERs, and USEs inside, this function returns false.
+
+ This rs6000-specific version of store_data_bypass_p checks for
+ certain conditions that result in assertion failures (and internal
+ compiler errors) in the generic store_data_bypass_p function and
+ returns false rather than calling store_data_bypass_p if one of the
+ problematic conditions is detected. */
+
+int
+rs6000_store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn)
+{
+ rtx out_set, in_set;
+ rtx out_pat, in_pat;
+ rtx out_exp, in_exp;
+ int i, j;
+
+ in_set = single_set (in_insn);
+ if (in_set)
+ {
+ if (MEM_P (SET_DEST (in_set)))
+ {
+ out_set = single_set (out_insn);
+ if (!out_set)
+ {
+ out_pat = PATTERN (out_insn);
+ if (GET_CODE (out_pat) == PARALLEL)
+ {
+ for (i = 0; i < XVECLEN (out_pat, 0); i++)
+ {
+ out_exp = XVECEXP (out_pat, 0, i);
+ if ((GET_CODE (out_exp) == CLOBBER)
+ || (GET_CODE (out_exp) == USE))
+ continue;
+ else if (GET_CODE (out_exp) != SET)
+ return false;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ in_pat = PATTERN (in_insn);
+ if (GET_CODE (in_pat) != PARALLEL)
+ return false;
+
+ for (i = 0; i < XVECLEN (in_pat, 0); i++)
+ {
+ in_exp = XVECEXP (in_pat, 0, i);
+ if ((GET_CODE (in_exp) == CLOBBER) || (GET_CODE (in_exp) == USE))
+ continue;
+ else if (GET_CODE (in_exp) != SET)
+ return false;
+
+ if (MEM_P (SET_DEST (in_exp)))
+ {
+ out_set = single_set (out_insn);
+ if (!out_set)
+ {
+ out_pat = PATTERN (out_insn);
+ if (GET_CODE (out_pat) != PARALLEL)
+ return false;
+ for (j = 0; j < XVECLEN (out_pat, 0); j++)
+ {
+ out_exp = XVECEXP (out_pat, 0, j);
+ if ((GET_CODE (out_exp) == CLOBBER)
+ || (GET_CODE (out_exp) == USE))
+ continue;
+ else if (GET_CODE (out_exp) != SET)
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return store_data_bypass_p (out_insn, in_insn);
+}
+
/* Return true if we have D-form addressing in altivec registers. */
static inline bool
mode_supports_vmx_dform (machine_mode mode)
@@ -3899,14 +3985,10 @@ static bool
rs6000_option_override_internal (bool global_init_p)
{
bool ret = true;
- bool have_cpu = false;
-
- /* The default cpu requested at configure time, if any. */
- const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT;
HOST_WIDE_INT set_masks;
HOST_WIDE_INT ignore_masks;
- int cpu_index;
+ int cpu_index = -1;
int tune_index;
struct cl_target_option *main_target_opt
= ((global_init_p || target_option_default_node == NULL)
@@ -3984,93 +4066,51 @@ rs6000_option_override_internal (bool global_init_p)
with -mtune on the command line. Process a '--with-cpu' configuration
request as an implicit --cpu. */
if (rs6000_cpu_index >= 0)
- {
- cpu_index = rs6000_cpu_index;
- have_cpu = true;
- }
+ cpu_index = rs6000_cpu_index;
else if (main_target_opt != NULL && main_target_opt->x_rs6000_cpu_index >= 0)
- {
- rs6000_cpu_index = cpu_index = main_target_opt->x_rs6000_cpu_index;
- have_cpu = true;
- }
- else if (implicit_cpu)
- {
- rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (implicit_cpu);
- have_cpu = true;
- }
- else
- {
- /* PowerPC 64-bit LE requires at least ISA 2.07. */
- const char *default_cpu = ((!TARGET_POWERPC64)
- ? "powerpc"
- : ((BYTES_BIG_ENDIAN)
- ? "powerpc64"
- : "powerpc64le"));
+ cpu_index = main_target_opt->x_rs6000_cpu_index;
+ else if (OPTION_TARGET_CPU_DEFAULT)
+ cpu_index = rs6000_cpu_name_lookup (OPTION_TARGET_CPU_DEFAULT);
- rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu);
- have_cpu = false;
- }
-
- gcc_assert (cpu_index >= 0);
-
- if (have_cpu)
+ if (cpu_index >= 0)
{
-#ifndef HAVE_AS_POWER9
- if (processor_target_table[rs6000_cpu_index].processor
- == PROCESSOR_POWER9)
+ const char *unavailable_cpu = NULL;
+ switch (processor_target_table[cpu_index].processor)
{
- have_cpu = false;
- warning (0, "will not generate power9 instructions because "
- "assembler lacks power9 support");
- }
+#ifndef HAVE_AS_POWER9
+ case PROCESSOR_POWER9:
+ unavailable_cpu = "power9";
+ break;
#endif
#ifndef HAVE_AS_POWER8
- if (processor_target_table[rs6000_cpu_index].processor
- == PROCESSOR_POWER8)
- {
- have_cpu = false;
- warning (0, "will not generate power8 instructions because "
- "assembler lacks power8 support");
- }
+ case PROCESSOR_POWER8:
+ unavailable_cpu = "power8";
+ break;
#endif
#ifndef HAVE_AS_POPCNTD
- if (processor_target_table[rs6000_cpu_index].processor
- == PROCESSOR_POWER7)
- {
- have_cpu = false;
- warning (0, "will not generate power7 instructions because "
- "assembler lacks power7 support");
- }
+ case PROCESSOR_POWER7:
+ unavailable_cpu = "power7";
+ break;
#endif
#ifndef HAVE_AS_DFP
- if (processor_target_table[rs6000_cpu_index].processor
- == PROCESSOR_POWER6)
- {
- have_cpu = false;
- warning (0, "will not generate power6 instructions because "
- "assembler lacks power6 support");
- }
+ case PROCESSOR_POWER6:
+ unavailable_cpu = "power6";
+ break;
#endif
#ifndef HAVE_AS_POPCNTB
- if (processor_target_table[rs6000_cpu_index].processor
- == PROCESSOR_POWER5)
- {
- have_cpu = false;
- warning (0, "will not generate power5 instructions because "
- "assembler lacks power5 support");
- }
+ case PROCESSOR_POWER5:
+ unavailable_cpu = "power5";
+ break;
#endif
-
- if (!have_cpu)
+ default:
+ break;
+ }
+ if (unavailable_cpu)
{
- /* PowerPC 64-bit LE requires at least ISA 2.07. */
- const char *default_cpu = (!TARGET_POWERPC64
- ? "powerpc"
- : (BYTES_BIG_ENDIAN
- ? "powerpc64"
- : "powerpc64le"));
-
- rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu);
+ cpu_index = -1;
+ warning (0, "will not generate %qs instructions because "
+ "assembler lacks %qs support", unavailable_cpu,
+ unavailable_cpu);
}
}
@@ -4079,8 +4119,9 @@ rs6000_option_override_internal (bool global_init_p)
with those from the cpu, except for options that were explicitly set. If
we don't have a cpu, do not override the target bits set in
TARGET_DEFAULT. */
- if (have_cpu)
+ if (cpu_index >= 0)
{
+ rs6000_cpu_index = cpu_index;
rs6000_isa_flags &= ~set_masks;
rs6000_isa_flags |= (processor_target_table[cpu_index].target_enable
& set_masks);
@@ -4094,14 +4135,26 @@ rs6000_option_override_internal (bool global_init_p)
If there is a TARGET_DEFAULT, use that. Otherwise fall back to using
-mcpu=powerpc, -mcpu=powerpc64, or -mcpu=powerpc64le defaults. */
- HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT
- : processor_target_table[cpu_index].target_enable);
+ HOST_WIDE_INT flags;
+ if (TARGET_DEFAULT)
+ flags = TARGET_DEFAULT;
+ else
+ {
+ /* PowerPC 64-bit LE requires at least ISA 2.07. */
+ const char *default_cpu = (!TARGET_POWERPC64
+ ? "powerpc"
+ : (BYTES_BIG_ENDIAN
+ ? "powerpc64"
+ : "powerpc64le"));
+ int default_cpu_index = rs6000_cpu_name_lookup (default_cpu);
+ flags = processor_target_table[default_cpu_index].target_enable;
+ }
rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit);
}
if (rs6000_tune_index >= 0)
tune_index = rs6000_tune_index;
- else if (have_cpu)
+ else if (cpu_index >= 0)
rs6000_tune_index = tune_index = cpu_index;
else
{
@@ -4113,7 +4166,7 @@ rs6000_option_override_internal (bool global_init_p)
for (i = 0; i < ARRAY_SIZE (processor_target_table); i++)
if (processor_target_table[i].processor == tune_proc)
{
- rs6000_tune_index = tune_index = i;
+ tune_index = i;
break;
}
}
@@ -4286,7 +4339,7 @@ rs6000_option_override_internal (bool global_init_p)
rs6000_isa_flags |= (ISA_3_0_MASKS_SERVER & ~ignore_masks);
else if (TARGET_P9_MINMAX)
{
- if (have_cpu)
+ if (cpu_index >= 0)
{
if (cpu_index == PROCESSOR_POWER9)
{
@@ -5036,7 +5089,7 @@ rs6000_option_override_internal (bool global_init_p)
default:
- if (have_cpu && !(rs6000_isa_flags_explicit & OPTION_MASK_ISEL))
+ if (cpu_index >= 0 && !(rs6000_isa_flags_explicit & OPTION_MASK_ISEL))
rs6000_isa_flags &= ~OPTION_MASK_ISEL;
break;
@@ -7543,7 +7596,7 @@ rs6000_expand_vector_set (rtx target, rtx val, int elt)
{
if (TARGET_P9_VECTOR)
x = gen_rtx_UNSPEC (mode,
- gen_rtvec (3, target, reg,
+ gen_rtvec (3, reg, target,
force_reg (V16QImode, x)),
UNSPEC_VPERMR);
else
@@ -33091,14 +33144,14 @@ rs6000_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
case TYPE_LOAD:
case TYPE_CNTLZ:
{
- if (! store_data_bypass_p (dep_insn, insn))
+ if (! rs6000_store_data_bypass_p (dep_insn, insn))
return get_attr_sign_extend (dep_insn)
== SIGN_EXTEND_YES ? 6 : 4;
break;
}
case TYPE_SHIFT:
{
- if (! store_data_bypass_p (dep_insn, insn))
+ if (! rs6000_store_data_bypass_p (dep_insn, insn))
return get_attr_var_shift (dep_insn) == VAR_SHIFT_YES ?
6 : 3;
break;
@@ -33109,7 +33162,7 @@ rs6000_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
case TYPE_EXTS:
case TYPE_INSERT:
{
- if (! store_data_bypass_p (dep_insn, insn))
+ if (! rs6000_store_data_bypass_p (dep_insn, insn))
return 3;
break;
}
@@ -33118,19 +33171,19 @@ rs6000_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost,
case TYPE_FPSTORE:
{
if (get_attr_update (dep_insn) == UPDATE_YES
- && ! store_data_bypass_p (dep_insn, insn))
+ && ! rs6000_store_data_bypass_p (dep_insn, insn))
return 3;
break;
}
case TYPE_MUL:
{
- if (! store_data_bypass_p (dep_insn, insn))
+ if (! rs6000_store_data_bypass_p (dep_insn, insn))
return 17;
break;
}
case TYPE_DIV:
{
- if (! store_data_bypass_p (dep_insn, insn))
+ if (! rs6000_store_data_bypass_p (dep_insn, insn))
return get_attr_size (dep_insn) == SIZE_32 ? 45 : 57;
break;
}
@@ -37307,14 +37360,16 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
*total = COSTS_N_INSNS (1);
return true;
}
+ /* FALLTHRU */
+
+ case GT:
+ case LT:
+ case UNORDERED:
if (outer_code == SET)
{
if (XEXP (x, 1) == const0_rtx)
{
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
+ *total = COSTS_N_INSNS (2);
return true;
}
else
@@ -37323,19 +37378,6 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
return false;
}
}
- /* FALLTHRU */
-
- case GT:
- case LT:
- case UNORDERED:
- if (outer_code == SET && (XEXP (x, 1) == const0_rtx))
- {
- if (TARGET_ISEL && !TARGET_MFCRF)
- *total = COSTS_N_INSNS (8);
- else
- *total = COSTS_N_INSNS (2);
- return true;
- }
/* CC COMPARE. */
if (outer_code == COMPARE)
{
@@ -37994,7 +38036,7 @@ altivec_expand_vec_perm_le (rtx operands[4])
if (TARGET_P9_VECTOR)
{
- unspec = gen_rtx_UNSPEC (mode, gen_rtvec (3, op0, op1, sel),
+ unspec = gen_rtx_UNSPEC (mode, gen_rtvec (3, op1, op0, sel),
UNSPEC_VPERMR);
}
else
@@ -39400,9 +39442,9 @@ rs6000_valid_attribute_p (tree fndecl,
{
struct cl_target_option cur_target;
bool ret;
- tree old_optimize = build_optimization_node (&global_options);
+ tree old_optimize;
tree new_target, new_optimize;
- tree func_optimize = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
+ tree func_optimize;
gcc_assert ((fndecl != NULL_TREE) && (args != NULL_TREE));
@@ -39529,6 +39571,7 @@ rs6000_pragma_target_parse (tree args, tree pop_target)
}
target_option_current_node = cur_tree;
+ rs6000_activate_target_options (target_option_current_node);
/* If we have the preprocessor linked in (i.e. C or C++ languages), possibly
change the macros that are defined. */
@@ -39569,7 +39612,7 @@ static GTY(()) tree rs6000_previous_fndecl;
/* Restore target's globals from NEW_TREE and invalidate the
rs6000_previous_fndecl cache. */
-static void
+void
rs6000_activate_target_options (tree new_tree)
{
cl_target_option_restore (&global_options, TREE_TARGET_OPTION (new_tree));
@@ -39949,7 +39992,8 @@ rs6000_address_for_fpconvert (rtx x)
gcc_assert (MEM_P (x));
addr = XEXP (x, 0);
- if (! legitimate_indirect_address_p (addr, strict_p)
+ if (can_create_pseudo_p ()
+ && ! legitimate_indirect_address_p (addr, strict_p)
&& ! legitimate_indexed_address_p (addr, strict_p))
{
if (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC)
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 3323976a35d..8c3ccda8d91 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -13304,14 +13304,12 @@
; Some 32-bit ABIs do not have a red zone, so the stack deallocation has to
; stay behind all restores from the stack, it cannot be reordered to before
-; one. See PR77687. This insn is an add or mr, and a stack_tie on the
-; operands of that.
+; one. See PR77687. This insn is an add or mr, and a memory clobber.
(define_insn "stack_restore_tie"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r,r")
(plus:SI (match_operand:SI 1 "gpc_reg_operand" "r,r")
(match_operand:SI 2 "reg_or_cint_operand" "O,rI")))
- (set (mem:BLK (match_dup 0)) (const_int 0))
- (set (mem:BLK (match_dup 1)) (const_int 0))]
+ (set (mem:BLK (scratch)) (const_int 0))]
"TARGET_32BIT"
"@
mr %0,%1
@@ -14644,6 +14642,9 @@
{
if (GET_CODE (operands[2]) == SCRATCH)
operands[2] = gen_reg_rtx (DImode);
+
+ if (MEM_P (operands[1]))
+ operands[1] = rs6000_address_for_fpconvert (operands[1]);
})
(define_insn_and_split "float<QHI:mode><IEEE128:mode>2"
@@ -14707,6 +14708,9 @@
{
if (GET_CODE (operands[2]) == SCRATCH)
operands[2] = gen_reg_rtx (DImode);
+
+ if (MEM_P (operands[1]))
+ operands[1] = rs6000_address_for_fpconvert (operands[1]);
})
(define_insn_and_split "floatuns<QHI:mode><IEEE128:mode>2"
diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems
index 1633b39367f..66c20aadea5 100644
--- a/gcc/config/rs6000/t-rtems
+++ b/gcc/config/rs6000/t-rtems
@@ -78,4 +78,3 @@ MULTILIB_REQUIRED += mcpu=860
MULTILIB_REQUIRED += mcpu=e6500/m32
MULTILIB_REQUIRED += mcpu=e6500/m32/msoft-float/mno-altivec
MULTILIB_REQUIRED += mcpu=e6500/m64
-MULTILIB_REQUIRED += mcpu=e6500/m64/msoft-float/mno-altivec
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 1e74f380bdb..414c64b2b5b 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -284,6 +284,9 @@ rx_is_restricted_memory_address (rtx mem, machine_mode mode)
/* Simple memory addresses are OK. */
return true;
+ case SUBREG:
+ return RX_REG_P (SUBREG_REG (mem));
+
case PRE_DEC:
case POST_INC:
return false;
diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md
index eae3e3b7d49..ef58f129a1d 100644
--- a/gcc/config/rx/rx.md
+++ b/gcc/config/rx/rx.md
@@ -2167,6 +2167,7 @@
[(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
(define_mode_iterator QIHI [QI HI])
+(define_mode_attr BW [(QI "B") (HI "W")])
(define_insn "sync_lock_test_and_setsi"
[(set (match_operand:SI 0 "register_operand" "=r,r")
@@ -2208,7 +2209,7 @@
(set (match_dup 1)
(match_operand:QIHI 2 "register_operand" "0"))]
""
- "xchg\t%1, %0"
+ "xchg\t%1.<BW>, %0"
[(set_attr "length" "6")
(set_attr "timings" "22")]
)
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index e19e977087d..4585c4855c7 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -2277,8 +2277,8 @@
""
{
rtx last;
+ rtx func_ptr = gen_reg_rtx (Pmode);
- operands[3] = gen_reg_rtx (Pmode);
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_DIVIDE_CALL_TABLE)
{
@@ -2298,16 +2298,16 @@
emit_move_insn (operands[0], operands[2]);
DONE;
}
- function_symbol (operands[3], "__udivsi3_i4i", SFUNC_GOT);
- last = gen_udivsi3_i4_int (operands[0], operands[3]);
+ function_symbol (func_ptr, "__udivsi3_i4i", SFUNC_GOT);
+ last = gen_udivsi3_i4_int (operands[0], func_ptr);
}
else if (TARGET_DIVIDE_CALL_FP)
{
- rtx lab = function_symbol (operands[3], "__udivsi3_i4", SFUNC_STATIC).lab;
+ rtx lab = function_symbol (func_ptr, "__udivsi3_i4", SFUNC_STATIC).lab;
if (TARGET_FPU_SINGLE)
- last = gen_udivsi3_i4_single (operands[0], operands[3], lab);
+ last = gen_udivsi3_i4_single (operands[0], func_ptr, lab);
else
- last = gen_udivsi3_i4 (operands[0], operands[3], lab);
+ last = gen_udivsi3_i4 (operands[0], func_ptr, lab);
}
else if (TARGET_SH2A)
{
@@ -2318,8 +2318,8 @@
}
else
{
- rtx lab = function_symbol (operands[3], "__udivsi3", SFUNC_STATIC).lab;
- last = gen_udivsi3_i1 (operands[0], operands[3], lab);
+ rtx lab = function_symbol (func_ptr, "__udivsi3", SFUNC_STATIC).lab;
+ last = gen_udivsi3_i1 (operands[0], func_ptr, lab);
}
emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]);
@@ -2405,22 +2405,22 @@
""
{
rtx last;
+ rtx func_ptr = gen_reg_rtx (Pmode);
- operands[3] = gen_reg_rtx (Pmode);
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_DIVIDE_CALL_TABLE)
{
- function_symbol (operands[3], sh_divsi3_libfunc, SFUNC_GOT);
- last = gen_divsi3_i4_int (operands[0], operands[3]);
+ function_symbol (func_ptr, sh_divsi3_libfunc, SFUNC_GOT);
+ last = gen_divsi3_i4_int (operands[0], func_ptr);
}
else if (TARGET_DIVIDE_CALL_FP)
{
- rtx lab = function_symbol (operands[3], sh_divsi3_libfunc,
+ rtx lab = function_symbol (func_ptr, sh_divsi3_libfunc,
SFUNC_STATIC).lab;
if (TARGET_FPU_SINGLE)
- last = gen_divsi3_i4_single (operands[0], operands[3], lab);
+ last = gen_divsi3_i4_single (operands[0], func_ptr, lab);
else
- last = gen_divsi3_i4 (operands[0], operands[3], lab);
+ last = gen_divsi3_i4 (operands[0], func_ptr, lab);
}
else if (TARGET_SH2A)
{
@@ -2431,8 +2431,8 @@
}
else
{
- function_symbol (operands[3], sh_divsi3_libfunc, SFUNC_GOT);
- last = gen_divsi3_i1 (operands[0], operands[3]);
+ function_symbol (func_ptr, sh_divsi3_libfunc, SFUNC_GOT);
+ last = gen_divsi3_i1 (operands[0], func_ptr);
}
emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
emit_move_insn (gen_rtx_REG (SImode, 5), operands[2]);
@@ -6519,6 +6519,7 @@
[(call (mem (match_operand:SI 0 "symbol_ref_operand" ""))
(match_operand 1 "" ""))
(use (reg:SI FPSCR_MODES_REG))
+ (use (match_scratch 2))
(clobber (reg:SI PR_REG))]
"TARGET_SH2A && sh2a_is_function_vector_call (operands[0])"
{
@@ -6629,6 +6630,7 @@
(call (mem:SI (match_operand:SI 1 "symbol_ref_operand" ""))
(match_operand 2 "" "")))
(use (reg:SI FPSCR_MODES_REG))
+ (use (match_scratch 3))
(clobber (reg:SI PR_REG))]
"TARGET_SH2A && sh2a_is_function_vector_call (operands[1])"
{
@@ -7044,13 +7046,11 @@
[(const_int 0)]
{
rtx lab = PATTERN (gen_call_site ());
- rtx call_insn;
-
- operands[3] = gen_rtx_REG (SImode, R1_REG);
+ rtx tmp = gen_rtx_REG (SImode, R1_REG);
- sh_expand_sym_label2reg (operands[3], operands[1], lab, true);
- call_insn = emit_call_insn (gen_sibcall_valuei_pcrel (operands[0],
- operands[3],
+ sh_expand_sym_label2reg (tmp, operands[1], lab, true);
+ rtx call_insn = emit_call_insn (gen_sibcall_valuei_pcrel (operands[0],
+ tmp,
operands[2],
copy_rtx (lab)));
SIBLING_CALL_P (call_insn) = 1;
@@ -7078,12 +7078,11 @@
[(const_int 0)]
{
rtx lab = PATTERN (gen_call_site ());
+ rtx tmp = gen_rtx_REG (SImode, R1_REG);
- operands[3] = gen_rtx_REG (SImode, R1_REG);
-
- sh_expand_sym_label2reg (operands[3], operands[1], lab, true);
+ sh_expand_sym_label2reg (tmp, operands[1], lab, true);
rtx i = emit_call_insn (gen_sibcall_valuei_pcrel_fdpic (operands[0],
- operands[3],
+ tmp,
operands[2],
copy_rtx (lab)));
SIBLING_CALL_P (i) = 1;
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index bc53a1ca284..d522de03f4a 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -205,8 +205,8 @@ along with GCC; see the file COPYING3. If not see
/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
#undef STARTFILE_SPEC
#ifdef HAVE_SOLARIS_CRTS
-/* Since Solaris 11.x and Solaris 12, the OS delivers crt1.o, crti.o, and
- crtn.o, with a hook for compiler-dependent stuff like profile handling. */
+/* Since Solaris 11.4, the OS delivers crt1.o, crti.o, and crtn.o, with a hook
+ for compiler-dependent stuff like profile handling. */
#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
crt1.o%s \
%{p:%e-p is not supported; \
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 83ca1dcc617..b9c8dcc57c1 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -914,6 +914,80 @@ mem_ref (rtx x)
return NULL_RTX;
}
+/* True if any of INSN's source register(s) is REG. */
+
+static bool
+insn_uses_reg_p (rtx_insn *insn, unsigned int reg)
+{
+ extract_insn (insn);
+ return ((REG_P (recog_data.operand[1])
+ && REGNO (recog_data.operand[1]) == reg)
+ || (recog_data.n_operands == 3
+ && REG_P (recog_data.operand[2])
+ && REGNO (recog_data.operand[2]) == reg));
+}
+
+/* True if INSN is a floating-point division or square-root. */
+
+static bool
+div_sqrt_insn_p (rtx_insn *insn)
+{
+ if (GET_CODE (PATTERN (insn)) != SET)
+ return false;
+
+ switch (get_attr_type (insn))
+ {
+ case TYPE_FPDIVS:
+ case TYPE_FPSQRTS:
+ case TYPE_FPDIVD:
+ case TYPE_FPSQRTD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* True if INSN is a floating-point instruction. */
+
+static bool
+fpop_insn_p (rtx_insn *insn)
+{
+ if (GET_CODE (PATTERN (insn)) != SET)
+ return false;
+
+ switch (get_attr_type (insn))
+ {
+ case TYPE_FPMOVE:
+ case TYPE_FPCMOVE:
+ case TYPE_FP:
+ case TYPE_FPCMP:
+ case TYPE_FPMUL:
+ case TYPE_FPDIVS:
+ case TYPE_FPSQRTS:
+ case TYPE_FPDIVD:
+ case TYPE_FPSQRTD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* True if INSN is an atomic instruction. */
+
+static bool
+atomic_insn_for_leon3_p (rtx_insn *insn)
+{
+ switch (INSN_CODE (insn))
+ {
+ case CODE_FOR_swapsi:
+ case CODE_FOR_ldstub:
+ case CODE_FOR_atomic_compare_and_swap_leon3_1:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* We use a machine specific pass to enable workarounds for errata.
We need to have the (essentially) final form of the insn stream in order
@@ -939,11 +1013,134 @@ sparc_do_work_around_errata (void)
{
bool insert_nop = false;
rtx set;
+ rtx_insn *jump;
+ rtx_sequence *seq;
/* Look into the instruction in a delay slot. */
- if (NONJUMP_INSN_P (insn))
- if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
+ if (NONJUMP_INSN_P (insn)
+ && (seq = dyn_cast <rtx_sequence *> (PATTERN (insn))))
+ {
+ jump = seq->insn (0);
insn = seq->insn (1);
+ }
+ else if (JUMP_P (insn))
+ jump = insn;
+ else
+ jump = NULL;
+
+ /* Place a NOP at the branch target of an integer branch if it is a
+ floating-point operation or a floating-point branch. */
+ if (sparc_fix_gr712rc
+ && jump
+ && jump_to_label_p (jump)
+ && get_attr_branch_type (jump) == BRANCH_TYPE_ICC)
+ {
+ rtx_insn *target = next_active_insn (JUMP_LABEL_AS_INSN (jump));
+ if (target
+ && (fpop_insn_p (target)
+ || (JUMP_P (target)
+ && get_attr_branch_type (target) == BRANCH_TYPE_FCC)))
+ emit_insn_before (gen_nop (), target);
+ }
+
+ /* Insert a NOP between load instruction and atomic instruction. Insert
+ a NOP at branch target if there is a load in delay slot and an atomic
+ instruction at branch target. */
+ if (sparc_fix_ut700
+ && NONJUMP_INSN_P (insn)
+ && (set = single_set (insn)) != NULL_RTX
+ && mem_ref (SET_SRC (set))
+ && REG_P (SET_DEST (set)))
+ {
+ if (jump && jump_to_label_p (jump))
+ {
+ rtx_insn *target = next_active_insn (JUMP_LABEL_AS_INSN (jump));
+ if (target && atomic_insn_for_leon3_p (target))
+ emit_insn_before (gen_nop (), target);
+ }
+
+ next = next_active_insn (insn);
+ if (!next)
+ break;
+
+ if (atomic_insn_for_leon3_p (next))
+ insert_nop = true;
+ }
+
+ /* Look for a sequence that starts with a fdiv or fsqrt instruction and
+ ends with another fdiv or fsqrt instruction with no dependencies on
+ the former, along with an appropriate pattern in between. */
+ if (sparc_fix_lost_divsqrt
+ && NONJUMP_INSN_P (insn)
+ && div_sqrt_insn_p (insn))
+ {
+ int i;
+ int fp_found = 0;
+ rtx_insn *after;
+
+ const unsigned int dest_reg = REGNO (SET_DEST (single_set (insn)));
+
+ next = next_active_insn (insn);
+ if (!next)
+ break;
+
+ for (after = next, i = 0; i < 4; i++)
+ {
+ /* Count floating-point operations. */
+ if (i != 3 && fpop_insn_p (after))
+ {
+ /* If the insn uses the destination register of
+ the div/sqrt, then it cannot be problematic. */
+ if (insn_uses_reg_p (after, dest_reg))
+ break;
+ fp_found++;
+ }
+
+ /* Count floating-point loads. */
+ if (i != 3
+ && (set = single_set (after)) != NULL_RTX
+ && REG_P (SET_DEST (set))
+ && REGNO (SET_DEST (set)) > 31)
+ {
+ /* If the insn uses the destination register of
+ the div/sqrt, then it cannot be problematic. */
+ if (REGNO (SET_DEST (set)) == dest_reg)
+ break;
+ fp_found++;
+ }
+
+ /* Check if this is a problematic sequence. */
+ if (i > 1
+ && fp_found >= 2
+ && div_sqrt_insn_p (after))
+ {
+ /* If this is the short version of the problematic
+ sequence we add two NOPs in a row to also prevent
+ the long version. */
+ if (i == 2)
+ emit_insn_before (gen_nop (), next);
+ insert_nop = true;
+ break;
+ }
+
+ /* No need to scan past a second div/sqrt. */
+ if (div_sqrt_insn_p (after))
+ break;
+
+ /* Insert NOP before branch. */
+ if (i < 3
+ && (!NONJUMP_INSN_P (after)
+ || GET_CODE (PATTERN (after)) == SEQUENCE))
+ {
+ insert_nop = true;
+ break;
+ }
+
+ after = next_active_insn (after);
+ if (!after)
+ break;
+ }
+ }
/* Look for either of these two sequences:
@@ -1003,8 +1200,8 @@ sparc_do_work_around_errata (void)
then the sequence cannot be problematic. */
if (i == 0)
{
- if (((set = single_set (after)) != NULL_RTX)
- && (MEM_P (SET_DEST (set)) || MEM_P (SET_SRC (set))))
+ if ((set = single_set (after)) != NULL_RTX
+ && (MEM_P (SET_DEST (set)) || mem_ref (SET_SRC (set))))
break;
after = next_active_insn (after);
@@ -1014,21 +1211,21 @@ sparc_do_work_around_errata (void)
/* Add NOP if third instruction is a store. */
if (i == 1
- && ((set = single_set (after)) != NULL_RTX)
+ && (set = single_set (after)) != NULL_RTX
&& MEM_P (SET_DEST (set)))
insert_nop = true;
}
}
- else
+
/* Look for a single-word load into an odd-numbered FP register. */
- if (sparc_fix_at697f
- && NONJUMP_INSN_P (insn)
- && (set = single_set (insn)) != NULL_RTX
- && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4
- && MEM_P (SET_SRC (set))
- && REG_P (SET_DEST (set))
- && REGNO (SET_DEST (set)) > 31
- && REGNO (SET_DEST (set)) % 2 != 0)
+ else if (sparc_fix_at697f
+ && NONJUMP_INSN_P (insn)
+ && (set = single_set (insn)) != NULL_RTX
+ && GET_MODE_SIZE (GET_MODE (SET_SRC (set))) == 4
+ && mem_ref (SET_SRC (set))
+ && REG_P (SET_DEST (set))
+ && REGNO (SET_DEST (set)) > 31
+ && REGNO (SET_DEST (set)) % 2 != 0)
{
/* The wrong dependency is on the enclosing double register. */
const unsigned int x = REGNO (SET_DEST (set)) - 1;
@@ -1095,7 +1292,8 @@ sparc_do_work_around_errata (void)
&& NONJUMP_INSN_P (insn)
&& (set = single_set (insn)) != NULL_RTX
&& GET_MODE_SIZE (GET_MODE (SET_SRC (set))) <= 4
- && mem_ref (SET_SRC (set)) != NULL_RTX
+ && (mem_ref (SET_SRC (set)) != NULL_RTX
+ || INSN_CODE (insn) == CODE_FOR_movsi_pic_gotdata_op)
&& REG_P (SET_DEST (set))
&& REGNO (SET_DEST (set)) < 32)
{
@@ -1133,6 +1331,11 @@ sparc_do_work_around_errata (void)
&& REGNO (src) != REGNO (x)))
&& !reg_mentioned_p (x, XEXP (dest, 0)))
insert_nop = true;
+
+ /* GOT accesses uses LD. */
+ else if (INSN_CODE (next) == CODE_FOR_movsi_pic_gotdata_op
+ && !reg_mentioned_p (x, XEXP (XEXP (src, 0), 1)))
+ insert_nop = true;
}
}
@@ -1272,7 +1475,8 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return sparc_fix_at697f || sparc_fix_ut699 || sparc_fix_b2bst;
+ return sparc_fix_at697f || sparc_fix_ut699 || sparc_fix_b2bst
+ || sparc_fix_gr712rc || sparc_fix_ut700 || sparc_fix_lost_divsqrt;
}
virtual unsigned int execute (function *)
@@ -1642,9 +1846,12 @@ sparc_option_override (void)
if (!(target_flags_explicit & MASK_LRA))
target_flags |= MASK_LRA;
- /* Enable the back-to-back store errata workaround for LEON3FT. */
+ /* Enable applicable errata workarounds for LEON3FT. */
if (sparc_fix_ut699 || sparc_fix_ut700 || sparc_fix_gr712rc)
+ {
sparc_fix_b2bst = 1;
+ sparc_fix_lost_divsqrt = 1;
+ }
/* Disable FsMULd for the UT699 since it doesn't work correctly. */
if (sparc_fix_ut699)
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 321c0d8b9fe..4ddbe56fbf4 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -430,6 +430,14 @@
(symbol_ref "(sparc_fix_b2bst != 0
? FIX_B2BST_TRUE : FIX_B2BST_FALSE)"))
+(define_attr "fix_lost_divsqrt" "false,true"
+ (symbol_ref "(sparc_fix_lost_divsqrt != 0
+ ? FIX_LOST_DIVSQRT_TRUE : FIX_LOST_DIVSQRT_FALSE)"))
+
+(define_attr "fix_gr712rc" "false,true"
+ (symbol_ref "(sparc_fix_gr712rc != 0
+ ? FIX_GR712RC_TRUE : FIX_GR712RC_FALSE)"))
+
;; Length (in # of insns).
;; Beware that setting a length greater or equal to 3 for conditional branches
;; has a side-effect (see output_cbranch and output_v9branch).
@@ -577,6 +585,9 @@
(define_attr "in_branch_delay" "false,true"
(cond [(eq_attr "type" "uncond_branch,branch,cbcond,uncond_cbcond,call,sibcall,call_no_delay_slot,multi")
(const_string "false")
+ (and (eq_attr "fix_lost_divsqrt" "true")
+ (eq_attr "type" "fpdivs,fpsqrts,fpdivd,fpsqrtd"))
+ (const_string "false")
(and (eq_attr "fix_b2bst" "true") (eq_attr "type" "store,fpstore"))
(const_string "false")
(and (eq_attr "fix_ut699" "true") (eq_attr "type" "load,sload"))
@@ -590,6 +601,15 @@
(const_string "true")
] (const_string "false")))
+(define_attr "in_integer_branch_annul_delay" "false,true"
+ (cond [(and (eq_attr "fix_gr712rc" "true")
+ (eq_attr "type" "fp,fpcmp,fpmove,fpcmove,fpmul,
+ fpdivs,fpsqrts,fpdivd,fpsqrtd"))
+ (const_string "false")
+ (eq_attr "in_branch_delay" "true")
+ (const_string "true")
+ ] (const_string "false")))
+
(define_delay (eq_attr "type" "call")
[(eq_attr "in_call_delay" "true") (nil) (nil)])
@@ -599,9 +619,15 @@
(define_delay (eq_attr "type" "return")
[(eq_attr "in_return_delay" "true") (nil) (nil)])
-(define_delay (eq_attr "type" "branch")
+(define_delay (and (eq_attr "type" "branch")
+ (not (eq_attr "branch_type" "icc")))
[(eq_attr "in_branch_delay" "true") (nil) (eq_attr "in_branch_delay" "true")])
+(define_delay (and (eq_attr "type" "branch")
+ (eq_attr "branch_type" "icc"))
+ [(eq_attr "in_branch_delay" "true") (nil)
+ (eq_attr "in_integer_branch_annul_delay" "true")])
+
(define_delay (eq_attr "type" "uncond_branch")
[(eq_attr "in_branch_delay" "true") (nil) (nil)])
diff --git a/gcc/config/sparc/sparc.opt b/gcc/config/sparc/sparc.opt
index 22267f50e90..71ead75831d 100644
--- a/gcc/config/sparc/sparc.opt
+++ b/gcc/config/sparc/sparc.opt
@@ -253,6 +253,10 @@ Enable workarounds for the errata of the GR712RC processor.
TargetVariable
unsigned int sparc_fix_b2bst
+;; Enable workaround for GRLIB-TN-0013 errata
+TargetVariable
+unsigned int sparc_fix_lost_divsqrt
+
Mask(LONG_DOUBLE_128)
;; Use 128-bit long double
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 1593bdeb903..43c66e96ba3 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -212,7 +212,7 @@
"cas<modesuffix>\t%1, %2, %0"
[(set_attr "type" "multi")])
-(define_insn "*atomic_compare_and_swap_leon3_1"
+(define_insn "atomic_compare_and_swap_leon3_1"
[(set (match_operand:SI 0 "register_operand" "=r")
(match_operand:SI 1 "mem_noofs_operand" "+w"))
(set (match_dup 1)
@@ -222,12 +222,16 @@
UNSPECV_CAS))]
"TARGET_LEON3"
{
+ if (sparc_fix_gr712rc)
+ output_asm_insn (".align\t16", operands);
if (TARGET_SV_MODE)
return "casa\t%1 0xb, %2, %0"; /* ASI for supervisor data space. */
else
return "casa\t%1 0xa, %2, %0"; /* ASI for user data space. */
}
- [(set_attr "type" "multi")])
+ [(set_attr "type" "multi")
+ (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+ (const_int 4) (const_int 1)))])
(define_insn "*atomic_compare_and_swapdi_v8plus"
[(set (match_operand:DI 0 "register_operand" "=h")
@@ -275,8 +279,15 @@
(set (match_dup 1)
(match_operand:SI 2 "register_operand" "0"))]
"(TARGET_V8 || TARGET_V9) && !sparc_fix_ut699"
- "swap\t%1, %0"
- [(set_attr "type" "multi")])
+{
+ if (sparc_fix_gr712rc)
+ return ".align\t16\n\tswap\t%1, %0";
+ else
+ return "swap\t%1, %0";
+}
+ [(set_attr "type" "multi")
+ (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+ (const_int 4) (const_int 1)))])
(define_expand "atomic_test_and_set"
[(match_operand:QI 0 "register_operand" "")
@@ -307,5 +318,12 @@
UNSPECV_LDSTUB))
(set (match_dup 1) (const_int -1))]
"!sparc_fix_ut699"
- "ldstub\t%1, %0"
- [(set_attr "type" "multi")])
+{
+ if (sparc_fix_gr712rc)
+ return ".align\t16\n\tldstub\t%1, %0";
+ else
+ return "ldstub\t%1, %0";
+}
+ [(set_attr "type" "multi")
+ (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+ (const_int 4) (const_int 1)))])
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 38901b7530a..dac5657948e 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -73,5 +73,6 @@ extern void xtensa_expand_prologue (void);
extern void xtensa_expand_epilogue (void);
extern void order_regs_for_local_alloc (void);
extern enum reg_class xtensa_regno_to_class (int regno);
+extern HOST_WIDE_INT xtensa_initial_elimination_offset (int from, int to);
#endif /* !__XTENSA_PROTOS_H__ */
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 8c404187107..9bdf870a0fd 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -176,6 +176,7 @@ static bool xtensa_member_type_forces_blk (const_tree,
machine_mode mode);
static void xtensa_conditional_register_usage (void);
+static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void);
@@ -304,6 +305,9 @@ static void xtensa_conditional_register_usage (void);
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE xtensa_conditional_register_usage
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET xtensa_asan_shadow_offset
+
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -2678,6 +2682,30 @@ xtensa_frame_pointer_required (void)
return false;
}
+HOST_WIDE_INT
+xtensa_initial_elimination_offset (int from, int to)
+{
+ long frame_size = compute_frame_size (get_frame_size ());
+ HOST_WIDE_INT offset;
+
+ switch (from)
+ {
+ case FRAME_POINTER_REGNUM:
+ if (FRAME_GROWS_DOWNWARD)
+ offset = frame_size - (WINDOW_SIZE * UNITS_PER_WORD)
+ - cfun->machine->callee_save_size;
+ else
+ offset = 0;
+ break;
+ case ARG_POINTER_REGNUM:
+ offset = frame_size;
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ return offset;
+}
/* minimum frame = reg save area (4 words) plus static chain (1 word)
and the total number of words must be a multiple of 128 bits. */
@@ -4313,4 +4341,12 @@ enum reg_class xtensa_regno_to_class (int regno)
return regno_to_class[regno];
}
+/* Implement TARGET_ASAN_SHADOW_OFFSET. */
+
+static unsigned HOST_WIDE_INT
+xtensa_asan_shadow_offset (void)
+{
+ return HOST_WIDE_INT_UC (0x10000000);
+}
+
#include "gt-xtensa.h"
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index c32e8caf6dd..ec9ee59b092 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -460,9 +460,12 @@ enum reg_class
#define STACK_GROWS_DOWNWARD 1
+#define FRAME_GROWS_DOWNWARD (flag_stack_protect \
+ || (flag_sanitize & SANITIZE_ADDRESS) != 0)
+
/* Offset within stack frame to start allocating local variables at. */
#define STARTING_FRAME_OFFSET \
- crtl->outgoing_args_size
+ (FRAME_GROWS_DOWNWARD ? 0 : crtl->outgoing_args_size)
/* The ARG_POINTER and FRAME_POINTER are not real Xtensa registers, so
they are eliminated to either the stack pointer or hard frame pointer. */
@@ -474,20 +477,7 @@ enum reg_class
/* Specify the initial difference between the specified pair of registers. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
- do { \
- long frame_size = compute_frame_size (get_frame_size ()); \
- switch (FROM) \
- { \
- case FRAME_POINTER_REGNUM: \
- (OFFSET) = 0; \
- break; \
- case ARG_POINTER_REGNUM: \
- (OFFSET) = frame_size; \
- break; \
- default: \
- gcc_unreachable (); \
- } \
- } while (0)
+ (OFFSET) = xtensa_initial_elimination_offset ((FROM), (TO))
/* If defined, the maximum amount of space required for outgoing
arguments will be computed and placed into the variable
diff --git a/gcc/configure b/gcc/configure
index 1f6f104ae94..9351f2848e5 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -28155,7 +28155,7 @@ elif test x$gcc_cv_ld != x; then
else
case "$target" in
*-*-solaris2.1[1-9]*)
- # Solaris 11.x and Solaris 12 added PIE support.
+ # Solaris 11.3 added PIE support.
if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
gcc_cv_ld_pie=yes
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9a34f3900cf..520fe58f70f 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5052,7 +5052,7 @@ elif test x$gcc_cv_ld != x; then
else
case "$target" in
*-*-solaris2.1[[1-9]]*)
- # Solaris 11.x and Solaris 12 added PIE support.
+ # Solaris 11.3 added PIE support.
if $gcc_cv_ld -z help 2>&1 | grep -- type.*pie > /dev/null; then
gcc_cv_ld_pie=yes
fi
diff --git a/gcc/convert.c b/gcc/convert.c
index af8dfda0eb4..8737f4d3965 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -461,8 +461,10 @@ do_narrow (location_t loc,
type in case the operation in outprec precision
could overflow. Otherwise, we would introduce
signed-overflow undefinedness. */
- || ((!TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0))
- || !TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1)))
+ || ((!(INTEGRAL_TYPE_P (TREE_TYPE (arg0))
+ && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0)))
+ || !(INTEGRAL_TYPE_P (TREE_TYPE (arg1))
+ && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1))))
&& ((TYPE_PRECISION (TREE_TYPE (arg0)) * 2u
> outprec)
|| (TYPE_PRECISION (TREE_TYPE (arg1)) * 2u
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 94c1237480b..99b594717d2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,90 @@
+2018-01-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83556
+ * tree.c (replace_placeholders_r): Pass NULL as last argument to
+ cp_walk_tree instead of d->pset. If non-TREE_CONSTANT and
+ non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
+ to false and return.
+ (replace_placeholders): Pass NULL instead of &pset as last argument
+ to cp_walk_tree.
+
+2017-12-19 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 2017-12-18 Marek Polacek <polacek@redhat.com>
+
+ PR c++/83116
+ * constexpr.c (cxx_eval_call_expression): Only look into
+ constexpr_call_table if ctx->strict.
+
+2017-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83205
+ * decl.c (cp_finish_decomp): Handle the case when tsize is not
+ error_mark_node, but doesn't fit into uhwi. Split up count != eltscnt
+ and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
+ to handle plural forms properly.
+
+ PR c++/81197
+ * cp-tree.h (cp_maybe_mangle_decomp): Declare.
+ * decl.c (cp_maybe_mangle_decomp): New function.
+ (cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
+ * parser.c (cp_convert_range_for,
+ cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
+ * pt.c (tsubst_expr): Likewise.
+ * mangle.c (find_decomp_unqualified_name): New function.
+ (write_unqualified_name): Handle DECL_DECOMPOSITION_P
+ where DECL_ASSEMBLER_NAME is already set.
+
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83217
+ * decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
+ call complete_type (TREE_TYPE (type)).
+
+ Backported from mainline
+ 2017-12-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/79650
+ * pt.c (convert_nontype_argument): Diagnose
+ reduced_constant_expression_p expressions that aren't INTEGER_CST.
+
+ 2017-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/80259
+ * decl2.c (grokfield): Diagnose = delete redefinition of a friend.
+
+ 2017-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81888
+ * parser.c (cp_parser_decomposition_declaration): Reject just
+ BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
+ than all such CONSTRUCTORs, and only if is_direct_init is true.
+
+ PR c++/81675
+ * cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
+ for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
+ INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
+ through into normal folding, otherwise just rebuild x if any op
+ changed.
+
+ 2017-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ * parser.c (cp_parser_omp_declare): Change return type to bool from
+ void, return true for declare simd.
+ (cp_parser_pragma): Return cp_parser_omp_declare returned value
+ rather than always false.
+
+ 2017-11-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82781
+ * constexpr.c (cxx_eval_vector_conditional_expression): New function.
+ (cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
+ of cxx_eval_conditional_expression.
+
2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/82085
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 41734c402ee..9082230b9d5 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1558,7 +1558,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
tree result = NULL_TREE;
constexpr_call *entry = NULL;
- if (depth_ok && !non_constant_args)
+ if (depth_ok && !non_constant_args && ctx->strict)
{
new_call.hash = iterative_hash_template_arg
(new_call.bindings, constexpr_fundef_hasher::hash (new_call.fundef));
@@ -2044,6 +2044,45 @@ cxx_eval_conditional_expression (const constexpr_ctx *ctx, tree t,
jump_target);
}
+/* Subroutine of cxx_eval_constant_expression.
+ Attempt to evaluate vector condition expressions. Unlike
+ cxx_eval_conditional_expression, VEC_COND_EXPR acts like a normal
+ ternary arithmetics operation, where all 3 arguments have to be
+ evaluated as constants and then folding computes the result from
+ them. */
+
+static tree
+cxx_eval_vector_conditional_expression (const constexpr_ctx *ctx, tree t,
+ bool *non_constant_p, bool *overflow_p)
+{
+ tree arg1 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
+ /*lval*/false,
+ non_constant_p, overflow_p);
+ VERIFY_CONSTANT (arg1);
+ tree arg2 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
+ /*lval*/false,
+ non_constant_p, overflow_p);
+ VERIFY_CONSTANT (arg2);
+ tree arg3 = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 2),
+ /*lval*/false,
+ non_constant_p, overflow_p);
+ VERIFY_CONSTANT (arg3);
+ location_t loc = EXPR_LOCATION (t);
+ tree type = TREE_TYPE (t);
+ tree r = fold_ternary_loc (loc, VEC_COND_EXPR, type, arg1, arg2, arg3);
+ if (r == NULL_TREE)
+ {
+ if (arg1 == TREE_OPERAND (t, 0)
+ && arg2 == TREE_OPERAND (t, 1)
+ && arg3 == TREE_OPERAND (t, 2))
+ r = t;
+ else
+ r = build3_loc (loc, VEC_COND_EXPR, type, arg1, arg2, arg3);
+ }
+ VERIFY_CONSTANT (r);
+ return r;
+}
+
/* Returns less than, equal to, or greater than zero if KEY is found to be
less than, to match, or to be greater than the constructor_elt's INDEX. */
@@ -4361,12 +4400,14 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
jump_target);
break;
}
- /* FALLTHRU */
- case VEC_COND_EXPR:
r = cxx_eval_conditional_expression (ctx, t, lval,
non_constant_p, overflow_p,
jump_target);
break;
+ case VEC_COND_EXPR:
+ r = cxx_eval_vector_conditional_expression (ctx, t, non_constant_p,
+ overflow_p);
+ break;
case CONSTRUCTOR:
if (TREE_CONSTANT (t))
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 7e7f3a2d101..b0e010e18ce 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -2278,13 +2278,6 @@ cp_fold (tree x)
case VEC_COND_EXPR:
case COND_EXPR:
-
- /* Don't bother folding a void condition, since it can't produce a
- constant value. Also, some statement-level uses of COND_EXPR leave
- one of the branches NULL, so folding would crash. */
- if (VOID_TYPE_P (TREE_TYPE (x)))
- return x;
-
loc = EXPR_LOCATION (x);
op0 = cp_fold_rvalue (TREE_OPERAND (x, 0));
op1 = cp_fold (TREE_OPERAND (x, 1));
@@ -2298,6 +2291,29 @@ cp_fold (tree x)
if (!VOID_TYPE_P (TREE_TYPE (op2)))
op2 = cp_truthvalue_conversion (op2);
}
+ else if (VOID_TYPE_P (TREE_TYPE (x)))
+ {
+ if (TREE_CODE (op0) == INTEGER_CST)
+ {
+ /* If the condition is constant, fold can fold away
+ the COND_EXPR. If some statement-level uses of COND_EXPR
+ have one of the branches NULL, avoid folding crash. */
+ if (!op1)
+ op1 = build_empty_stmt (loc);
+ if (!op2)
+ op2 = build_empty_stmt (loc);
+ }
+ else
+ {
+ /* Otherwise, don't bother folding a void condition, since
+ it can't produce a constant value. */
+ if (op0 != TREE_OPERAND (x, 0)
+ || op1 != TREE_OPERAND (x, 1)
+ || op2 != TREE_OPERAND (x, 2))
+ x = build3_loc (loc, code, TREE_TYPE (x), op0, op1, op2);
+ break;
+ }
+ }
if (op0 != TREE_OPERAND (x, 0)
|| op1 != TREE_OPERAND (x, 1)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 18bb8e7f2e4..fadf6ecb1a2 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5846,6 +5846,7 @@ extern void start_decl_1 (tree, bool);
extern bool check_array_initializer (tree, tree, tree);
extern void cp_finish_decl (tree, tree, bool, tree, int);
extern tree lookup_decomp_type (tree);
+extern void cp_maybe_mangle_decomp (tree, tree, unsigned int);
extern void cp_finish_decomp (tree, tree, unsigned int);
extern int cp_complete_array_type (tree *, tree, bool);
extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f2cd336146c..6bb7f6efe4f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7375,6 +7375,25 @@ lookup_decomp_type (tree v)
return *decomp_type_table->get (v);
}
+/* Mangle a decomposition declaration if needed. Arguments like
+ in cp_finish_decomp. */
+
+void
+cp_maybe_mangle_decomp (tree decl, tree first, unsigned int count)
+{
+ if (!processing_template_decl
+ && !error_operand_p (decl)
+ && DECL_NAMESPACE_SCOPE_P (decl))
+ {
+ auto_vec<tree, 16> v;
+ v.safe_grow (count);
+ tree d = first;
+ for (unsigned int i = 0; i < count; i++, d = DECL_CHAIN (d))
+ v[count - i - 1] = d;
+ SET_DECL_ASSEMBLER_NAME (decl, mangle_decomp (decl, v));
+ }
+}
+
/* Finish a decomposition declaration. DECL is the underlying declaration
"e", FIRST is the head of a chain of decls for the individual identifiers
chained through DECL_CHAIN in reverse order and COUNT is the number of
@@ -7444,7 +7463,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
if (TREE_CODE (type) == REFERENCE_TYPE)
{
dexp = convert_from_reference (dexp);
- type = TREE_TYPE (type);
+ type = complete_type (TREE_TYPE (type));
+ if (type == error_mark_node)
+ goto error_out;
}
tree eltype = NULL_TREE;
@@ -7465,11 +7486,20 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
{
cnt_mismatch:
if (count > eltscnt)
- error_at (loc, "%u names provided while %qT decomposes into "
- "%wu elements", count, type, eltscnt);
+ error_n (loc, count,
+ "%u name provided for structured binding",
+ "%u names provided for structured binding", count);
else
- error_at (loc, "only %u names provided while %qT decomposes into "
- "%wu elements", count, type, eltscnt);
+ error_n (loc, count,
+ "only %u name provided for structured binding",
+ "only %u names provided for structured binding", count);
+ /* Some languages have special plural rules even for large values,
+ but it is periodic with period of 10, 100, 1000 etc. */
+ inform_n (loc, eltscnt > INT_MAX
+ ? (eltscnt % 1000000) + 1000000 : eltscnt,
+ "while %qT decomposes into %wu element",
+ "while %qT decomposes into %wu elements",
+ type, eltscnt);
goto error_out;
}
eltype = TREE_TYPE (type);
@@ -7538,6 +7568,15 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
"constant expression", type);
goto error_out;
}
+ if (!tree_fits_uhwi_p (tsize))
+ {
+ error_n (loc, count,
+ "%u name provided for structured binding",
+ "%u names provided for structured binding", count);
+ inform (loc, "while %qT decomposes into %E elements",
+ type, tsize);
+ goto error_out;
+ }
eltscnt = tree_to_uhwi (tsize);
if (count != eltscnt)
goto cnt_mismatch;
@@ -7645,8 +7684,6 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
DECL_HAS_VALUE_EXPR_P (v[i]) = 1;
}
}
- else if (DECL_NAMESPACE_SCOPE_P (decl))
- SET_DECL_ASSEMBLER_NAME (decl, mangle_decomp (decl, v));
}
/* Returns a declaration for a VAR_DECL as if:
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fd5622b8cad..b1c3c30521f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -888,9 +888,18 @@ grokfield (const cp_declarator *declarator,
{
if (init == ridpointers[(int)RID_DELETE])
{
- DECL_DELETED_FN (value) = 1;
- DECL_DECLARED_INLINE_P (value) = 1;
- DECL_INITIAL (value) = error_mark_node;
+ if (friendp && decl_defined_p (value))
+ {
+ error ("redefinition of %q#D", value);
+ inform (DECL_SOURCE_LOCATION (value),
+ "%q#D previously defined here", value);
+ }
+ else
+ {
+ DECL_DELETED_FN (value) = 1;
+ DECL_DECLARED_INLINE_P (value) = 1;
+ DECL_INITIAL (value) = error_mark_node;
+ }
}
else if (init == ridpointers[(int)RID_DEFAULT])
{
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index c669cc4366a..b392c122604 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1247,6 +1247,51 @@ write_template_prefix (const tree node)
add_substitution (substitution);
}
+/* As the list of identifiers for the structured binding declaration
+ DECL is likely gone, try to recover the DC <source-name>+ E portion
+ from its mangled name. Return pointer to the DC and set len to
+ the length up to and including the terminating E. On failure
+ return NULL. */
+
+static const char *
+find_decomp_unqualified_name (tree decl, size_t *len)
+{
+ const char *p = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+ const char *end = p + IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (decl));
+ bool nested = false;
+ if (strncmp (p, "_Z", 2))
+ return NULL;
+ p += 2;
+ if (!strncmp (p, "St", 2))
+ p += 2;
+ else if (*p == 'N')
+ {
+ nested = true;
+ ++p;
+ while (ISDIGIT (p[0]))
+ {
+ char *e;
+ long num = strtol (p, &e, 10);
+ if (num >= 1 && num < end - e)
+ p = e + num;
+ else
+ break;
+ }
+ }
+ if (strncmp (p, "DC", 2))
+ return NULL;
+ if (nested)
+ {
+ if (end[-1] != 'E')
+ return NULL;
+ --end;
+ }
+ if (end[-1] != 'E')
+ return NULL;
+ *len = end - p;
+ return p;
+}
+
/* We don't need to handle thunks, vtables, or VTTs here. Those are
mangled through special entry points.
@@ -1316,7 +1361,17 @@ write_unqualified_name (tree decl)
{
found = true;
gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
- write_source_name (DECL_ASSEMBLER_NAME (decl));
+ const char *decomp_str = NULL;
+ size_t decomp_len = 0;
+ if (VAR_P (decl)
+ && DECL_DECOMPOSITION_P (decl)
+ && DECL_NAME (decl) == NULL_TREE
+ && DECL_NAMESPACE_SCOPE_P (decl))
+ decomp_str = find_decomp_unqualified_name (decl, &decomp_len);
+ if (decomp_str)
+ write_chars (decomp_str, decomp_len);
+ else
+ write_source_name (DECL_ASSEMBLER_NAME (decl));
}
else if (DECL_DECLARES_FUNCTION_P (decl))
{
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d2904e920b8..29aa76b5dab 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11735,6 +11735,9 @@ cp_convert_range_for (tree statement, tree range_decl, tree range_expr,
tf_warning_or_error);
finish_for_expr (expression, statement);
+ if (VAR_P (range_decl) && DECL_DECOMPOSITION_P (range_decl))
+ cp_maybe_mangle_decomp (range_decl, decomp_first_name, decomp_cnt);
+
/* The declaration is initialized with *__begin inside the loop body. */
cp_finish_decl (range_decl,
build_x_indirect_ref (input_location, begin, RO_NULL,
@@ -13048,7 +13051,8 @@ cp_parser_decomposition_declaration (cp_parser *parser,
if (initializer == NULL_TREE
|| (TREE_CODE (initializer) == TREE_LIST
&& TREE_CHAIN (initializer))
- || (TREE_CODE (initializer) == CONSTRUCTOR
+ || (is_direct_init
+ && BRACE_ENCLOSED_INITIALIZER_P (initializer)
&& CONSTRUCTOR_NELTS (initializer) != 1))
{
error_at (loc, "invalid initializer for structured binding "
@@ -13058,6 +13062,7 @@ cp_parser_decomposition_declaration (cp_parser *parser,
if (decl != error_mark_node)
{
+ cp_maybe_mangle_decomp (decl, prev, v.length ());
cp_finish_decl (decl, initializer, non_constant_p, NULL_TREE,
is_direct_init ? LOOKUP_NORMAL : LOOKUP_IMPLICIT);
cp_finish_decomp (decl, prev, v.length ());
@@ -37253,7 +37258,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
initializer-clause[opt] new-line
#pragma omp declare target new-line */
-static void
+static bool
cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
enum pragma_context context)
{
@@ -37267,7 +37272,7 @@ cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
cp_lexer_consume_token (parser->lexer);
cp_parser_omp_declare_simd (parser, pragma_tok,
context);
- return;
+ return true;
}
cp_ensure_no_omp_declare_simd (parser);
if (strcmp (p, "reduction") == 0)
@@ -37275,23 +37280,24 @@ cp_parser_omp_declare (cp_parser *parser, cp_token *pragma_tok,
cp_lexer_consume_token (parser->lexer);
cp_parser_omp_declare_reduction (parser, pragma_tok,
context);
- return;
+ return false;
}
if (!flag_openmp) /* flag_openmp_simd */
{
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
- return;
+ return false;
}
if (strcmp (p, "target") == 0)
{
cp_lexer_consume_token (parser->lexer);
cp_parser_omp_declare_target (parser, pragma_tok);
- return;
+ return false;
}
}
cp_parser_error (parser, "expected %<simd%> or %<reduction%> "
"or %<target%>");
cp_parser_require_pragma_eol (parser, pragma_tok);
+ return false;
}
/* OpenMP 4.5:
@@ -38211,8 +38217,7 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context, bool *if_p)
return false;
case PRAGMA_OMP_DECLARE:
- cp_parser_omp_declare (parser, pragma_tok, context);
- return false;
+ return cp_parser_omp_declare (parser, pragma_tok, context);
case PRAGMA_OACC_DECLARE:
cp_parser_oacc_declare (parser, pragma_tok);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 39ed0866229..61fe2a3a14d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6523,7 +6523,20 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
return NULL_TREE;
/* else cxx_constant_value complained but gave us
a real constant, so go ahead. */
- gcc_assert (TREE_CODE (expr) == INTEGER_CST);
+ if (TREE_CODE (expr) != INTEGER_CST)
+ {
+ /* Some assemble time constant expressions like
+ (intptr_t)&&lab1 - (intptr_t)&&lab2 or
+ 4 + (intptr_t)&&var satisfy reduced_constant_expression_p
+ as we can emit them into .rodata initializers of
+ variables, yet they can't fold into an INTEGER_CST at
+ compile time. Refuse them here. */
+ gcc_checking_assert (reduced_constant_expression_p (expr));
+ location_t loc = EXPR_LOC_OR_LOC (expr, input_location);
+ error_at (loc, "template argument %qE for type %qT not "
+ "a constant integer", expr, type);
+ return NULL_TREE;
+ }
}
else
return NULL_TREE;
@@ -15923,19 +15936,23 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
if (VAR_P (decl))
const_init = (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P
(pattern_decl));
- cp_finish_decl (decl, init, const_init, NULL_TREE, 0);
if (VAR_P (decl)
&& DECL_DECOMPOSITION_P (decl)
&& TREE_TYPE (pattern_decl) != error_mark_node)
{
unsigned int cnt;
tree first;
- decl = tsubst_decomp_names (decl, pattern_decl, args,
- complain, in_decl, &first,
- &cnt);
- if (decl != error_mark_node)
- cp_finish_decomp (decl, first, cnt);
+ tree ndecl
+ = tsubst_decomp_names (decl, pattern_decl, args,
+ complain, in_decl, &first, &cnt);
+ if (ndecl != error_mark_node)
+ cp_maybe_mangle_decomp (ndecl, first, cnt);
+ cp_finish_decl (decl, init, const_init, NULL_TREE, 0);
+ if (ndecl != error_mark_node)
+ cp_finish_decomp (ndecl, first, cnt);
}
+ else
+ cp_finish_decl (decl, init, const_init, NULL_TREE, 0);
}
}
}
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a5f7f44200c..6501f127d7c 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2804,6 +2804,11 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
{
constructor_elt *ce;
vec<constructor_elt,va_gc> *v = CONSTRUCTOR_ELTS (*t);
+ if (d->pset->add (*t))
+ {
+ *walk_subtrees = false;
+ return NULL_TREE;
+ }
for (unsigned i = 0; vec_safe_iterate (v, i, &ce); ++i)
{
tree *valp = &ce->value;
@@ -2823,7 +2828,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
valp = &TARGET_EXPR_INITIAL (*valp);
}
d->obj = subob;
- cp_walk_tree (valp, replace_placeholders_r, data_, d->pset);
+ cp_walk_tree (valp, replace_placeholders_r, data_, NULL);
d->obj = obj;
}
*walk_subtrees = false;
@@ -2831,6 +2836,8 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
}
default:
+ if (d->pset->add (*t))
+ *walk_subtrees = false;
break;
}
@@ -2859,7 +2866,7 @@ replace_placeholders (tree exp, tree obj, bool *seen_p)
replace_placeholders_t data = { obj, false, &pset };
if (TREE_CODE (exp) == TARGET_EXPR)
tp = &TARGET_EXPR_INITIAL (exp);
- cp_walk_tree (tp, replace_placeholders_r, &data, &pset);
+ cp_walk_tree (tp, replace_placeholders_r, &data, NULL);
if (seen_p)
*seen_p = data.seen;
return exp;
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 706aa6cf0b0..88b8d6d9071 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -328,6 +328,13 @@ handlers, respectively. Given @samp{-a} option, unexecuted blocks are
marked @samp{$$$$$} or @samp{%%%%%}, depending on whether a basic block
is reachable via non-exceptional or exceptional paths.
+Note that GCC can completely remove the bodies of functions that are
+not needed -- for instance if they are inlined everywhere. Such functions
+are marked with @samp{-}, which can be confusing.
+Use the @option{-fkeep-inline-functions} and @option{-fkeep-static-functions}
+options to retain these functions and
+allow gcov to properly show their @var{execution_count}.
+
Some lines of information at the start have @var{line_number} of zero.
These preamble lines are of the form
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e66b3cd7552..6c8eadc9574 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -965,7 +965,6 @@ See RS/6000 and PowerPC Options.
@emph{RISC-V Options}
@gccoptlist{-mbranch-cost=@var{N-instruction} @gol
--mmemcpy -mno-memcpy @gol
-mplt -mno-plt @gol
-mabi=@var{ABI-string} @gol
-mfdiv -mno-fdiv @gol
@@ -974,7 +973,8 @@ See RS/6000 and PowerPC Options.
-mtune=@var{processor-string} @gol
-msmall-data-limit=@var{N-bytes} @gol
-msave-restore -mno-save-restore @gol
--mcmodel=@var{code-model} @gol
+-mstrict-align -mno-strict-align @gol
+-mcmodel=medlow -mcmodel=medany @gol
-mexplicit-relocs -mno-explicit-relocs @gol}
@emph{RL78 Options}
@@ -10647,9 +10647,9 @@ Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
Run the program on a representative workload to generate the arc profile
information. This may be repeated any number of times. You can run
concurrent instances of your program, and provided that the file system
-supports locking, the data files will be correctly updated. Also
-@code{fork} calls are detected and correctly handled (double counting
-will not happen).
+supports locking, the data files will be correctly updated. Unless
+a strict ISO C dialect option is in effect, @code{fork} calls are
+detected and correctly handled without double counting.
@item
For profile-directed optimizations, compile the source files again with
@@ -20892,32 +20892,46 @@ These command-line options are defined for RISC-V targets:
@opindex mbranch-cost
Set the cost of branches to roughly @var{n} instructions.
-@item -mmemcpy
-@itemx -mno-memcpy
-@opindex mmemcpy
-Don't optimize block moves.
-
@item -mplt
@itemx -mno-plt
@opindex plt
-When generating PIC code, allow the use of PLTs. Ignored for non-PIC.
+When generating PIC code, do or don't allow the use of PLTs. Ignored for
+non-PIC. The default is @option{-mplt}.
@item -mabi=@var{ABI-string}
@opindex mabi
-Specify integer and floating-point calling convention. This defaults to the
-natural calling convention: e.g.@ LP64 for RV64I, ILP32 for RV32I, LP64D for
-RV64G.
+Specify integer and floating-point calling convention. @var{ABI-string}
+contains two parts: the size of integer types and the registers used for
+floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
+@samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
+32-bit), and that floating-point values up to 64 bits wide are passed in F
+registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
+allows the compiler to generate code that uses the F and D extensions but only
+allows floating-point values up to 32 bits long to be passed in registers; or
+@samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
+passed in registers.
+
+The default for this argument is system dependent, users who want a specific
+calling convention should specify one explicitly. The valid calling
+conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
+@samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
+implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
+invalid because the ABI requires 64-bit values be passed in F registers, but F
+registers are only 32 bits wide.
@item -mfdiv
@itemx -mno-fdiv
@opindex mfdiv
-Use hardware floating-point divide and square root instructions. This requires
-the F or D extensions for floating-point registers.
+Do or don't use hardware floating-point divide and square root instructions.
+This requires the F or D extensions for floating-point registers. The default
+is to use them if the specified architecture has these instructions.
@item -mdiv
@itemx -mno-div
@opindex mdiv
-Use hardware instructions for integer division. This requires the M extension.
+Do or don't use hardware instructions for integer division. This requires the
+M extension. The default is to use them if the specified architecture has
+these instructions.
@item -march=@var{ISA-string}
@opindex march
@@ -20937,11 +20951,35 @@ Put global and static data smaller than @var{n} bytes into a special section
@item -msave-restore
@itemx -mno-save-restore
@opindex msave-restore
-Use smaller but slower prologue and epilogue code.
+Do or don't use smaller but slower prologue and epilogue code that uses
+library function calls. The default is to use fast inline prologues and
+epilogues.
-@item -mcmodel=@var{code-model}
-@opindex mcmodel
-Specify the code model.
+@item -mstrict-align
+@itemx -mno-strict-align
+@opindex mstrict-align
+Do not or do generate unaligned memory accesses. The default is set depending
+on whether the processor we are optimizing for supports fast unaligned access
+or not.
+
+@item -mcmodel=medlow
+@opindex mcmodel=medlow
+Generate code for the medium-low code model. The program and its statically
+defined symbols must lie within a single 2 GiB address range and must lie
+between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
+statically or dynamically linked. This is the default code model.
+
+@item -mcmodel=medany
+@opindex mcmodel=medany
+Generate code for the medium-any code model. The program and its statically
+defined symbols must be within any single 2 GiB address range. Programs can be
+statically or dynamically linked.
+
+@item -mexplicit-relocs
+@itemx -mno-exlicit-relocs
+Use or do not use assembler relocation operators when dealing with symbolic
+addresses. The alternative is to use assembler macros instead, which may
+limit optimization.
@end table
diff --git a/gcc/expmed.c b/gcc/expmed.c
index c0260c53853..e9f634aa27d 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2331,9 +2331,8 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted,
&& CONST_INT_P (op1)
&& INTVAL (op1) == BITS_PER_UNIT
&& GET_MODE_SIZE (scalar_mode) == 2
- && optab_handler (bswap_optab, HImode) != CODE_FOR_nothing)
- return expand_unop (HImode, bswap_optab, shifted, NULL_RTX,
- unsignedp);
+ && optab_handler (bswap_optab, mode) != CODE_FOR_nothing)
+ return expand_unop (mode, bswap_optab, shifted, NULL_RTX, unsignedp);
if (op1 == const0_rtx)
return shifted;
diff --git a/gcc/expr.c b/gcc/expr.c
index 461f94ba2d7..c09bfbbc4d8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5104,7 +5104,8 @@ expand_assignment (tree to, tree from, bool nontemporal)
else if (GET_CODE (to_rtx) == CONCAT)
{
unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx));
- if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))
+ if (TYPE_MODE (TREE_TYPE (from)) == GET_MODE (to_rtx)
+ && COMPLEX_MODE_P (GET_MODE (to_rtx))
&& bitpos == 0
&& bitsize == mode_bitsize)
result = store_expr (from, to_rtx, false, nontemporal, reversep);
@@ -5125,17 +5126,56 @@ expand_assignment (tree to, tree from, bool nontemporal)
nontemporal, reversep);
else if (bitpos == 0 && bitsize == mode_bitsize)
{
- rtx from_rtx;
result = expand_normal (from);
- from_rtx = simplify_gen_subreg (GET_MODE (to_rtx), result,
- TYPE_MODE (TREE_TYPE (from)), 0);
- emit_move_insn (XEXP (to_rtx, 0),
- read_complex_part (from_rtx, false));
- emit_move_insn (XEXP (to_rtx, 1),
- read_complex_part (from_rtx, true));
+ if (GET_CODE (result) == CONCAT)
+ {
+ machine_mode to_mode = GET_MODE_INNER (GET_MODE (to_rtx));
+ machine_mode from_mode = GET_MODE_INNER (GET_MODE (result));
+ rtx from_real
+ = simplify_gen_subreg (to_mode, XEXP (result, 0),
+ from_mode, 0);
+ rtx from_imag
+ = simplify_gen_subreg (to_mode, XEXP (result, 1),
+ from_mode, 0);
+ if (!from_real || !from_imag)
+ goto concat_store_slow;
+ emit_move_insn (XEXP (to_rtx, 0), from_real);
+ emit_move_insn (XEXP (to_rtx, 1), from_imag);
+ }
+ else
+ {
+ rtx from_rtx
+ = simplify_gen_subreg (GET_MODE (to_rtx), result,
+ TYPE_MODE (TREE_TYPE (from)), 0);
+ if (from_rtx)
+ {
+ emit_move_insn (XEXP (to_rtx, 0),
+ read_complex_part (from_rtx, false));
+ emit_move_insn (XEXP (to_rtx, 1),
+ read_complex_part (from_rtx, true));
+ }
+ else
+ {
+ machine_mode to_mode
+ = GET_MODE_INNER (GET_MODE (to_rtx));
+ rtx from_real
+ = simplify_gen_subreg (to_mode, result,
+ TYPE_MODE (TREE_TYPE (from)),
+ 0);
+ rtx from_imag
+ = simplify_gen_subreg (to_mode, result,
+ TYPE_MODE (TREE_TYPE (from)),
+ GET_MODE_SIZE (to_mode));
+ if (!from_real || !from_imag)
+ goto concat_store_slow;
+ emit_move_insn (XEXP (to_rtx, 0), from_real);
+ emit_move_insn (XEXP (to_rtx, 1), from_imag);
+ }
+ }
}
else
{
+ concat_store_slow:;
rtx temp = assign_stack_temp (GET_MODE (to_rtx),
GET_MODE_SIZE (GET_MODE (to_rtx)));
write_complex_part (temp, XEXP (to_rtx, 0), false);
@@ -5575,8 +5615,21 @@ store_expr_with_bounds (tree exp, rtx target, int call_param_p,
if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode
&& TREE_CODE (exp) != ERROR_MARK
&& GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
- temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
- temp, TYPE_UNSIGNED (TREE_TYPE (exp)));
+ {
+ if (GET_MODE_CLASS (GET_MODE (target))
+ != GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (exp)))
+ && GET_MODE_BITSIZE (GET_MODE (target))
+ == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (exp))))
+ {
+ rtx t = simplify_gen_subreg (GET_MODE (target), temp,
+ TYPE_MODE (TREE_TYPE (exp)), 0);
+ if (t)
+ temp = t;
+ }
+ if (GET_MODE (temp) == VOIDmode)
+ temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
+ temp, TYPE_UNSIGNED (TREE_TYPE (exp)));
+ }
/* If value was not generated in the target, store it there.
Convert the value to TARGET's type first if necessary and emit the
@@ -6998,7 +7051,16 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
size. */
mode = TYPE_MODE (DECL_BIT_FIELD_TYPE (field));
else if (!DECL_BIT_FIELD (field))
- mode = DECL_MODE (field);
+ {
+ mode = DECL_MODE (field);
+ /* For vector fields re-check the target flags, as DECL_MODE
+ could have been set with different target flags than
+ the current function has. */
+ if (mode == BLKmode
+ && VECTOR_TYPE_P (TREE_TYPE (field))
+ && VECTOR_MODE_P (TYPE_MODE_RAW (TREE_TYPE (field))))
+ mode = TYPE_MODE (TREE_TYPE (field));
+ }
else if (DECL_MODE (field) == BLKmode)
blkmode_bitfield = true;
diff --git a/gcc/file-find.c b/gcc/file-find.c
index b072a4993d7..b5a1fe8494e 100644
--- a/gcc/file-find.c
+++ b/gcc/file-find.c
@@ -208,38 +208,3 @@ prefix_from_string (const char *p, struct path_prefix *pprefix)
}
free (nstore);
}
-
-void
-remove_prefix (const char *prefix, struct path_prefix *pprefix)
-{
- struct prefix_list *remove, **prev, **remove_prev = NULL;
- int max_len = 0;
-
- if (pprefix->plist)
- {
- prev = &pprefix->plist;
- for (struct prefix_list *pl = pprefix->plist; pl->next; pl = pl->next)
- {
- if (strcmp (prefix, pl->prefix) == 0)
- {
- remove = pl;
- remove_prev = prev;
- continue;
- }
-
- int l = strlen (pl->prefix);
- if (l > max_len)
- max_len = l;
-
- prev = &pl;
- }
-
- if (remove_prev)
- {
- *remove_prev = remove->next;
- free (remove);
- }
-
- pprefix->max_len = max_len;
- }
-}
diff --git a/gcc/file-find.h b/gcc/file-find.h
index 8f49a3af273..407feba26e7 100644
--- a/gcc/file-find.h
+++ b/gcc/file-find.h
@@ -41,7 +41,6 @@ extern void find_file_set_debug (bool);
extern char *find_a_file (struct path_prefix *, const char *, int);
extern void add_prefix (struct path_prefix *, const char *);
extern void add_prefix_begin (struct path_prefix *, const char *);
-extern void remove_prefix (const char *prefix, struct path_prefix *);
extern void prefix_from_env (const char *, struct path_prefix *);
extern void prefix_from_string (const char *, struct path_prefix *);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index aa6490a18f3..8152ccfda53 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9123,8 +9123,8 @@ expr_not_equal_to (tree t, const wide_int &w)
return NULL_TREE. */
tree
-fold_binary_loc (location_t loc,
- enum tree_code code, tree type, tree op0, tree op1)
+fold_binary_loc (location_t loc, enum tree_code code, tree type,
+ tree op0, tree op1)
{
enum tree_code_class kind = TREE_CODE_CLASS (code);
tree arg0, arg1, tem;
@@ -9728,10 +9728,17 @@ fold_binary_loc (location_t loc,
case MINUS_EXPR:
/* (-A) - B -> (-B) - A where B is easily negated and we can swap. */
if (TREE_CODE (arg0) == NEGATE_EXPR
- && negate_expr_p (op1))
- return fold_build2_loc (loc, MINUS_EXPR, type,
- negate_expr (op1),
- fold_convert_loc (loc, type,
+ && negate_expr_p (op1)
+ /* If arg0 is e.g. unsigned int and type is int, then this could
+ introduce UB, because if A is INT_MIN at runtime, the original
+ expression can be well defined while the latter is not.
+ See PR83269. */
+ && !(ANY_INTEGRAL_TYPE_P (type)
+ && TYPE_OVERFLOW_UNDEFINED (type)
+ && ANY_INTEGRAL_TYPE_P (TREE_TYPE (arg0))
+ && !TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0))))
+ return fold_build2_loc (loc, MINUS_EXPR, type, negate_expr (op1),
+ fold_convert_loc (loc, type,
TREE_OPERAND (arg0, 0)));
/* Fold __complex__ ( x, 0 ) - __complex__ ( 0, y ) to
@@ -11237,22 +11244,48 @@ fold_binary_loc (location_t loc,
} /* switch (code) */
}
+/* Used by contains_label_[p1]. */
+
+struct contains_label_data
+{
+ hash_set<tree> *pset;
+ bool inside_switch_p;
+};
+
/* Callback for walk_tree, looking for LABEL_EXPR. Return *TP if it is
- a LABEL_EXPR; otherwise return NULL_TREE. Do not check the subtrees
- of GOTO_EXPR. */
+ a LABEL_EXPR or CASE_LABEL_EXPR not inside of another SWITCH_EXPR; otherwise
+ return NULL_TREE. Do not check the subtrees of GOTO_EXPR. */
static tree
-contains_label_1 (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
+contains_label_1 (tree *tp, int *walk_subtrees, void *data)
{
+ contains_label_data *d = (contains_label_data *) data;
switch (TREE_CODE (*tp))
{
case LABEL_EXPR:
return *tp;
+ case CASE_LABEL_EXPR:
+ if (!d->inside_switch_p)
+ return *tp;
+ return NULL_TREE;
+
+ case SWITCH_EXPR:
+ if (!d->inside_switch_p)
+ {
+ if (walk_tree (&SWITCH_COND (*tp), contains_label_1, data, d->pset))
+ return *tp;
+ d->inside_switch_p = true;
+ if (walk_tree (&SWITCH_BODY (*tp), contains_label_1, data, d->pset))
+ return *tp;
+ d->inside_switch_p = false;
+ *walk_subtrees = 0;
+ }
+ return NULL_TREE;
+
case GOTO_EXPR:
*walk_subtrees = 0;
-
- /* fall through */
+ return NULL_TREE;
default:
return NULL_TREE;
@@ -11265,8 +11298,9 @@ contains_label_1 (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
static bool
contains_label_p (tree st)
{
- return
- (walk_tree_without_duplicates (&st, contains_label_1 , NULL) != NULL_TREE);
+ hash_set<tree> pset;
+ contains_label_data data = { &pset, false };
+ return walk_tree (&st, contains_label_1, &data, &pset) != NULL_TREE;
}
/* Fold a ternary expression of code CODE and type TYPE with operands
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b2d17d301e2..0d1607d2ddd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,87 @@
+2012-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/78814
+ * interface.c (symbol_rank): Check for NULL pointer.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/82367
+ * resolve.c (resolve_allocate_expr): Check for NULL pointer.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/83093
+ * resolve.c (resolve_charlen): Check the type of cl->length
+ after resolution.
+
+2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
+
+ Backport r254555 from trunk
+ PR Fortran/82841
+ * simplify.c(gfc_simplify_transfer): Do not dereference a NULL pointer.
+ Unwrap a short line.
+
+2018-01-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR Fortran/83679
+ * simplify.c (gfc_simplify_cshift): Restore early return for zero-sized
+ array. Update Copyright year while here.
+
+2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83650
+ * simplify.c (gfc_simplify_cshift): Correct contition for
+ negative shifts.
+
+2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR Fortran/83548
+ * match.c (gfc_match_type_spec): Check for LOGICAL conflict in
+ type-spec versus LOGICAL intrinsic subprogram.
+
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/81304
+ * trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Set
+ attr.implicit_type in intrinsic_sym to avoid undesirable warning.
+
+ 2017-11-23 Dirk Broemmel <d.broemmel@fz-juelich.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/81841
+ * parse.c (parse_spec): Allow ST_OMP_THREADPRIVATE inside of
+ BLOCK DATA.
+
+2017-11-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83021
+ * resolve.c (resolve_component): Only escape for use assciated
+ vtypes if the current namespace has no proc_name and is most
+ particularly block data.
+
+2017-11-23 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk
+ PR fortran/79072
+ * trans-expr.c (trans_class_vptr_len_assignment): Set from_len
+ if the temporary is unlimited polymorphic.
+ * trans-stmt.c (trans_associate_var): Use the fake result decl
+ to obtain the 'len' field from an explicit function result when
+ in that function scope.
+
+2017-11-21 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk fix for PR82586
+ PR fortran/78686
+ * resolve.c (resolve_generic_f): Check usage of derived type by
+ calling gfc_use_derived.
+
2017-11-13 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 6fe0647ecfe..2e5732a8810 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1261,8 +1261,13 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
static int
symbol_rank (gfc_symbol *sym)
{
- gfc_array_spec *as;
- as = (sym->ts.type == BT_CLASS) ? CLASS_DATA (sym)->as : sym->as;
+ gfc_array_spec *as = NULL;
+
+ if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
+ as = CLASS_DATA (sym)->as;
+ else
+ as = sym->as;
+
return as ? as->rank : 0;
}
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 1c23cc3b22a..78fd6a4ba11 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2052,27 +2052,31 @@ gfc_match_type_spec (gfc_typespec *ts)
return m;
}
- if (gfc_match ("logical") == MATCH_YES)
- {
- ts->type = BT_LOGICAL;
- ts->kind = gfc_default_logical_kind;
- goto kind_selector;
- }
-
/* REAL is a real pain because it can be a type, intrinsic subprogram,
or list item in a type-list of an OpenMP reduction clause. Need to
differentiate REAL([KIND]=scalar-int-initialization-expr) from
- REAL(A,[KIND]) and REAL(KIND,A). */
+ REAL(A,[KIND]) and REAL(KIND,A). Logically, when this code was
+ written the use of LOGICAL as a type-spec or intrinsic subprogram
+ was overlooked. */
m = gfc_match (" %n", name);
- if (m == MATCH_YES && strcmp (name, "real") == 0)
+ if (m == MATCH_YES
+ && (strcmp (name, "real") == 0 || strcmp (name, "logical") == 0))
{
char c;
gfc_expr *e;
locus where;
- ts->type = BT_REAL;
- ts->kind = gfc_default_real_kind;
+ if (*name == 'r')
+ {
+ ts->type = BT_REAL;
+ ts->kind = gfc_default_real_kind;
+ }
+ else
+ {
+ ts->type = BT_LOGICAL;
+ ts->kind = gfc_default_logical_kind;
+ }
gfc_gobble_whitespace ();
@@ -2104,7 +2108,7 @@ gfc_match_type_spec (gfc_typespec *ts)
c = gfc_next_char ();
if (c == '=')
{
- if (strcmp(name, "a") == 0)
+ if (strcmp(name, "a") == 0 || strcmp(name, "l") == 0)
return MATCH_NO;
else if (strcmp(name, "kind") == 0)
goto found;
@@ -2144,7 +2148,7 @@ found:
gfc_next_char (); /* Burn the ')'. */
ts->kind = (int) mpz_get_si (e->value.integer);
- if (gfc_validate_kind (BT_REAL, ts->kind , true) == -1)
+ if (gfc_validate_kind (ts->type, ts->kind , true) == -1)
{
gfc_error ("Invalid type-spec at %C");
return MATCH_ERROR;
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 305a036a71e..3aedb1d93bf 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -3694,6 +3694,7 @@ loop:
case ST_EQUIVALENCE:
case ST_IMPLICIT:
case ST_IMPLICIT_NONE:
+ case ST_OMP_THREADPRIVATE:
case ST_PARAMETER:
case ST_STRUCTURE_DECL:
case ST_TYPE:
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index c6bbcda58fc..8e7babfe9e9 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2591,6 +2591,8 @@ generic:
if (!gfc_convert_to_structure_constructor (expr, intr->sym, NULL,
NULL, false))
return false;
+ if (!gfc_use_derived (expr->ts.u.derived))
+ return false;
return resolve_structure_cons (expr, 0);
}
@@ -7285,8 +7287,13 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec)
if (code->ext.alloc.ts.type == BT_CHARACTER && !e->ts.deferred
&& !UNLIMITED_POLY (e))
{
- int cmp = gfc_dep_compare_expr (e->ts.u.cl->length,
- code->ext.alloc.ts.u.cl->length);
+ int cmp;
+
+ if (!e->ts.u.cl->length)
+ goto failure;
+
+ cmp = gfc_dep_compare_expr (e->ts.u.cl->length,
+ code->ext.alloc.ts.u.cl->length);
if (cmp == 1 || cmp == -1 || cmp == -3)
{
gfc_error ("Allocating %s at %L with type-spec requires the same "
@@ -11456,10 +11463,17 @@ resolve_charlen (gfc_charlen *cl)
specification_expr = saved_specification_expr;
return false;
}
+
+ /* cl->length has been resolved. It should have an integer type. */
+ if (cl->length && cl->length->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Scalar INTEGER expression expected at %L",
+ &cl->length->where);
+ return false;
+ }
}
else
{
-
if (!resolve_index_expr (cl->length))
{
specification_expr = saved_specification_expr;
@@ -13299,7 +13313,11 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
if (c->attr.artificial)
return true;
- if (sym->attr.vtype && sym->attr.use_assoc)
+ /* Do not allow vtype components to be resolved in nameless namespaces
+ such as block data because the procedure pointers will cause ICEs
+ and vtables are not needed in these contexts. */
+ if (sym->attr.vtype && sym->attr.use_assoc
+ && sym->ns->proc_name == NULL)
return true;
/* F2008, C442. */
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 169aef1d892..a9d8c7534b8 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -1,5 +1,5 @@
/* Simplify intrinsic functions at compile-time.
- Copyright (C) 2000-2017 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
Contributed by Andy Vaught & Katherine Holcomb
This file is part of GCC.
@@ -1990,11 +1990,17 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
sz = mpz_get_si (size);
mpz_clear (size);
+ /* Special case: Zero-sized array. */
+ if (sz == 0)
+ return a;
+
/* Adjust shft to deal with right or left shifts. */
- shft = shft < 0 ? 1 - shft : shft;
+ shft = shft % sz;
+ if (shft < 0)
+ shft += sz;
/* Special case: Shift to the original order! */
- if (sz == 0 || shft % sz == 0)
+ if (shft % sz == 0)
return a;
result = gfc_copy_expr (a);
@@ -6571,8 +6577,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
return NULL;
/* Calculate the size of the source. */
- if (source->expr_type == EXPR_ARRAY
- && !gfc_array_size (source, &tmp))
+ if (source->expr_type == EXPR_ARRAY && !gfc_array_size (source, &tmp))
gfc_internal_error ("Failure getting length of a constant array.");
/* Create an empty new expression with the appropriate characteristics. */
@@ -6580,7 +6585,7 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
&source->where);
result->ts = mold->ts;
- mold_element = mold->expr_type == EXPR_ARRAY
+ mold_element = (mold->expr_type == EXPR_ARRAY && mold->value.constructor)
? gfc_constructor_first (mold->value.constructor)->expr
: mold;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b9ca5257713..b022704e7fd 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -8113,6 +8113,8 @@ trans_class_vptr_len_assignment (stmtblock_t *block, gfc_expr * le,
{
vptr_expr = NULL;
se.expr = gfc_class_vptr_get (rse->expr);
+ if (UNLIMITED_POLY (re))
+ from_len = gfc_class_len_get (rse->expr);
}
else if (re->expr_type != EXPR_NULL)
/* Only when rhs is non-NULL use its declared type for vptr
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index bf96b695778..4cef0b2be6e 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1623,6 +1623,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where)
intrinsic_sym.attr.referenced = 1;
intrinsic_sym.attr.intrinsic = 1;
intrinsic_sym.attr.function = 1;
+ intrinsic_sym.attr.implicit_type = 1;
intrinsic_sym.result = &intrinsic_sym;
intrinsic_sym.declared_at = where;
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index fd4dbd3ce9e..79ec6c2e13b 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1774,6 +1774,13 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
gcc_assert (!e->symtree->n.sym->ts.deferred);
tmp = e->symtree->n.sym->ts.u.cl->backend_decl;
}
+ else if (e->expr_type == EXPR_VARIABLE
+ && e->symtree->n.sym->attr.function
+ && e->symtree->n.sym == e->symtree->n.sym->result)
+ {
+ tmp = gfc_get_fake_result_decl (e->symtree->n.sym, 0);
+ tmp = gfc_class_len_get (tmp);
+ }
else
tmp = gfc_class_len_get (gfc_get_symbol_decl (e->symtree->n.sym));
gfc_get_symbol_decl (sym);
diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c
index 78d2fc1ad30..d5d80e042e5 100644
--- a/gcc/gcc-ar.c
+++ b/gcc/gcc-ar.c
@@ -194,14 +194,6 @@ main (int ac, char **av)
#ifdef CROSS_DIRECTORY_STRUCTURE
real_exe_name = concat (target_machine, "-", PERSONALITY, NULL);
#endif
- /* Do not search original location in the same folder. */
- char *exe_folder = lrealpath (av[0]);
- exe_folder[strlen (exe_folder) - strlen (lbasename (exe_folder))] = '\0';
- char *location = concat (exe_folder, PERSONALITY, NULL);
-
- if (access (location, X_OK) == 0)
- remove_prefix (exe_folder, &path);
-
exe_name = find_a_file (&path, real_exe_name, X_OK);
if (!exe_name)
{
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 1aef94ec91f..da994c2faea 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -92,11 +92,6 @@ along with GCC; see the file COPYING3. If not see
4: Object marks as well. */
#define GGC_DEBUG_LEVEL (0)
-#ifndef HOST_BITS_PER_PTR
-#define HOST_BITS_PER_PTR HOST_BITS_PER_LONG
-#endif
-
-
/* A two-level tree is used to look up the page-entry for a given
pointer. Two chunks of the pointer's bits are extracted to index
the first and second levels of the tree, as follows:
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index d971d294040..8b4e9620515 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -3759,24 +3759,18 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
tree fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
gimple *new_stmt = gimple_build_call (fndecl, 0);
gimple_set_location (new_stmt, gimple_location (stmt));
+ /* If the call had a SSA name as lhs morph that into
+ an uninitialized value. */
if (lhs && TREE_CODE (lhs) == SSA_NAME)
{
tree var = create_tmp_var (TREE_TYPE (lhs));
- tree def = get_or_create_ssa_default_def (cfun, var);
-
- /* To satisfy condition for
- cgraph_update_edges_for_call_stmt_node,
- we need to preserve GIMPLE_CALL statement
- at position of GSI iterator. */
- update_call_from_tree (gsi, def);
- gsi_insert_before (gsi, new_stmt, GSI_NEW_STMT);
- }
- else
- {
- gimple_set_vuse (new_stmt, gimple_vuse (stmt));
- gimple_set_vdef (new_stmt, gimple_vdef (stmt));
- gsi_replace (gsi, new_stmt, false);
+ SET_SSA_NAME_VAR_OR_IDENTIFIER (lhs, var);
+ SSA_NAME_DEF_STMT (lhs) = gimple_build_nop ();
+ set_ssa_default_def (cfun, var, lhs);
}
+ gimple_set_vuse (new_stmt, gimple_vuse (stmt));
+ gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+ gsi_replace (gsi, new_stmt, false);
return true;
}
}
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index d3771ddcc67..28b672133ec 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1717,6 +1717,8 @@ static fmtresult
format_floating (const directive &dir, tree arg)
{
HOST_WIDE_INT prec[] = { dir.prec[0], dir.prec[1] };
+ tree type = (dir.modifier == FMT_LEN_L || dir.modifier == FMT_LEN_ll
+ ? long_double_type_node : double_type_node);
/* For an indeterminate precision the lower bound must be assumed
to be zero. */
@@ -1724,10 +1726,6 @@ format_floating (const directive &dir, tree arg)
{
/* Get the number of fractional decimal digits needed to represent
the argument without a loss of accuracy. */
- tree type = arg ? TREE_TYPE (arg) :
- (dir.modifier == FMT_LEN_L || dir.modifier == FMT_LEN_ll
- ? long_double_type_node : double_type_node);
-
unsigned fmtprec
= REAL_MODE_FORMAT (TYPE_MODE (type))->p;
@@ -1778,7 +1776,9 @@ format_floating (const directive &dir, tree arg)
}
}
- if (!arg || TREE_CODE (arg) != REAL_CST)
+ if (!arg
+ || TREE_CODE (arg) != REAL_CST
+ || !useless_type_conversion_p (type, TREE_TYPE (arg)))
return format_floating (dir, prec);
/* The minimum and maximum number of bytes produced by the directive. */
@@ -2294,7 +2294,8 @@ maybe_warn (substring_loc &dirloc, source_range *pargrange,
/* For plain character directives (i.e., the format string itself)
but not others, point the caret at the first character that's
past the end of the destination. */
- dirloc.set_caret_index (dirloc.get_caret_idx () + navail);
+ if (navail < dir.len)
+ dirloc.set_caret_index (dirloc.get_caret_idx () + navail);
}
if (*dir.beg == '\0')
@@ -2423,7 +2424,8 @@ maybe_warn (substring_loc &dirloc, source_range *pargrange,
/* For plain character directives (i.e., the format string itself)
but not others, point the caret at the first character that's
past the end of the destination. */
- dirloc.set_caret_index (dirloc.get_caret_idx () + navail);
+ if (navail < dir.len)
+ dirloc.set_caret_index (dirloc.get_caret_idx () + navail);
}
if (*dir.beg == '\0')
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index e23aae91094..5264a4f3d40 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2212,8 +2212,10 @@ expand_FALLTHROUGH_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
break;
}
}
+ else if (gimple_call_internal_p (stmt, IFN_ASAN_MARK))
+ ;
else
- /* Something other than a label. That's not expected. */
+ /* Something other is not expected. */
break;
gsi_next (&gsi2);
}
diff --git a/gcc/hwint.h b/gcc/hwint.h
index 2a61e3c9be6..e5fa33fc602 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -14,6 +14,7 @@
#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT)
#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT)
#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG)
+#define HOST_BITS_PER_PTR (CHAR_BIT * SIZEOF_VOID_P)
/* The string that should be inserted into a printf style format to
indicate a "long" operand. */
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index fa3d5fd7548..716c8cc3a1f 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1224,20 +1224,20 @@ ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input)
if (!is_gimple_ip_invariant (input))
return NULL_TREE;
- if (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
- == tcc_unary)
- res = fold_unary (ipa_get_jf_pass_through_operation (jfunc),
- TREE_TYPE (input), input);
+ tree_code opcode = ipa_get_jf_pass_through_operation (jfunc);
+ if (TREE_CODE_CLASS (opcode) == tcc_comparison)
+ restype = boolean_type_node;
+ else if (expr_type_first_operand_type_p (opcode))
+ restype = TREE_TYPE (input);
else
- {
- if (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
- == tcc_comparison)
- restype = boolean_type_node;
- else
- restype = TREE_TYPE (input);
- res = fold_binary (ipa_get_jf_pass_through_operation (jfunc), restype,
- input, ipa_get_jf_pass_through_operand (jfunc));
- }
+ return NULL_TREE;
+
+ if (TREE_CODE_CLASS (opcode) == tcc_unary)
+ res = fold_unary (opcode, restype, input);
+ else
+ res = fold_binary (opcode, restype, input,
+ ipa_get_jf_pass_through_operand (jfunc));
+
if (res && !is_gimple_ip_invariant (res))
return NULL_TREE;
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 4843f8a2f8e..0dfdd551577 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2358,6 +2358,19 @@ dump_inline_stats (void)
(int) reason[i][2], (int) reason[i][1], reason[i][0]);
}
+/* Called when node is removed. */
+
+static void
+flatten_remove_node_hook (struct cgraph_node *node, void *data)
+{
+ if (lookup_attribute ("flatten", DECL_ATTRIBUTES (node->decl)) == NULL)
+ return;
+
+ hash_set<struct cgraph_node *> *removed
+ = (hash_set<struct cgraph_node *> *) data;
+ removed->add (node);
+}
+
/* Decide on the inlining. We do so in the topological order to avoid
expenses on updating data structures. */
@@ -2367,7 +2380,7 @@ ipa_inline (void)
struct cgraph_node *node;
int nnodes;
struct cgraph_node **order;
- int i;
+ int i, j;
int cold;
bool remove_functions = false;
@@ -2408,26 +2421,56 @@ ipa_inline (void)
if (dump_file)
fprintf (dump_file, "\nFlattening functions:\n");
+ /* First shrink order array, so that it only contains nodes with
+ flatten attribute. */
+ for (i = nnodes - 1, j = i; i >= 0; i--)
+ {
+ node = order[i];
+ if (lookup_attribute ("flatten",
+ DECL_ATTRIBUTES (node->decl)) != NULL)
+ order[j--] = order[i];
+ }
+
+ /* After the above loop, order[j + 1] ... order[nnodes - 1] contain
+ nodes with flatten attribute. If there is more than one such
+ node, we need to register a node removal hook, as flatten_function
+ could remove other nodes with flatten attribute. See PR82801. */
+ struct cgraph_node_hook_list *node_removal_hook_holder = NULL;
+ hash_set<struct cgraph_node *> *flatten_removed_nodes = NULL;
+ if (j < nnodes - 2)
+ {
+ flatten_removed_nodes = new hash_set<struct cgraph_node *>;
+ node_removal_hook_holder
+ = symtab->add_cgraph_removal_hook (&flatten_remove_node_hook,
+ flatten_removed_nodes);
+ }
+
/* In the first pass handle functions to be flattened. Do this with
a priority so none of our later choices will make this impossible. */
- for (i = nnodes - 1; i >= 0; i--)
+ for (i = nnodes - 1; i > j; i--)
{
node = order[i];
+ if (flatten_removed_nodes
+ && flatten_removed_nodes->contains (node))
+ continue;
/* Handle nodes to be flattened.
Ideally when processing callees we stop inlining at the
entry of cycles, possibly cloning that entry point and
try to flatten itself turning it into a self-recursive
function. */
- if (lookup_attribute ("flatten",
- DECL_ATTRIBUTES (node->decl)) != NULL)
- {
- if (dump_file)
- fprintf (dump_file,
- "Flattening %s\n", node->name ());
- flatten_function (node, false);
- }
+ if (dump_file)
+ fprintf (dump_file, "Flattening %s\n", node->name ());
+ flatten_function (node, false);
+ }
+
+ if (j < nnodes - 2)
+ {
+ symtab->remove_cgraph_removal_hook (node_removal_hook_holder);
+ delete flatten_removed_nodes;
}
+ free (order);
+
if (dump_file)
dump_overall_stats ();
@@ -2439,7 +2482,6 @@ ipa_inline (void)
inline functions and virtual functions so we really know what is called
once. */
symtab->remove_unreachable_nodes (dump_file);
- free (order);
/* Inline functions with a property that after inlining into all callers the
code size will shrink because the out-of-line copy is eliminated.
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 77605f70109..97b8b0c7d2f 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1954,7 +1954,7 @@ input_offload_tables (bool do_force_output)
static int
output_cgraph_opt_summary_p (struct cgraph_node *node)
{
- return (node->clone_of
+ return ((node->clone_of || node->former_clone_of)
&& (node->clone.tree_map
|| node->clone.args_to_skip
|| node->clone.combined_args_to_skip));
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 4236564b5ee..3f3c3a1c709 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-09 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
+2018-01-01 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
2017-08-21 Joseph Myers <joseph@codesourcery.com>
* de.po: Update.
diff --git a/gcc/po/es.po b/gcc/po/es.po
index 146efbff311..94510a792c6 100644
--- a/gcc/po/es.po
+++ b/gcc/po/es.po
@@ -1,8 +1,8 @@
# Mensajes en español para gcc-4.7.2.
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017, 2018 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Cristian Othón Martínez Vera <cfuga@cfuga.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017
+# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018
#
# Agradezco a Juan Cuquejo Mira por sus comentarios sobre esta traducción
#
@@ -37,10 +37,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gcc 7.1.0\n"
+"Project-Id-Version: gcc 7.2.0\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2017-08-04 22:17+0000\n"
-"PO-Revision-Date: 2017-07-26 08:25+0200\n"
+"PO-Revision-Date: 2018-01-07 10:20+0100\n"
"Last-Translator: Antonio Ceballos <aceballos@gmail.com>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
"Language: es\n"
@@ -10257,10 +10257,8 @@ msgid "Use UltraSPARC Visual Instruction Set version 4.0 extensions."
msgstr "Usa las extensiones del Conjunto de Instrucciones Visuales de UltraSPARC versión 4.0."
#: config/sparc/sparc.opt:86
-#, fuzzy
-#| msgid "Use vector and scalar instructions added in ISA 2.07."
msgid "Use additional VIS instructions introduced in OSA2017."
-msgstr "Usa las instrucciones de vectores y escalares añadidas en ISA 2.07."
+msgstr "Usa las instrucciones adicionales de VIS introducidas en OSA2017."
#: config/sparc/sparc.opt:90
msgid "Use UltraSPARC Compare-and-Branch extensions."
@@ -10341,16 +10339,12 @@ msgid "Enable workarounds for the errata of the UT699 processor."
msgstr "Activa evitar el error único del procesador UT699."
#: config/sparc/sparc.opt:246
-#, fuzzy
-#| msgid "Enable workarounds for the errata of the UT699 processor."
msgid "Enable workarounds for the errata of the UT699E/UT700 processor."
-msgstr "Activa evitar el error único del procesador UT699."
+msgstr "Activa evitar el error único del procesador UT699E/UT700."
#: config/sparc/sparc.opt:250
-#, fuzzy
-#| msgid "Enable workarounds for the errata of the UT699 processor."
msgid "Enable workarounds for the errata of the GR712RC processor."
-msgstr "Activa evitar el error único del procesador UT699."
+msgstr "Activa evitar el error único del procesador GR712RC."
#: config/sparc/sparc.opt:283
msgid "Specify the memory model in effect for the program."
@@ -14700,8 +14694,6 @@ msgid "Detect paths that trigger erroneous or undefined behavior due to derefere
msgstr "Detecta rutas que disparan comportamiento erróneo o indefinido debido a desreferencia de puntero nulo. Aisla esas rutas del flujo de control principal y convierte la sentencia con comportamiento erróneo o indefinido en una trampa."
#: common.opt:2495
-#, fuzzy
-#| msgid "Detect paths that trigger erroneous or undefined behavior due a null value being used in a way forbidden by a returns_nonnull or nonnull attribute. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap."
msgid "Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or nonnull attribute. Isolate those paths from the main control flow and turn the statement with erroneous or undefined behavior into a trap."
msgstr "Detecta rutas que disparan comportamiento erróneo o indefinido debido a un uso indebido de un valor nuloen un atributo returns_nonnull o nonnull. Aisla esas rutas del flujo de control principal y convierte la sentencia con comportamiento erróneo o indefinido en una trampa."
@@ -17454,10 +17446,9 @@ msgid "input file %qs is the same as output file"
msgstr "el fichero de entrada %qs es el mismo que el de salida"
#: gcc.c:4476
-#, fuzzy, gcc-internal-format
-#| msgid "output file not specified"
+#, gcc-internal-format
msgid "output filename may not be empty"
-msgstr "no se ha especificado el fichero de salida"
+msgstr "el nombre fichero del salida puede no estar vacío"
#: gcc.c:4501
#, gcc-internal-format
@@ -18757,8 +18748,7 @@ msgid "types have different parameter counts"
msgstr "tipos con número de parámetros diferentes"
#: ipa-devirt.c:1229
-#, fuzzy, gcc-internal-format
-#| msgid "type %qT itself violate the C++ One Definition Rule"
+#, gcc-internal-format
msgid "type %qT itself violates the C++ One Definition Rule"
msgstr "el propio tipo %qT viola la regla de una sola definición de C++"
@@ -18858,8 +18848,7 @@ msgid "a field of same name but different type is defined in another translation
msgstr "hay un campo con el mismo nombre pero distinto tipo definido en otra unidad de traducción"
#: ipa-devirt.c:1576
-#, fuzzy, gcc-internal-format
-#| msgid "fields has different layout in another translation unit"
+#, gcc-internal-format
msgid "fields have different layout in another translation unit"
msgstr "los campos tienen distinta disposición en otra unidad de translación"
@@ -19676,16 +19665,14 @@ msgid "-fsanitize-address-use-after-scope requires -fstack-reuse=none option"
msgstr "-fsanitize-address-use-after-scope requiere -fstack-reuse=none option"
#: opts.c:1012
-#, fuzzy, gcc-internal-format
-#| msgid "transactional memory is not supported with non-call exceptions"
+#, gcc-internal-format
msgid "transactional memory is not supported with %<-fsanitize=address%>"
-msgstr "la memoria transaccional no se admite con excepciones que no son llamada"
+msgstr "la memoria transaccional no se admite con %<-fsanitize=address%>"
#: opts.c:1015
-#, fuzzy, gcc-internal-format
-#| msgid "transactional memory is not supported with non-call exceptions"
+#, gcc-internal-format
msgid "transactional memory is not supported with %<-fsanitize=kernel-address%>"
-msgstr "la memoria transaccional no se admite con excepciones que no son llamada"
+msgstr "la memoria transaccional no se admite con %<-fsanitize=kernel-address%>"
#: opts.c:1417
#, gcc-internal-format
@@ -20420,10 +20407,9 @@ msgid "double linked list of assembler names corrupted"
msgstr "lista doblemente enlazada de nombres del ensamblador corrrupta"
#: symtab.c:1043
-#, fuzzy, gcc-internal-format
-#| msgid "%qD used before its definition"
+#, gcc-internal-format
msgid "node has body_removed but is definition"
-msgstr "se usó %qD antes de su definición"
+msgstr "el nodo tiene body_removed y sin embargo es una definición"
#: symtab.c:1048
#, gcc-internal-format
@@ -25005,10 +24991,9 @@ msgid "argument to %<sizeof%> in %qD call is the same pointer type %qT as the se
msgstr "el argumento de %<sizeof%> en la llamada %qD es el mismo tipo de puntero %qT que el segundo origen; se esperaba %qT o una longitud explícita"
#: c-family/c-warn.c:860 c-family/c-warn.c:867
-#, fuzzy, gcc-internal-format
-#| msgid "invalid parameter type %qT"
+#, gcc-internal-format
msgid "%<_Atomic%>-qualified parameter type %qT of %q+D"
-msgstr "tipo de parámetro %qT no válido"
+msgstr "tipo de parámetro cualificado %<_Atomic%> %qT de %q+D"
#: c-family/c-warn.c:877
#, gcc-internal-format
@@ -25790,38 +25775,34 @@ msgid "this compiler does not support %s"
msgstr "este compilador no tiene soporte para %s"
#: config/darwin-driver.c:233
-#, fuzzy, gcc-internal-format
-#| msgid "The compiler does not support -march=%s."
+#, gcc-internal-format
msgid "this compiler does not support PowerPC (arch flags ignored)"
-msgstr "El compilador no tiene soporte para -march=%s."
+msgstr "este compilador no tiene soporte para PowerPC (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin-driver.c:237
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "-mcpu=%s conflicts with -march=%s"
+#, gcc-internal-format, gfc-internal-format
msgid "%s conflicts with i386 (arch flags ignored)"
-msgstr "-mcpu=%s genera conflicto con -march=%s"
+msgstr "%s genera conflicto con i386 (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin-driver.c:245
#, gcc-internal-format, gfc-internal-format
msgid "%s conflicts with x86_64 (arch flags ignored)"
-msgstr ""
+msgstr "%s genera conflicto con x86_64 (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin-driver.c:252
-#, fuzzy, gcc-internal-format
-#| msgid "The compiler does not support -march=%s."
+#, gcc-internal-format
msgid "this compiler does not support X86 (arch flags ignored)"
-msgstr "El compilador no tiene soporte para -march=%s."
+msgstr "este compilador no tiene soporte para x86 (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin-driver.c:256
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "-mcpu=%s conflicts with -march=%s"
+#, gcc-internal-format, gfc-internal-format
msgid "%s conflicts with ppc (arch flags ignored)"
-msgstr "-mcpu=%s genera conflicto con -march=%s"
+msgstr "%s genera conflicto con ppc (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin-driver.c:264
#, gcc-internal-format, gfc-internal-format
msgid "%s conflicts with ppc64 (arch flags ignored)"
-msgstr ""
+msgstr "%s genera conflicto con ppc64 (se hace caso omiso de los indicadores de arquitectura)"
#: config/darwin.c:1691
#, gcc-internal-format
@@ -25990,10 +25971,9 @@ msgid "%Klane index must be a constant immediate"
msgstr "el índice %Klane debe ser un inmediato constante"
#: config/aarch64/aarch64-builtins.c:1163
-#, fuzzy, gcc-internal-format
-#| msgid "the second argument must be a 4-bit immediate"
+#, gcc-internal-format
msgid "%Ktotal size and element size must be a non-zero constant immediate"
-msgstr "el segundo argumento debe ser un inmediato de 4-bit"
+msgstr "el tamaño %Ktotal y el tamaño de elemento han de ser un inmediato constante distinto de cero"
#: config/aarch64/aarch64.c:927
#, gcc-internal-format
@@ -26001,10 +25981,9 @@ msgid "%qs is incompatible with %s %s"
msgstr "%qs es incompatible con %s %s"
#: config/aarch64/aarch64.c:929
-#, fuzzy, gcc-internal-format
-#| msgid "%qs is incompatible with %qs"
+#, gcc-internal-format
msgid "%qs feature modifier is incompatible with %s %s"
-msgstr "%qs es incompatible con %qs"
+msgstr "el modificador de característica %qs es incompatible con %s %s"
#: config/aarch64/aarch64.c:8382
#, gcc-internal-format, gfc-internal-format
@@ -26017,16 +25996,14 @@ msgid "%s string ill-formed\n"
msgstr "cadena %s mal formada\n"
#: config/aarch64/aarch64.c:8483
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "Invalid range %s in option %s"
+#, gcc-internal-format, gfc-internal-format
msgid "tuning string missing in option (%s)"
-msgstr "Rango %s no válido en la opción %s"
+msgstr "falta la cadena de ajuste en la opción (%s)"
#: config/aarch64/aarch64.c:8501
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "unknown string token %s\n"
+#, gcc-internal-format, gfc-internal-format
msgid "unknown tuning option (%s)"
-msgstr "cadena de elemento %s desconocida\n"
+msgstr "opción de cadena de ajuste desconocida (%s)"
#: config/aarch64/aarch64.c:8715
#, gcc-internal-format
@@ -26039,16 +26016,14 @@ msgid "missing cpu name in %<-mcpu=%s%>"
msgstr "falta el nombre de la cpu en %<-mcpu=%s%>"
#: config/aarch64/aarch64.c:8763
-#, fuzzy, gcc-internal-format
-#| msgid "invalid floating point option: -mfpu=%s"
+#, gcc-internal-format
msgid "invalid feature modifier in %<-mcpu=%s%>"
-msgstr "opción de coma flotante no válida: -mfpu-%s"
+msgstr "modificador de característica no válido en %<-mcpu=%s%>"
#: config/aarch64/aarch64.c:8790
-#, fuzzy, gcc-internal-format
-#| msgid "missing path after %qs"
+#, gcc-internal-format
msgid "missing arch name in %<-march=%s%>"
-msgstr "falta una ruta después de %qs"
+msgstr "falta el nombre de la arquitectura en %<-march=%s%>"
#: config/aarch64/aarch64.c:8793
#, gcc-internal-format
@@ -26056,10 +26031,9 @@ msgid "unknown value %qs for -march"
msgstr "valor %qs desconocido para -march"
#: config/aarch64/aarch64.c:8797
-#, fuzzy, gcc-internal-format
-#| msgid "invalid data model option -mdata-model=%s"
+#, gcc-internal-format
msgid "invalid feature modifier in %<-march=%s%>"
-msgstr "opción de modelo de datos -mdata-model=%s no válida"
+msgstr "modificador de característica no válido en %<-march=%s%>"
#: config/aarch64/aarch64.c:8823
#, gcc-internal-format
@@ -26104,7 +26078,7 @@ msgstr "valor %qs desconocido para el objetivo 'arch' %s"
#: config/aarch64/aarch64.c:9202
#, gcc-internal-format
msgid "invalid feature modifier %qs for 'arch' target %s"
-msgstr ""
+msgstr "modificador de característica no válido %qs para el objetivo 'arch' %s"
#: config/aarch64/aarch64.c:9236
#, gcc-internal-format, gfc-internal-format
@@ -26119,7 +26093,7 @@ msgstr "valor %qs desconocido para el objetivo 'cpu' %s"
#: config/aarch64/aarch64.c:9243
#, gcc-internal-format
msgid "invalid feature modifier %qs for 'cpu' target %s"
-msgstr ""
+msgstr "modificador de característica no válido %qs para el objetivo 'cpu' %s"
#: config/aarch64/aarch64.c:9274
#, gcc-internal-format
@@ -26127,16 +26101,14 @@ msgid "unknown value %qs for 'tune' target %s"
msgstr "valor %qs desconocido para el objetivo 'tune' %s"
#: config/aarch64/aarch64.c:9315
-#, fuzzy, gcc-internal-format
-#| msgid "missing makefile target after %qs"
+#, gcc-internal-format
msgid "missing feature modifier in target %s %qs"
-msgstr "falta un fichero make objetivo después de %qs"
+msgstr "falta el modificador de característica en el objetivo %s %qs"
#: config/aarch64/aarch64.c:9320
-#, fuzzy, gcc-internal-format
-#| msgid "invalid memory model argument %d of %qE"
+#, gcc-internal-format
msgid "invalid feature modifier in target %s %qs"
-msgstr "argumento de modelo de memoria %d no válido de %qE"
+msgstr "modificador de característica no válido en el objetivo %s %qs"
#: config/aarch64/aarch64.c:9372
#, gcc-internal-format, gfc-internal-format
@@ -26161,10 +26133,9 @@ msgstr "el objetivo %s %s=%s no es válido"
#: config/aarch64/aarch64.c:9544 config/arm/arm.c:30400
#: config/i386/i386.c:6778 config/rs6000/rs6000.c:39332
#: config/s390/s390.c:15024
-#, fuzzy, gcc-internal-format
-#| msgid "attribute %qE argument not a string"
+#, gcc-internal-format
msgid "attribute %<target%> argument not a string"
-msgstr "el argumento del atributo %qE no es una cadena"
+msgstr "el argumento del atributo %<target%> no es una cadena"
#: config/aarch64/aarch64.c:9554
#, gcc-internal-format, gfc-internal-format
@@ -26179,7 +26150,7 @@ msgstr "el objetivo %s %qs no es válido"
#: config/aarch64/aarch64.c:9580
#, gcc-internal-format
msgid "malformed target %s list %qs"
-msgstr ""
+msgstr "lista %qs del objetivo %s mal formada"
#: config/aarch64/aarch64.c:11428
#, gcc-internal-format
@@ -26187,10 +26158,9 @@ msgid "%Klane %wd out of range %wd - %wd"
msgstr "%Klane %wd fuera de rango %wd - %wd"
#: config/aarch64/aarch64.c:11430
-#, fuzzy, gcc-internal-format
-#| msgid "line number out of range"
+#, gcc-internal-format
msgid "lane %wd out of range %wd - %wd"
-msgstr "número de línea fuera de rango"
+msgstr "vía %wd fuera de rango %wd - %wd"
#: config/alpha/alpha.c:414
#, gcc-internal-format
@@ -26257,7 +26227,7 @@ msgstr "fcode interno erróneo"
#: config/arc/arc.c:717
#, gcc-internal-format
msgid "-mno-mpy supported only for ARC700 or ARCv2"
-msgstr ""
+msgstr "-mno-mpy solo se admite para ARC700 o ARCv2"
#: config/arc/arc.c:720
#, gcc-internal-format
@@ -26265,10 +26235,9 @@ msgid "-mno-dpfp-lrsr supported only with -mdpfp"
msgstr "-mno-dpfp-lrsr sólo se admite con -mdpfp"
#: config/arc/arc.c:725
-#, fuzzy, gcc-internal-format
-#| msgid "-mcorea and -mcoreb can%'t be used together"
+#, gcc-internal-format
msgid "FPX fast and compact options cannot be specified together"
-msgstr "no se pueden usar juntos -mcorea y -mcoreab"
+msgstr "las opciones de FPX fast y compact no pueden especificarse juntas"
#: config/arc/arc.c:729
#, gcc-internal-format
@@ -26288,8 +26257,7 @@ msgstr "No se admite PIC para %s. Se generará soloamente código no PIC.."
#. Check options against architecture options. Throw an error if
#. option is not allowed.
#: config/arc/arc.c:850 config/arc/arc.c:858
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "%qD is not a variable in clause %qs"
+#, gcc-internal-format, gfc-internal-format
msgid "%s is not available for %s architecture"
msgstr "%s no está disponible para la arquitectura %s"
@@ -26426,10 +26394,9 @@ msgid "insn addresses not freed"
msgstr "direcciones de insn no liberadas"
#: config/arm/arm-builtins.c:2354
-#, fuzzy, gcc-internal-format
-#| msgid "nested functions not supported on this target"
+#, gcc-internal-format
msgid "this builtin is not supported for this target"
-msgstr "no se admiten funciones anidadas en este objetivo"
+msgstr "no se admite este interno para este objetivo"
#: config/arm/arm-builtins.c:2459
#, gcc-internal-format
@@ -26939,20 +26906,18 @@ msgid "devices natively supported:%s"
msgstr "dispositivos aceptados de forma nativa:%s"
#: config/avr/avr-devices.c:212
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "unknown architecture %qs"
+#, gcc-internal-format, gfc-internal-format
msgid "supported core architectures:%s"
-msgstr "arquitectura %qs desconocida"
+msgstr "arquitecturas de núcleo no admitidas:%s"
#. Reached the end of `avr_mcu_types'. This should actually never
#. happen as options are provided by device-specs. It could be a
#. typo in a device-specs or calling the compiler proper directly
#. with -mmcu=<device>.
#: config/avr/avr.c:703
-#, fuzzy, gcc-internal-format
-#| msgid "unknown architecture %qs"
+#, gcc-internal-format
msgid "unknown core architecture %qs specified with %qs"
-msgstr "arquitectura %qs desconocida"
+msgstr "arquitectura de núcleo %qs desconocida especificada con %qs"
#: config/avr/avr.c:769 config/visium/visium.c:387
#, gcc-internal-format
@@ -26995,15 +26960,14 @@ msgid "%qs function cannot return a value"
msgstr "la función %qs no puede devolver un valor"
#: config/avr/avr.c:1085
-#, fuzzy, gcc-internal-format
-#| msgid "%qs appears to be a misspelled %s handler, missing __vector prefix"
+#, gcc-internal-format
msgid "%qs appears to be a misspelled %qs handler, missing %<__vector%> prefix"
-msgstr "%qs parece ser un manejador %s mal escrito; falta el prefijo __vector"
+msgstr "%qs parece ser un manejador %s mal escrito; falta el prefijo %<__vector%>"
#: config/avr/avr.c:1098
#, gcc-internal-format
msgid "%qs is a reserved indentifier in AVR-LibC. Consider %<#include <avr/interrupt.h>%> before using the %qs macro"
-msgstr ""
+msgstr "%qs es un identificador invertido en AVR-LibC. Plantéese %<#include <avr/interrupt.h>%> antes de usar la macro %qs"
#: config/avr/avr.c:1327
#, gcc-internal-format
@@ -27113,10 +27077,9 @@ msgstr "Sólo las variables sin inicializar se pueden colocar en la sección .no
#. This might happen with C++ if stuff needs constructing.
#: config/avr/avr.c:10149
-#, fuzzy, gcc-internal-format
-#| msgid "uninitialized variable %q+D put into program memory area"
+#, gcc-internal-format
msgid "variable %q+D with dynamic initialization put into program memory area"
-msgstr "se colocó la variable %q+D sin inicializar en el área de memoria del programa"
+msgstr "se colocó la variable %q+D con inicialización dinámica en el área de memoria del programa"
#: config/avr/avr.c:10160
#, gcc-internal-format
@@ -29022,10 +28985,9 @@ msgid "-mdata-region=upper requires 430X-compatible cpu"
msgstr "-mdata-region=upper requiere una -mmcu= compatible con 430X"
#: config/msp430/msp430.c:1859
-#, fuzzy, gcc-internal-format
-#| msgid "invalid argument of %qE attribute"
+#, gcc-internal-format
msgid "unrecognized interrupt vector argument of %qE attribute"
-msgstr "argumento no válido del atributo %qE"
+msgstr "no se reconoce el argumento de vector de interrupciones del atributo %qE"
#: config/msp430/msp430.c:1868
#, gcc-internal-format
@@ -29038,10 +29000,9 @@ msgid "argument of %qE attribute is not a string constant or number"
msgstr "el argumento del atributo %qE no es una cadena constante ni un número"
#: config/msp430/msp430.c:2124
-#, fuzzy, gcc-internal-format
-#| msgid "cannot set interrupt attribute: no current function"
+#, gcc-internal-format
msgid "argument to interrupt attribute is unsupported for weak functions"
-msgstr "no se puede establecer el atributo de interrupción: no hay una función actual"
+msgstr "no se admite el argumento para el atributo de interrupción para funciones débiles"
#: config/msp430/msp430.c:2494
#, gcc-internal-format
@@ -29076,10 +29037,9 @@ msgid "multiple save reg attributes to function %qD"
msgstr "faltan argumentos para la función %q#D"
#: config/nds32/nds32-isr.c:348
-#, fuzzy, gcc-internal-format
-#| msgid "multiple function type attributes specified"
+#, gcc-internal-format
msgid "multiple nested types attributes to function %qD"
-msgstr "se especificaron múltiples atributos de tipo de función"
+msgstr "atributos de tipos anidados múltiples para la función %qD"
#: config/nds32/nds32-isr.c:360
#, gcc-internal-format
@@ -29786,23 +29746,22 @@ msgstr "el atributo o pragma target cambia el tamaño de double long"
#: config/rs6000/rs6000.c:4799
#, gcc-internal-format
msgid "-mfloat128 requires VSX support"
-msgstr ""
+msgstr "-mfloat128 necesita soporte para VSX"
#: config/rs6000/rs6000.c:4809
#, gcc-internal-format
msgid "-mfloat128-type requires VSX support"
-msgstr ""
+msgstr "-mfloat128-type necesita soporte para VSX"
#: config/rs6000/rs6000.c:4825
#, gcc-internal-format
msgid "-mfloat128 requires -mfloat128-type"
-msgstr ""
+msgstr "-mfloat128 necesita -mfloat128-type"
#: config/rs6000/rs6000.c:4838
-#, fuzzy, gcc-internal-format
-#| msgid "-mrecip requires -mfused-madd"
+#, gcc-internal-format
msgid "-mfloat128-hardware requires -mfloat128-type"
-msgstr "-mrecip requiere -mfused-madd"
+msgstr "-mfloat128-hardware necesita -mfloat128-type"
#: config/rs6000/rs6000.c:4861
#, gcc-internal-format
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 30fd7597450..849214305f4 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -1792,11 +1792,11 @@ print_insn (pretty_printer *pp, const rtx_insn *x, int verbose)
case DEBUG_INSN:
{
const char *name = "?";
+ char idbuf[32];
if (DECL_P (INSN_VAR_LOCATION_DECL (x)))
{
tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x));
- char idbuf[32];
if (id)
name = IDENTIFIER_POINTER (id);
else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x))
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index acb4230aac8..b93d19537bb 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -4312,7 +4312,7 @@ nonzero_bits1 (const_rtx x, machine_mode mode, const_rtx known_x,
{
unsigned HOST_WIDE_INT nonzero = GET_MODE_MASK (mode);
unsigned HOST_WIDE_INT inner_nz;
- enum rtx_code code;
+ enum rtx_code code = GET_CODE (x);
machine_mode inner_mode;
unsigned int mode_width = GET_MODE_PRECISION (mode);
@@ -4335,18 +4335,18 @@ nonzero_bits1 (const_rtx x, machine_mode mode, const_rtx known_x,
return nonzero;
/* If MODE is wider than X, but both are a single word for both the host
- and target machines, we can compute this from which bits of the
- object might be nonzero in its own mode, taking into account the fact
- that on many CISC machines, accessing an object in a wider mode
- causes the high-order bits to become undefined. So they are
- not known to be zero. */
-
- if (!WORD_REGISTER_OPERATIONS
- && GET_MODE (x) != VOIDmode
+ and target machines, we can compute this from which bits of the object
+ might be nonzero in its own mode, taking into account the fact that, on
+ CISC machines, accessing an object in a wider mode generally causes the
+ high-order bits to become undefined, so they are not known to be zero.
+ We extend this reasoning to RISC machines for rotate operations since the
+ semantics of the operations in the larger mode is not well defined. */
+ if (GET_MODE (x) != VOIDmode
&& GET_MODE (x) != mode
&& GET_MODE_PRECISION (GET_MODE (x)) <= BITS_PER_WORD
&& GET_MODE_PRECISION (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT
- && GET_MODE_PRECISION (mode) > GET_MODE_PRECISION (GET_MODE (x)))
+ && GET_MODE_PRECISION (mode) > GET_MODE_PRECISION (GET_MODE (x))
+ && (!WORD_REGISTER_OPERATIONS || code == ROTATE))
{
nonzero &= cached_nonzero_bits (x, GET_MODE (x),
known_x, known_mode, known_ret);
@@ -4356,7 +4356,6 @@ nonzero_bits1 (const_rtx x, machine_mode mode, const_rtx known_x,
/* Please keep nonzero_bits_binary_arith_p above in sync with
the code in the switch below. */
- code = GET_CODE (x);
switch (code)
{
case REG:
@@ -4873,8 +4872,10 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode, const_rtx known_x,
{
/* If this machine does not do all register operations on the entire
register and MODE is wider than the mode of X, we can say nothing
- at all about the high-order bits. */
- if (!WORD_REGISTER_OPERATIONS)
+ at all about the high-order bits. We extend this reasoning to every
+ machine for rotate operations since the semantics of the operations
+ in the larger mode is not well defined. */
+ if (!WORD_REGISTER_OPERATIONS || code == ROTATE || code == ROTATERT)
return 1;
/* Likewise on machines that do, if the mode of the object is smaller
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f895762eff7..e4ea2377fbe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,460 @@
+2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83811
+ * gfortran.dg/fmt_e.f90: New test.
+
+2018-01-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/83677
+ * gcc.target/powerpc/pr83677.c: New file.
+
+2018-01-14 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2018-01-12 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83628
+ * gcc.target/alpha/pr83628-3.c: New test.
+
+2018-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/78814
+ * gfortran.dg/interface_40.f90: New testcase.
+
+2018-01-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20180112-1.c: New test.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/82367
+ * gfortran.dg/deferred_character_18.f90: New test.
+
+2018-01-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/83093
+ * gfortran.dg/allocate_with_typespec_7.f90: New test.
+
+2018-01-10 Steven G. Kargl <kargl@kgcc.gnu.org>
+
+ Backport r254555 from trunk
+ PR Fortran/82841
+ * gfortran.dg/transfer_simplify_11.f90: New test.
+
+2018-01-09 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-01-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/83713
+ * g++.dg/torture/pr83713.C: New testcase.
+
+2018-01-08 Jim Wilson <jimw@sifive.com>
+
+ Backport from mainline
+ 2018-01-08 Chih-Mao Chen <pkmx.tw@gmail.com>
+ Monk Chiang <sh.chiang04@gmail.com>
+
+ * gcc.target/riscv/save-restore-1.c: New.
+
+ 2017-11-29 Jim Wilson <jimw@sifive.com>
+
+ * gcc.target/riscv/riscv.exp: New.
+
+2018-01-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * gcc.dg/pr82975.c: New test.
+
+2018-01-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83628
+ * gcc.target/alpha/pr83628-1.c: New test.
+ * gcc.target/alpha/pr83628-2.c: Ditto.
+
+2018-01-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83556
+ * g++.dg/cpp0x/pr83556.C: New test.
+
+2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83650
+ * gfortran.dg/simplify_cshift_1.f90: Correct condition.
+
+2018-01-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83608
+ * g++.dg/opt/pr83608.C: New test.
+
+ PR middle-end/83609
+ * gcc.dg/pr83609.c: New test.
+ * g++.dg/opt/pr83609.C: New test.
+
+ PR middle-end/83623
+ * gcc.dg/pr83623.c: New test.
+
+2017-12-28 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR Fortran/83548
+ * gfortran.dg/array_constructor_type_22.f03: New test.
+
+2017-12-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83553
+ * c-c++-common/torture/pr83553.c: New test.
+
+2017-12-22 Martin Jambor <mjambor@suse.cz>
+
+ PR lto/82027
+ * g++.dg/lto/pr82027_0.C: New test.
+
+2017-12-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83550
+ * c-c++-common/dwarf2/pr83550.c: New test.
+
+ Backported from mainline
+ 2017-12-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/83448
+ * gcc.c-torture/compile/pr83448.c: New test.
+ * gcc.dg/tree-ssa/builtin-snprintf-warn-4.c: New test.
+
+ PR rtl-optimization/80747
+ PR rtl-optimization/83512
+ * gcc.dg/pr80747.c: New test.
+ * gcc.dg/pr83512.c: New test.
+
+ PR tree-optimization/83523
+ * g++.dg/tree-ssa/pr83523.C: New test.
+
+ PR tree-optimization/83521
+ * gcc.dg/pr83521.c: New test.
+
+ 2017-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/82801
+ PR ipa/83346
+ * g++.dg/ipa/pr82801.C: New test.
+
+2017-12-21 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/83467
+ * gcc.target/i386/pr83467-1.c: New test.
+ * gcc.target/i386/pr83467-2.c: Ditto.
+
+2017-12-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/83436
+ * gfortran.dg/internal_readwrite_4.f90: New test.
+
+2017-12-19 Bin Cheng <bin.cheng@arm.com>
+
+ Backport from mainline
+ 2017-11-15 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/82726
+ * gcc.dg/tree-ssa/pr82726.c: New test.
+
+2017-12-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2017-12-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/83471
+ * g++.dg/torture/pr83471.C: New test.
+
+2017-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83205
+ * g++.dg/cpp1z/decomp3.C: Adjust for structured binding count
+ mismatch diagnostics split into error and warning with plural
+ forms.
+ * g++.dg/cpp1z/decomp10.C: Likewise.
+ * g++.dg/cpp1z/decomp32.C: New test.
+
+ PR c++/81197
+ * g++.dg/cpp1z/decomp34.C: New test.
+
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83217
+ * g++.dg/cpp1z/decomp33.C: New test.
+
+ PR tree-optimization/83269
+ * gcc.c-torture/execute/pr83269.c: New test.
+
+ PR tree-optimization/80631
+ * gcc.target/i386/avx2-pr80631.c: New test.
+
+ Backported from mainline
+ 2017-12-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83198
+ * gcc.dg/pr83198.c: New test.
+ * gcc.dg/tree-ssa/pr83198.c: New test.
+
+ PR c++/79650
+ * g++.dg/template/pr79650.C: New test.
+
+ 2017-12-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/80631
+ * gcc.dg/vect/pr80631-1.c: New test.
+ * gcc.dg/vect/pr80631-2.c: New test.
+
+ 2017-12-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/81906
+ * gcc.target/i386/pr81906.c: New test.
+
+ 2017-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/80259
+ * g++.dg/cpp0x/pr80259.C: New test.
+
+ 2017-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81212
+ * g++.dg/ubsan/pr81212.C: New test.
+
+ 2017-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/78643
+ PR target/80583
+ * gcc.target/i386/pr80583.c: New test.
+
+ 2017-11-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/80819
+ * gcc.target/i386/pr80819-1.c: New test.
+ * gcc.target/i386/pr80819-2.c: New test.
+
+ 2017-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/81888
+ * g++.dg/cpp1z/decomp30.C: Add a test for structured binding with
+ = {} and = { a, a } initializers.
+ * g++.dg/cpp1z/decomp31.C: New test.
+
+ PR c++/81675
+ * g++.dg/warn/pr81675.C: New test.
+
+ 2017-11-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/81553
+ * gcc.c-torture/compile/pr81553.c: New test.
+
+ 2017-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83014
+ * gcc.dg/ubsan/pr83014.c: New test.
+
+ * gcc.dg/builtin-object-size-18.c: New test.
+
+ 2017-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/82253
+ * gfortran.dg/pr82253.f90: New test.
+
+ 2017-11-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/83084
+ * g++.dg/opt/pr83084.C: New test.
+
+ 2017-11-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/82880
+ * gcc.dg/opts-8.c: New test.
+
+ PR c++/83059
+ * c-c++-common/pr83059.c: New test.
+
+ 2017-11-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/82781
+ * g++.dg/ext/constexpr-pr82781.C: New test.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ PR tree-optimization/82060
+ * g++.dg/torture/pr82060.C: New testcase.
+
+2017-12-15 Sudakshina Das <sudi.das@arm.com>
+
+ * gcc.target/arm/armv8_2-fp16-move-2.c: Remove dg-add-options.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82102
+ * gcc.dg/torture/pr82102.c: New testcase.
+
+ 2017-09-13 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82128
+ * g++.dg/pr82128.C: New testcase.
+
+2017-12-15 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82402
+ * gcc.dg/torture/pr82402.c: New testcase.
+
+ 2017-10-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82697
+ * gcc.dg/torture/pr82697.c: New testcase.
+
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/82765
+ * gcc.dg/pr82765.c: New testcase.
+
+ 2017-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82902
+ * g++.dg/torture/pr82902.C: New testcase.
+
+2017-12-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-10-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80210
+ * gcc.target/powerpc/pr80210-2.c: New test.
+
+2017-12-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/alignment13.adb: New test.
+
+2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-12-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ * gcc.target/powerpc/cpu-builtin-1.c (htm-no-suspend): Add test.
+
+2017-12-11 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2017-12-01 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/81959
+ * gcc.target/powerpc/pr81959.c: New test.
+
+2017-12-11 Sudakshina Das <sudi.das@arm.com>
+
+ Backported from trunk
+ 2017-12-01 Sudakshina Das <sudi.das@arm.com>
+
+ * gcc.target/arm/armv8_2-fp16-move-2.c: New test.
+
+2017-12-07 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ Backport from trunk
+ 2017-05-08 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ PR target/80101
+ * gcc.target/powerpc/pr80101-1.c: New test.
+
+2017-12-04 Sebastian Peryt <sebastian.peryt@intel.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from trunk
+ PR target/82941
+ PR target/82942
+ PR target/82990
+ * gcc.target/i386/pr82941-1.c: New test.
+ * gcc.target/i386/pr82941-2.c: Likewise.
+ * gcc.target/i386/pr82942-1.c: Likewise.
+ * gcc.target/i386/pr82942-2.c: Likewise.
+ * gcc.target/i386/pr82990-1.c: Likewise.
+ * gcc.target/i386/pr82990-2.c: Likewise.
+ * gcc.target/i386/pr82990-3.c: Likewise.
+ * gcc.target/i386/pr82990-4.c: Likewise.
+ * gcc.target/i386/pr82990-5.c: Likewise.
+ * gcc.target/i386/pr82990-6.c: Likewise.
+ * gcc.target/i386/pr82990-7.c: Likewise.
+
+2017-12-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from trunk
+ PR fortran/83191
+ * gfortran.dg/namelist_95.f90: New test.
+
+2017-11-29 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/82808
+ * gcc.dg/ipa/pr82808.c: New test.
+
+2017-11-23 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk
+ PR fortran/79072
+ * gfortran.dg/class_result_5.f90: New test.
+ * gfortran.dg/class_result_6.f90: New test.
+
+2017-11-21 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk fix for PR82586
+ PR fortran/78686
+ * gfortran.dg/pr78686.f90: New test.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-11-08 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/82792
+ * g++.dg/asan/pr82792.C: New test.
+
+2017-11-21 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-18 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/82545
+ * gcc.dg/asan/pr82545.c: New test.
+
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/target-supports.exp (check_effective_target_pie): Adapt
+ comment for Solaris 12 renaming.
+
+ * gcc.dg/torture/pr60092.c: Remove *-*-solaris2.11* dg-xfail-run-if.
+
+2017-11-20 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-09-20 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/77687
+ * gcc.target/powerpc/pr77687.c: New testcase.
+
2017-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/82985
@@ -140,8 +597,8 @@
2017-10-24 Qing Zhao <qing.zhao@oracle.com>
Wilco Dijkstra <wilco.dijkstra@arm.com>
- PR middle-end/80295
- * gcc.target/aarch64/pr80295.c: New test.
+ PR middle-end/80295
+ * gcc.target/aarch64/pr80295.c: New test.
2017-10-21 Paul Thomas <pault@gcc.gnu.org>
@@ -843,8 +1300,8 @@
2017-06-21 Marc Glisse <marc.glisse@inria.fr>
- * gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
- * gcc.dg/tree-ssa/addadd-2.c: New file.
+ * gcc.dg/tree-ssa/addadd.c: Un-XFAIL.
+ * gcc.dg/tree-ssa/addadd-2.c: New file.
2016-07-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
diff --git a/gcc/testsuite/c-c++-common/dwarf2/pr83550.c b/gcc/testsuite/c-c++-common/dwarf2/pr83550.c
new file mode 100644
index 00000000000..1d77e9530cd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dwarf2/pr83550.c
@@ -0,0 +1,10 @@
+/* PR debug/83550 */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -dA -fno-merge-debug-strings" } */
+
+struct my_struct;
+extern struct my_struct s;
+struct my_struct { int a, b; };
+struct my_struct q;
+
+/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"my_struct\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?7\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */
diff --git a/gcc/testsuite/c-c++-common/pr83059.c b/gcc/testsuite/c-c++-common/pr83059.c
new file mode 100644
index 00000000000..9a6ff5e0db2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr83059.c
@@ -0,0 +1,10 @@
+/* PR c++/83059 */
+/* { dg-do compile } */
+
+void
+foo (int *p, int *q, int *r)
+{
+ __atomic_compare_exchange (p, q, r, 0, 0, -1); /* { dg-warning "invalid memory model argument 6" } */
+ /* { dg-warning "\[uU]nknown architecture specifi" "" { target *-*-* } .-1 } */
+ /* { dg-warning "failure memory model cannot be stronger than success memory model" "" { target *-*-* } .-2 } */
+}
diff --git a/gcc/testsuite/c-c++-common/torture/pr83553.c b/gcc/testsuite/c-c++-common/torture/pr83553.c
new file mode 100644
index 00000000000..c12b79b9e77
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr83553.c
@@ -0,0 +1,29 @@
+/* PR c++/83553 */
+/* { dg-do run } */
+
+int a[3];
+
+int
+foo (int n)
+{
+ switch (n)
+ {
+ case 0:
+ for (n = 7, a[0]++; 0; a[2] = a[1] + 1)
+ {
+ case 2:
+ a[1] = a[0] + 1;
+ }
+ }
+ return n;
+}
+
+int
+main ()
+{
+ if (foo (0) != 7 || a[0] != 1 || a[1] || a[2])
+ __builtin_abort ();
+ if (foo (2) != 2 || a[0] != 1 || a[1] != 2 || a[2] != 3)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/asan/pr82792.C b/gcc/testsuite/g++.dg/asan/pr82792.C
new file mode 100644
index 00000000000..99f1c35328c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr82792.C
@@ -0,0 +1,32 @@
+/* PR sanitizer/82792 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=address" } */
+
+extern int
+test (int i, int j)
+{
+ long c;
+ (c) = 1;
+ switch (i)
+ {
+ case 1:
+ if (j)
+ {
+ c = 1;
+ }
+ goto default_case;
+ case 2:
+ {
+ if (j)
+ {
+ c = 0;
+ }
+ }
+ __attribute ((fallthrough));
+ default_case:
+ default:
+ c = 0;
+ break;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr80259.C b/gcc/testsuite/g++.dg/cpp0x/pr80259.C
new file mode 100644
index 00000000000..9d2a109bcf3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr80259.C
@@ -0,0 +1,13 @@
+// PR c++/80259
+// { dg-do compile { target c++11 } }
+
+void foo () {} // { dg-message "previously defined here" }
+void bar ();
+
+struct A
+{
+ friend void foo () = delete; // { dg-error "redefinition of" }
+ friend void bar () = delete; // { dg-message "previously defined here" }
+};
+
+void bar () {} // { dg-error "redefinition of" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83556.C b/gcc/testsuite/g++.dg/cpp0x/pr83556.C
new file mode 100644
index 00000000000..bab06a5b943
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr83556.C
@@ -0,0 +1,28 @@
+// PR c++/83556
+// { dg-do run { target c++11 } }
+
+int
+foo ()
+{
+ return 1;
+}
+
+struct A
+{
+ int a = foo ();
+ int b = 1;
+ int c = a ? 1 * b : 2 * b;
+};
+
+struct B
+{
+ A d {};
+};
+
+int
+main ()
+{
+ B e {};
+ if (e.d.c != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-83116.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-83116.C
new file mode 100644
index 00000000000..18d79e2e1cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-83116.C
@@ -0,0 +1,18 @@
+// PR c++/83116
+// { dg-do run { target c++14 } }
+// { dg-options "-O2" }
+
+struct S {
+ constexpr S () : s(0) { foo (); }
+ constexpr int foo () { return s; }
+ int s;
+};
+
+int
+main ()
+{
+ static S var;
+ var.s = 5;
+ if (var.s != 5 || var.foo () != 5)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp10.C b/gcc/testsuite/g++.dg/cpp1z/decomp10.C
index c2bcb93c1d7..f27cbfbc0d9 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp10.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp10.C
@@ -11,7 +11,8 @@ void f1() { auto [ x ] = a1; } // { dg-error "is not an integral constant expres
struct A2 { int i,j; } a2;
template<> struct std::tuple_size<A2> { enum { value = 5 }; };
-void f2() { auto [ x ] = a2; } // { dg-error "decomposes into 5" }
+void f2() { auto [ x ] = a2; } // { dg-error "only 1 name provided" }
+ // { dg-message "decomposes into 5" "" { target *-*-* } .-1 }
struct A3 { int i,j; } a3;
template<> struct std::tuple_size<A3> { enum { value = 1 }; };
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp3.C b/gcc/testsuite/g++.dg/cpp1z/decomp3.C
index a739d3ace37..416a22b79f0 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp3.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp3.C
@@ -51,16 +51,21 @@ int arr[4];
void
test3 (A &b, B c)
{
- auto [ d, e, f ] = arr; // { dg-error "only 3 names provided while 'int .4.' decomposes into 4 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided while 'int .4.' decomposes into 4 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ l, m ] = b; // { dg-error "only 2 names provided while 'A' decomposes into 3 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto & [ n, o, p, q ] = b; // { dg-error "4 names provided while 'A' decomposes into 3 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [ d, e, f ] = arr; // { dg-error "only 3 names provided" }
+ // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-2 }
+ auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided" }
+ // { dg-message "while 'int .4.' decomposes into 4 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-2 }
+ auto [ l, m ] = b; // { dg-error "only 2 names provided" }
+ // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-2 }
+ auto & [ n, o, p, q ] = b; // { dg-error "4 names provided" }
+ // { dg-message "while 'A' decomposes into 3 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-2 }
auto [] { c }; // { dg-error "empty decomposition declaration" }
// { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ r, s ] = c; // { dg-error "2 names provided while 'B' decomposes into 1 elements" }
- // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
+ auto [ r, s ] = c; // { dg-error "2 names provided" }
+ // { dg-message "while 'B' decomposes into 1 element" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-2 }
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp30.C b/gcc/testsuite/g++.dg/cpp1z/decomp30.C
index 23115ad1082..cca15ed126b 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp30.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp30.C
@@ -10,3 +10,5 @@ auto [j, k] { a, a }; // { dg-error "invalid initializer for structured binding
auto [l, m] = { a }; // { dg-error "deducing from brace-enclosed initializer list requires" }
auto [n, o] {}; // { dg-error "invalid initializer for structured binding declaration" }
auto [p, q] (); // { dg-error "invalid initializer for structured binding declaration" }
+auto [r, s] = {}; // { dg-error "deducing from brace-enclosed initializer list requires" }
+auto [t, u] = { a, a }; // { dg-error "deducing from brace-enclosed initializer list requires" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp31.C b/gcc/testsuite/g++.dg/cpp1z/decomp31.C
new file mode 100644
index 00000000000..04b2516dada
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp31.C
@@ -0,0 +1,18 @@
+// PR c++/81888
+// { dg-do compile { target c++1z } }
+
+struct S {
+ bool s = true;
+};
+
+auto [a] = S{};
+
+template <class T>
+bool
+foo () noexcept
+{
+ auto [c] = T{};
+ return c;
+}
+
+const bool b = foo<S> ();
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp32.C b/gcc/testsuite/g++.dg/cpp1z/decomp32.C
new file mode 100644
index 00000000000..c4ea130d551
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp32.C
@@ -0,0 +1,32 @@
+// PR c++/83205
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { int i; };
+struct B { int i; };
+namespace std {
+ template <typename T> struct tuple_size;
+ template <> struct tuple_size<A> {
+ static constexpr int value = -1;
+ };
+#ifdef __SIZEOF_INT128__
+ template <> struct tuple_size<B> {
+ static constexpr unsigned __int128 value = -1;
+ };
+#endif
+}
+
+auto [a] = A{}; // { dg-error "1 name provided" }
+ // { dg-message "while 'A' decomposes into -1 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-2 }
+#ifdef __SIZEOF_INT128__
+auto [b] = B{}; // { dg-error "1 name provided" "" { target int128 } }
+ // { dg-message "while 'B' decomposes into \[0-9xa-fXA-F]* elements" "" { target int128 } .-1 }
+ // { dg-warning "decomposition declaration only available with" "" { target { c++14_down && int128 } } .-2 }
+auto [c, d] = B{}; // { dg-error "2 names provided" "" { target int128 } }
+ // { dg-message "while 'B' decomposes into \[0-9xa-fXA-F]* elements" "" { target int128 } .-1 }
+ // { dg-warning "decomposition declaration only available with" "" { target { c++14_down && int128 } } .-2 }
+#endif
+auto [e, f, g] = A{}; // { dg-error "3 names provided" }
+ // { dg-message "while 'A' decomposes into -1 elements" "" { target *-*-* } .-1 }
+ // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-2 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp33.C b/gcc/testsuite/g++.dg/cpp1z/decomp33.C
new file mode 100644
index 00000000000..9c5914a1d13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp33.C
@@ -0,0 +1,21 @@
+// PR c++/83217
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <typename T>
+struct S
+{
+ T a;
+};
+
+void
+foo (S<int> *b)
+{
+ auto & [c] = *b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+}
+
+void
+bar (S<char> *d)
+{
+ auto [e] = *d; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp34.C b/gcc/testsuite/g++.dg/cpp1z/decomp34.C
new file mode 100644
index 00000000000..e8cda7954b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp34.C
@@ -0,0 +1,11 @@
+// PR c++/81197
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct X { int a; };
+struct Y { int b, c, d; };
+auto&& [t] = X{}; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+namespace A { namespace B { auto&& [u, v, ww] = Y{}; } } // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+
+// { dg-final { scan-assembler "_ZGRDC1tE0" } }
+// { dg-final { scan-assembler "_ZGRN1A1BDC1u1v2wwEE1" } }
diff --git a/gcc/testsuite/g++.dg/ext/constexpr-pr82781.C b/gcc/testsuite/g++.dg/ext/constexpr-pr82781.C
new file mode 100644
index 00000000000..eee0159351c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/constexpr-pr82781.C
@@ -0,0 +1,12 @@
+// PR c++/82781
+// { dg-do compile { target c++11 } }
+
+typedef int V __attribute__ ((vector_size (16)));
+constexpr V b1 = { 0, 1, 10, 20 };
+constexpr V b2 = { 0, 2, 10, 0 };
+constexpr V b3 = b1 == b2;
+
+static_assert (b3[0] == -1, "");
+static_assert (b3[1] == 0, "");
+static_assert (b3[2] == -1, "");
+static_assert (b3[3] == 0, "");
diff --git a/gcc/testsuite/g++.dg/ipa/pr82801.C b/gcc/testsuite/g++.dg/ipa/pr82801.C
new file mode 100644
index 00000000000..d0c2756e47a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr82801.C
@@ -0,0 +1,20 @@
+// PR ipa/82801
+// { dg-do compile }
+// { dg-options "-O2 -Wno-attributes" }
+
+template<int>
+struct A { A () {} };
+struct B { double foo () const; };
+
+__attribute__((always_inline, flatten))
+double B::foo () const
+{
+ A<1> v;
+ return 0.0;
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr82027_0.C b/gcc/testsuite/g++.dg/lto/pr82027_0.C
new file mode 100644
index 00000000000..70cc776b2db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr82027_0.C
@@ -0,0 +1,73 @@
+// { dg-lto-do run }
+// { dg-lto-options { { -O3 -flto } } }
+
+class Position
+{
+ public:
+ Position( void ) {}
+ virtual ~Position() {}
+
+ virtual void calcPercent( const char *name,int pos,int size ) {}
+};
+
+
+class Looper
+{
+ public:
+ Looper( Position *cc,int size )
+ : m_cc(cc), m_size(size) {}
+ virtual ~Looper() {}
+
+ void loop( void )
+ {
+ for( int pos=0; pos<m_size; pos++ )
+ {
+ m_cc->calcPercent( "",pos,m_size );
+ }
+ }
+
+ private:
+ Position *m_cc;
+ int m_size;
+};
+
+
+class EmptyClass
+{
+ public:
+ EmptyClass( void ) {}
+ virtual ~EmptyClass() {}
+};
+
+
+class Combined : public EmptyClass, public Position
+{
+ public:
+ Combined( void ) : m_percent(0) {}
+ ~Combined() {}
+
+ void calcPercent( const char *name,int pos,int size )
+ {
+ int percent = 100*pos/size;
+ if( percent!=m_percent )
+ m_percent = percent;
+ }
+
+ private:
+ int m_percent;
+};
+
+
+
+int main( int argc,char **argv )
+{
+ Combined *comb = new Combined();
+ Looper *looper = new Looper( comb,argc );
+
+ looper->loop();
+
+ delete comb;
+ delete looper;
+
+ return( 0 );
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr83084.C b/gcc/testsuite/g++.dg/opt/pr83084.C
new file mode 100644
index 00000000000..d21e30878ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr83084.C
@@ -0,0 +1,16 @@
+// PR debug/83084
+// { dg-do compile }
+// { dg-options "-O2 -fcompare-debug -Wno-return-type" }
+
+enum E { F };
+template <E = F> struct A {
+ bool foo ();
+ int b;
+};
+template <> bool A<>::foo () {
+ int a;
+ do
+ if (a)
+ return false;
+ while (__atomic_compare_exchange_n (&b, &a, 0, 1, 4, 0));
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr83608.C b/gcc/testsuite/g++.dg/opt/pr83608.C
new file mode 100644
index 00000000000..555e5877e75
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr83608.C
@@ -0,0 +1,28 @@
+// PR middle-end/83608
+// { dg-do compile }
+// { dg-options "-O2" }
+
+template <typename> class B;
+template <> struct B<float>
+{
+ float foo () { return __real__ b; }
+ _Complex double b;
+};
+
+void bar (int);
+
+template <class T>
+void
+baz ()
+{
+ B<T> h;
+ T *a = (T *) &h;
+ a[0] = a[1] = 6;
+ h.foo () ? void () : bar (7);
+}
+
+int
+main ()
+{
+ baz<float> ();
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr83609.C b/gcc/testsuite/g++.dg/opt/pr83609.C
new file mode 100644
index 00000000000..a43d2916d9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr83609.C
@@ -0,0 +1,28 @@
+// PR middle-end/83609
+// { dg-do compile }
+// { dg-options "-O2 -fno-tree-forwprop" }
+
+template <typename> class B;
+template <> struct B<float>
+{
+ float foo () { return __real__ b; }
+ _Complex float b;
+};
+
+void bar (int);
+
+template <class T>
+void
+baz ()
+{
+ B<T> h;
+ T *a = (T *) &h;
+ a[0] = a[1] = 6;
+ h.foo () ? void () : bar (7);
+}
+
+int
+main ()
+{
+ baz<float> ();
+}
diff --git a/gcc/testsuite/g++.dg/pr82128.C b/gcc/testsuite/g++.dg/pr82128.C
new file mode 100644
index 00000000000..98bb27adf9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr82128.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-options "-O3 -fno-tree-forwprop" }
+
+class A {
+ virtual unsigned long m_fn1() const;
+ virtual int &m_fn2(unsigned long) const;
+};
+class C : A {
+public:
+ int &m_fn2(unsigned long) const;
+ unsigned long m_fn1() const;
+};
+class B {
+ void m_fn3(const A &, const int &, const C &, int &) const;
+};
+void B::m_fn3(const A &, const int &, const C &, int &) const {
+ C &a(a);
+ for (long b = 0; a.m_fn1(); b++)
+ a.m_fn2(0);
+}
diff --git a/gcc/testsuite/g++.dg/template/pr79650.C b/gcc/testsuite/g++.dg/template/pr79650.C
new file mode 100644
index 00000000000..72c78140942
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr79650.C
@@ -0,0 +1,20 @@
+// PR c++/79650
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+typedef __INTPTR_TYPE__ intptr_t;
+template<intptr_t> struct A {};
+
+void
+foo ()
+{
+ static int a, b;
+lab1:
+lab2:
+ A<(intptr_t)&&lab1 - (__INTPTR_TYPE__)&&lab2> c; // { dg-error "not a constant integer" }
+ A<(intptr_t)&&lab1 - (__INTPTR_TYPE__)&&lab1> d;
+ A<(intptr_t)&a - (intptr_t)&b> e; // { dg-error "is not a constant expression" }
+ A<(intptr_t)&a - (intptr_t)&a> f;
+ A<(intptr_t)sizeof(a) + (intptr_t)&a> g; // { dg-error "not a constant integer" }
+ A<(intptr_t)&a> h; // { dg-error "conversion from pointer type" }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr82060.C b/gcc/testsuite/g++.dg/torture/pr82060.C
new file mode 100644
index 00000000000..3cea930ae05
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr82060.C
@@ -0,0 +1,32 @@
+// { dg-do compile }
+
+struct A
+{
+ char a[1]; // must be char array
+};
+
+struct B
+{
+ A& a() { return ma; } // must be accessed through a getter
+ A ma;
+};
+
+struct C
+{
+ B& b() { return mb; } // must be accessed through a getter
+ B mb;
+};
+
+struct D
+{
+ virtual A getA() = 0; // must be virtual
+};
+
+void
+foo(D& d) // The D object must not be created locally
+ // (so that getA implementation is not known at compile time?)
+{
+ C c;
+ for (;;) // must be in a loop
+ c.b().a() = d.getA();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr82902.C b/gcc/testsuite/g++.dg/torture/pr82902.C
new file mode 100644
index 00000000000..cc2ce271d4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr82902.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+
+typedef struct el_t {
+ el_t *next;
+ int elem[];
+} EL;
+el_t a, c;
+void *b;
+void *fn1() {
+ if (b)
+ return a.elem;
+ return c.elem;
+}
+typedef struct {
+ int x;
+} EV_T;
+EV_T *d;
+void fn2() {
+ EV_T *e = (EV_T *)fn1();
+ d[0] = *e;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr83471.C b/gcc/testsuite/g++.dg/torture/pr83471.C
new file mode 100644
index 00000000000..b9687265d77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr83471.C
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+class a {
+public:
+ void *operator new(__SIZE_TYPE__, int);
+};
+class b : public a {
+public:
+ b();
+ virtual void c() {}
+ void m_fn2();
+};
+int d;
+void e() {
+ long f;
+ b *g;
+ (f);
+ g = new (d) b;
+ g->c();
+ g->m_fn2();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr83713.C b/gcc/testsuite/g++.dg/torture/pr83713.C
new file mode 100644
index 00000000000..ca6af04406d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr83713.C
@@ -0,0 +1,12 @@
+// { dg-do compile }
+
+class a
+{
+ char b;
+ void c ();
+};
+void
+a::c ()
+{
+ &b + ((long long) &b & 0);
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr83523.C b/gcc/testsuite/g++.dg/tree-ssa/pr83523.C
new file mode 100644
index 00000000000..d9adf90f0b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr83523.C
@@ -0,0 +1,25 @@
+// PR tree-optimization/83523
+// { dg-do compile }
+// { dg-options "-O2 -fexceptions -fnon-call-exceptions -ftrapv" }
+
+#ifdef __SIZEOF_INT128__
+typedef __int128 T;
+typedef long long int U;
+#else
+typedef long long int T;
+typedef int U;
+#endif
+
+struct S { S (); ~S (); };
+void bar ();
+
+T
+foo (U x, U y)
+{
+ T z = x;
+ S s;
+ bar ();
+ z *= y;
+ bar ();
+ return z;
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr81212.C b/gcc/testsuite/g++.dg/ubsan/pr81212.C
new file mode 100644
index 00000000000..ce92a07dceb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr81212.C
@@ -0,0 +1,16 @@
+// PR c++/81212
+// { dg-do compile }
+// { dg-options "-Wreturn-type -fsanitize=return" }
+
+struct S
+{
+ S (void *);
+ void *s;
+};
+
+S
+foo (bool x, void *y)
+{
+ if (x)
+ return S (y);
+} // { dg-warning "control reaches end of non-void function" }
diff --git a/gcc/testsuite/g++.dg/warn/pr81675.C b/gcc/testsuite/g++.dg/warn/pr81675.C
new file mode 100644
index 00000000000..24a7a3b0677
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr81675.C
@@ -0,0 +1,15 @@
+// PR c++/81675
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+struct S
+{
+ ~S () __attribute__((noreturn));
+ int a;
+};
+
+int
+foo ()
+{
+ false ? 5 : S ().a;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81553.c b/gcc/testsuite/gcc.c-torture/compile/pr81553.c
new file mode 100644
index 00000000000..ae33b169824
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr81553.c
@@ -0,0 +1,10 @@
+/* PR rtl-optimization/81553 */
+
+int a, b, c, d;
+
+void
+foo (void)
+{
+ d = 1 >> c >> 1;
+ b = ~(209883449764912897ULL & d) << (0 >= a) | ~d;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83448.c b/gcc/testsuite/gcc.c-torture/compile/pr83448.c
new file mode 100644
index 00000000000..9f0d9aca4eb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr83448.c
@@ -0,0 +1,15 @@
+/* PR c/83448 */
+
+char *a;
+int b;
+
+void
+foo (void)
+{
+ for (;;)
+ {
+ if (b < 0)
+ foo ();
+ __builtin_snprintf (a, b, "%*s", b, "");
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20180112-1.c b/gcc/testsuite/gcc.c-torture/execute/20180112-1.c
new file mode 100644
index 00000000000..6752661ecb6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20180112-1.c
@@ -0,0 +1,32 @@
+/* PR rtl-optimization/83565 */
+/* Testcase by Sergei Trofimovich <slyfox@inbox.ru> */
+
+extern void abort (void);
+
+typedef unsigned int u32;
+
+u32 bug (u32 * result) __attribute__((noinline));
+u32 bug (u32 * result)
+{
+ volatile u32 ss = 0xFFFFffff;
+ volatile u32 d = 0xEEEEeeee;
+ u32 tt = d & 0x00800000;
+ u32 r = tt << 8;
+
+ r = (r >> 31) | (r << 1);
+
+ u32 u = r^ss;
+ u32 off = u >> 1;
+
+ *result = tt;
+ return off;
+}
+
+int main(void)
+{
+ u32 l;
+ u32 off = bug(&l);
+ if (off != 0x7fffffff)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr83269.c b/gcc/testsuite/gcc.c-torture/execute/pr83269.c
new file mode 100644
index 00000000000..37fc5d14db7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr83269.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/83269 */
+
+int
+main ()
+{
+#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ > 4 && __CHAR_BIT__ == 8
+ volatile unsigned char a = 1;
+ long long b = 0x80000000L;
+ int c = -((int)(-b) - (-0x7fffffff * a));
+ if (c != 1)
+ __builtin_abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr82545.c b/gcc/testsuite/gcc.dg/asan/pr82545.c
new file mode 100644
index 00000000000..8870db3653f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr82545.c
@@ -0,0 +1,17 @@
+/* PR sanitizer/82545. */
+/* { dg-do compile } */
+
+extern void c(int);
+extern void d(void);
+
+void *buf[5];
+
+void a(void) {
+ {
+ int b;
+ &b;
+ __builtin_setjmp(buf);
+ c(b);
+ }
+ d();
+}
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-18.c b/gcc/testsuite/gcc.dg/builtin-object-size-18.c
new file mode 100644
index 00000000000..e065393282a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-18.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* __stpncpy_chk could return buf up to buf + 64, so
+ the minimum object size might be far smaller than 64. */
+/* { dg-final { scan-tree-dump-not "return 64;" "optimized" } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+size_t
+foo (const char *p, size_t s, size_t t)
+{
+ char buf[64];
+ char *q = __builtin___stpncpy_chk (buf, p, s, t);
+ return __builtin_object_size (q, 2);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr82808.c b/gcc/testsuite/gcc.dg/ipa/pr82808.c
new file mode 100644
index 00000000000..9c95d0b6ed7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr82808.c
@@ -0,0 +1,27 @@
+/* { dg-options "-O2" } */
+/* { dg-do run } */
+
+static void __attribute__((noinline))
+foo (double *a, double x)
+{
+ *a = x;
+}
+
+static double __attribute__((noinline))
+f_c1 (int m, double *a)
+{
+ foo (a, m);
+ return *a;
+}
+
+int
+main (){
+ double data;
+ double ret = 0 ;
+
+ if ((ret = f_c1 (2, &data)) != 2)
+ {
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/opts-8.c b/gcc/testsuite/gcc.dg/opts-8.c
new file mode 100644
index 00000000000..7837197ed43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/opts-8.c
@@ -0,0 +1,6 @@
+/* PR target/82880 */
+/* Test we don't ICE or hang. */
+/* { dg-do compile } */
+/* { dg-options "--help=target --help=optimizers" } */
+/* { dg-allow-blank-lines-in-output 1 } */
+/* { dg-prune-output ".*" } */
diff --git a/gcc/testsuite/gcc.dg/pr80747.c b/gcc/testsuite/gcc.dg/pr80747.c
new file mode 100644
index 00000000000..ea9dd3c3033
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr80747.c
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/80747 */
+/* { dg-do compile } */
+/* { dg-options "-fprofile-use -freorder-blocks-and-partition -O1 -foptimize-sibling-calls" } */
+
+int
+foo (int a)
+{
+ int r;
+ if (a & 1)
+ r = foo (a - 1);
+ else if (a)
+ r = foo (a - 2);
+ else
+ return 0;
+ if (r)
+ r = r;
+ return r;
+}
diff --git a/gcc/testsuite/gcc.dg/pr82765.c b/gcc/testsuite/gcc.dg/pr82765.c
new file mode 100644
index 00000000000..dde0aeba7ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82765.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -w" } */
+
+int a[1][1];
+int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
diff --git a/gcc/testsuite/gcc.dg/pr82975.c b/gcc/testsuite/gcc.dg/pr82975.c
new file mode 100644
index 00000000000..422ba6c6855
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82975.c
@@ -0,0 +1,20 @@
+/* PR target/82975. */
+/* { dg-do compile } */
+/* { dg-options "-fno-sched-pressure -O2" } */
+/* { dg-additional-options "-mtune=cortex-a57" { target arm*-*-* aarch64*-*-* } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+struct S1
+{
+ char pad1;
+ char val;
+ short pad2;
+};
+
+extern char t[256];
+
+void foo (struct S1 a, size_t i)
+{
+ t[i] = a.val;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83198.c b/gcc/testsuite/gcc.dg/pr83198.c
new file mode 100644
index 00000000000..856f2be07d5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83198.c
@@ -0,0 +1,18 @@
+/* PR tree-optimization/83198 */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wno-format" } */
+
+int
+foo (char *d[6], int x)
+{
+ int r = 0;
+ r += __builtin_sprintf (d[0], "%f", x);
+ r += __builtin_sprintf (d[1], "%a", x);
+ r += __builtin_sprintf (d[2], "%f", "foo");
+ r += __builtin_sprintf (d[3], "%a", "bar");
+#ifdef __SIZEOF_FLOAT128__
+ r += __builtin_sprintf (d[4], "%a", 1.0Q);
+ r += __builtin_sprintf (d[5], "%Lf", 1.0Q);
+#endif
+ return r;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83512.c b/gcc/testsuite/gcc.dg/pr83512.c
new file mode 100644
index 00000000000..d86e57befc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83512.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/83512 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -freorder-blocks-algorithm=simple" } */
+
+int a;
+
+void
+foo (int *x)
+{
+ for (;;)
+ {
+ for (*x = 0; *x < 1; *x++)
+ ;
+ ++a;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr83521.c b/gcc/testsuite/gcc.dg/pr83521.c
new file mode 100644
index 00000000000..fc7ca04d1b4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83521.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/83521 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-tree-forwprop" } */
+
+int
+foo (unsigned int x, int y)
+{
+ int *z = (int *)&x;
+ return (y == 0) ? y : *z;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83609.c b/gcc/testsuite/gcc.dg/pr83609.c
new file mode 100644
index 00000000000..eac11fca936
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83609.c
@@ -0,0 +1,29 @@
+/* PR middle-end/83609 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fno-tree-fre -fno-tree-pre -fno-code-hoisting" } */
+
+#if __SIZEOF_LONG_LONG__ == 2 * __SIZEOF_FLOAT__
+_Complex float
+foo (void)
+{
+ _Complex float c;
+ *((unsigned long long *)&c) = 0x123456789abcdef0ULL;
+ return c;
+}
+
+int
+main ()
+{
+ union { _Complex float c; unsigned long long l; } u;
+ u.c = foo ();
+ if (u.l != 0x123456789abcdef0ULL)
+ __builtin_abort ();
+ return 0;
+}
+#else
+int
+main ()
+{
+ return 0;
+}
+#endif
diff --git a/gcc/testsuite/gcc.dg/pr83623.c b/gcc/testsuite/gcc.dg/pr83623.c
new file mode 100644
index 00000000000..5d62c04f542
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83623.c
@@ -0,0 +1,12 @@
+/* PR middle-end/83623 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mmovbe" { target i?86-*-* x86_64-*-* } } */
+
+unsigned short __attribute__ ((__vector_size__ (16))) x;
+
+void
+foo (void)
+{
+ x = x << 8 | x >> 8;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr60092.c b/gcc/testsuite/gcc.dg/torture/pr60092.c
index d66e3f2444e..7c6cabb509a 100644
--- a/gcc/testsuite/gcc.dg/torture/pr60092.c
+++ b/gcc/testsuite/gcc.dg/torture/pr60092.c
@@ -4,7 +4,6 @@
/* { dg-skip-if "No undefined weak" { nvptx-*-* } { "*" } { "" } } */
/* { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } */
/* { dg-additional-options "-Wl,-flat_namespace" { target *-*-darwin[89]* } } */
-/* { dg-xfail-run-if "posix_memalign modifies first arg on error" { *-*-solaris2.11* } { "-O0" } } */
typedef __SIZE_TYPE__ size_t;
extern int posix_memalign(void **memptr, size_t alignment, size_t size) __attribute__((weak));
diff --git a/gcc/testsuite/gcc.dg/torture/pr82102.c b/gcc/testsuite/gcc.dg/torture/pr82102.c
new file mode 100644
index 00000000000..393f8bf9590
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82102.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+void *a, *b;
+struct pt3_i2cbuf {
+ int num_cmds;
+} c;
+void *memcpy(void *, void *, __SIZE_TYPE__);
+void put_stop();
+void translate(struct pt3_i2cbuf *p1, int p2)
+{
+ p1->num_cmds = 0;
+ if (p2)
+ put_stop();
+}
+void pt3_i2c_master_xfer(int p1)
+{
+ translate(&c, p1);
+ memcpy(a, b, c.num_cmds);
+ for (; p1;)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82402.c b/gcc/testsuite/gcc.dg/torture/pr82402.c
new file mode 100644
index 00000000000..cf90d5c6faf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82402.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+typedef int jmp_buf[1];
+
+extern void exit(int) __attribute__((__noreturn__));
+extern int setjmpx(jmp_buf) __attribute__((__returns_twice__));
+
+jmp_buf jbAnagram;
+int a[6];
+int d;
+int b () { exit (1); }
+int c () { b (); }
+int e ()
+{
+ int f = 0;
+ for (; f < 6; f++)
+ a[f] = d;
+ c ();
+ setjmpx (jbAnagram);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr82697.c b/gcc/testsuite/gcc.dg/torture/pr82697.c
new file mode 100644
index 00000000000..57da8a264b9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr82697.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+__attribute__((noinline,noclone))
+void test(int *pi, long *pl, int f)
+{
+ *pl = 0;
+
+ *pi = 1;
+
+ if (f)
+ *pl = 2;
+}
+
+int main()
+{
+ void *p = __builtin_malloc(sizeof (long));
+
+ test(p, p, 0);
+
+ if (*(int *)p != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-4.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-4.c
new file mode 100644
index 00000000000..e6abf24c672
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-4.c
@@ -0,0 +1,46 @@
+/* PR c/83448 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wformat-truncation -fdiagnostics-show-caret" } */
+
+extern int snprintf (char *, __SIZE_TYPE__, const char *, ...);
+
+void
+foo (char *a, char *b, char *c, int d, int e)
+{
+ snprintf (a, 7, "abc\\\123 efg");
+ /* { dg-warning "directive output truncated writing 9 bytes into a region of size 7" "" { target *-*-* } .-1 }
+ { dg-message ".snprintf. output 10 bytes into a destination of size 7" "note" { target *-*-* } .-2 }
+ { dg-begin-multiline-output "" }
+ snprintf (a, 7, "abc\\\123 efg");
+ ~~~~~~~~~~~^~
+ { dg-end-multiline-output "" }
+ { dg-begin-multiline-output "note" }
+ snprintf (a, 7, "abc\\\123 efg");
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+ d &= 63;
+ d += 10;
+ snprintf (b, 7, "a%dbcdefg", d);
+ /* { dg-warning "'bcdefg' directive output truncated writing 6 bytes into a region of size 4" "" { target *-*-* } .-1 }
+ { dg-message ".snprintf. output 10 bytes into a destination of size 7" "note" { target *-*-* } .-2 }
+ { dg-begin-multiline-output "" }
+ snprintf (b, 7, "a%dbcdefg", d);
+ ~~~~^~
+ { dg-end-multiline-output "" }
+ { dg-begin-multiline-output "note" }
+ snprintf (b, 7, "a%dbcdefg", d);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+ e &= 127;
+ snprintf (c, 7, "a%dbcdefgh", e);
+ /* { dg-warning "'bcdefgh' directive output truncated writing 7 bytes into a region of size between 3 and 5" "" { target *-*-* } .-1 }
+ { dg-message ".snprintf. output between 10 and 12 bytes into a destination of size 7" "note" { target *-*-* } .-2 }
+ { dg-begin-multiline-output "" }
+ snprintf (c, 7, "a%dbcdefgh", e);
+ ~~~~~^~
+ { dg-end-multiline-output "" }
+ { dg-begin-multiline-output "note" }
+ snprintf (c, 7, "a%dbcdefgh", e);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr82726.c b/gcc/testsuite/gcc.dg/tree-ssa/pr82726.c
new file mode 100644
index 00000000000..22bc59dacc8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82726.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 --param tree-reassoc-width=4" } */
+/* { dg-additional-options "-mavx2" { target { x86_64-*-* i?86-*-* } } } */
+
+#define N 40
+#define M 128
+unsigned int in[N+M];
+unsigned short out[N];
+
+/* Outer-loop vectorization. */
+
+void
+foo (){
+ int i,j;
+ unsigned int diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i];
+ }
+ out[i]=(unsigned short)diff;
+ }
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr83198.c b/gcc/testsuite/gcc.dg/tree-ssa/pr83198.c
new file mode 100644
index 00000000000..f9dba2acc68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr83198.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/83198 */
+/* { dg-do compile { target __float128 } } */
+/* { dg-options "-O2 -fprintf-return-value -Wno-format -fdump-tree-optimized" } */
+/* { dg-add-options __float128 } */
+
+void bar (void);
+void link_error (void);
+
+void
+foo (char *x)
+{
+ int a = __builtin_sprintf (x, "%f", 1.0Q);
+ if (a < 8)
+ link_error ();
+ if (a > 13)
+ bar ();
+ if (a > 322)
+ link_error ();
+}
+
+/* Verify we don't optimize return value to [8, 13]. */
+/* { dg-final { scan-tree-dump-not "link_error \\(\\);" "optimized" } } */
+/* { dg-final { scan-tree-dump "bar \\(\\);" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr83014.c b/gcc/testsuite/gcc.dg/ubsan/pr83014.c
new file mode 100644
index 00000000000..de626043cc6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr83014.c
@@ -0,0 +1,12 @@
+/* PR sanitizer/83014 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined" } */
+
+int
+foo (void)
+{
+ int data[5];
+ data[0] = 0;
+ data[5] = 0;
+ return data[0];
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr80631-1.c b/gcc/testsuite/gcc.dg/vect/pr80631-1.c
new file mode 100644
index 00000000000..fc81245935a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr80631-1.c
@@ -0,0 +1,76 @@
+/* PR tree-optimization/80631 */
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int v[8] = { 77, 1, 79, 3, 4, 3, 6, 7 };
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int k, r = -1;
+ for (k = 0; k < 8; k++)
+ if (v[k] == 77)
+ r = k;
+ if (r != 0)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int k, r = 4;
+ for (k = 0; k < 8; k++)
+ if (v[k] == 79)
+ r = k;
+ if (r != 2)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f3 (void)
+{
+ int k, r = -17;
+ for (k = 0; k < 8; k++)
+ if (v[k] == 78)
+ r = k;
+ if (r != -17)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f4 (void)
+{
+ int k, r = 7;
+ for (k = 0; k < 8; k++)
+ if (v[k] == 78)
+ r = k;
+ if (r != 7)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f5 (void)
+{
+ int k, r = -1;
+ for (k = 0; k < 8; k++)
+ if (v[k] == 3)
+ r = k;
+ if (r != 5)
+ abort ();
+}
+
+int
+main ()
+{
+ check_vect ();
+ f1 ();
+ f2 ();
+ f3 ();
+ f4 ();
+ f5 ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 5 "vect" { xfail { ! vect_max_reduc } } } } */
+/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 10 "vect" { xfail { ! vect_max_reduc } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr80631-2.c b/gcc/testsuite/gcc.dg/vect/pr80631-2.c
new file mode 100644
index 00000000000..60f4cf0c194
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr80631-2.c
@@ -0,0 +1,73 @@
+/* PR tree-optimization/80631 */
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+int v[8] = { 77, 1, 79, 3, 4, 3, 6, 7 };
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int k, r = -1;
+ for (k = 7; k >= 0; k--)
+ if (v[k] == 77)
+ r = k;
+ if (r != 0)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int k, r = 4;
+ for (k = 7; k >= 0; k--)
+ if (v[k] == 79)
+ r = k;
+ if (r != 2)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f3 (void)
+{
+ int k, r = -17;
+ for (k = 7; k >= 0; k--)
+ if (v[k] == 78)
+ r = k;
+ if (r != -17)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f4 (void)
+{
+ int k, r = 7;
+ for (k = 7; k >= 0; k--)
+ if (v[k] == 78)
+ r = k;
+ if (r != 7)
+ abort ();
+}
+
+__attribute__((noinline, noclone)) void
+f5 (void)
+{
+ int k, r = -1;
+ for (k = 7; k >= 0; k--)
+ if (v[k] == 3)
+ r = k;
+ if (r != 3)
+ abort ();
+}
+
+int
+main ()
+{
+ check_vect ();
+ f1 ();
+ f2 ();
+ f3 ();
+ f4 ();
+ f5 ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/alpha/pr83628-1.c b/gcc/testsuite/gcc.target/alpha/pr83628-1.c
new file mode 100644
index 00000000000..a4a32d98969
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/pr83628-1.c
@@ -0,0 +1,19 @@
+/* PR target/83628 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+int
+get_int (int *p, size_t idx)
+{
+ return p[idx];
+}
+
+long
+get_long (long *p, size_t idx)
+{
+ return p[idx];
+}
+
+/* { dg-final { scan-assembler-not "\[ \t\]add\[ql\]" } } */
diff --git a/gcc/testsuite/gcc.target/alpha/pr83628-2.c b/gcc/testsuite/gcc.target/alpha/pr83628-2.c
new file mode 100644
index 00000000000..2f02181d28b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/pr83628-2.c
@@ -0,0 +1,29 @@
+/* PR target/83628 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+s4l (int a, int b)
+{
+ return a * 4 + b;
+}
+
+int
+s8l (int a, int b)
+{
+ return a * 8 + b;
+}
+
+long
+s4q (long a, long b)
+{
+ return a * 4 + b;
+}
+
+long
+s8q (long a, long b)
+{
+ return a * 8 + b;
+}
+
+/* { dg-final { scan-assembler-not "\[ \t\]add\[ql\]" } } */
diff --git a/gcc/testsuite/gcc.target/alpha/pr83628-3.c b/gcc/testsuite/gcc.target/alpha/pr83628-3.c
new file mode 100644
index 00000000000..5bec89f8047
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/pr83628-3.c
@@ -0,0 +1,29 @@
+/* PR target/83628 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+s4l (int a, int b)
+{
+ return a * 4 - b;
+}
+
+int
+s8l (int a, int b)
+{
+ return a * 8 - b;
+}
+
+long
+s4q (long a, long b)
+{
+ return a * 4 - b;
+}
+
+long
+s8q (long a, long b)
+{
+ return a * 8 - b;
+}
+
+/* { dg-final { scan-assembler-not "\[ \t\]sub\[ql\]" } } */
diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c
new file mode 100644
index 00000000000..09adddfd57c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-move-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */
+/* { dg-options "-O2 -mfpu=fp-armv8 -march=armv8.2-a+fp16 -marm -mfloat-abi=hard" } */
+
+__fp16
+test_select (__fp16 a, __fp16 b, __fp16 c)
+{
+ return (a < b) ? b : c;
+}
+/* { dg-final { scan-assembler "bpl" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr80631.c b/gcc/testsuite/gcc.target/i386/avx2-pr80631.c
new file mode 100644
index 00000000000..5af1b0feb2c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr80631.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/80631 */
+/* { dg-do run } */
+/* { dg-options "-O2 -ftree-vectorize -mavx2 -fno-vect-cost-model" } */
+/* { dg-require-effective-target avx2 } */
+
+#include "avx2-check.h"
+
+#define N 8
+
+static void
+avx2_test (void)
+{
+ int v[N], k;
+ for(k = 0; k < N; k++)
+ v[k] = k;
+ v[0] = 77;
+ int found_index = -1;
+ for (k = 0; k < N; k++)
+ if (v[k] == 77)
+ found_index = k;
+ if (found_index != 0)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr80583.c b/gcc/testsuite/gcc.target/i386/pr80583.c
new file mode 100644
index 00000000000..6fe3212b65c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr80583.c
@@ -0,0 +1,13 @@
+/* PR target/80583 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -mno-avx" } */
+
+typedef int V __attribute__((__vector_size__(32)));
+struct S { V a; };
+
+V __attribute__((target ("avx")))
+foo (struct S *b)
+{
+ V x = b->a;
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr80819-1.c b/gcc/testsuite/gcc.target/i386/pr80819-1.c
new file mode 100644
index 00000000000..f06c3628e02
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr80819-1.c
@@ -0,0 +1,13 @@
+/* PR target/80819 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse4 -mno-avx -mtune=haswell -masm=att" } */
+
+typedef unsigned long long V __attribute__((vector_size (16)));
+
+V
+foo (unsigned long long x, unsigned long long y)
+{
+ return (V) { x, y };
+}
+
+/* { dg-final { scan-assembler-not "movq\[ \t]*%rsi, \[-0-9]*\\(" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr80819-2.c b/gcc/testsuite/gcc.target/i386/pr80819-2.c
new file mode 100644
index 00000000000..7571e8160cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr80819-2.c
@@ -0,0 +1,13 @@
+/* PR target/80819 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -msse4 -mno-avx -mtune=generic -masm=att" } */
+
+typedef unsigned long long V __attribute__((vector_size (16)));
+
+V
+foo (unsigned long long x, unsigned long long y)
+{
+ return (V) { x, y };
+}
+
+/* { dg-final { scan-assembler-not "movq\[ \t]*%rsi, \[-0-9]*\\(" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr81906.c b/gcc/testsuite/gcc.target/i386/pr81906.c
new file mode 100644
index 00000000000..6c71bec41c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81906.c
@@ -0,0 +1,37 @@
+/* PR target/81906 */
+/* { dg-do run { target *-*-linux* *-*-gnu* } }
+/* { dg-options "-O2 -frounding-math" } */
+
+#include <fenv.h>
+
+int
+main ()
+{
+ #define N 12
+ double a[N] = { 2.0, 2.25, 2.5, 2.75, 3.5, -2.0, -2.25, -2.5, -2.75, -3.5, 0x2.0p53, -0x2.0p53 };
+ double b[N], c[N], d[N], e[N];
+ double be[N] = { 2.0, 2.0, 2.0, 3.0, 4.0, -2.0, -2.0, -2.0, -3.0, -4.0, 0x2.0p53, -0x2.0p53 };
+ double ce[N] = { 2.0, 2.0, 2.0, 2.0, 3.0, -2.0, -3.0, -3.0, -3.0, -4.0, 0x2.0p53, -0x2.0p53 };
+ double de[N] = { 2.0, 3.0, 3.0, 3.0, 4.0, -2.0, -2.0, -2.0, -2.0, -3.0, 0x2.0p53, -0x2.0p53 };
+ double ee[N] = { 2.0, 2.0, 2.0, 2.0, 3.0, -2.0, -2.0, -2.0, -2.0, -3.0, 0x2.0p53, -0x2.0p53 };
+ asm volatile ("" : : "g" (a), "g" (be), "g" (ce), "g" (de), "g" (ee) : "memory");
+
+ int i;
+ fesetround (FE_TONEAREST);
+ for (i = 0; i < N; ++i)
+ b[i] = __builtin_rint (a[i]);
+ fesetround (FE_DOWNWARD);
+ for (i = 0; i < N; ++i)
+ c[i] = __builtin_rint (a[i]);
+ fesetround (FE_UPWARD);
+ for (i = 0; i < N; ++i)
+ d[i] = __builtin_rint (a[i]);
+ fesetround (FE_TOWARDZERO);
+ for (i = 0; i < N; ++i)
+ e[i] = __builtin_rint (a[i]);
+ fesetround (FE_TONEAREST);
+ for (i = 0; i < N; ++i)
+ if (b[i] != be[i] || c[i] != ce[i] || d[i] != de[i] || e[i] != ee[i])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82941-1.c b/gcc/testsuite/gcc.target/i386/pr82941-1.c
new file mode 100644
index 00000000000..d7e530d5116
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82941-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82941-2.c b/gcc/testsuite/gcc.target/i386/pr82941-2.c
new file mode 100644
index 00000000000..db2f8589ab6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82941-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=knl" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82942-1.c b/gcc/testsuite/gcc.target/i386/pr82942-1.c
new file mode 100644
index 00000000000..9cdf81a9d60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82942-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-avx512er -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82942-2.c b/gcc/testsuite/gcc.target/i386/pr82942-2.c
new file mode 100644
index 00000000000..ddb4e689659
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82942-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mavx512er -mtune=knl -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-1.c b/gcc/testsuite/gcc.target/i386/pr82990-1.c
new file mode 100644
index 00000000000..ff1d6d40eb2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=knl -mvzeroupper" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-2.c b/gcc/testsuite/gcc.target/i386/pr82990-2.c
new file mode 100644
index 00000000000..0d3cb2333dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-2.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mno-vzeroupper" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-3.c b/gcc/testsuite/gcc.target/i386/pr82990-3.c
new file mode 100644
index 00000000000..201fa98d8d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-3.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mavx512er -mvzeroupper -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-4.c b/gcc/testsuite/gcc.target/i386/pr82990-4.c
new file mode 100644
index 00000000000..09f161c7291
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-4.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-avx512er -mno-vzeroupper -O2" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-5.c b/gcc/testsuite/gcc.target/i386/pr82990-5.c
new file mode 100644
index 00000000000..9932bdc5375
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mtune=generic" } */
+
+#include <immintrin.h>
+
+extern __m512d y, z;
+
+void
+pr82941 ()
+{
+ z = y;
+}
+
+/* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-6.c b/gcc/testsuite/gcc.target/i386/pr82990-6.c
new file mode 100644
index 00000000000..063a61c111d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-6.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mtune=knl" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr82990-7.c b/gcc/testsuite/gcc.target/i386/pr82990-7.c
new file mode 100644
index 00000000000..dedde8b854b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82990-7.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=skylake-avx512 -mtune=generic -mtune-ctrl=^emit_vzeroupper" } */
+
+#include "pr82941-1.c"
+
+/* { dg-final { scan-assembler-not "vzeroupper" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr83467-1.c b/gcc/testsuite/gcc.target/i386/pr83467-1.c
new file mode 100644
index 00000000000..b5cf17edec2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr83467-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flive-range-shrinkage -m8bit-idiv" } */
+/* { dg-require-effective-target int128 } */
+
+unsigned a;
+
+__int128
+b (unsigned c, short d, int e, long f, unsigned __int128 g, char h,
+ int i, __int128 j)
+{
+ j %= 5;
+ c *= i;
+ e = e >> (g & 31);
+ h &= e /= d;
+ g <<= 0 <= 0;
+ g &= h < j;
+ return c + d + f + g + h + i + a + j;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr83467-2.c b/gcc/testsuite/gcc.target/i386/pr83467-2.c
new file mode 100644
index 00000000000..1b424fec2cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr83467-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flive-range-shrinkage" } */
+/* { dg-require-effective-target int128 } */
+
+int
+a (int b, short c, int d, long e, __int128 f, short g, long h, __int128 i)
+{
+ d <<= f & 31;
+ f >>= 127;
+ g *= d > c;
+ f >>= g;
+ return b + e + f + h + i;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
index 8a1f7c86013..928131b52ce 100644
--- a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c
@@ -73,6 +73,7 @@ use_cpu_supports_builtins (unsigned int *p)
p[37] = __builtin_cpu_supports ("vsx");
p[38] = __builtin_cpu_supports ("darn");
p[39] = __builtin_cpu_supports ("scv");
+ p[40] = __builtin_cpu_supports ("htm-no-suspend");
#else
p[0] = 0;
#endif
diff --git a/gcc/testsuite/gcc.target/powerpc/pr77687.c b/gcc/testsuite/gcc.target/powerpc/pr77687.c
new file mode 100644
index 00000000000..95b27ae99e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr77687.c
@@ -0,0 +1,20 @@
+/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-final { scan-assembler-not {\mmr r?1,r?11\M.*11.*\mblr\M} } } */
+
+/* PR77687: We used to do stack accesses (via r11) after restoring r1. */
+
+void g(int, char *);
+const char * dum = "hello";
+
+void f(int x)
+{
+ char big[200000];
+ start:
+ g(x, big);
+ g(x, big);
+ register void *p asm("r11") = &&start;
+ asm("" : : "r"(p));
+ asm("" : : :"r28");
+ asm("" : : :"r29");
+ asm("" : : :"r30");
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80101-1.c b/gcc/testsuite/gcc.target/powerpc/pr80101-1.c
new file mode 100644
index 00000000000..45011d54ac2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr80101-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power6" } } */
+/* { dg-require-effective-target dfp_hw } */
+/* { dg-options "-mcpu=power6 -mno-sched-epilog -Ofast" } */
+
+/* Prior to resolving PR 80101, this test case resulted in an internal
+ compiler error. The role of this test program is to assure that
+ dejagnu's "test for excess errors" does not find any. */
+
+int b;
+
+void e ();
+
+int c ()
+{
+ struct
+ {
+ int a[b];
+ } d;
+ if (d.a[0])
+ e ();
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80210-2.c b/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
new file mode 100644
index 00000000000..455f7d6e31f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
@@ -0,0 +1,11 @@
+/* Test for ICE arising from GCC target pragma. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#pragma GCC target "no-powerpc-gpopt"
+double
+foo (double a)
+{
+ return __builtin_sqrt (a);
+}
+/* { dg-final { scan-assembler-not "fsqrt" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr81959.c b/gcc/testsuite/gcc.target/powerpc/pr81959.c
new file mode 100644
index 00000000000..c4cc3733841
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr81959.c
@@ -0,0 +1,25 @@
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-vector -O2 -mfloat128" } */
+
+/* PR 81959, the compiler raised on unrecognizable insn message in converting
+ int to __float128, where the int had a PRE_INC in the address. */
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE 1024
+#endif
+
+void
+convert_int_to_float128 (__float128 * __restrict__ p,
+ int * __restrict__ q)
+{
+ unsigned long i;
+
+ for (i = 0; i < ARRAY_SIZE; i++)
+ p[i] = (__float128)q[i];
+}
+
+/* { dg-final { scan-assembler {\mlfiwax\M|\mlxsiwax\M} } } */
+/* { dg-final { scan-assembler {\mxscvsdqp\M} } } */
+/* { dg-final { scan-assembler-not {\mmtvsrd\M} } } */
+/* { dg-final { scan-assembler-not {\mmtvsrw[sz]\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83677.c b/gcc/testsuite/gcc.target/powerpc/pr83677.c
new file mode 100644
index 00000000000..a1a760df811
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83677.c
@@ -0,0 +1,166 @@
+/* { dg-do run { target { powerpc*-*-* && { lp64 && p9vector_hw } } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-mcpu=power9 -O2 " } */
+
+/* PR83677: This test case used to fail due to mis-generation of the
+ xxpermr instruction. It requires inlining to create enough register
+ pressure that we generate xxpermr rather than vpermr. */
+
+#include <altivec.h>
+
+void v_expand_u8(vector unsigned char* a, vector unsigned short* b0, vector unsigned short* b1)
+{
+ *b0 = (vector unsigned short)vec_mergeh(*a, vec_splats((unsigned char)0));
+ *b1 = (vector unsigned short)vec_mergel(*a, vec_splats((unsigned char)0));
+}
+
+void v_expand_u16(vector unsigned short* a, vector unsigned int* b0, vector unsigned int* b1)
+{
+ *b0 = (vector unsigned int)vec_mergeh(*a, vec_splats((unsigned short)0));
+ *b1 = (vector unsigned int)vec_mergel(*a, vec_splats((unsigned short)0));
+}
+
+void v_load_deinterleave_u8(unsigned char *ptr, vector unsigned char* a, vector unsigned char* b, vector unsigned char* c)
+{
+ vector unsigned char v1 = vec_xl( 0, ptr);
+ vector unsigned char v2 = vec_xl(16, ptr);
+ vector unsigned char v3 = vec_xl(32, ptr);
+
+ static const vector unsigned char a12_perm = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 0, 0, 0, 0, 0};
+ static const vector unsigned char a123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 17, 20, 23, 26, 29};
+ *a = vec_perm(vec_perm(v1, v2, a12_perm), v3, a123_perm);
+
+ static const vector unsigned char b12_perm = {1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 0, 0, 0, 0, 0};
+ static const vector unsigned char b123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 18, 21, 24, 27, 30};
+ *b = vec_perm(vec_perm(v1, v2, b12_perm), v3, b123_perm);
+
+ static const vector unsigned char c12_perm = {2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 0, 0, 0, 0, 0, 0};
+ static const vector unsigned char c123_perm = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 19, 22, 25, 28, 31};
+ *c = vec_perm(vec_perm(v1, v2, c12_perm), v3, c123_perm);
+}
+
+void v_load_deinterleave_f32(float *ptr, vector float* a, vector float* b, vector float* c)
+{
+ vector float v1 = vec_xl( 0, ptr);
+ vector float v2 = vec_xl(16, ptr);
+ vector float v3 = vec_xl(32, ptr);
+
+ static const vector unsigned char flp = {0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 28, 29, 30, 31};
+ *a = vec_perm(v1, vec_sld(v3, v2, 8), flp);
+
+ static const vector unsigned char flp2 = {28, 29, 30, 31, 0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19};
+ *b = vec_perm(v2, vec_sld(v1, v3, 8), flp2);
+
+ *c = vec_perm(vec_sld(v2, v1, 8), v3, flp);
+}
+
+void v_store_interleave_f32(float *ptr, vector float a, vector float b, vector float c)
+{
+ vector float hbc = vec_mergeh(b, c);
+
+ static const vector unsigned char ahbc = {0, 1, 2, 3, 16, 17, 18, 19, 20, 21, 22, 23, 4, 5, 6, 7};
+ vec_xst(vec_perm(a, hbc, ahbc), 0, ptr);
+
+ vector float lab = vec_mergel(a, b);
+ vec_xst(vec_sld(lab, hbc, 8), 16, ptr);
+
+ static const vector unsigned char clab = {8, 9, 10, 11, 24, 25, 26, 27, 28, 29, 30, 31, 12, 13, 14, 15};
+ vec_xst(vec_perm(c, lab, clab), 32, ptr);
+}
+
+vector float v_cvt_f32(vector unsigned int a)
+{
+ return (vector float)vec_ctf(a, 0);
+}
+
+void acc_simd_(const unsigned char* src, float* dst, const unsigned char* mask, int len)
+{
+ int x = 0;
+ const int cVectorWidth = 16;
+
+ for ( ; x <= len - cVectorWidth; x += cVectorWidth)
+ {
+ vector unsigned char v_mask = vec_xl(0, mask + x);
+ v_mask = (vector unsigned char)vec_cmpeq(vec_splats((unsigned char)0), v_mask);
+ v_mask = (vector unsigned char)vec_nor(v_mask, v_mask);
+ vector unsigned char v_src0, v_src1, v_src2;
+ v_load_deinterleave_u8((unsigned char *)(src + (x * 3)), &v_src0, &v_src1, &v_src2);
+ v_src0 = v_src0 & v_mask;
+ v_src1 = v_src1 & v_mask;
+ v_src2 = v_src2 & v_mask;
+
+ /* expand 16 uchar to 4 vectors which contains 4 uint */
+ vector unsigned short v_src00, v_src01, v_src10, v_src11, v_src20, v_src21;
+ v_expand_u8(&v_src0, &v_src00, &v_src01);
+ v_expand_u8(&v_src1, &v_src10, &v_src11);
+ v_expand_u8(&v_src2, &v_src20, &v_src21);
+ vector unsigned int v_src000, v_src001, v_src010, v_src011;
+ vector unsigned int v_src100, v_src101, v_src110, v_src111;
+ vector unsigned int v_src200, v_src201, v_src210, v_src211;
+ v_expand_u16(&v_src00, &v_src000, &v_src001);
+ v_expand_u16(&v_src01, &v_src010, &v_src011);
+ v_expand_u16(&v_src10, &v_src100, &v_src101);
+ v_expand_u16(&v_src11, &v_src110, &v_src111);
+ v_expand_u16(&v_src20, &v_src200, &v_src201);
+ v_expand_u16(&v_src21, &v_src210, &v_src211);
+
+ vector float v_dst000, v_dst001, v_dst010, v_dst011;
+ vector float v_dst100, v_dst101, v_dst110, v_dst111;
+ vector float v_dst200, v_dst201, v_dst210, v_dst211;
+ v_load_deinterleave_f32(dst + (x * 3), &v_dst000, &v_dst100, &v_dst200);
+ v_load_deinterleave_f32(dst + ((x + 4) * 3), &v_dst001, &v_dst101, &v_dst201);
+ v_load_deinterleave_f32(dst + ((x + 8) * 3), &v_dst010, &v_dst110, &v_dst210);
+ v_load_deinterleave_f32(dst + ((x + 12) * 3), &v_dst011, &v_dst111, &v_dst211);
+
+ v_store_interleave_f32(dst + (x * 3), vec_add(v_dst000, v_cvt_f32(v_src000)), vec_add(v_dst100, v_cvt_f32(v_src100)), vec_add(v_dst200, v_cvt_f32(v_src200)));
+ v_store_interleave_f32(dst + ((x + 4) * 3), vec_add(v_dst001, v_cvt_f32(v_src001)), vec_add(v_dst101, v_cvt_f32(v_src101)), vec_add(v_dst201, v_cvt_f32(v_src201)));
+ v_store_interleave_f32(dst + ((x + 8) * 3), vec_add(v_dst010, v_cvt_f32(v_src010)), vec_add(v_dst110, v_cvt_f32(v_src110)), vec_add(v_dst210, v_cvt_f32(v_src210)));
+ v_store_interleave_f32(dst + ((x + 12) * 3), vec_add(v_dst011, v_cvt_f32(v_src011)), vec_add(v_dst111, v_cvt_f32(v_src111)), vec_add(v_dst211, v_cvt_f32(v_src211)));
+ }
+ return;
+}
+
+void acc_(const unsigned char* src, float* dst, const unsigned char* mask, int len)
+{
+ int x = 0;
+ src += (x * 3);
+ dst += (x * 3);
+ for( ; x < len; x++, src += 3, dst += 3 )
+ {
+ if( mask[x] ) /* if mask, R/G/B dst[] += src[] */
+ {
+ for( int k = 0; k < 3; k++ )
+ {
+ dst[k] += src[k];
+ }
+ }
+ }
+ return;
+}
+
+#define N 16
+
+int main(int argc, char *argv[])
+{
+ unsigned char __attribute__ ((aligned (16) )) mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1};
+ unsigned char __attribute__ ((aligned (16) )) src[3*N];
+ float __attribute__ ((aligned (16) )) dst[3*N];
+ float __attribute__ ((aligned (16) )) exp[3*N];
+
+ int i;
+
+ /* initialize src and dst */
+ for (i=0; i<3*N; i++) src[i] = (unsigned char)(i*3);
+ for (i=0; i<3*N; i++) {dst[i] = i * 1.0f; exp[i] = dst[i];}
+
+ acc_(src, exp, mask, N);
+ acc_simd_(src, dst, mask, N);
+
+ for (i=0; i<N; i++)
+ {
+ if ((dst[3*i] != exp[3*i]) || (dst[3*i+1] != exp[3*i+1]) || (dst[3*i+2] != exp[3*i+2]))
+ __builtin_abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/riscv.exp b/gcc/testsuite/gcc.target/riscv/riscv.exp
new file mode 100644
index 00000000000..6a141964d22
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/riscv.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't a RISC-V target.
+if ![istarget riscv*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/riscv/save-restore-1.c b/gcc/testsuite/gcc.target/riscv/save-restore-1.c
new file mode 100644
index 00000000000..35b08b96760
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/save-restore-1.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msave-restore -fomit-frame-pointer" } */
+
+#include <stdlib.h>
+
+__attribute__((noinline)) int g(void) { return 42; }
+
+__attribute__((noinline)) int f(void) {
+ asm volatile ("li s0, 0x87654321" ::: "s0");
+ return g();
+}
+
+int main(void) {
+ asm volatile ("li s0, 0x12345678" ::: "s0");
+
+ f();
+
+ long s0;
+ asm volatile ("mv %0, s0" : "=r"(s0));
+
+ if (s0 == 0x12345678)
+ exit (0);
+ else
+ abort();
+}
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90
new file mode 100644
index 00000000000..feb6c8c16cf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_7.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! PR Fortran/83093
+! Contributed by Gerhard Steinmetz <gscfq at t-online dot de>
+program p
+ integer, parameter :: n(2) = [1,2]
+ real :: x = 2
+ character(:), allocatable :: z, zz, zzz
+ character(:), allocatable :: y, yy
+ allocate (character(a) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(x) :: zz) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character((1.0)) :: z) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(y) :: y) ! { dg-error "Scalar INTEGER expression" }
+ allocate (character(n(1:2)) :: y)! { dg-error "Scalar INTEGER expression" }
+end
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_type_22.f03 b/gcc/testsuite/gfortran.dg/array_constructor_type_22.f03
new file mode 100644
index 00000000000..75130df7ec1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_constructor_type_22.f03
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! PR Fortran/83548
+program foo
+
+ implicit none
+
+ logical, parameter :: t = .true., f = .false.
+ logical, parameter :: a1(2) = [t, f]
+ logical(kind=1), parameter :: a2(2) = [logical(kind=1) :: t, f]
+ logical(kind=4), parameter :: a3(2) = [logical(kind=4) :: t, f]
+ logical(kind=1), parameter :: a4(2) = [logical(t, 1), logical(f, 1)]
+ logical(kind=4), parameter :: a5(2) = [logical(t, 4), logical(f, 4)]
+ logical(kind=1) b(2)
+ logical(kind=4) c(2)
+
+ real, parameter :: x = 1, y = 2
+ real, parameter :: r1(2) = [x, y]
+ real(kind=4), parameter :: r2(2) = [real(kind=4) :: x, y]
+ real(kind=8), parameter :: r3(2) = [real(kind=8) :: x, y]
+ real(kind=4), parameter :: r4(2) = [real(x, 4), real(y, 4)]
+ real(kind=8), parameter :: r5(2) = [real(x, 8), real(y, 8)]
+ real(kind=4) p(2)
+ real(kind=8) q(2)
+
+ p = [real(kind=4) :: x, y]
+ q = [real(kind=8) :: x, y]
+ if (any(p .ne. r2)) call abort
+ if (any(q .ne. r3)) call aborts
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/class_result_5.f90 b/gcc/testsuite/gfortran.dg/class_result_5.f90
new file mode 100644
index 00000000000..c557ed37180
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_result_5.f90
@@ -0,0 +1,38 @@
+! { dg-do run }
+!
+! Test the fix for PR79072. The original problem was that an ICE
+! would occur in the select type construct. On fixing that, it was
+! found that the string length was not being transferred in the
+! pointer assignment in the main program.
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+function foo(string)
+ class(*), pointer :: foo
+ character(3), target :: string
+ foo => string
+ select type (foo)
+ type is (character(*))
+ if (foo .ne. 'foo') call abort
+ foo = 'bar'
+ end select
+end function
+
+ interface
+ function foo(string)
+ class(*), pointer :: foo
+ character(3), target :: string
+ end function
+ end interface
+
+ class(*), pointer :: res
+ character(3), target :: string = 'foo'
+
+ res => foo (string)
+
+ select type (res)
+ type is (character(*))
+ if (res .ne. 'bar') call abort
+ end select
+ if (string .ne. 'bar') call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/class_result_6.f90 b/gcc/testsuite/gfortran.dg/class_result_6.f90
new file mode 100644
index 00000000000..44e17a22025
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_result_6.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+!
+! Test the fix for PR79072 comment #12. A description of the problem
+! is to be found in class_result_5.f90.
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+ character(3), target :: a = 'foo'
+ class(*), pointer :: b
+ b => ptr()
+ select type (b)
+ type is (character(*))
+ if (a .ne. "bar") call abort
+ end select
+contains
+ function ptr()
+ class(*), pointer :: ptr
+ ptr => a
+ select type (ptr)
+ type is (character(*))
+ ptr = "bar"
+ end select
+ end function
+end
diff --git a/gcc/testsuite/gfortran.dg/deferred_character_18.f90 b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
new file mode 100644
index 00000000000..1b1457fa293
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deferred_character_18.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+! PR Fortran/82367
+! Contributed by Walter Spector <w6ws at earthlink dot net>
+module cls_allocmod
+ implicit none
+
+contains
+
+ subroutine cls_alloc (n, str)
+ integer, intent(in) :: n
+ character(*), allocatable, intent(out) :: str
+! Note: Star ^ should have been a colon (:)
+
+ allocate (character(n)::str)
+
+ end subroutine
+
+end module
+
+program cls
+ use cls_allocmod
+ implicit none
+
+ character(:), allocatable :: s
+
+ call cls_alloc(42, s) ! { dg-error "allocatable or pointer dummy argument" }
+ print *, 'string len =', len(s)
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/fmt_e.f90 b/gcc/testsuite/gfortran.dg/fmt_e.f90
new file mode 100644
index 00000000000..a85506b0929
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_e.f90
@@ -0,0 +1,10 @@
+! { dg-do run }
+! PR83811 fortran 'e' format broken for single digit exponents
+program test
+ character(25) :: s
+ write(s, '(1pe5.0e1)') 1.e-4
+ if (s.ne."1.E-4") call abort
+ write(s, '(e5.1e1)') 1.e12
+ if (s.ne."*****") call abort
+end
+
diff --git a/gcc/testsuite/gfortran.dg/interface_40.f90 b/gcc/testsuite/gfortran.dg/interface_40.f90
new file mode 100644
index 00000000000..085c6b30f39
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_40.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/78814
+! Code contributed by Gerhard Steinmetz
+program p
+ class(*) :: x ! { dg-error " must be dummy, allocatable or pointer" }
+ print *, f(x)
+end
+
diff --git a/gcc/testsuite/gfortran.dg/internal_readwrite_4.f90 b/gcc/testsuite/gfortran.dg/internal_readwrite_4.f90
new file mode 100644
index 00000000000..cd2e684a456
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/internal_readwrite_4.f90
@@ -0,0 +1,30 @@
+! { dg-do run }
+! PR 83436 - this used to cause an error.
+! Original test case by Daan van Vugt.
+module mod_random_seed
+ implicit none
+contains
+ !> Read an int from /dev/urandom
+ subroutine read_urandom_int(seed, ierr)
+ implicit none
+ integer, intent(out) :: seed
+ integer, intent(out) :: ierr
+ integer :: un
+ character(len=80) :: restart_file
+ write(restart_file,'(A,A)') 'jorek', '_restart.h5'
+
+ open(newunit=un, file="/dev/urandom", access="stream", &
+ form="unformatted", action="read", status="old", iostat=ierr)
+ if (ierr == 0) then
+ read(un) seed
+ close(un)
+ end if
+ end subroutine read_urandom_int
+end module mod_random_seed
+
+program test_random_seed
+ use mod_random_seed
+ implicit none
+ integer :: seed, ierr
+ call read_urandom_int(seed, ierr)
+end program test_random_seed
diff --git a/gcc/testsuite/gfortran.dg/namelist_95.f90 b/gcc/testsuite/gfortran.dg/namelist_95.f90
new file mode 100644
index 00000000000..59566480865
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_95.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! PR83191 Writing a namelist with repeated complex
+
+program test
+
+implicit none
+
+integer, parameter :: UNIT = 1
+character(len=8), parameter :: FILE = "namelist"
+
+complex, dimension(3) :: a = (/ (0.0, 0.0), (0.0, 0.0), (3.0, 4.0) /)
+
+namelist /complex_namelist/ a
+
+open(UNIT, file=FILE)
+write(UNIT, nml=complex_namelist)
+close(UNIT)
+
+open(UNIT, file=FILE)
+read(UNIT, nml=complex_namelist)
+close(UNIT, status="delete")
+if (any(a.ne.(/ (0.0, 0.0), (0.0, 0.0), (3.0, 4.0) /))) call abort
+end program test
diff --git a/gcc/testsuite/gfortran.dg/pr78686.f90 b/gcc/testsuite/gfortran.dg/pr78686.f90
new file mode 100644
index 00000000000..b17fe4192c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr78686.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! Test the fix for PR78686, which used to ICE.
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+!
+program p
+ type t
+ character :: c(1) = [t()] ! { dg-error "is being used before it is defined" }
+ end type
+end
diff --git a/gcc/testsuite/gfortran.dg/pr82253.f90 b/gcc/testsuite/gfortran.dg/pr82253.f90
new file mode 100644
index 00000000000..4dc681012a0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr82253.f90
@@ -0,0 +1,40 @@
+! PR middle-end/82253
+! { dg-do compile { target fortran_real_16 } }
+! { dg-options "-Og" }
+
+module pr82253
+ implicit none
+ private
+ public :: static_type
+ type, public :: T
+ procedure(), nopass, pointer :: testProc => null()
+ end type
+ type, public :: S
+ complex(kind=16), pointer :: ptr
+ end type
+ type(T), target :: type_complex32
+ interface static_type
+ module procedure foo
+ end interface
+ interface
+ subroutine bar (testProc)
+ procedure(), optional :: testProc
+ end subroutine
+ end interface
+ contains
+ function foo (self) result(res)
+ complex(kind=16) :: self
+ type(T), pointer :: res
+ call bar (testProc = baz)
+ end function
+ subroutine baz (buffer, status)
+ character(len=*) :: buffer
+ integer(kind=4) :: status
+ complex(kind=16), target :: obj
+ type(S) :: self
+ integer(kind=1), parameter :: zero(storage_size(obj)/8) = 0
+ obj = transfer (zero, obj)
+ self%ptr => obj
+ write (buffer, *, iostat=status) self%ptr, '#'
+ end subroutine
+end module pr82253
diff --git a/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90 b/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
index dbe67f4c8e9..3eb5adb49c8 100644
--- a/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
+++ b/gcc/testsuite/gfortran.dg/simplify_cshift_1.f90
@@ -23,12 +23,12 @@ program foo
v = cshift(c, 2)
if (any(b /= v)) call abort
- ! Special cases shift = 0, size(a), 1-size(a)
+ ! Special cases shift = 0, size(a), size(a)
b = cshift([1, 2, 3, 4, 5], 0)
if (any(b /= a)) call abort
b = cshift([1, 2, 3, 4, 5], size(a))
if (any(b /= a)) call abort
- b = cshift([1, 2, 3, 4, 5], 1-size(a))
+ b = cshift([1, 2, 3, 4, 5], -size(a))
if (any(b /= a)) call abort
! simplification of array arg.
diff --git a/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90 b/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90
new file mode 100644
index 00000000000..ce7a4ad5e56
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+! PR Fortran/82841
+!
+ integer, parameter :: N = 2
+ character(len=1) :: chr(N)
+ chr = transfer(repeat("x",ncopies=N),[character(len=1) ::], N)
+ if (chr(1) /= 'x' .and. chr(2) /= 'x') call abort
+end
diff --git a/gcc/testsuite/gnat.dg/alignment13.adb b/gcc/testsuite/gnat.dg/alignment13.adb
new file mode 100644
index 00000000000..dd0b25425f0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/alignment13.adb
@@ -0,0 +1,21 @@
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+procedure Alignment13 is
+
+ type Rec is record
+ I1 : aliased Short_Integer;
+ I2 : Integer;
+ end record;
+
+ for Rec use record
+ I1 at 0 range 0 .. 15;
+ end record;
+
+ R : Rec;
+
+begin
+ if R.I2'Bit_Position /= 32 then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index bac9b5383f6..677230c1406 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1136,8 +1136,8 @@ proc check_effective_target_pie { } {
return 1;
}
if { [istarget *-*-solaris2.1\[1-9\]*] } {
- # Full PIE support was added in Solaris 11.x and Solaris 12, but gcc
- # errors out if missing, so check for that.
+ # Full PIE support was added in Solaris 11.3, but gcc errors out
+ # if missing, so check for that.
return [check_no_compiler_messages pie executable {
int main (void) { return 0; }
} "-pie -fpie"]
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 540349dbc44..4f09c827d9e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8917,7 +8917,6 @@ pass_warn_function_return::execute (function *fun)
without returning a value. */
else if (warn_return_type
&& !TREE_NO_WARNING (fun->decl)
- && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
&& !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
{
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
@@ -8931,11 +8930,40 @@ pass_warn_function_return::execute (function *fun)
location = gimple_location (last);
if (location == UNKNOWN_LOCATION)
location = fun->function_end_locus;
- warning_at (location, OPT_Wreturn_type, "control reaches end of non-void function");
+ warning_at (location, OPT_Wreturn_type,
+ "control reaches end of non-void function");
TREE_NO_WARNING (fun->decl) = 1;
break;
}
}
+ /* -fsanitize=return turns fallthrough from the end of non-void function
+ into __builtin___ubsan_handle_missing_return () call.
+ Recognize those too. */
+ basic_block bb;
+ if (!TREE_NO_WARNING (fun->decl) && (flag_sanitize & SANITIZE_RETURN))
+ FOR_EACH_BB_FN (bb, fun)
+ if (EDGE_COUNT (bb->succs) == 0)
+ {
+ gimple *last = last_stmt (bb);
+ const enum built_in_function ubsan_missing_ret
+ = BUILT_IN_UBSAN_HANDLE_MISSING_RETURN;
+ if (last && gimple_call_builtin_p (last, ubsan_missing_ret))
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (last);
+ gsi_prev_nondebug (&gsi);
+ gimple *prev = gsi_stmt (gsi);
+ if (prev == NULL)
+ location = UNKNOWN_LOCATION;
+ else
+ location = gimple_location (prev);
+ if (LOCATION_LOCUS (location) == UNKNOWN_LOCATION)
+ location = fun->function_end_locus;
+ warning_at (location, OPT_Wreturn_type,
+ "control reaches end of non-void function");
+ TREE_NO_WARNING (fun->decl) = 1;
+ break;
+ }
+ }
}
return 0;
}
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 197847796eb..3d7d0af8f7c 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -481,7 +481,6 @@ pass_through_call (const gcall *call)
case BUILT_IN_MEMSET_CHK:
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STRNCPY_CHK:
- case BUILT_IN_STPNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
case BUILT_IN_ASSUME_ALIGNED:
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 57d8f7d207c..a2bb6763e52 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -943,6 +943,17 @@ order_drefs (const void *a, const void *b)
return (*da)->pos - (*db)->pos;
}
+/* Compares two drefs A and B by their position. Callback for qsort. */
+
+static int
+order_drefs_by_pos (const void *a, const void *b)
+{
+ const dref *const da = (const dref *) a;
+ const dref *const db = (const dref *) b;
+
+ return (*da)->pos - (*db)->pos;
+}
+
/* Returns root of the CHAIN. */
static inline dref
@@ -2164,11 +2175,10 @@ remove_name_from_operation (gimple *stmt, tree op)
}
/* Reassociates the expression in that NAME1 and NAME2 are used so that they
- are combined in a single statement, and returns this statement. Note the
- statement is inserted before INSERT_BEFORE if it's not NULL. */
+ are combined in a single statement, and returns this statement. */
static gimple *
-reassociate_to_the_same_stmt (tree name1, tree name2, gimple *insert_before)
+reassociate_to_the_same_stmt (tree name1, tree name2)
{
gimple *stmt1, *stmt2, *root1, *root2, *s1, *s2;
gassign *new_stmt, *tmp_stmt;
@@ -2225,12 +2235,6 @@ reassociate_to_the_same_stmt (tree name1, tree name2, gimple *insert_before)
var = create_tmp_reg (type, "predreastmp");
new_name = make_ssa_name (var);
new_stmt = gimple_build_assign (new_name, code, name1, name2);
- if (insert_before && stmt_dominates_stmt_p (insert_before, s1))
- bsi = gsi_for_stmt (insert_before);
- else
- bsi = gsi_for_stmt (s1);
-
- gsi_insert_before (&bsi, new_stmt, GSI_SAME_STMT);
var = create_tmp_reg (type, "predreastmp");
tmp_name = make_ssa_name (var);
@@ -2247,6 +2251,7 @@ reassociate_to_the_same_stmt (tree name1, tree name2, gimple *insert_before)
s1 = gsi_stmt (bsi);
update_stmt (s1);
+ gsi_insert_before (&bsi, new_stmt, GSI_SAME_STMT);
gsi_insert_before (&bsi, tmp_stmt, GSI_SAME_STMT);
return new_stmt;
@@ -2255,11 +2260,10 @@ reassociate_to_the_same_stmt (tree name1, tree name2, gimple *insert_before)
/* Returns the statement that combines references R1 and R2. In case R1
and R2 are not used in the same statement, but they are used with an
associative and commutative operation in the same expression, reassociate
- the expression so that they are used in the same statement. The combined
- statement is inserted before INSERT_BEFORE if it's not NULL. */
+ the expression so that they are used in the same statement. */
static gimple *
-stmt_combining_refs (dref r1, dref r2, gimple *insert_before)
+stmt_combining_refs (dref r1, dref r2)
{
gimple *stmt1, *stmt2;
tree name1 = name_for_ref (r1);
@@ -2270,7 +2274,7 @@ stmt_combining_refs (dref r1, dref r2, gimple *insert_before)
if (stmt1 == stmt2)
return stmt1;
- return reassociate_to_the_same_stmt (name1, name2, insert_before);
+ return reassociate_to_the_same_stmt (name1, name2);
}
/* Tries to combine chains CH1 and CH2 together. If this succeeds, the
@@ -2283,8 +2287,7 @@ combine_chains (chain_p ch1, chain_p ch2)
enum tree_code op = ERROR_MARK;
bool swap = false;
chain_p new_chain;
- int i, j, num;
- gimple *root_stmt;
+ unsigned i;
tree rslt_type = NULL_TREE;
if (ch1 == ch2)
@@ -2305,9 +2308,6 @@ combine_chains (chain_p ch1, chain_p ch2)
return NULL;
}
- ch1->combined = true;
- ch2->combined = true;
-
if (swap)
std::swap (ch1, ch2);
@@ -2319,69 +2319,65 @@ combine_chains (chain_p ch1, chain_p ch2)
new_chain->rslt_type = rslt_type;
new_chain->length = ch1->length;
- gimple *insert = NULL;
- num = ch1->refs.length ();
- i = (new_chain->length == 0) ? num - 1 : 0;
- j = (new_chain->length == 0) ? -1 : 1;
- /* For ZERO length chain, process refs in reverse order so that dominant
- position is ready when it comes to the root ref.
- For non-ZERO length chain, process refs in order. See PR79663. */
- for (; num > 0; num--, i += j)
- {
- r1 = ch1->refs[i];
- r2 = ch2->refs[i];
+ for (i = 0; (ch1->refs.iterate (i, &r1)
+ && ch2->refs.iterate (i, &r2)); i++)
+ {
nw = XCNEW (struct dref_d);
+ nw->stmt = stmt_combining_refs (r1, r2);
nw->distance = r1->distance;
- /* For ZERO length chain, insert combined stmt of root ref at dominant
- position. */
- nw->stmt = stmt_combining_refs (r1, r2, i == 0 ? insert : NULL);
- /* For ZERO length chain, record dominant position where combined stmt
- of root ref should be inserted. In this case, though all root refs
- dominate following ones, it's possible that combined stmt doesn't.
- See PR70754. */
- if (new_chain->length == 0
- && (insert == NULL || stmt_dominates_stmt_p (nw->stmt, insert)))
- insert = nw->stmt;
-
new_chain->refs.safe_push (nw);
}
- if (new_chain->length == 0)
- {
- /* Restore the order for ZERO length chain's refs. */
- num = new_chain->refs.length () >> 1;
- for (i = 0, j = new_chain->refs.length () - 1; i < num; i++, j--)
- std::swap (new_chain->refs[i], new_chain->refs[j]);
- /* For ZERO length chain, has_max_use_after must be true since root
- combined stmt must dominates others. */
- new_chain->has_max_use_after = true;
- return new_chain;
- }
+ ch1->combined = true;
+ ch2->combined = true;
+ return new_chain;
+}
- new_chain->has_max_use_after = false;
- root_stmt = get_chain_root (new_chain)->stmt;
- for (i = 1; new_chain->refs.iterate (i, &nw); i++)
- {
- if (nw->distance == new_chain->length
- && !stmt_dominates_stmt_p (nw->stmt, root_stmt))
- {
- new_chain->has_max_use_after = true;
- break;
- }
- }
+/* Recursively update position information of all offspring chains to ROOT
+ chain's position information. */
- return new_chain;
+static void
+update_pos_for_combined_chains (chain_p root)
+{
+ chain_p ch1 = root->ch1, ch2 = root->ch2;
+ dref ref, ref1, ref2;
+ for (unsigned j = 0; (root->refs.iterate (j, &ref)
+ && ch1->refs.iterate (j, &ref1)
+ && ch2->refs.iterate (j, &ref2)); ++j)
+ ref1->pos = ref2->pos = ref->pos;
+
+ if (ch1->type == CT_COMBINATION)
+ update_pos_for_combined_chains (ch1);
+ if (ch2->type == CT_COMBINATION)
+ update_pos_for_combined_chains (ch2);
}
-/* Try to combine the CHAINS. */
+/* Returns true if statement S1 dominates statement S2. */
+
+static bool
+pcom_stmt_dominates_stmt_p (gimple *s1, gimple *s2)
+{
+ basic_block bb1 = gimple_bb (s1), bb2 = gimple_bb (s2);
+
+ if (!bb1 || s1 == s2)
+ return true;
+
+ if (bb1 == bb2)
+ return gimple_uid (s1) < gimple_uid (s2);
+
+ return dominated_by_p (CDI_DOMINATORS, bb2, bb1);
+}
+
+/* Try to combine the CHAINS in LOOP. */
static void
-try_combine_chains (vec<chain_p> *chains)
+try_combine_chains (struct loop *loop, vec<chain_p> *chains)
{
unsigned i, j;
chain_p ch1, ch2, cch;
auto_vec<chain_p> worklist;
+ bool combined_p = false;
FOR_EACH_VEC_ELT (*chains, i, ch1)
if (chain_can_be_combined_p (ch1))
@@ -2403,6 +2399,78 @@ try_combine_chains (vec<chain_p> *chains)
{
worklist.safe_push (cch);
chains->safe_push (cch);
+ combined_p = true;
+ break;
+ }
+ }
+ }
+ if (!combined_p)
+ return;
+
+ /* Setup UID for all statements in dominance order. */
+ basic_block *bbs = get_loop_body (loop);
+ renumber_gimple_stmt_uids_in_blocks (bbs, loop->num_nodes);
+ free (bbs);
+
+ /* Re-association in combined chains may generate statements different to
+ order of references of the original chain. We need to keep references
+ of combined chain in dominance order so that all uses will be inserted
+ after definitions. Note:
+ A) This is necessary for all combined chains.
+ B) This is only necessary for ZERO distance references because other
+ references inherit value from loop carried PHIs.
+
+ We first update position information for all combined chains. */
+ dref ref;
+ for (i = 0; chains->iterate (i, &ch1); ++i)
+ {
+ if (ch1->type != CT_COMBINATION || ch1->combined)
+ continue;
+
+ for (j = 0; ch1->refs.iterate (j, &ref); ++j)
+ ref->pos = gimple_uid (ref->stmt);
+
+ update_pos_for_combined_chains (ch1);
+ }
+ /* Then sort references according to newly updated position information. */
+ for (i = 0; chains->iterate (i, &ch1); ++i)
+ {
+ if (ch1->type != CT_COMBINATION && !ch1->combined)
+ continue;
+
+ /* Find the first reference with non-ZERO distance. */
+ if (ch1->length == 0)
+ j = ch1->refs.length();
+ else
+ {
+ for (j = 0; ch1->refs.iterate (j, &ref); ++j)
+ if (ref->distance != 0)
+ break;
+ }
+
+ /* Sort all ZERO distance references by position. */
+ qsort (&ch1->refs[0], j, sizeof (ch1->refs[0]), order_drefs_by_pos);
+
+ if (ch1->combined)
+ continue;
+
+ /* For ZERO length chain, has_max_use_after must be true since root
+ combined stmt must dominates others. */
+ if (ch1->length == 0)
+ {
+ ch1->has_max_use_after = true;
+ continue;
+ }
+ /* Check if there is use at max distance after root for combined chains
+ and set flag accordingly. */
+ ch1->has_max_use_after = false;
+ gimple *root_stmt = get_chain_root (ch1)->stmt;
+ for (j = 1; ch1->refs.iterate (j, &ref); ++j)
+ {
+ if (ref->distance == ch1->length
+ && !pcom_stmt_dominates_stmt_p (ref->stmt, root_stmt))
+ {
+ ch1->has_max_use_after = true;
break;
}
}
@@ -2564,7 +2632,7 @@ tree_predictive_commoning_loop (struct loop *loop)
prepare_initializers (loop, chains);
/* Try to combine the chains that are always worked with together. */
- try_combine_chains (&chains);
+ try_combine_chains (loop, &chains);
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index e87371933fe..4ff66e4ebcd 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -3074,8 +3074,12 @@ is_widening_mult_p (gimple *stmt,
{
tree type = TREE_TYPE (gimple_assign_lhs (stmt));
- if (TREE_CODE (type) != INTEGER_TYPE
- && TREE_CODE (type) != FIXED_POINT_TYPE)
+ if (TREE_CODE (type) == INTEGER_TYPE)
+ {
+ if (TYPE_OVERFLOW_TRAPS (type))
+ return false;
+ }
+ else if (TREE_CODE (type) != FIXED_POINT_TYPE)
return false;
if (!is_widening_mult_rhs_p (type, gimple_assign_rhs1 (stmt), type1_out,
@@ -3443,7 +3447,8 @@ convert_mult_to_fma (gimple *mul_stmt, tree op1, tree op2)
/* We don't want to do bitfield reduction ops. */
if (INTEGRAL_TYPE_P (type)
&& (TYPE_PRECISION (type)
- != GET_MODE_PRECISION (TYPE_MODE (type))))
+ != GET_MODE_PRECISION (TYPE_MODE (type))
+ || TYPE_OVERFLOW_TRAPS (type)))
return false;
/* If the target doesn't support it, don't generate it. We assume that
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 07a226e149c..b5e46c98897 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -550,8 +550,12 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
/* Create the conversion stmt and insert it. */
if (convert_code == VIEW_CONVERT_EXPR)
- temp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (result), temp);
- new_stmt = gimple_build_assign (result, convert_code, temp);
+ {
+ temp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (result), temp);
+ new_stmt = gimple_build_assign (result, temp);
+ }
+ else
+ new_stmt = gimple_build_assign (result, convert_code, temp);
gsi = gsi_after_labels (gimple_bb (phi));
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
@@ -1809,9 +1813,24 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
gsi_remove (&gsi, true);
release_defs (assign);
+ /* Make both store and load use alias-set zero as we have to
+ deal with the case of the store being a conditional change
+ of the dynamic type. */
+ lhs = unshare_expr (lhs);
+ tree *basep = &lhs;
+ while (handled_component_p (*basep))
+ basep = &TREE_OPERAND (*basep, 0);
+ if (TREE_CODE (*basep) == MEM_REF
+ || TREE_CODE (*basep) == TARGET_MEM_REF)
+ TREE_OPERAND (*basep, 1)
+ = fold_convert (ptr_type_node, TREE_OPERAND (*basep, 1));
+ else
+ *basep = build2 (MEM_REF, TREE_TYPE (*basep),
+ build_fold_addr_expr (*basep),
+ build_zero_cst (ptr_type_node));
+
/* 2) Insert a load from the memory of the store to the temporary
on the edge which did not contain the store. */
- lhs = unshare_expr (lhs);
name = make_temp_ssa_name (TREE_TYPE (lhs), NULL, "cstore");
new_stmt = gimple_build_assign (name, lhs);
gimple_set_location (new_stmt, locus);
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 095df967e16..63c3c164894 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -354,7 +354,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
/* Found a proper dereference with an aggregate copy. Just
insert aggregate copies on the edges instead. */
- if (!is_gimple_reg_type (TREE_TYPE (TREE_TYPE (ptr))))
+ if (!is_gimple_reg_type (TREE_TYPE (gimple_assign_lhs (use_stmt))))
{
if (!gimple_vdef (use_stmt))
goto next;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index f8f03807ef0..443193dca78 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4566,6 +4566,7 @@ eliminate_dom_walker::before_dom_children (basic_block b)
/* If we didn't replace the whole stmt (or propagate the result
into all uses), replace all uses on this stmt with their
leaders. */
+ bool modified = false;
use_operand_p use_p;
ssa_op_iter iter;
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
@@ -4587,7 +4588,7 @@ eliminate_dom_walker::before_dom_children (basic_block b)
|| !bitmap_bit_p (inserted_exprs, SSA_NAME_VERSION (sprime))))
{
propagate_value (use_p, sprime);
- gimple_set_modified (stmt, true);
+ modified = true;
if (TREE_CODE (sprime) == SSA_NAME
&& !is_gimple_debug (stmt))
gimple_set_plf (SSA_NAME_DEF_STMT (sprime),
@@ -4595,8 +4596,34 @@ eliminate_dom_walker::before_dom_children (basic_block b)
}
}
+ /* Fold the stmt if modified, this canonicalizes MEM_REFs we propagated
+ into which is a requirement for the IPA devirt machinery. */
+ gimple *old_stmt = stmt;
+ if (modified)
+ {
+ /* If a formerly non-invariant ADDR_EXPR is turned into an
+ invariant one it was on a separate stmt. */
+ if (gimple_assign_single_p (stmt)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR)
+ recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
+ if (is_gimple_call (stmt))
+ {
+ /* ??? Only fold calls inplace for now, this may create new
+ SSA names which in turn will confuse free_scc_vn SSA name
+ release code. */
+ fold_stmt_inplace (&gsi);
+ }
+ else
+ {
+ fold_stmt (&gsi);
+ stmt = gsi_stmt (gsi);
+ }
+ }
+
/* Visit indirect calls and turn them into direct calls if
- possible using the devirtualization machinery. */
+ possible using the devirtualization machinery. Do this before
+ checking for required EH/abnormal/noreturn cleanup as devird
+ may expose more of those. */
if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
{
tree fn = gimple_call_fn (call_stmt);
@@ -4605,24 +4632,21 @@ eliminate_dom_walker::before_dom_children (basic_block b)
&& virtual_method_call_p (fn))
{
tree otr_type = obj_type_ref_class (fn);
+ unsigned HOST_WIDE_INT otr_tok
+ = tree_to_uhwi (OBJ_TYPE_REF_TOKEN (fn));
tree instance;
- ipa_polymorphic_call_context context (current_function_decl, fn, stmt, &instance);
+ ipa_polymorphic_call_context context (current_function_decl,
+ fn, stmt, &instance);
+ context.get_dynamic_type (instance, OBJ_TYPE_REF_OBJECT (fn),
+ otr_type, stmt);
bool final;
-
- context.get_dynamic_type (instance, OBJ_TYPE_REF_OBJECT (fn), otr_type, stmt);
-
- vec <cgraph_node *>targets
+ vec <cgraph_node *> targets
= possible_polymorphic_call_targets (obj_type_ref_class (fn),
- tree_to_uhwi
- (OBJ_TYPE_REF_TOKEN (fn)),
- context,
- &final);
+ otr_tok, context, &final);
if (dump_file)
dump_possible_polymorphic_call_targets (dump_file,
obj_type_ref_class (fn),
- tree_to_uhwi
- (OBJ_TYPE_REF_TOKEN (fn)),
- context);
+ otr_tok, context);
if (final && targets.length () <= 1 && dbg_cnt (devirt))
{
tree fn;
@@ -4632,7 +4656,7 @@ eliminate_dom_walker::before_dom_children (basic_block b)
fn = builtin_decl_implicit (BUILT_IN_UNREACHABLE);
if (dump_enabled_p ())
{
- location_t loc = gimple_location_safe (stmt);
+ location_t loc = gimple_location (stmt);
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
"converting indirect call to "
"function %s\n",
@@ -4649,43 +4673,27 @@ eliminate_dom_walker::before_dom_children (basic_block b)
== void_type_node))
gimple_call_set_fntype (call_stmt, TREE_TYPE (fn));
maybe_remove_unused_call_args (cfun, call_stmt);
- gimple_set_modified (stmt, true);
+ modified = true;
}
}
}
- if (gimple_modified_p (stmt))
+ if (modified)
{
- /* If a formerly non-invariant ADDR_EXPR is turned into an
- invariant one it was on a separate stmt. */
- if (gimple_assign_single_p (stmt)
- && TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR)
- recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
- gimple *old_stmt = stmt;
- if (is_gimple_call (stmt))
- {
- /* ??? Only fold calls inplace for now, this may create new
- SSA names which in turn will confuse free_scc_vn SSA name
- release code. */
- fold_stmt_inplace (&gsi);
- /* When changing a call into a noreturn call, cfg cleanup
- is needed to fix up the noreturn call. */
- if (!was_noreturn && gimple_call_noreturn_p (stmt))
- el_to_fixup.safe_push (stmt);
- }
- else
- {
- fold_stmt (&gsi);
- stmt = gsi_stmt (gsi);
- if ((gimple_code (stmt) == GIMPLE_COND
- && (gimple_cond_true_p (as_a <gcond *> (stmt))
- || gimple_cond_false_p (as_a <gcond *> (stmt))))
- || (gimple_code (stmt) == GIMPLE_SWITCH
- && TREE_CODE (gimple_switch_index (
- as_a <gswitch *> (stmt)))
- == INTEGER_CST))
- el_todo |= TODO_cleanup_cfg;
- }
+ /* When changing a call into a noreturn call, cfg cleanup
+ is needed to fix up the noreturn call. */
+ if (!was_noreturn
+ && is_gimple_call (stmt) && gimple_call_noreturn_p (stmt))
+ el_to_fixup.safe_push (stmt);
+ /* When changing a condition or switch into one we know what
+ edge will be executed, schedule a cfg cleanup. */
+ if ((gimple_code (stmt) == GIMPLE_COND
+ && (gimple_cond_true_p (as_a <gcond *> (stmt))
+ || gimple_cond_false_p (as_a <gcond *> (stmt))))
+ || (gimple_code (stmt) == GIMPLE_SWITCH
+ && TREE_CODE (gimple_switch_index
+ (as_a <gswitch *> (stmt))) == INTEGER_CST))
+ el_todo |= TODO_cleanup_cfg;
/* If we removed EH side-effects from the statement, clean
its EH information. */
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
@@ -4803,7 +4811,8 @@ eliminate (bool do_pre)
else
lhs = gimple_get_lhs (stmt);
- if (inserted_exprs
+ if (lhs
+ && inserted_exprs
&& TREE_CODE (lhs) == SSA_NAME)
bitmap_clear_bit (inserted_exprs, SSA_NAME_VERSION (lhs));
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index f48336bff58..1269422cb31 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -643,6 +643,8 @@ create_lcssa_for_virtual_phi (struct loop *loop)
gimple *stmt;
use_operand_p use_p;
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_vop)
+ = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vop);
add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION);
gimple_phi_set_result (new_phi, new_vop);
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, vop)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index af874e7ad8e..a6ec5396345 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4262,7 +4262,7 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
case BIT_XOR_EXPR:
case MULT_EXPR:
case BIT_AND_EXPR:
- /* ADJUSMENT_DEF is NULL when called from
+ /* ADJUSTMENT_DEF is NULL when called from
vect_create_epilog_for_reduction to vectorize double reduction. */
if (adjustment_def)
*adjustment_def = init_val;
@@ -4358,6 +4358,9 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
first one in this group is STMT.
INDUCTION_INDEX is the index of the loop for condition reductions.
Otherwise it is undefined.
+ INDUC_VAL is for INTEGER_INDUC_COND_REDUCTION the value to use for the case
+ when the COND_EXPR is never true in the loop. It needs to
+ be smaller than any value of the IV in the loop.
This function:
1. Creates the reduction def-use cycles: sets the arguments for
@@ -4403,7 +4406,8 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
int ncopies, enum tree_code reduc_code,
vec<gimple *> reduction_phis,
int reduc_index, bool double_reduc,
- slp_tree slp_node, tree induction_index)
+ slp_tree slp_node, tree induction_index,
+ tree induc_val)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
stmt_vec_info prev_phi_info;
@@ -4488,6 +4492,15 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
gimple *def_stmt = SSA_NAME_DEF_STMT (reduction_op);
initial_def = PHI_ARG_DEF_FROM_EDGE (def_stmt,
loop_preheader_edge (loop));
+ /* Optimize: if initial_def is for REDUC_MAX smaller than the base
+ and we can't use zero for induc_val, use initial_def. Similarly
+ for REDUC_MIN and initial_def larger than the base. */
+ if (TREE_CODE (initial_def) == INTEGER_CST
+ && (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
+ == INTEGER_INDUC_COND_REDUCTION)
+ && !integer_zerop (induc_val)
+ && tree_int_cst_lt (initial_def, induc_val))
+ induc_val = initial_def;
vect_is_simple_use (initial_def, loop_vinfo, &def_stmt, &initial_def_dt);
vec_initial_def = get_initial_def_for_reduction (stmt, initial_def,
&adjustment_def);
@@ -4528,9 +4541,10 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
gcc_assert (i == 0);
tree vec_init_def_type = TREE_TYPE (vec_init_def);
- tree zero_vec = build_zero_cst (vec_init_def_type);
+ tree induc_val_vec
+ = build_vector_from_val (vec_init_def_type, induc_val);
- add_phi_arg (as_a <gphi *> (phi), zero_vec,
+ add_phi_arg (as_a <gphi *> (phi), induc_val_vec,
loop_preheader_edge (loop), UNKNOWN_LOCATION);
}
else
@@ -4879,14 +4893,16 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
gimple_assign_set_lhs (epilog_stmt, new_temp);
gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
- if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
- == INTEGER_INDUC_COND_REDUCTION)
+ if ((STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
+ == INTEGER_INDUC_COND_REDUCTION)
+ && !operand_equal_p (initial_def, induc_val, 0))
{
- /* Earlier we set the initial value to be zero. Check the result
- and if it is zero then replace with the original initial
- value. */
- tree zero = build_zero_cst (scalar_type);
- tree zcompare = build2 (EQ_EXPR, boolean_type_node, new_temp, zero);
+ /* Earlier we set the initial value to be a vector if induc_val
+ values. Check the result and if it is induc_val then replace
+ with the original initial value, unless induc_val is
+ the same as initial_def already. */
+ tree zcompare = build2 (EQ_EXPR, boolean_type_node, new_temp,
+ induc_val);
tmp = make_ssa_name (new_scalar_dest);
epilog_stmt = gimple_build_assign (tmp, COND_EXPR, zcompare,
@@ -5001,7 +5017,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
else
vec_temp = gimple_assign_lhs (new_phi);
tree rhs = build3 (BIT_FIELD_REF, scalar_type, vec_temp, bitsize,
- bitsize_zero_node);
+ bitsize_zero_node);
epilog_stmt = gimple_build_assign (new_scalar_dest, rhs);
new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
gimple_assign_set_lhs (epilog_stmt, new_temp);
@@ -5485,6 +5501,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
gimple *def_stmt;
enum vect_def_type dt, cond_reduc_dt = vect_unknown_def_type;
gphi *new_phi = NULL;
+ gimple *cond_reduc_def_stmt = NULL;
tree scalar_type;
bool is_simple_use;
gimple *orig_stmt;
@@ -5672,9 +5689,13 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
cond_reduc_dt = dt;
cond_reduc_val = ops[i];
}
- if (dt == vect_induction_def && def_stmt != NULL
+ if (dt == vect_induction_def
+ && def_stmt != NULL
&& is_nonwrapping_integer_induction (def_stmt, loop))
- cond_reduc_dt = dt;
+ {
+ cond_reduc_dt = dt;
+ cond_reduc_def_stmt = def_stmt;
+ }
}
}
@@ -5713,12 +5734,28 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
{
if (cond_reduc_dt == vect_induction_def)
{
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "condition expression based on "
- "integer induction.\n");
- STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
- = INTEGER_INDUC_COND_REDUCTION;
+ stmt_vec_info cond_stmt_vinfo = vinfo_for_stmt (cond_reduc_def_stmt);
+ tree base
+ = STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED (cond_stmt_vinfo);
+
+ gcc_assert (TREE_CODE (base) == INTEGER_CST);
+ cond_reduc_val = NULL_TREE;
+ /* Find a suitable value below base; punt if base is the minimum
+ value of the type for now. */
+ if (tree_int_cst_sgn (base) == 1)
+ cond_reduc_val = build_int_cst (TREE_TYPE (base), 0);
+ else if (tree_int_cst_lt (TYPE_MIN_VALUE (TREE_TYPE (base)), base))
+ cond_reduc_val
+ = int_const_binop (MINUS_EXPR, base, integer_one_node);
+ if (cond_reduc_val)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "condition expression based on "
+ "integer induction.\n");
+ STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
+ = INTEGER_INDUC_COND_REDUCTION;
+ }
}
/* Loop peeling modifies initial value of reduction PHI, which
@@ -5915,7 +5952,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
gcc_assert (orig_code == MAX_EXPR || orig_code == MIN_EXPR);
}
else if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
- == INTEGER_INDUC_COND_REDUCTION)
+ == INTEGER_INDUC_COND_REDUCTION)
orig_code = MAX_EXPR;
}
@@ -6382,7 +6419,8 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
vect_create_epilog_for_reduction (vect_defs, stmt, epilog_copies,
epilog_reduc_code, phis, reduc_index,
- double_reduc, slp_node, cond_name);
+ double_reduc, slp_node, cond_name,
+ cond_reduc_val);
return true;
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 69425ab59ee..698213c3501 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -14515,6 +14515,50 @@ get_nonnull_args (const_tree fntype)
return argmap;
}
+/* Return true if an expression with CODE has to have the same result type as
+ its first operand. */
+
+bool
+expr_type_first_operand_type_p (tree_code code)
+{
+ switch (code)
+ {
+ case NEGATE_EXPR:
+ case ABS_EXPR:
+ case BIT_NOT_EXPR:
+ case PAREN_EXPR:
+ case CONJ_EXPR:
+
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case CEIL_DIV_EXPR:
+ case FLOOR_DIV_EXPR:
+ case ROUND_DIV_EXPR:
+ case TRUNC_MOD_EXPR:
+ case CEIL_MOD_EXPR:
+ case FLOOR_MOD_EXPR:
+ case ROUND_MOD_EXPR:
+ case RDIV_EXPR:
+ case EXACT_DIV_EXPR:
+ case MIN_EXPR:
+ case MAX_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ case BIT_AND_EXPR:
+
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
+ case LROTATE_EXPR:
+ case RROTATE_EXPR:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
#if CHECKING_P
namespace selftest {
diff --git a/gcc/tree.h b/gcc/tree.h
index 375edcd4ba6..f20b77f17e4 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5471,6 +5471,7 @@ extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
extern bool nonnull_arg_p (const_tree);
extern bool is_redundant_typedef (const_tree);
+extern bool expr_type_first_operand_type_p (tree_code);
extern location_t
set_source_range (tree expr, location_t start, location_t finish);
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index daee6975a64..1665934d44a 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -433,10 +433,10 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style pstyle)
&& TYPE_MAX_VALUE (dom) != NULL_TREE
&& TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
{
+ unsigned HOST_WIDE_INT m;
if (tree_fits_uhwi_p (TYPE_MAX_VALUE (dom))
- && tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1 != 0)
- pp_printf (&pretty_name, HOST_WIDE_INT_PRINT_DEC,
- tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1);
+ && (m = tree_to_uhwi (TYPE_MAX_VALUE (dom))) + 1 != 0)
+ pp_unsigned_wide_integer (&pretty_name, m + 1);
else
pp_wide_int (&pretty_name,
wi::add (wi::to_widest (TYPE_MAX_VALUE (dom)), 1),
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 9e28d4b4f57..9dcf135e167 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -171,10 +171,13 @@ propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data)
if (REG_P (*iter) && ++cnt > 1)
{
rtx dval = make_debug_expr_from_rtl (old_rtx);
+ rtx to = pair->to;
+ if (volatile_insn_p (to))
+ to = gen_rtx_UNKNOWN_VAR_LOC ();
/* Emit a debug bind insn. */
rtx bind
= gen_rtx_VAR_LOCATION (GET_MODE (old_rtx),
- DEBUG_EXPR_TREE_DECL (dval), pair->to,
+ DEBUG_EXPR_TREE_DECL (dval), to,
VAR_INIT_STATUS_INITIALIZED);
rtx_insn *bind_insn = emit_debug_insn_before (bind, pair->insn);
df_insn_rescan (bind_insn);
@@ -217,6 +220,8 @@ propagate_for_debug (rtx_insn *insn, rtx_insn *last, rtx dest, rtx src,
dest, propagate_for_debug_subst, &p);
if (loc == INSN_VAR_LOCATION_LOC (insn))
continue;
+ if (volatile_insn_p (loc))
+ loc = gen_rtx_UNKNOWN_VAR_LOC ();
INSN_VAR_LOCATION_LOC (insn) = loc;
df_insn_rescan (insn);
}
@@ -660,6 +665,12 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno,
}
return 0;
}
+ /* Asm in DEBUG_INSN is never useful, we can't emit debug info for
+ that. And for volatile_insn_p, it is actually harmful
+ - DEBUG_INSNs shouldn't have any side-effects. */
+ else if (GET_CODE (src) == ASM_OPERANDS
+ || volatile_insn_p (src))
+ set = NULL_RTX;
}
/* ??? Should we try to extract it from a PARALLEL? */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 05e48a5b894..e240ba77430 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2827,7 +2827,7 @@ static void
decode_addr_const (tree exp, struct addr_const *value)
{
tree target = TREE_OPERAND (exp, 0);
- int offset = 0;
+ HOST_WIDE_INT offset = 0;
rtx x;
while (1)
@@ -2841,8 +2841,9 @@ decode_addr_const (tree exp, struct addr_const *value)
else if (TREE_CODE (target) == ARRAY_REF
|| TREE_CODE (target) == ARRAY_RANGE_REF)
{
- offset += (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (target)))
- * tree_to_shwi (TREE_OPERAND (target, 1)));
+ /* Truncate big offset. */
+ offset += (TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (target)))
+ * TREE_INT_CST_LOW (TREE_OPERAND (target, 1)));
target = TREE_OPERAND (target, 0);
}
else if (TREE_CODE (target) == MEM_REF
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 907eaed1ebe..8967b7d8a14 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,13 @@
+2018-01-05 Michael Weiser <michael.weiser@gmx.de>
+
+ Backport from trunk
+ 2017-12-20 Michael Weiser <michael.weiser@gmx.de>
+
+ PR preprocessor/83492
+ * lex.c (search_line_fast) [__ARM_NEON && __ARM_64BIT_STATE]:
+ Fix selection of big-endian shift parameters by using
+ __ARM_BIG_ENDIAN.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 9edd2a6afdb..097c78002cb 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -772,7 +772,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
const uint8x16_t repl_qm = vdupq_n_u8 ('?');
const uint8x16_t xmask = (uint8x16_t) vdupq_n_u64 (0x8040201008040201ULL);
-#ifdef __AARCH64EB
+#ifdef __ARM_BIG_ENDIAN
const int16x8_t shift = {8, 8, 8, 8, 0, 0, 0, 0};
#else
const int16x8_t shift = {0, 0, 0, 0, 8, 8, 8, 8};
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 569963ba46e..86fd102d320 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,26 @@
+2018-01-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline
+ 2018-01-05 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.host (epiphany-*-elf*): Add (epiphany-*-rtems*)
+ configuration.
+
+2017-11-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2017-11-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * config.host (*-*-solaris2*): Adapt comment for Solaris 12
+ renaming.
+ * config/sol2/crtpg.c (__start_crt_compiler): Likewise.
+ * configure.ac (libgcc_cv_solaris_crts): Likewise.
+ * configure: Regenerate.
+
+2017-11-17 Vineet Gupta <vgupta@synopsys.com>
+
+ * config.host: Remove uclibc from arc target spec.
+
2017-11-05 Andreas Tobler <andreast@gcc.gnu.org>
Backport from mainline
diff --git a/libgcc/config.host b/libgcc/config.host
index 1d42e8eeafe..d2ffa1499c4 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -284,7 +284,7 @@ case ${host} in
tmake_file="$tmake_file $cpu_type/t-sol2"
extra_parts="gmon.o crtbegin.o crtend.o"
if test "${libgcc_cv_solaris_crts}" = yes; then
- # Solaris 11.x and 12 provide crt1.o, crti.o, and crtn.o as part of the
+ # Solaris 11.4 provides crt1.o, crti.o, and crtn.o as part of the
# base system. crtp.o and crtpg.o implement the compiler-dependent parts.
extra_parts="$extra_parts crtp.o crtpg.o"
# If the Solaris CRTs are present, both ld and gld will have PIE support.
@@ -387,7 +387,7 @@ arc*-*-elf*)
extra_parts="crti.o crtn.o crtend.o crtbegin.o crtendS.o crtbeginS.o"
extra_parts="$extra_parts crttls.o"
;;
-arc*-*-linux-uclibc*)
+arc*-*-linux*)
tmake_file="${tmake_file} t-slibgcc-libgcc t-slibgcc-nolc-override arc/t-arc-uClibc arc/t-arc"
extra_parts="$extra_parts crti.o crtn.o"
extra_parts="$extra_parts crttls.o"
@@ -498,8 +498,8 @@ cris-*-elf)
cris-*-linux* | crisv32-*-linux*)
tmake_file="$tmake_file cris/t-cris t-softfp-sfdf t-softfp cris/t-linux"
;;
-epiphany-*-elf*)
- tmake_file="epiphany/t-epiphany t-fdpbit epiphany/t-custom-eqsf"
+epiphany-*-elf* | epiphany-*-rtems*)
+ tmake_file="$tmake_file epiphany/t-epiphany t-fdpbit epiphany/t-custom-eqsf"
extra_parts="$extra_parts crti.o crtint.o crtrunc.o crtm1reg-r43.o crtm1reg-r63.o crtn.o"
;;
fr30-*-elf)
diff --git a/libgcc/config/sol2/crtpg.c b/libgcc/config/sol2/crtpg.c
index dcebfcdcdf0..d5966b0226b 100644
--- a/libgcc/config/sol2/crtpg.c
+++ b/libgcc/config/sol2/crtpg.c
@@ -31,11 +31,10 @@ extern char _start[], _etext[];
int __start_crt_compiler (int, char **);
-/* Since Solaris 11.x and Solaris 12, the system-provided CRTs provide a
- hook to invoke initialization code early during process startup.
- __start_crt_compiler is documented in crt1.o(5). We use it to perform
- initialization for profiling as a substitute for the earlier separate
- gcrt1.o. */
+/* Since Solaris 11.4, the system-provided CRTs provide a hook to invoke
+ initialization code early during process startup. __start_crt_compiler
+ is documented in crt1.o(5). We use it to perform initialization for
+ profiling as a substitute for the earlier separate gcrt1.o. */
int
__start_crt_compiler (int argc __attribute__ ((unused)),
diff --git a/libgcc/configure b/libgcc/configure
index 42dda7fbeec..9a7eb8446bb 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -4875,7 +4875,7 @@ esac
case ${host} in
*-*-solaris2*)
- # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
+ # Check for system-provided CRTs on Solaris 11.4.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking system-provided CRTs on Solaris" >&5
$as_echo_n "checking system-provided CRTs on Solaris... " >&6; }
if test "${libgcc_cv_solaris_crts+set}" = set; then :
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 6bcaad651ff..99b8e15562f 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -296,7 +296,7 @@ esac
case ${host} in
*-*-solaris2*)
- # Check for system-provided CRTs on Solaris 11.x and Solaris 12.
+ # Check for system-provided CRTs on Solaris 11.4.
AC_CACHE_CHECK([system-provided CRTs on Solaris],
[libgcc_cv_solaris_crts],
[libgcc_cv_solaris_crts=no
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 3a359e5059a..15b8139e859 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,90 @@
+2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83811
+ * write.c (select_buffer): Adjust buffer size up by 1.
+
+2018-01-03 Janne Blomqvist <jb@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83649
+ * io/unix.c (MAX_CHUNK): New define.
+ (raw_read): For reads larger than MAX_CHUNK, loop.
+ (raw_write): Write no more than MAX_CHUNK bytes per iteration.
+
+2017-12-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83613
+ * io/unit.c (init_units): Don't forget to unlock the unit locks
+ after being inserted.
+
+2017-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/81937
+ * io/list_read.c (next_char_internal): Don't attempt to read
+ from the internal unit stream if no bytes are left. Decrement
+ bytes_left in the right place.
+
+2017-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/78549
+ * io/inquire.c (inquire_via_unit): Adjust test for existence for
+ pre-connected internal units.
+ * io/transfer.c (finalize_transfer): When done with a transfer
+ to internal units, free the format buffer and close the stream.
+ (st_read_done): Delete freeing the stream, now handled using
+ sclose in finalize_transfer. (st_write_done): Likewise.
+ * io/unit.c (get_unit): Return NULL for special reserved unit
+ numbers, signifying not accessible to the user.
+ (init_units): Insert the two special internal units into the
+ unit treap. This makes these unit structures available without
+ further allocations for later use by internal unit I/O. These
+ units are automatically deleted by normal program termination.
+ * io/unix.c (mem_close): Add a guard check to protect from double free.
+
+2017-12-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83168
+ * io/write.c (select_string): Bump size by one to avoid
+ overrun.
+
+2017-12-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ Backport from trunk
+ PR libgfortran/83191
+ * io/transfer.c (list_formatted_read_scalar): Do not set
+ namelist_mode bit here. (namelist_read): Likewise.
+ (data_transfer_init): Clear the mode bit here.
+ (finalize_transfer): Do set the mode bit just before any calls
+ to namelist_read or namelist_write. It can now be referred to
+ in complex_write.
+ * io/write.c (write_complex): Suppress the leading blanks when
+ namelist_mode bit is not set to 1.
+
+2017-12-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/83225
+ * io/io.h (is_internal_unit): Use the unit_is_internal bit.
+ * io/transfer.c (data_transfer_init): Set the bit to true for
+ internal units. Use that bit for checks for internal unit
+ initializations.
+ * io/unit.c (insert_unit): As a precaution, set the
+ internal_unit_kind to zero when a unit structure is first created.
+
+2017-11-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/78549
+ * io/io.h (newunit_free): Add declaration. Clean some whitespace.
+ * io/transfer.c (st_read_done, st_write_done): Call newunit_free.
+ * io/unit.c (newunit_free): Change type from static void to void.
+
2017-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Rimvydas (RJ)
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 4cf87d339a7..da5b674a891 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -47,7 +47,10 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u)
generate_error (&iqp->common, LIBERROR_INQUIRE_INTERNAL_UNIT, NULL);
if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0)
- *iqp->exist = (u != NULL) || (iqp->common.unit >= 0);
+ *iqp->exist = (u != NULL &&
+ iqp->common.unit != GFC_INTERNAL_UNIT &&
+ iqp->common.unit != GFC_INTERNAL_UNIT4)
+ || (iqp->common.unit >= 0);
if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0)
*iqp->opened = (u != NULL);
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index df491577349..dfcf4913394 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -69,7 +69,7 @@ internal_proto(old_locale_lock);
#define is_array_io(dtp) ((dtp)->internal_unit_desc)
-#define is_internal_unit(dtp) ((dtp)->u.p.current_unit->internal_unit_kind)
+#define is_internal_unit(dtp) ((dtp)->u.p.unit_is_internal)
#define is_stream_io(dtp) ((dtp)->u.p.current_unit->flags.access == ACCESS_STREAM)
@@ -765,14 +765,16 @@ extern void unlock_unit (gfc_unit *);
internal_proto(unlock_unit);
extern void finish_last_advance_record (gfc_unit *u);
-internal_proto (finish_last_advance_record);
+internal_proto(finish_last_advance_record);
extern int unit_truncate (gfc_unit *, gfc_offset, st_parameter_common *);
-internal_proto (unit_truncate);
+internal_proto(unit_truncate);
extern int newunit_alloc (void);
internal_proto(newunit_alloc);
+extern void newunit_free (int);
+internal_proto(newunit_free);
/* open.c */
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 6a05cfe4f22..f907818f379 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -266,15 +266,19 @@ next_char_internal (st_parameter_dt *dtp)
}
/* Get the next character and handle end-of-record conditions. */
-
- if (is_char4_unit(dtp)) /* Check for kind=4 internal unit. */
- length = sread (dtp->u.p.current_unit->s, &c, 1);
+ if (likely (dtp->u.p.current_unit->bytes_left > 0))
+ {
+ if (unlikely (is_char4_unit(dtp))) /* Check for kind=4 internal unit. */
+ length = sread (dtp->u.p.current_unit->s, &c, 1);
+ else
+ {
+ char cc;
+ length = sread (dtp->u.p.current_unit->s, &cc, 1);
+ c = cc;
+ }
+ }
else
- {
- char cc;
- length = sread (dtp->u.p.current_unit->s, &cc, 1);
- c = cc;
- }
+ length = 0;
if (unlikely (length < 0))
{
@@ -290,7 +294,6 @@ next_char_internal (st_parameter_dt *dtp)
generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL);
return '\0';
}
- dtp->u.p.current_unit->bytes_left--;
}
else
{
@@ -302,6 +305,7 @@ next_char_internal (st_parameter_dt *dtp)
dtp->u.p.at_eof = 1;
}
}
+ dtp->u.p.current_unit->bytes_left--;
done:
dtp->u.p.at_eol = (c == '\n' || c == EOF);
@@ -2099,8 +2103,6 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p,
int c, i, m;
int err = 0;
- dtp->u.p.namelist_mode = 0;
-
/* Set the next_char and push_char worker functions. */
set_workers (dtp);
@@ -3546,7 +3548,6 @@ namelist_read (st_parameter_dt *dtp)
name. */
namelist_info *prev_nl = NULL;
- dtp->u.p.namelist_mode = 1;
dtp->u.p.input_complete = 0;
dtp->u.p.expanded_read = 0;
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 529637061b1..7d270fb8b36 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -2671,7 +2671,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
dtp->u.p.ionml = ionml;
dtp->u.p.mode = read_flag ? READING : WRITING;
-
+ dtp->u.p.namelist_mode = 0;
dtp->u.p.cc.len = 0;
if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
@@ -2766,6 +2766,8 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
else
dtp->u.p.current_unit->has_size = false;
}
+ else if (dtp->u.p.current_unit->internal_unit_kind > 0)
+ dtp->u.p.unit_is_internal = 1;
/* Check the action. */
@@ -3887,6 +3889,7 @@ finalize_transfer (st_parameter_dt *dtp)
if ((dtp->u.p.ionml != NULL)
&& (cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0)
{
+ dtp->u.p.namelist_mode = 1;
if ((cf & IOPARM_DT_NAMELIST_READ_MODE) != 0)
namelist_read (dtp);
else
@@ -3981,6 +3984,19 @@ finalize_transfer (st_parameter_dt *dtp)
next_record (dtp, 1);
done:
+
+ if (dtp->u.p.unit_is_internal)
+ {
+ fbuf_destroy (dtp->u.p.current_unit);
+ if (dtp->u.p.current_unit
+ && (dtp->u.p.current_unit->child_dtio == 0)
+ && dtp->u.p.current_unit->s)
+ {
+ sclose (dtp->u.p.current_unit->s);
+ dtp->u.p.current_unit->s = NULL;
+ }
+ }
+
#ifdef HAVE_USELOCALE
if (dtp->u.p.old_locale != (locale_t) 0)
{
@@ -4084,18 +4100,19 @@ st_read_done (st_parameter_dt *dtp)
if (dtp->u.p.current_unit != NULL
&& dtp->u.p.current_unit->child_dtio == 0)
{
- if (is_internal_unit (dtp) &&
- (dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
- {
- free (dtp->u.p.current_unit->filename);
- dtp->u.p.current_unit->filename = NULL;
- free (dtp->u.p.current_unit->s);
- dtp->u.p.current_unit->s = NULL;
- if (dtp->u.p.current_unit->ls)
- free (dtp->u.p.current_unit->ls);
- dtp->u.p.current_unit->ls = NULL;
+ if (dtp->u.p.unit_is_internal)
+ {
+ if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
+ {
+ free (dtp->u.p.current_unit->filename);
+ dtp->u.p.current_unit->filename = NULL;
+ if (dtp->u.p.current_unit->ls)
+ free (dtp->u.p.current_unit->ls);
+ dtp->u.p.current_unit->ls = NULL;
+ }
+ newunit_free (dtp->common.unit);
}
- if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
+ if (dtp->u.p.unit_is_internal || dtp->u.p.format_not_saved)
{
free_format_data (dtp->u.p.fmt);
free_format (dtp);
@@ -4152,18 +4169,19 @@ st_write_done (st_parameter_dt *dtp)
/* If this is a parent WRITE statement we do not need to retain the
internal unit structure for child use. */
- if (is_internal_unit (dtp) &&
- (dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
+ if (dtp->u.p.unit_is_internal)
{
- free (dtp->u.p.current_unit->filename);
- dtp->u.p.current_unit->filename = NULL;
- free (dtp->u.p.current_unit->s);
- dtp->u.p.current_unit->s = NULL;
- if (dtp->u.p.current_unit->ls)
- free (dtp->u.p.current_unit->ls);
- dtp->u.p.current_unit->ls = NULL;
+ if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
+ {
+ free (dtp->u.p.current_unit->filename);
+ dtp->u.p.current_unit->filename = NULL;
+ if (dtp->u.p.current_unit->ls)
+ free (dtp->u.p.current_unit->ls);
+ dtp->u.p.current_unit->ls = NULL;
+ }
+ newunit_free (dtp->common.unit);
}
- if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
+ if (dtp->u.p.unit_is_internal || dtp->u.p.format_not_saved)
{
free_format_data (dtp->u.p.fmt);
free_format (dtp);
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index e06867aa0a1..c81d89ca716 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -89,7 +89,6 @@ static int newunit_size; /* Total number of elements in the newunits array. */
units are allocated, above and equal to the LWI there may be both
allocated and free units. */
static int newunit_lwi;
-static void newunit_free (int);
/* Unit numbers assigned with NEWUNIT start from here. */
#define NEWUNIT_START -10
@@ -229,6 +228,7 @@ insert_unit (int n)
{
gfc_unit *u = xcalloc (1, sizeof (gfc_unit));
u->unit_number = n;
+ u->internal_unit_kind = 0;
#ifdef __GTHREAD_MUTEX_INIT
{
__gthread_mutex_t tmp = __GTHREAD_MUTEX_INIT;
@@ -563,7 +563,11 @@ get_unit (st_parameter_dt *dtp, int do_create)
is not allowed, such units must be created with
OPEN(NEWUNIT=...). */
if (dtp->common.unit < 0)
- return get_gfc_unit (dtp->common.unit, 0);
+ {
+ if (dtp->common.unit > NEWUNIT_START) /* Reserved units. */
+ return NULL;
+ return get_gfc_unit (dtp->common.unit, 0);
+ }
return get_gfc_unit (dtp->common.unit, do_create);
}
@@ -683,6 +687,11 @@ init_units (void)
__gthread_mutex_unlock (&u->lock);
}
+ /* The default internal units. */
+ u = insert_unit (GFC_INTERNAL_UNIT);
+ __gthread_mutex_unlock (&u->lock);
+ u = insert_unit (GFC_INTERNAL_UNIT4);
+ __gthread_mutex_unlock (&u->lock);
/* Calculate the maximum file offset in a portable manner.
max will be the largest signed number for the type gfc_offset.
@@ -911,7 +920,7 @@ newunit_alloc (void)
/* Free a previously allocated newunit= unit number. unit_lock must
be held when calling. */
-static void
+void
newunit_free (int unit)
{
int ind = -unit + NEWUNIT_START;
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index c76b427387a..bb9bc9a5c12 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -292,18 +292,49 @@ raw_flush (unix_stream *s __attribute__ ((unused)))
return 0;
}
+/* Write/read at most 2 GB - 4k chunks at a time. Linux never reads or
+ writes more than this, and there are reports that macOS fails for
+ larger than 2 GB as well. */
+#define MAX_CHUNK 2147479552
+
static ssize_t
raw_read (unix_stream *s, void *buf, ssize_t nbyte)
{
/* For read we can't do I/O in a loop like raw_write does, because
that will break applications that wait for interactive I/O. We
- still can loop around EINTR, though. */
- while (true)
+ still can loop around EINTR, though. This however causes a
+ problem for large reads which must be chunked, see comment above.
+ So assume that if the size is larger than the chunk size, we're
+ reading from a file and not the terminal. */
+ if (nbyte <= MAX_CHUNK)
{
- ssize_t trans = read (s->fd, buf, nbyte);
- if (trans == -1 && errno == EINTR)
- continue;
- return trans;
+ while (true)
+ {
+ ssize_t trans = read (s->fd, buf, nbyte);
+ if (trans == -1 && errno == EINTR)
+ continue;
+ return trans;
+ }
+ }
+ else
+ {
+ ssize_t bytes_left = nbyte;
+ char *buf_st = buf;
+ while (bytes_left > 0)
+ {
+ ssize_t to_read = bytes_left < MAX_CHUNK ? bytes_left: MAX_CHUNK;
+ ssize_t trans = read (s->fd, buf_st, to_read);
+ if (trans == -1)
+ {
+ if (errno == EINTR)
+ continue;
+ else
+ return trans;
+ }
+ buf_st += trans;
+ bytes_left -= trans;
+ }
+ return nbyte - bytes_left;
}
}
@@ -317,10 +348,13 @@ raw_write (unix_stream *s, const void *buf, ssize_t nbyte)
buf_st = (char *) buf;
/* We must write in a loop since some systems don't restart system
- calls in case of a signal. */
+ calls in case of a signal. Also some systems might fail outright
+ if we try to write more than 2 GB in a single syscall, so chunk
+ up large writes. */
while (bytes_left > 0)
{
- trans = write (s->fd, buf_st, bytes_left);
+ ssize_t to_write = bytes_left < MAX_CHUNK ? bytes_left: MAX_CHUNK;
+ trans = write (s->fd, buf_st, to_write);
if (trans == -1)
{
if (errno == EINTR)
@@ -959,8 +993,8 @@ mem_flush (unix_stream *s __attribute__ ((unused)))
static int
mem_close (unix_stream *s)
{
- free (s);
-
+ if (s)
+ free (s);
return 0;
}
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index c9aad150090..a7307a8f762 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1537,8 +1537,9 @@ select_buffer (st_parameter_dt *dtp, const fnode *f, int precision,
{
char *result;
- /* The buffer needs at least one more byte to allow room for normalizing. */
- *size = size_from_kind (dtp, f, kind) + precision + 1;
+ /* The buffer needs at least one more byte to allow room for
+ normalizing and 1 to hold null terminator. */
+ *size = size_from_kind (dtp, f, kind) + precision + 1 + 1;
if (*size > BUF_STACK_SZ)
result = xmalloc (*size);
@@ -1552,7 +1553,7 @@ select_string (st_parameter_dt *dtp, const fnode *f, char *buf, size_t *size,
int kind)
{
char *result;
- *size = size_from_kind (dtp, f, kind) + f->u.real.d;
+ *size = size_from_kind (dtp, f, kind) + f->u.real.d + 1;
if (*size > BUF_STACK_SZ)
result = xmalloc (*size);
else
@@ -1809,9 +1810,11 @@ write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size)
precision, buf_size, result1, &res_len1);
get_float_string (dtp, &f, source + size / 2 , kind, 0, buffer,
precision, buf_size, result2, &res_len2);
- lblanks = width - res_len1 - res_len2 - 3;
-
- write_x (dtp, lblanks, lblanks);
+ if (!dtp->u.p.namelist_mode)
+ {
+ lblanks = width - res_len1 - res_len2 - 3;
+ write_x (dtp, lblanks, lblanks);
+ }
write_char (dtp, '(');
write_float_string (dtp, result1, res_len1);
write_char (dtp, semi_comma);
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 471d53baf42..f7d613ab0ef 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1118,7 +1118,7 @@ syscall/wait.lo: go/syscall/wait.c runtime.inc
@$(MKDIR_P) syscall
$(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
-# Solaris 12 changed the type of fields in struct stat.
+# Solaris 11.4 changed the type of fields in struct stat.
# Use a build tag, based on a configure check, to cope.
if LIBGO_IS_SOLARIS
if HAVE_STAT_TIMESPEC
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 400fab66e9a..cdeaaa44a98 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1173,7 +1173,7 @@ runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
extra_go_files_runtime_internal_sys = version.go
@HAVE_STAT_TIMESPEC_FALSE@@LIBGO_IS_SOLARIS_TRUE@matchargs_os =
-# Solaris 12 changed the type of fields in struct stat.
+# Solaris 11.4 changed the type of fields in struct stat.
# Use a build tag, based on a configure check, to cope.
@HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@matchargs_os = --tag=solaristag
@LIBGO_IS_SOLARIS_FALSE@matchargs_os =
diff --git a/libgo/configure b/libgo/configure
index b848167d517..1d3d714fc05 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -11104,7 +11104,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11107 "configure"
+#line 11108 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11210,7 +11210,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11213 "configure"
+#line 11214 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13753,7 +13753,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
esac
case "${host}" in
mips*el-*-*)
- GOARCH="${GOARCH}le"
+ GOARCH="${GOARCH}le"
;;
*)
GOARCH_BIGENDIAN=1
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 672bc0073bc..51b2c161846 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -737,7 +737,7 @@ STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset}
AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET)
dnl Check if <sys/stat.h> uses timespec_t for st_?tim members. Introduced
-dnl in Solaris 12 for XPG7 compatibility.
+dnl in Solaris 11.4 for XPG7 compatibility.
AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h],
[have_stat_timespec=yes], [have_stat_timespec=no])
AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes)
diff --git a/libgo/mkrsysinfo.sh b/libgo/mkrsysinfo.sh
index af185945010..1296e800376 100755
--- a/libgo/mkrsysinfo.sh
+++ b/libgo/mkrsysinfo.sh
@@ -115,22 +115,22 @@ grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr/[16]byte/' \
>> ${OUT}
-# The Solaris 12 _flow_arp_desc_t struct.
+# The Solaris 11.4 _flow_arp_desc_t struct.
grep '^type _flow_arp_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _flow_l3_desc_t struct.
+# The Solaris 11.4 _flow_l3_desc_t struct.
grep '^type _flow_l3_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mac_ipaddr_t struct.
+# The Solaris 11.3 _mac_ipaddr_t struct.
grep '^type _mac_ipaddr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mactun_info_t struct.
+# The Solaris 11.3 _mactun_info_t struct.
grep '^type _mactun_info_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 4fcf89f094c..61d39d7e2dd 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1263,22 +1263,22 @@ grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr/[16]byte/' \
>> ${OUT}
-# The Solaris 12 _flow_arp_desc_t struct.
+# The Solaris 11.4 _flow_arp_desc_t struct.
grep '^type _flow_arp_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _flow_l3_desc_t struct.
+# The Solaris 11.4 _flow_l3_desc_t struct.
grep '^type _flow_l3_desc_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mac_ipaddr_t struct.
+# The Solaris 11.3 _mac_ipaddr_t struct.
grep '^type _mac_ipaddr_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
-# The Solaris 12 _mactun_info_t struct.
+# The Solaris 11.3 _mactun_info_t struct.
grep '^type _mactun_info_t ' gen-sysinfo.go | \
sed -e 's/_in6_addr_t/[16]byte/g' \
>> ${OUT}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 59a2ff88b0e..ae4dbc68f50 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,24 @@
+2017-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2017-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/81304
+ * testsuite/libgomp.fortran/pr81304.f90: New test.
+
+ 2017-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/81841
+ * libgomp.fortran/pr81841.f90: New test.
+
+2017-12-10 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ PR c/81875
+ 2017-09-16 Tom de Vries <tom@codesourcery.com>
+
+ * testsuite/libgomp.c/pr81875.c: New test.
+
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/testsuite/libgomp.c/pr81875.c b/libgomp/testsuite/libgomp.c/pr81875.c
new file mode 100644
index 00000000000..3067d49a492
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr81875.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
+
+#define N 32ULL
+int a[N];
+
+const unsigned long long c = 0x7fffffffffffffffULL;
+
+void
+f2_tpf_static32 (void)
+{
+ unsigned long long i;
+ #pragma omp for
+ for (i = c + N; i > c; i -= 1ULL)
+ a[i - 1ULL - c] -= 4;
+}
+
+__attribute__((noinline, noclone)) int
+test_tpf_static32 (void)
+{
+ int i, j, k;
+ for (i = 0; i < N; i++)
+ a[i] = i - 25;
+
+ f2_tpf_static32 ();
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i - 29)
+ return 1;
+
+ return 0;
+}
+
+int
+main ()
+{
+ if (test_tpf_static32 ())
+ abort ();
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.fortran/pr81304.f90 b/libgomp/testsuite/libgomp.fortran/pr81304.f90
new file mode 100644
index 00000000000..460a2a04fb3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr81304.f90
@@ -0,0 +1,17 @@
+! PR fortran/81304
+! { dg-do run }
+! { dg-options "-Wsurprising" }
+
+program pr81304
+ integer :: i
+ real, dimension(1:3) :: a, b, c
+ a = 128
+ b = 0
+!$omp parallel do reduction(min: a) reduction(max: b) private (c) ! { dg-bogus "Type specified for intrinsic function" }
+ do i = 1, 16
+ c = (/ i, i - 5, i + 5 /)
+ a = min (a, c)
+ b = max (b, c)
+ end do
+ if (any (a /= (/ 1, -4, 6 /)) .or. any (b /= (/ 16, 11, 21 /))) call abort
+end
diff --git a/libgomp/testsuite/libgomp.fortran/pr81841.f90 b/libgomp/testsuite/libgomp.fortran/pr81841.f90
new file mode 100644
index 00000000000..176d1c8d9c0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr81841.f90
@@ -0,0 +1,26 @@
+! PR fortran/81841
+! { dg-do run }
+
+block data
+ integer :: a
+ real :: b(2)
+ common /c/ a, b
+ !$omp threadprivate (/c/)
+ data a / 32 /
+ data b /2*1./
+end
+
+program pr81841
+ use omp_lib
+ integer :: e
+ real :: f(2)
+ common /c/ e, f
+ !$omp threadprivate (/c/)
+ !$omp parallel num_threads(8)
+ if ((e /= 32) .or. any(f /= 1.)) call abort
+ e = omp_get_thread_num ()
+ f = e + 19.
+ !$omp barrier
+ if ((e /= omp_get_thread_num ()) .or. any(f /= e + 19.)) call abort
+ !$omp end parallel
+end
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ebf999ca699..e0c46e0a9aa 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,226 @@
+2018-01-13 Jonathan Wakely <jwakely@redhat.com>
+
+ * python/libstdcxx/v6/printers.py (register_type_printers): Remove
+ printer for experimental::any. Fix printers for experimental::optional
+ and experimental::basic_string_view.
+
+ Backport from mainline
+ 2018-01-05 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83626
+ * src/filesystem/ops.cc (remove(const path&, error_code&)): Remove
+ unnecessary symlink_status call.
+ (remove_all(const path&, error_code&)): Use filesystem::remove.
+
+2018-01-05 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-10-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/experimental/filesystem/iterators/
+ recursive_directory_iterator.cc: Ensure that error_code arguments are
+ cleared when required.
+ * testsuite/experimental/filesystem/operations/create_directory.cc:
+ Remove redundant check.
+ * testsuite/experimental/filesystem/operations/temp_directory_path.cc:
+ Ensure that error_code argument is cleared when required.
+
+ Backport from mainline
+ 2017-12-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83600
+ * include/bits/regex.h (match_results::end()): Return valid iterator
+ when not ready.
+ * testsuite/28_regex/match_results/ctors/char/default.cc: Check that
+ unready objects are empty and have equal begin and end iterators.
+ * testsuite/28_regex/match_results/ctors/wchar_t/default.cc: Likewise.
+
+ Backport from mainline
+ 2017-12-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83598
+ * include/bits/regex.h (basic_regex): Don't modify flags passed to
+ constructors.
+ * testsuite/28_regex/basic_regex/ctors/83598.cc: New test.
+
+ Backport from mainline
+ 2017-12-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83279
+ * src/filesystem/std-ops.cc (do_copy_file): Handle sendfile not
+ copying entire file.
+
+ Backport from mainline
+ 2018-01-04 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/experimental/fs_ops.h (exists(const path&, error_code&))):
+ Only check status_known once.
+
+ Backport from mainline
+ 2018-01-05 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83626
+ * src/filesystem/ops.cc (remove(const path&, error_code&)): Do not
+ report an error for ENOENT.
+ (remove_all(const path&)): Fix type of result variable.
+ (remove_all(const path&, error_code&)): Use non-throwing increment
+ for directory iterator. Call POSIX remove directly to avoid redundant
+ calls to symlink_status. Do not report errors for ENOENT.
+ * testsuite/experimental/filesystem/operations/remove_all.cc: Test
+ throwing overload.
+
+ Backport from mainline
+ 2018-01-04 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83626
+ * src/filesystem/ops.cc (remove(const path&, error_code&))): Remove
+ redundant call to ec.clear().
+ (remove_all(const path&, error_code&))): Do not return an error for
+ non-existent paths.
+ * testsuite/experimental/filesystem/operations/remove.cc: New test.
+ * testsuite/experimental/filesystem/operations/remove_all.cc: Fix
+ expected results for non-existent paths.
+
+ Backport from mainline
+ 2017-10-25 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/79283
+ * src/filesystem/ops.cc (read_symlink): Handle st_size being zero.
+
+2018-01-04 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2018-01-03 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Protect optional's deduction guide with the feature macro
+ * include/std/optional: Use the feature macro.
+
+2017-12-28 François Dumont <fdumont@gcc.gnu.org>
+
+ Backport from mainline
+ 2017-12-20 François Dumont <fdumont@gcc.gnu.org>
+
+ PR libstdc++/82522
+ * include/debug/map.h (map::insert(value_type&&))
+ (map::insert(const_iterator, value_type&&)): Add overload for rvalues.
+ * include/debug/multimap.h (multimap::insert(value_type&&))
+ (multimap::insert(const_iterator, value_type&&)): Likewise.
+ * include/debug/unordered_map (unordered_map::insert(value_type&&))
+ (unordered_map::insert(const_iterator, value_type&&))
+ (unordered_multimap::insert(value_type&&))
+ (unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
+ * testsuite/23_containers/map/modifiers/insert/dr2354.cc (test02): New.
+ * testsuite/23_containers/multimap/modifiers/insert/dr2354.cc (test02):
+ New.
+ * testsuite/23_containers/unordered_map/insert/dr2354.cc (test02): New.
+ * testsuite/23_containers/unordered_multimap/insert/dr2354.cc (test02):
+ New.
+
+2017-12-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83427
+ * include/bits/refwrap.h (_Weak_result_type_impl)
+ (_Reference_wrapper_base): Deduce noexcept for function types.
+ * testsuite/20_util/bind/83427.cc: New test.
+ * testsuite/20_util/reference_wrapper/83427.cc: New test.
+
+ PR libstdc++/59568
+ * include/std/complex (operator>>): Only use putback if a character
+ was successfully extracted and only set the value if a number was
+ successfully extracted.
+ * testsuite/26_numerics/complex/inserters_extractors/char/59568.cc:
+ New test.
+
+2017-12-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83395
+ * include/std/type_traits (__is_invocable_impl): Remove partial
+ specialization for INVOKE<void> and restore is_void<R> check in
+ primary template.
+ (__is_nt_invocable_impl): Likewise.
+ * testsuite/20_util/is_invocable/83395.cc: New test.
+ * testsuite/20_util/is_nothrow_invocable/83395.cc: New test.
+
+2017-12-01 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-10-13 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/82522
+ * doc/xml/manual/intro.xml: Document LWG 2354 changes.
+ * include/bits/stl_map.h (map::insert(value_type&&))
+ (map::insert(const_iterator, value_type&&)): Add overload for rvalues.
+ * include/bits/stl_multimap.h (multimap::insert(value_type&&))
+ (multimap::insert(const_iterator, value_type&&)): Likewise.
+ * include/bits/unordered_map.h (unordered_map::insert(value_type&&))
+ (unordered_map::insert(const_iterator, value_type&&))
+ (unordered_multimap::insert(value_type&&))
+ (unordered_multimap::insert(const_iterator, value_type&&)): Likewise.
+ * testsuite/23_containers/map/modifiers/insert/dr2354.cc: New test.
+ * testsuite/23_containers/multimap/modifiers/insert/dr2354.cc: New
+ test.
+ * testsuite/23_containers/unordered_map/insert/dr2354.cc: New test.
+ * testsuite/23_containers/unordered_multimap/insert/dr2354.cc: New
+ test.
+
+ Backport from mainline
+ 2017-11-23 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83134
+ * include/std/type_traits (__not_): Explicitly convert to bool.
+ * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error.
+ * testsuite/20_util/logical_traits/83134.cc: New test.
+ * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
+ dg-error.
+ * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
+ Likewise.
+
+ Backport from mainline
+ 2017-12-01 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/std/type_traits (integral_constant): Make member functions
+ noexcept (LWG 2346).
+ * include/std/utility (integer_sequence): Likewise.
+
+ Backport from mainline
+ 2017-11-16 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/std/future (shared_future): Add noexcept to copy constructor
+ and copy-assignment operator (LWG 2799).
+
+ Backport from mainline
+ 2017-11-15 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/range_access.h (size, empty, data): Add conditional
+ noexcept to generic overloads.
+
+ Backport from mainline
+ 2017-10-24 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/82685
+ * include/experimental/string_view (operator""sv): Add noexcept.
+ * include/std/string_view (operator""sv): Likewise.
+
+ Backport from mainline
+ 2017-11-30 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83226
+ * include/bits/node_handle.h (_Node_handle::__pointer): Avoid forming
+ pointer-to-reference types.
+ * testsuite/23_containers/map/modifiers/insert/83226.cc: New test.
+
+ Backport from mainline
+ 2017-11-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/locale_conv.h (wbuffer_convert::_M_conv_get): Fix typo.
+ * testsuite/22_locale/conversions/buffer/3.cc: New test.
+
+ Backport from mainline
+ 2017-11-03 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/node_handle.h (_Node_insert_return::get): Remove, as
+ per P0508R0.
+
2017-10-25 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/manual/status_cxx1998.xml: Correct statement about
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 4ec74949bfb..157b2845463 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -986,6 +986,12 @@ requirements of the license of GCC.
<listitem><para>Add deleted constructors.
</para></listitem></varlistentry>
+ <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&DR;#2354">2332</link>:
+ <emphasis>Unnecessary copying when inserting into maps with braced-init syntax</emphasis>
+ </term>
+ <listitem><para>Add overloads of <code>insert</code> taking <code>value_type&amp;&amp;</code> rvalues.
+ </para></listitem></varlistentry>
+
<varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&DR;#2399">2399</link>:
<emphasis><code>shared_ptr</code>'s constructor from <code>unique_ptr</code> should be constrained</emphasis>
</term>
diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index 47c8dee53cb..b8f77dcaca9 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -431,7 +431,7 @@ _GLIBCXX_END_NAMESPACE_CXX11
streamsize __nbytes = sizeof(_M_get_buf) - _M_unconv;
__nbytes = std::min(__nbytes, _M_buf->in_avail());
if (__nbytes < 1)
- __nbytes == 1;
+ __nbytes = 1;
__nbytes = _M_buf->sgetn(_M_get_buf + _M_unconv, __nbytes);
if (__nbytes < 1)
return false;
diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h
index c7694a1e0ef..f75f7425f47 100644
--- a/libstdc++-v3/include/bits/node_handle.h
+++ b/libstdc++-v3/include/bits/node_handle.h
@@ -37,7 +37,6 @@
# define __cpp_lib_node_extract 201606
#include <optional>
-#include <tuple>
#include <bits/alloc_traits.h>
#include <bits/ptr_traits.h>
@@ -200,7 +199,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _Tp>
- using __pointer = __ptr_rebind<typename _AllocTraits::pointer, _Tp>;
+ using __pointer
+ = __ptr_rebind<typename _AllocTraits::pointer,
+ remove_reference_t<_Tp>>;
__pointer<_Key> _M_pkey = nullptr;
__pointer<typename _Value::second_type> _M_pmapped = nullptr;
@@ -283,26 +284,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Iterator position = _Iterator();
bool inserted = false;
_NodeHandle node;
-
- template<size_t _Idx>
- decltype(auto) get() &
- { return std::get<_Idx>(std::tie(inserted, position, node)); }
-
- template<size_t _Idx>
- decltype(auto) get() const &
- { return std::get<_Idx>(std::tie(inserted, position, node)); }
-
- template<size_t _Idx>
- decltype(auto) get() &&
- {
- return std::move(std::get<_Idx>(std::tie(inserted, position, node)));
- }
-
- template<size_t _Idx>
- decltype(auto) get() const &&
- {
- return std::move(std::get<_Idx>(std::tie(inserted, position, node)));
- }
};
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
index 3987c2addf1..2a037ad8082 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -230,7 +230,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // C++14
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
#define __cpp_lib_nonmember_container_access 201411
/**
@@ -239,7 +239,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template <typename _Container>
constexpr auto
- size(const _Container& __cont) -> decltype(__cont.size())
+ size(const _Container& __cont) noexcept(noexcept(__cont.size()))
+ -> decltype(__cont.size())
{ return __cont.size(); }
/**
@@ -257,7 +258,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template <typename _Container>
constexpr auto
- empty(const _Container& __cont) -> decltype(__cont.empty())
+ empty(const _Container& __cont) noexcept(noexcept(__cont.empty()))
+ -> decltype(__cont.empty())
{ return __cont.empty(); }
/**
@@ -284,7 +286,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template <typename _Container>
constexpr auto
- data(_Container& __cont) -> decltype(__cont.data())
+ data(_Container& __cont) noexcept(noexcept(__cont.data()))
+ -> decltype(__cont.data())
{ return __cont.data(); }
/**
@@ -293,7 +296,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template <typename _Container>
constexpr auto
- data(const _Container& __cont) -> decltype(__cont.data())
+ data(const _Container& __cont) noexcept(noexcept(__cont.data()))
+ -> decltype(__cont.data())
{ return __cont.data(); }
/**
diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h
index 124ee97bd2a..86260dac993 100644
--- a/libstdc++-v3/include/bits/refwrap.h
+++ b/libstdc++-v3/include/bits/refwrap.h
@@ -64,12 +64,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// Retrieve the result type for a function type.
- template<typename _Res, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res(_ArgTypes...)>
+ template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res(_ArgTypes......)>
+ template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
template<typename _Res, typename... _ArgTypes>
@@ -106,50 +106,65 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ typedef _Res result_type; };
/// Retrieve the result type for a function pointer.
- template<typename _Res, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res(*)(_ArgTypes...)>
+ template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res(*)(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res(*)(_ArgTypes......)>
+ template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res(*)(_ArgTypes......)
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
/// Retrieve result type for a member function pointer.
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......)>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......)
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
/// Retrieve result type for a const member function pointer.
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
/// Retrieve result type for a volatile member function pointer.
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename _Class, typename... _ArgTypes>
- struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) volatile>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
+ struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) volatile
+ _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
/// Retrieve result type for a const volatile member function pointer.
- template<typename _Res, typename _Class, typename... _ArgTypes>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...)
- const volatile>
+ const volatile _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
- template<typename _Res, typename _Class, typename... _ArgTypes>
+ template<typename _Res, typename _Class, typename... _ArgTypes
+ _GLIBCXX_NOEXCEPT_PARM>
struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......)
- const volatile>
+ const volatile _GLIBCXX_NOEXCEPT_QUAL>
{ typedef _Res result_type; };
/**
@@ -201,8 +216,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
// - a function type (unary)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res(_T1)>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res(_T1) _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<_T1, _Res>
{ };
@@ -222,8 +237,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
// - a function type (binary)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res(_T1, _T2)>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<_T1, _T2, _Res>
{ };
@@ -243,62 +258,62 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
// - a function pointer type (unary)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res(*)(_T1)>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res(*)(_T1) _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<_T1, _Res>
{ };
// - a function pointer type (binary)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res(*)(_T1, _T2)>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res(*)(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<_T1, _T2, _Res>
{ };
// - a pointer to member function type (unary, no qualifiers)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res (_T1::*)()>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)() _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<_T1*, _Res>
{ };
// - a pointer to member function type (binary, no qualifiers)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res (_T1::*)(_T2)>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<_T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, const)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res (_T1::*)() const>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)() const _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<const _T1*, _Res>
{ };
// - a pointer to member function type (binary, const)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<const _T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, volatile)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res (_T1::*)() volatile>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)() volatile _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<volatile _T1*, _Res>
{ };
// - a pointer to member function type (binary, volatile)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<volatile _T1*, _T2, _Res>
{ };
// - a pointer to member function type (unary, const volatile)
- template<typename _Res, typename _T1>
- struct _Reference_wrapper_base<_Res (_T1::*)() const volatile>
+ template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)() const volatile _GLIBCXX_NOEXCEPT_QUAL>
: unary_function<const volatile _T1*, _Res>
{ };
// - a pointer to member function type (binary, const volatile)
- template<typename _Res, typename _T1, typename _T2>
- struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile>
+ template<typename _Res, typename _T1, typename _T2 _GLIBCXX_NOEXCEPT_PARM>
+ struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile _GLIBCXX_NOEXCEPT_QUAL>
: binary_function<const volatile _T1*, _T2, _Res>
{ };
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 60837ea6cff..14a1ae6f61d 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -762,9 +762,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
template<typename _FwdIter>
basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc,
flag_type __f)
- : _M_flags((__f & (ECMAScript | basic | extended | awk | grep | egrep))
- ? __f : (__f | ECMAScript)),
- _M_loc(std::move(__loc)),
+ : _M_flags(__f), _M_loc(std::move(__loc)),
_M_automaton(__detail::__compile_nfa<_FwdIter, _Rx_traits>(
std::move(__first), std::move(__last), _M_loc, _M_flags))
{ }
@@ -1753,7 +1751,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
*/
const_iterator
end() const
- { return _Base_type::end() - 3; }
+ { return _Base_type::end() - (empty() ? 0 : 3); }
/**
* @brief Gets an iterator to one-past-the-end of the collection.
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 30339536f57..ea0e3277738 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -777,7 +777,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/**
* @brief Attempts to insert a std::pair into the %map.
-
* @param __x Pair to be inserted (see std::make_pair for easy
* creation of pairs).
*
@@ -790,12 +789,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* first element (the key) is not already present in the %map.
*
* Insertion requires logarithmic time.
+ * @{
*/
std::pair<iterator, bool>
insert(const value_type& __x)
{ return _M_t._M_insert_unique(__x); }
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ std::pair<iterator, bool>
+ insert(value_type&& __x)
+ { return _M_t._M_insert_unique(std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -803,6 +809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(_Pair&& __x)
{ return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
#endif
+ // @}
#if __cplusplus >= 201103L
/**
@@ -839,6 +846,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* for more on @a hinting.
*
* Insertion requires logarithmic time (if the hint is not taken).
+ * @{
*/
iterator
#if __cplusplus >= 201103L
@@ -849,6 +857,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_insert_unique_(__position, __x); }
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __position, value_type&& __x)
+ { return _M_t._M_insert_unique_(__position, std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -857,6 +871,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_insert_unique_(__position,
std::forward<_Pair>(__x)); }
#endif
+ // @}
/**
* @brief Template function that attempts to insert a range of elements.
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 7dc22a96a59..68ffea3adba 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -525,12 +525,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* thus multiple pairs with the same key can be inserted.
*
* Insertion requires logarithmic time.
+ * @{
*/
iterator
insert(const value_type& __x)
{ return _M_t._M_insert_equal(__x); }
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(value_type&& __x)
+ { return _M_t._M_insert_equal(std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -538,6 +545,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(_Pair&& __x)
{ return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
#endif
+ // @}
/**
* @brief Inserts a std::pair into the %multimap.
@@ -558,6 +566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
*
* Insertion requires logarithmic time (if the hint is not taken).
+ * @{
*/
iterator
#if __cplusplus >= 201103L
@@ -568,6 +577,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_insert_equal_(__position, __x); }
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __position, value_type&& __x)
+ { return _M_t._M_insert_equal_(__position, std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -576,6 +591,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_t._M_insert_equal_(__position,
std::forward<_Pair>(__x)); }
#endif
+ // @}
/**
* @brief A template function that attempts to insert a range
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index 4ef30ccccd6..dd881d46213 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -578,6 +578,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(const value_type& __x)
{ return _M_h.insert(__x); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ std::pair<iterator, bool>
+ insert(value_type&& __x)
+ { return _M_h.insert(std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -612,6 +618,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(const_iterator __hint, const value_type& __x)
{ return _M_h.insert(__hint, __x); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __hint, value_type&& __x)
+ { return _M_h.insert(__hint, std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -1467,6 +1479,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(const value_type& __x)
{ return _M_h.insert(__x); }
+ iterator
+ insert(value_type&& __x)
+ { return _M_h.insert(std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -1499,6 +1515,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
insert(const_iterator __hint, const value_type& __x)
{ return _M_h.insert(__hint, __x); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __hint, value_type&& __x)
+ { return _M_h.insert(__hint, std::move(__x)); }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index c275979052c..ba6a6201f8e 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -260,6 +260,15 @@ namespace __debug
}
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ std::pair<iterator, bool>
+ insert(value_type&& __x)
+ {
+ auto __res = _Base::insert(std::move(__x));
+ return { iterator(__res.first, this), __res.second };
+ }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -291,6 +300,15 @@ namespace __debug
}
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __position, value_type&& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return { _Base::insert(__position.base(), std::move(__x)), this };
+ }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index f971cfa41f0..08fc73012c8 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -244,6 +244,12 @@ namespace __debug
{ return iterator(_Base::insert(__x), this); }
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(value_type&& __x)
+ { return { _Base::insert(std::move(__x)), this }; }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -270,6 +276,15 @@ namespace __debug
}
#if __cplusplus >= 201103L
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __position, value_type&& __x)
+ {
+ __glibcxx_check_insert(__position);
+ return { _Base::insert(__position.base(), std::move(__x)), this };
+ }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 51a55ae21f3..658712815e3 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -312,19 +312,20 @@ namespace __debug
insert(const value_type& __obj)
{
size_type __bucket_count = this->bucket_count();
- std::pair<_Base_iterator, bool> __res = _Base::insert(__obj);
+ auto __res = _Base::insert(__obj);
_M_check_rehashed(__bucket_count);
- return std::make_pair(iterator(__res.first, this), __res.second);
+ return { iterator(__res.first, this), __res.second };
}
- iterator
- insert(const_iterator __hint, const value_type& __obj)
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ std::pair<iterator, bool>
+ insert(value_type&& __x)
{
- __glibcxx_check_insert(__hint);
size_type __bucket_count = this->bucket_count();
- _Base_iterator __it = _Base::insert(__hint.base(), __obj);
+ auto __res = _Base::insert(std::move(__x));
_M_check_rehashed(__bucket_count);
- return iterator(__it, this);
+ return { iterator(__res.first, this), __res.second };
}
template<typename _Pair, typename = typename
@@ -340,6 +341,28 @@ namespace __debug
return std::make_pair(iterator(__res.first, this), __res.second);
}
+ iterator
+ insert(const_iterator __hint, const value_type& __obj)
+ {
+ __glibcxx_check_insert(__hint);
+ size_type __bucket_count = this->bucket_count();
+ _Base_iterator __it = _Base::insert(__hint.base(), __obj);
+ _M_check_rehashed(__bucket_count);
+ return iterator(__it, this);
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __hint, value_type&& __x)
+ {
+ __glibcxx_check_insert(__hint);
+ size_type __bucket_count = this->bucket_count();
+ auto __it = _Base::insert(__hint.base(), std::move(__x));
+ _M_check_rehashed(__bucket_count);
+ return iterator(__it, this);
+ }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
@@ -907,6 +930,17 @@ namespace __debug
return iterator(__it, this);
}
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(value_type&& __x)
+ {
+ size_type __bucket_count = this->bucket_count();
+ auto __it = _Base::insert(std::move(__x));
+ _M_check_rehashed(__bucket_count);
+ return { __it, this };
+ }
+
iterator
insert(const_iterator __hint, const value_type& __obj)
{
@@ -917,6 +951,18 @@ namespace __debug
return iterator(__it, this);
}
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2354. Unnecessary copying when inserting into maps with braced-init
+ iterator
+ insert(const_iterator __hint, value_type&& __x)
+ {
+ __glibcxx_check_insert(__hint);
+ size_type __bucket_count = this->bucket_count();
+ auto __it = _Base::insert(__hint.base(), std::move(__x));
+ _M_check_rehashed(__bucket_count);
+ return iterator(__it, this);
+ }
+
template<typename _Pair, typename = typename
std::enable_if<std::is_constructible<value_type,
_Pair&&>::value>::type>
diff --git a/libstdc++-v3/include/experimental/bits/fs_ops.h b/libstdc++-v3/include/experimental/bits/fs_ops.h
index 1b455f541ba..11be712aaaa 100644
--- a/libstdc++-v3/include/experimental/bits/fs_ops.h
+++ b/libstdc++-v3/include/experimental/bits/fs_ops.h
@@ -131,8 +131,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
auto __s = status(__p, __ec);
if (status_known(__s))
- __ec.clear();
- return exists(__s);
+ {
+ __ec.clear();
+ return __s.type() != file_type::not_found;
+ }
+ return false;
}
uintmax_t file_size(const path& __p);
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 24c17e8cbe8..2235a51ea5d 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -660,22 +660,22 @@ namespace experimental
_GLIBCXX_BEGIN_NAMESPACE_VERSION
inline constexpr basic_string_view<char>
- operator""sv(const char* __str, size_t __len)
+ operator""sv(const char* __str, size_t __len) noexcept
{ return basic_string_view<char>{__str, __len}; }
#ifdef _GLIBCXX_USE_WCHAR_T
inline constexpr basic_string_view<wchar_t>
- operator""sv(const wchar_t* __str, size_t __len)
+ operator""sv(const wchar_t* __str, size_t __len) noexcept
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
inline constexpr basic_string_view<char16_t>
- operator""sv(const char16_t* __str, size_t __len)
+ operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }
inline constexpr basic_string_view<char32_t>
- operator""sv(const char32_t* __str, size_t __len)
+ operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
#endif
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 6342c98e88a..22107cb2264 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -493,7 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
{
_Tp __re_x, __im_x;
- _CharT __ch;
+ _CharT __ch = _CharT();
__is >> __ch;
if (__ch == '(')
{
@@ -511,11 +511,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
else
__is.setstate(ios_base::failbit);
}
- else
+ else if (__is)
{
__is.putback(__ch);
- __is >> __re_x;
- __x = __re_x;
+ if (__is >> __re_x)
+ __x = __re_x;
+ else
+ __is.setstate(ios_base::failbit);
}
return __is;
}
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 73d5a60a918..d9d446bc2f6 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -896,7 +896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr shared_future() noexcept : _Base_type() { }
/// Copy constructor
- shared_future(const shared_future& __sf) : _Base_type(__sf) { }
+ shared_future(const shared_future& __sf) noexcept : _Base_type(__sf) { }
/// Construct from a future rvalue
shared_future(future<_Res>&& __uf) noexcept
@@ -908,7 +908,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Base_type(std::move(__sf))
{ }
- shared_future& operator=(const shared_future& __sf)
+ shared_future& operator=(const shared_future& __sf) noexcept
{
shared_future(__sf)._M_swap(*this);
return *this;
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 9e3f1f75fcd..49ed8632227 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1031,7 +1031,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @}
+#if __cpp_deduction_guides >= 201606
template <typename _Tp> optional(_Tp) -> optional<_Tp>;
+#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 8bbf9afc7c6..f53dfcc672d 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -644,22 +644,22 @@ _GLIBCXX_END_NAMESPACE_VERSION
_GLIBCXX_BEGIN_NAMESPACE_VERSION
inline constexpr basic_string_view<char>
- operator""sv(const char* __str, size_t __len)
+ operator""sv(const char* __str, size_t __len) noexcept
{ return basic_string_view<char>{__str, __len}; }
#ifdef _GLIBCXX_USE_WCHAR_T
inline constexpr basic_string_view<wchar_t>
- operator""sv(const wchar_t* __str, size_t __len)
+ operator""sv(const wchar_t* __str, size_t __len) noexcept
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
inline constexpr basic_string_view<char16_t>
- operator""sv(const char16_t* __str, size_t __len)
+ operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }
inline constexpr basic_string_view<char32_t>
- operator""sv(const char32_t* __str, size_t __len)
+ operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
#endif
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index e34529d8be5..baacfb006dd 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -71,12 +71,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static constexpr _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant<_Tp, __v> type;
- constexpr operator value_type() const { return value; }
+ constexpr operator value_type() const noexcept { return value; }
#if __cplusplus > 201103L
#define __cpp_lib_integral_constant_callable 201304
- constexpr value_type operator()() const { return value; }
+ constexpr value_type operator()() const noexcept { return value; }
#endif
};
@@ -151,10 +151,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Pp>
struct __not_
- : public integral_constant<bool, !_Pp::value>
+ : public __bool_constant<!bool(_Pp::value)>
{ };
-#if __cplusplus > 201402L
+#if __cplusplus >= 201703L
#define __cpp_lib_logical_traits 201510
@@ -174,18 +174,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
template<typename... _Bn>
- inline constexpr bool conjunction_v
- = conjunction<_Bn...>::value;
+ inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
template<typename... _Bn>
- inline constexpr bool disjunction_v
- = disjunction<_Bn...>::value;
+ inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
template<typename _Pp>
- inline constexpr bool negation_v
- = negation<_Pp>::value;
+ inline constexpr bool negation_v = negation<_Pp>::value;
-#endif
+#endif // C++17
// For several sfinae-friendly trait implementations we transport both the
// result information (as the member type) and the failure information (no
@@ -2758,12 +2755,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Result, typename _Ret>
struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
- : is_convertible<typename _Result::type, _Ret>::type
- { };
-
- template<typename _Result>
- struct __is_invocable_impl<_Result, void, __void_t<typename _Result::type>>
- : true_type
+ : __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type
{ };
template<typename _Fn, typename... _ArgTypes>
@@ -2868,14 +2860,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Result, typename _Ret>
struct __is_nt_invocable_impl<_Result, _Ret,
__void_t<typename _Result::type>>
- : __and_<is_convertible<typename _Result::type, _Ret>,
- is_nothrow_constructible<_Ret, typename _Result::type>>
- { };
-
- template<typename _Result>
- struct __is_nt_invocable_impl<_Result, void,
- __void_t<typename _Result::type>>
- : true_type
+ : __or_<is_void<_Ret>,
+ __and_<is_convertible<typename _Result::type, _Ret>,
+ is_nothrow_constructible<_Ret, typename _Result::type>>>
{ };
/// std::is_nothrow_invocable_r
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 1d9b8eb4287..978acb747e9 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -323,7 +323,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct integer_sequence
{
typedef _Tp value_type;
- static constexpr size_t size() { return sizeof...(_Idx); }
+ static constexpr size_t size() noexcept { return sizeof...(_Idx); }
};
template<typename _Tp, _Tp _Num,
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index a67b27ab736..8f1023949bb 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1277,7 +1277,7 @@ class TemplateTypePrinter(object):
Recognizes type names that match a regular expression.
Replaces them with a formatted string which can use replacement field
{N} to refer to the \N subgroup of the regex match.
- Type printers are recusively applied to the subgroups.
+ Type printers are recursively applied to the subgroups.
This allows recognizing e.g. "std::vector<(.*), std::allocator<\\1> >"
and replacing it with "std::vector<{1}>", omitting the template argument
@@ -1473,15 +1473,15 @@ def register_type_printers(obj):
'unordered_multiset<{1}>')
# strip the "fundamentals_v1" inline namespace from these types
- add_one_template_type_printer(obj, 'any<T>',
- 'experimental::fundamentals_v\d::any<(.*)>',
- 'experimental::any<\\1>')
+ add_one_template_type_printer(obj, 'any',
+ 'experimental::fundamentals_v\d::any',
+ 'experimental::any')
add_one_template_type_printer(obj, 'optional<T>',
'experimental::fundamentals_v\d::optional<(.*)>',
- 'experimental::optional<\\1>')
+ 'experimental::optional<{1}>')
add_one_template_type_printer(obj, 'basic_string_view<C>',
'experimental::fundamentals_v\d::basic_string_view<(.*), std::char_traits<\\1> >',
- 'experimental::basic_string_view<\\1>')
+ 'experimental::basic_string_view<{1}>')
def register_libstdcxx_printers (obj):
"Register libstdc++ pretty-printers with objfile Obj."
diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
index c711de16f06..8de3511346e 100644
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -443,48 +443,68 @@ namespace
return false;
}
+ size_t count = from_st->st_size;
#ifdef _GLIBCXX_USE_SENDFILE
off_t offset = 0;
- const auto n = ::sendfile(out.fd, in.fd, &offset, from_st->st_size);
- if (n < 0 && (errno == ENOSYS || errno == EINVAL))
+ ssize_t n = ::sendfile(out.fd, in.fd, &offset, count);
+ if (n < 0 && errno != ENOSYS && errno != EINVAL)
{
-#endif
- __gnu_cxx::stdio_filebuf<char> sbin(in.fd, std::ios::in);
- __gnu_cxx::stdio_filebuf<char> sbout(out.fd, std::ios::out);
- if (sbin.is_open())
- in.fd = -1;
- if (sbout.is_open())
- out.fd = -1;
- if (from_st->st_size && !(std::ostream(&sbout) << &sbin))
- {
- ec = std::make_error_code(std::errc::io_error);
- return false;
- }
- if (!sbout.close() || !sbin.close())
+ ec.assign(errno, std::generic_category());
+ return false;
+ }
+ if ((size_t)n == count)
+ {
+ if (!out.close() || !in.close())
{
ec.assign(errno, std::generic_category());
return false;
}
-
ec.clear();
return true;
+ }
+ else if (n > 0)
+ count -= n;
+#endif // _GLIBCXX_USE_SENDFILE
+
+ using std::ios;
+ __gnu_cxx::stdio_filebuf<char> sbin(in.fd, ios::in|ios::binary);
+ __gnu_cxx::stdio_filebuf<char> sbout(out.fd, ios::out|ios::binary);
+
+ if (sbin.is_open())
+ in.fd = -1;
+ if (sbout.is_open())
+ out.fd = -1;
#ifdef _GLIBCXX_USE_SENDFILE
+ if (n != 0)
+ {
+ if (n < 0)
+ n = 0;
+
+ const auto p1 = sbin.pubseekoff(n, ios::beg, ios::in);
+ const auto p2 = sbout.pubseekoff(n, ios::beg, ios::out);
+
+ const std::streampos errpos(std::streamoff(-1));
+ if (p1 == errpos || p2 == errpos)
+ {
+ ec = std::make_error_code(std::errc::io_error);
+ return false;
+ }
}
- if (n != from_st->st_size)
+#endif
+
+ if (count && !(std::ostream(&sbout) << &sbin))
{
- ec.assign(errno, std::generic_category());
+ ec = std::make_error_code(std::errc::io_error);
return false;
}
- if (!out.close() || !in.close())
+ if (!sbout.close() || !sbin.close())
{
ec.assign(errno, std::generic_category());
return false;
}
-
ec.clear();
return true;
-#endif
}
}
#endif
@@ -1199,26 +1219,45 @@ fs::read_symlink(const path& p)
fs::path fs::read_symlink(const path& p, error_code& ec)
{
+ path result;
#ifdef _GLIBCXX_HAVE_SYS_STAT_H
stat_type st;
if (::lstat(p.c_str(), &st))
{
ec.assign(errno, std::generic_category());
- return {};
+ return result;
}
- std::string buf(st.st_size, '\0');
- ssize_t len = ::readlink(p.c_str(), &buf.front(), buf.size());
- if (len == -1)
+ std::string buf(st.st_size ? st.st_size + 1 : 128, '\0');
+ do
{
- ec.assign(errno, std::generic_category());
- return {};
+ ssize_t len = ::readlink(p.c_str(), &buf.front(), buf.size());
+ if (len == -1)
+ {
+ ec.assign(errno, std::generic_category());
+ return result;
+ }
+ else if (len == (ssize_t)buf.size())
+ {
+ if (buf.size() > 4096)
+ {
+ ec.assign(ENAMETOOLONG, std::generic_category());
+ return result;
+ }
+ buf.resize(buf.size() * 2);
+ }
+ else
+ {
+ buf.resize(len);
+ result.assign(buf);
+ ec.clear();
+ break;
+ }
}
- ec.clear();
- return path{buf.data(), buf.data()+len};
+ while (true);
#else
ec = std::make_error_code(std::errc::not_supported);
- return {};
#endif
+ return result;
}
@@ -1227,7 +1266,7 @@ fs::remove(const path& p)
{
error_code ec;
bool result = fs::remove(p, ec);
- if (ec.value())
+ if (ec)
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove", p, ec));
return result;
}
@@ -1235,16 +1274,15 @@ fs::remove(const path& p)
bool
fs::remove(const path& p, error_code& ec) noexcept
{
- if (exists(symlink_status(p, ec)))
+ if (::remove(p.c_str()) == 0)
{
- if (::remove(p.c_str()) == 0)
- {
- ec.clear();
- return true;
- }
- else
- ec.assign(errno, std::generic_category());
+ ec.clear();
+ return true;
}
+ else if (errno == ENOENT)
+ ec.clear();
+ else
+ ec.assign(errno, std::generic_category());
return false;
}
@@ -1253,8 +1291,8 @@ std::uintmax_t
fs::remove_all(const path& p)
{
error_code ec;
- bool result = remove_all(p, ec);
- if (ec.value())
+ const auto result = remove_all(p, ec);
+ if (ec)
_GLIBCXX_THROW_OR_ABORT(filesystem_error("cannot remove all", p, ec));
return result;
}
@@ -1262,14 +1300,28 @@ fs::remove_all(const path& p)
std::uintmax_t
fs::remove_all(const path& p, error_code& ec) noexcept
{
- auto fs = symlink_status(p, ec);
- uintmax_t count = 0;
- if (ec.value() == 0 && fs.type() == file_type::directory)
- for (directory_iterator d(p, ec), end; ec.value() == 0 && d != end; ++d)
- count += fs::remove_all(d->path(), ec);
- if (ec.value())
+ const auto s = symlink_status(p, ec);
+ if (!status_known(s))
return -1;
- return fs::remove(p, ec) ? ++count : -1; // fs:remove() calls ec.clear()
+
+ ec.clear();
+ if (s.type() == file_type::not_found)
+ return 0;
+
+ uintmax_t count = 0;
+ if (s.type() == file_type::directory)
+ {
+ for (directory_iterator d(p, ec), end; !ec && d != end; d.increment(ec))
+ count += fs::remove_all(d->path(), ec);
+ if (ec.value() == ENOENT)
+ ec.clear();
+ else if (ec)
+ return -1;
+ }
+
+ if (fs::remove(p, ec))
+ ++count;
+ return ec ? -1 : count;
}
void
diff --git a/libstdc++-v3/testsuite/20_util/bind/83427.cc b/libstdc++-v3/testsuite/20_util/bind/83427.cc
new file mode 100644
index 00000000000..3b8a6506966
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bind/83427.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <functional>
+
+// PR libstdc++/83427
+
+int f() noexcept { return 0; }
+auto b = std::bind(f);
+static_assert(std::is_same_v<decltype(b)::result_type, int>);
+
+struct X { long f() const noexcept { return 0L; } };
+auto b2 = std::bind(&X::f, X{});
+static_assert(std::is_same_v<decltype(b2)::result_type, long>);
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 dc9daeb42ce..bc12719071e 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -18,7 +18,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-error "static assertion failed" "" { target *-*-* } 2259 }
+// { dg-error "declval.. must not be used" "" { target *-*-* } 0 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/is_invocable/83395.cc b/libstdc++-v3/testsuite/20_util/is_invocable/83395.cc
new file mode 100644
index 00000000000..53020255819
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_invocable/83395.cc
@@ -0,0 +1,28 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <type_traits>
+
+// PR libstdc++/83395
+using F = int(*)();
+static_assert(std::is_invocable_r<void, F>::value);
+static_assert(std::is_invocable_r<void const, F>::value);
+static_assert(std::is_invocable_r<void volatile, F>::value);
+static_assert(std::is_invocable_r<void const volatile, F>::value);
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/83395.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/83395.cc
new file mode 100644
index 00000000000..0051a5489f2
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/83395.cc
@@ -0,0 +1,28 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <type_traits>
+
+// PR libstdc++/83395
+using F = int(*)() noexcept;
+static_assert(std::is_nothrow_invocable_r<void, F>::value);
+static_assert(std::is_nothrow_invocable_r<void const, F>::value);
+static_assert(std::is_nothrow_invocable_r<void volatile, F>::value);
+static_assert(std::is_nothrow_invocable_r<void const volatile, F>::value);
diff --git a/libstdc++-v3/testsuite/20_util/logical_traits/83134.cc b/libstdc++-v3/testsuite/20_util/logical_traits/83134.cc
new file mode 100644
index 00000000000..06f45da3b01
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/logical_traits/83134.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <type_traits>
+
+struct X {
+ constexpr operator bool() const { return false; }
+ constexpr bool operator!() const = delete;
+};
+
+struct Y {
+ static constexpr X value{};
+};
+
+static_assert(std::negation<Y>::value); // PR libstdc++/83134
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 664fb70fb4b..6d10e606cde 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
@@ -47,4 +47,4 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 39 }
// { dg-error "required from here" "" { target *-*-* } 41 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1924 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1921 }
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 6d6471755f7..4ab6880a346 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
@@ -47,5 +47,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 39 }
// { dg-error "required from here" "" { target *-*-* } 41 }
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1820 }
-// { dg-error "declaration of" "" { target *-*-* } 1777 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1817 }
+// { dg-error "declaration of" "" { target *-*-* } 1774 }
diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc
new file mode 100644
index 00000000000..170caf92045
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <functional>
+
+// PR libstdc++/83427
+
+int f(short) noexcept { return 0; }
+std::reference_wrapper<decltype(f)> r(f);
+static_assert(std::is_same_v<decltype(r)::result_type, int>);
+static_assert(std::is_same_v<decltype(r)::argument_type, short>);
+
+auto* p = &f;
+std::reference_wrapper<decltype(&f)> r2(p);
+static_assert(std::is_same_v<decltype(r2)::result_type, int>);
+static_assert(std::is_same_v<decltype(r2)::argument_type, short>);
+
+struct X { long f() const noexcept { return 0L; } };
+auto m = &X::f;
+std::reference_wrapper<decltype(m)> r3(m);
+static_assert(std::is_same_v<decltype(r3)::result_type, long>);
+static_assert(std::is_same_v<decltype(r3)::argument_type, const X*>);
diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
new file mode 100644
index 00000000000..99a679dc124
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc
@@ -0,0 +1,58 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <locale>
+#include <streambuf>
+#include <testsuite_hooks.h>
+
+struct streambuf : std::streambuf
+{
+ int_type underflow() override
+ {
+ if (c != '\0')
+ {
+ this->setg(&c, &c, &c + 1);
+ return *this->gptr();
+ }
+ c = '\0';
+ return traits_type::eof();
+ }
+
+private:
+ char c = 'a';
+};
+
+struct codecvt : std::codecvt<wchar_t, char, std::mbstate_t> { };
+
+void
+test01()
+{
+ // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html
+ streambuf sb;
+ std::wbuffer_convert<codecvt> conv(&sb);
+ VERIFY( sb.in_avail() == 0 );
+ wchar_t c = conv.sgetc();
+ VERIFY( c == L'a' );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc
new file mode 100644
index 00000000000..4a660dd7469
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 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-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <map>
+
+void
+test01()
+{
+ int i = 0;
+ std::map<int, int&> m;
+ std::pair<const int, int&> p{1, i};
+ m.insert(p); // PR libstdc++/83226
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/dr2354.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/dr2354.cc
new file mode 100644
index 00000000000..cc0fcbb4677
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/dr2354.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 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 { target c++11 } }
+
+#include <map>
+
+struct MoveOnly {
+ MoveOnly(int) { }
+ MoveOnly(MoveOnly&&) = default;
+};
+
+void
+test01()
+{
+ std::map<int, MoveOnly> m;
+ m.insert({1, 2}); // PR libstdc++/82522 - LWG 2354
+}
+
+void
+test02()
+{
+ std::map<int, MoveOnly> m;
+ m.insert(m.begin(), {1, 2}); // PR libstdc++/82522 - LWG 2354
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/dr2354.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/dr2354.cc
new file mode 100644
index 00000000000..73cbf4cf6d4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/insert/dr2354.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 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 { target c++11 } }
+
+#include <map>
+
+struct MoveOnly {
+ MoveOnly(int) { }
+ MoveOnly(MoveOnly&&) = default;
+};
+
+void
+test01()
+{
+ std::multimap<int, MoveOnly> m;
+ m.insert({1, 2}); // PR libstdc++/82522 - LWG 2354
+}
+
+void
+test02()
+{
+ std::multimap<int, MoveOnly> m;
+ m.insert(m.begin(), {1, 2}); // PR libstdc++/82522 - LWG 2354
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/insert/dr2354.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/dr2354.cc
new file mode 100644
index 00000000000..3507efa34a2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/insert/dr2354.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 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 { target c++11 } }
+
+#include <unordered_map>
+
+struct MoveOnly {
+ MoveOnly(int) { }
+ MoveOnly(MoveOnly&&) = default;
+};
+
+void
+test01()
+{
+ std::unordered_map<int, MoveOnly> m;
+ m.insert({1, 2}); // PR libstdc++/82522 - LWG 2354
+}
+
+void
+test02()
+{
+ std::unordered_map<int, MoveOnly> m;
+ m.insert(m.begin(), {1, 2}); // PR libstdc++/82522 - LWG 2354
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/dr2354.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/dr2354.cc
new file mode 100644
index 00000000000..ff661132a09
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/insert/dr2354.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2017 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 { target c++11 } }
+
+#include <unordered_map>
+
+struct MoveOnly {
+ MoveOnly(int) { }
+ MoveOnly(MoveOnly&&) = default;
+};
+
+void
+test01()
+{
+ std::unordered_multimap<int, MoveOnly> m;
+ m.insert({1, 2}); // PR libstdc++/82522 - LWG 2354
+}
+
+void
+test02()
+{
+ std::unordered_multimap<int, MoveOnly> m;
+ m.insert(m.begin(), {1, 2}); // PR libstdc++/82522 - LWG 2354
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc
new file mode 100644
index 00000000000..e292e13311a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/59568.cc
@@ -0,0 +1,191 @@
+// Copyright (C) 2017 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 <complex>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::istringstream in(" 1 (2) ( 2.0 , 0.5 ) ");
+ std::complex<double> c1, c2, c3;
+ in >> c1 >> c2 >> c3;
+ VERIFY( in.good() );
+ VERIFY( c1.real() == 1 && c1.imag() == 0 );
+ VERIFY( c2.real() == 2 && c2.imag() == 0 );
+ VERIFY( c3.real() == 2 && c3.imag() == 0.5 );
+}
+
+void
+test02()
+{
+ std::istringstream in;
+ std::complex<double> c(-1, -1);
+ const std::complex<double> c0 = c;
+
+ in.str("a");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'a' );
+ VERIFY( c == c0 );
+
+ in.str(" ( ) ");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ')' );
+ VERIFY( c == c0 );
+
+ in.str("(,");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ',' );
+ VERIFY( c == c0 );
+
+ in.str("(b)");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'b' );
+ VERIFY( c == c0 );
+
+ in.str("( c)");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'c' );
+ VERIFY( c == c0 );
+
+ in.str("(99d");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'd' );
+ VERIFY( c == c0 );
+
+ in.str("(99 e");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'e' );
+ VERIFY( c == c0 );
+
+ in.str("(99, f");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == 'f' );
+ VERIFY( c == c0 );
+
+ in.str("(99, 88g");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'g' );
+ VERIFY( c == c0 );
+
+ in.str("(99, 88 h");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ // VERIFY( in.get() == 'h' );
+ VERIFY( c == c0 );
+
+ in.str("(99, )");
+ in >> c;
+ VERIFY( in.fail() );
+ in.clear();
+ VERIFY( in.get() == ')' );
+ VERIFY( c == c0 );
+}
+
+void
+test03()
+{
+ // PR libstdc++/59568
+ std::istringstream in;
+ std::complex<double> c;
+
+ in.str("");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str(" ");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99,");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+
+ in.str("(99,99");
+ in >> c;
+ VERIFY( in.fail() );
+ VERIFY( in.eof() );
+ in.clear();
+}
+
+void
+test04()
+{
+ // Test noskipws handling
+ std::istringstream in;
+ const char* bad_inputs[] = {
+ " 1", " (2)", "( 2)", "(2 )", "(2 ,3)", "(2,3 )", 0
+ };
+ const std::complex<double> c0(-1, -1);
+ std::complex<double> c;
+ for (int i = 0; bad_inputs[i]; ++i)
+ {
+ c = c0;
+ in.clear();
+ in.str(bad_inputs[i]);
+ in >> std::noskipws >> c;
+ VERIFY( in.fail() );
+ VERIFY( c == c0 );
+
+ in.clear();
+ in.str(bad_inputs[i]);
+ in >> std::skipws >> c;
+ VERIFY( !in.fail() );
+ VERIFY( c != c0 );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+}
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc
new file mode 100644
index 00000000000..b958dfbe42f
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/83598.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ // PR libstdc++83598
+ std::regex r1(".", std::regex_constants::syntax_option_type{});
+ VERIFY(r1.flags() == std::regex_constants::syntax_option_type{});
+ std::regex r2(".", std::regex_constants::icase);
+ VERIFY(r2.flags() == std::regex_constants::icase);
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
index a6d1375df9e..c2177580ebb 100644
--- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
+++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/char/default.cc
@@ -30,6 +30,8 @@ void test01()
std::cmatch cm;
VERIFY( cm.size() == 0 );
VERIFY( !cm.ready() );
+ VERIFY( cm.empty() );
+ VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
}
void test02()
@@ -37,6 +39,8 @@ void test02()
std::smatch sm;
VERIFY( sm.size() == 0 );
VERIFY( !sm.ready() );
+ VERIFY( sm.empty() );
+ VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
}
int
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
index f1d0a3f1191..22e25e13f39 100644
--- a/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
+++ b/libstdc++-v3/testsuite/28_regex/match_results/ctors/wchar_t/default.cc
@@ -30,6 +30,8 @@ void test01()
std::wcmatch cm;
VERIFY( cm.size() == 0 );
VERIFY( !cm.ready() );
+ VERIFY( cm.empty() );
+ VERIFY( cm.begin() == cm.end() ); // PR libstdc++/83600
}
void test02()
@@ -37,6 +39,8 @@ void test02()
std::wsmatch sm;
VERIFY( sm.size() == 0 );
VERIFY( !sm.ready() );
+ VERIFY( sm.empty() );
+ VERIFY( sm.begin() == sm.end() ); // PR libstdc++/83600
}
int
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
index e7b5e53d43d..50cc7d45de8 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
@@ -28,6 +28,7 @@ namespace fs = std::experimental::filesystem;
void
test01()
{
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::error_code ec;
// Test non-existent path.
@@ -37,15 +38,19 @@ test01()
VERIFY( iter == end(iter) );
// Test empty directory.
+ ec = bad_ec;
create_directory(p, fs::current_path(), ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter == end(iter) );
// Test non-empty directory.
- create_directories(p / "d1/d2");
+ ec = bad_ec;
+ create_directories(p / "d1/d2", ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -56,6 +61,7 @@ test01()
VERIFY( iter == end(iter) );
// Test inaccessible directory.
+ ec = bad_ec;
permissions(p, fs::perms::none, ec);
VERIFY( !ec );
iter = fs::recursive_directory_iterator(p, ec);
@@ -64,15 +70,19 @@ test01()
// Test inaccessible directory, skipping permission denied.
const auto opts = fs::directory_options::skip_permission_denied;
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, opts, ec);
VERIFY( !ec );
VERIFY( iter == end(iter) );
// Test inaccessible sub-directory.
+ ec = bad_ec;
permissions(p, fs::perms::owner_all, ec);
VERIFY( !ec );
+ ec = bad_ec;
permissions(p/"d1/d2", fs::perms::none, ec);
VERIFY( !ec );
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -84,12 +94,14 @@ test01()
VERIFY( iter == end(iter) );
// Test inaccessible sub-directory, skipping permission denied.
+ ec = bad_ec;
iter = fs::recursive_directory_iterator(p, opts, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
VERIFY( iter->path() == p/"d1" );
++iter; // should recurse into d1
VERIFY( iter->path() == p/"d1/d2" );
+ ec = bad_ec;
iter.increment(ec); // should fail to recurse into p/d1/d2, so skip it
VERIFY( !ec );
VERIFY( iter == end(iter) );
@@ -101,12 +113,15 @@ test01()
void
test02()
{
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::error_code ec;
const auto p = __gnu_test::nonexistent_path();
+ ec = bad_ec;
create_directories(p / "d1/d2", ec);
VERIFY( !ec );
// Test post-increment (libstdc++/71005)
+ ec = bad_ec;
auto iter = fs::recursive_directory_iterator(p, ec);
VERIFY( !ec );
VERIFY( iter != end(iter) );
@@ -126,7 +141,7 @@ test02()
void
test03()
{
- std::error_code ec;
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
const auto p = __gnu_test::nonexistent_path();
create_directories(p / "longer_than_small_string_buffer", ec);
VERIFY( !ec );
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
index f1c50a6e8e3..85e8281a6e1 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/create_directory.cc
@@ -50,7 +50,6 @@ test01()
VERIFY( !ec );
VERIFY( !b );
b = create_directory(p);
- VERIFY( !ec );
VERIFY( !b );
remove_all(p, ec);
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
new file mode 100644
index 00000000000..7c098b4864b
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove.cc
@@ -0,0 +1,100 @@
+// Copyright (C) 2018 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-options "-lstdc++fs" }
+// { dg-do run { target c++11 } }
+// { dg-require-filesystem-ts "" }
+
+#include <experimental/filesystem>
+#include <testsuite_hooks.h>
+#include <testsuite_fs.h>
+
+namespace fs = std::experimental::filesystem;
+
+void
+test01()
+{
+ std::error_code ec;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
+ bool n;
+
+ n = fs::remove("", ec);
+ VERIFY( !ec ); // This seems odd, but is what the standard requires.
+ VERIFY( !n );
+
+ auto p = __gnu_test::nonexistent_path();
+ ec = bad_ec;
+ n = remove(p, ec);
+ VERIFY( !ec );
+ VERIFY( !n );
+
+ auto link = __gnu_test::nonexistent_path();
+ create_symlink(p, link); // dangling symlink
+ ec = bad_ec;
+ n = remove(link, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(link)) );
+
+ __gnu_test::scoped_file f(p);
+ create_symlink(p, link);
+ ec = bad_ec;
+ n = remove(link, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(link)) ); // The symlink is removed, but
+ VERIFY( exists(p) ); // its target is not.
+
+ ec = bad_ec;
+ n = remove(p, ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(symlink_status(p)) );
+
+ const auto dir = __gnu_test::nonexistent_path();
+ create_directories(dir/"a/b");
+ ec.clear();
+ n = remove(dir/"a", ec);
+ VERIFY( ec );
+ VERIFY( !n );
+ VERIFY( exists(dir/"a/b") );
+
+ permissions(dir, fs::perms::none, ec);
+ if (!ec)
+ {
+ ec.clear();
+ n = remove(dir/"a/b", ec);
+ VERIFY( ec );
+ VERIFY( !n );
+ permissions(dir, fs::perms::owner_all, ec);
+ }
+
+ ec = bad_ec;
+ n = remove(dir/"a/b", ec);
+ VERIFY( !ec );
+ VERIFY( n );
+ VERIFY( !exists(dir/"a/b") );
+
+ remove(dir/"a", ec);
+ remove(dir, ec);
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
index f4b5513b202..e325c83301d 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc
@@ -29,19 +29,19 @@ void
test01()
{
std::error_code ec;
+ const std::error_code bad_ec = make_error_code(std::errc::invalid_argument);
std::uintmax_t n;
n = fs::remove_all("", ec);
- VERIFY( ec );
- VERIFY( n == std::uintmax_t(-1) );
+ VERIFY( !ec ); // This seems odd, but is what the TS requires.
+ VERIFY( n == 0 );
auto p = __gnu_test::nonexistent_path();
- ec.clear();
+ ec = bad_ec;
n = remove_all(p, ec);
- VERIFY( ec );
- VERIFY( n == std::uintmax_t(-1) );
+ VERIFY( !ec );
+ VERIFY( n == 0 );
- const auto bad_ec = ec;
auto link = __gnu_test::nonexistent_path();
create_symlink(p, link); // dangling symlink
ec = bad_ec;
@@ -59,7 +59,7 @@ test01()
VERIFY( !exists(symlink_status(link)) ); // The symlink is removed, but
VERIFY( exists(p) ); // its target is not.
- auto dir = __gnu_test::nonexistent_path();
+ const auto dir = __gnu_test::nonexistent_path();
create_directories(dir/"a/b/c");
ec = bad_ec;
n = remove_all(dir/"a", ec);
@@ -85,8 +85,28 @@ test01()
b2.path.clear();
}
+void
+test02()
+{
+ const auto dir = __gnu_test::nonexistent_path();
+ create_directories(dir/"a/b/c");
+ std::uintmax_t n = remove_all(dir/"a");
+ VERIFY( n == 3 );
+ VERIFY( exists(dir) );
+ VERIFY( !exists(dir/"a") );
+
+ n = remove_all(dir/"a");
+ VERIFY( n == 0 );
+ VERIFY( exists(dir) );
+
+ n = remove_all(dir);
+ VERIFY( n == 1 );
+ VERIFY( !exists(dir) );
+}
+
int
main()
{
test01();
+ test02();
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc b/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
index e8a6dd3cd85..1689a2a0775 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc
@@ -43,7 +43,7 @@ test01()
if (!fs::exists("/tmp"))
return; // just give up
- std::error_code ec;
+ std::error_code ec = make_error_code(std::errc::invalid_argument);
fs::path p1 = fs::temp_directory_path(ec);
VERIFY( !ec );
VERIFY( exists(p1) );