aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-03-07 14:12:04 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-03-08 09:47:33 +0000
commit120525557a2dce8d4634456016a0d3943fcb8eb2 (patch)
tree4fe5ed0798b05eff3371d3dc06554c2930507a15
parentf7cd0a49635b07f902e4ce8f5323b894f0baef20 (diff)
Merge branches/gcc-7-branch rev 258315 .
Change-Id: I651281d13f040cd2f9f911c460a26b61fe82b136
-rw-r--r--ChangeLog4
-rw-r--r--config/ChangeLog4
-rw-r--r--contrib/ChangeLog4
-rw-r--r--contrib/header-tools/ChangeLog4
-rw-r--r--contrib/reghunt/ChangeLog4
-rw-r--r--contrib/regression/ChangeLog4
-rw-r--r--fixincludes/ChangeLog4
-rw-r--r--gcc/BASE-VER2
-rw-r--r--gcc/ChangeLog1185
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/gcc-interface/trans.c2
-rw-r--r--gcc/brig/ChangeLog4
-rw-r--r--gcc/builtins.c3
-rw-r--r--gcc/c-family/ChangeLog16
-rw-r--r--gcc/c-family/c-cppbuiltin.c13
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/cgraph.h3
-rw-r--r--gcc/cif-code.def4
-rw-r--r--gcc/combine.c31
-rw-r--r--gcc/config/aarch64/aarch64-simd.md10
-rw-r--r--gcc/config/aarch64/aarch64.c8
-rw-r--r--gcc/config/aarch64/aarch64.h6
-rw-r--r--gcc/config/aarch64/constraints.md4
-rw-r--r--gcc/config/arm/iterators.md4
-rw-r--r--gcc/config/arm/neon.md28
-rw-r--r--gcc/config/avr/avr.h3
-rw-r--r--gcc/config/avr/avr.md2
-rw-r--r--gcc/config/i386/constraints.md6
-rw-r--r--gcc/config/i386/i386-opts.h13
-rw-r--r--gcc/config/i386/i386-protos.h4
-rw-r--r--gcc/config/i386/i386.c967
-rw-r--r--gcc/config/i386/i386.h18
-rw-r--r--gcc/config/i386/i386.md92
-rw-r--r--gcc/config/i386/i386.opt28
-rw-r--r--gcc/config/i386/predicates.md21
-rw-r--r--gcc/config/i386/sse.md6
-rw-r--r--gcc/config/m68k/m68k.c21
-rw-r--r--gcc/config/msp430/msp430.c4
-rw-r--r--gcc/config/nvptx/nvptx.c10
-rw-r--r--gcc/config/pa/pa.c8
-rw-r--r--gcc/config/pa/predicates.md3
-rw-r--r--gcc/config/rs6000/altivec.h4
-rw-r--r--gcc/config/rs6000/altivec.md1
-rw-r--r--gcc/config/rs6000/driver-rs6000.c97
-rw-r--r--gcc/config/rs6000/predicates.md3
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def7
-rw-r--r--gcc/config/rs6000/rs6000-c.c27
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c112
-rw-r--r--gcc/config/rs6000/rs6000.md621
-rw-r--r--gcc/config/rs6000/rs6000.opt5
-rw-r--r--gcc/config/rs6000/vsx.md121
-rw-r--r--gcc/config/s390/s390-opts.h9
-rw-r--r--gcc/config/s390/s390-protos.h12
-rw-r--r--gcc/config/s390/s390.c713
-rw-r--r--gcc/config/s390/s390.h120
-rw-r--r--gcc/config/s390/s390.md574
-rw-r--r--gcc/config/s390/s390.opt59
-rw-r--r--gcc/config/sh/sh_optimize_sett_clrt.cc5
-rwxr-xr-xgcc/configure8
-rw-r--r--gcc/configure.ac8
-rw-r--r--gcc/cp/ChangeLog257
-rw-r--r--gcc/cp/call.c43
-rw-r--r--gcc/cp/class.c13
-rw-r--r--gcc/cp/constexpr.c87
-rw-r--r--gcc/cp/cp-gimplify.c8
-rw-r--r--gcc/cp/cvt.c2
-rw-r--r--gcc/cp/decl.c43
-rw-r--r--gcc/cp/except.c4
-rw-r--r--gcc/cp/lambda.c7
-rw-r--r--gcc/cp/method.c43
-rw-r--r--gcc/cp/parser.c191
-rw-r--r--gcc/cp/pt.c80
-rw-r--r--gcc/cp/tree.c7
-rw-r--r--gcc/dce.c15
-rw-r--r--gcc/doc/extend.texi31
-rw-r--r--gcc/doc/gcov.texi4
-rw-r--r--gcc/doc/invoke.texi47
-rw-r--r--gcc/doc/rtl.texi5
-rw-r--r--gcc/doc/tm.texi8
-rw-r--r--gcc/doc/tm.texi.in8
-rw-r--r--gcc/expmed.c12
-rw-r--r--gcc/expr.c26
-rw-r--r--gcc/final.c4
-rw-r--r--gcc/fold-const.c19
-rw-r--r--gcc/fortran/ChangeLog221
-rw-r--r--gcc/fortran/check.c2
-rw-r--r--gcc/fortran/decl.c65
-rw-r--r--gcc/fortran/expr.c8
-rw-r--r--gcc/fortran/frontend-passes.c45
-rw-r--r--gcc/fortran/gfortran.h6
-rw-r--r--gcc/fortran/interface.c32
-rw-r--r--gcc/fortran/match.c13
-rw-r--r--gcc/fortran/module.c4
-rw-r--r--gcc/fortran/openmp.c8
-rw-r--r--gcc/fortran/primary.c18
-rw-r--r--gcc/fortran/resolve.c62
-rw-r--r--gcc/fortran/simplify.c30
-rw-r--r--gcc/fortran/trans-array.c20
-rw-r--r--gcc/fortran/trans-decl.c50
-rw-r--r--gcc/fortran/trans-expr.c42
-rw-r--r--gcc/fortran/trans-intrinsic.c22
-rw-r--r--gcc/fortran/trans-io.c41
-rw-r--r--gcc/fortran/trans-openmp.c29
-rw-r--r--gcc/fortran/trans-types.c42
-rw-r--r--gcc/gcc.c12
-rw-r--r--gcc/genmatch.c6
-rw-r--r--gcc/genmodes.c1
-rw-r--r--gcc/gimple-ssa-store-merging.c10
-rw-r--r--gcc/gimple-ssa-strength-reduction.c4
-rw-r--r--gcc/go/ChangeLog4
-rw-r--r--gcc/hsa-gen.c10
-rw-r--r--gcc/ipa-cp.c18
-rw-r--r--gcc/ipa-icf.c11
-rw-r--r--gcc/ipa-inline-analysis.c5
-rw-r--r--gcc/ipa-inline.c2
-rw-r--r--gcc/ipa-prop.c17
-rw-r--r--gcc/ipa-utils.c2
-rw-r--r--gcc/ira-costs.c5
-rw-r--r--gcc/jit/ChangeLog4
-rw-r--r--gcc/loop-unroll.c2
-rw-r--r--gcc/lra-constraints.c16
-rw-r--r--gcc/lra-eliminations.c4
-rw-r--r--gcc/lra-int.h11
-rw-r--r--gcc/lra-lives.c4
-rw-r--r--gcc/lra-spills.c2
-rw-r--r--gcc/lra.c4
-rw-r--r--gcc/lto-streamer-out.c54
-rw-r--r--gcc/lto/ChangeLog77
-rw-r--r--gcc/lto/lto-lang.c2
-rw-r--r--gcc/lto/lto-partition.c3
-rw-r--r--gcc/lto/lto-symtab.c47
-rw-r--r--gcc/lto/lto.c67
-rw-r--r--gcc/machmode.def1
-rw-r--r--gcc/objc/ChangeLog4
-rw-r--r--gcc/objcp/ChangeLog4
-rw-r--r--gcc/omp-low.c51
-rw-r--r--gcc/opts.c20
-rw-r--r--gcc/params.def4
-rw-r--r--gcc/po/ChangeLog8
-rw-r--r--gcc/po/es.po65
-rw-r--r--gcc/reorg.c38
-rw-r--r--gcc/rtlanal.c4
-rw-r--r--gcc/sched-deps.c21
-rw-r--r--gcc/shrink-wrap.c2
-rw-r--r--gcc/simplify-rtx.c3
-rw-r--r--gcc/stor-layout.c24
-rw-r--r--gcc/symtab.c56
-rw-r--r--gcc/testsuite/ChangeLog1078
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr83977-1.c19
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr83977-2.c18
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr83977-3.c21
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr84341.c10
-rw-r--r--gcc/testsuite/c-c++-common/tsan/race_on_mutex.c9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-84449.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ctor21.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-list2.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-33837.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype43.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/elision3.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor30.C27
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist98.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle5.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept32.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi-empty1.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr82878.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr83824.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/ref-qual18.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic171.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C41
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-nsdmi1.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr83817.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr84496.C44
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr84558.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/var-templ58.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/var-templ58a.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/var-templ59.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/aligned-new8.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction49.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-84684.C163
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp-lambda1.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp35.C35
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp36.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/launder7.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/launder8.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C18
-rw-r--r--gcc/testsuite/g++.dg/ext/is_trivially_constructible6.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/stmtexpr22.C13
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr84430.C12
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr84448.C17
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr84556.C14
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr84557.C14
-rw-r--r--gcc/testsuite/g++.dg/init/pr83993-2.C14
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr82352.C93
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr83549.C8
-rw-r--r--gcc/testsuite/g++.dg/other/anon5.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/crash67.C2
-rw-r--r--gcc/testsuite/g++.dg/pr84279.C35
-rw-r--r--gcc/testsuite/g++.dg/template/incomplete11.C10
-rw-r--r--gcc/testsuite/g++.dg/template/nontype-fn1.C11
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81877.C22
-rw-r--r--gcc/testsuite/g++.dg/torture/pr83659.C18
-rw-r--r--gcc/testsuite/g++.dg/torture/pr84190.C20
-rw-r--r--gcc/testsuite/g++.dg/torture/pr84233.C25
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/volatile1.C28
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/volatile2.C20
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr83987-2.C24
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr83987.C15
-rw-r--r--gcc/testsuite/g++.dg/vect/pr70729-nest.cc2
-rw-r--r--gcc/testsuite/g++.dg/vect/pr70729.cc2
-rw-r--r--gcc/testsuite/g++.dg/vect/pr84556.cc21
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr82096.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr84425.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20180131-1.c28
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20180226-1.c31
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr82210.c26
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr84524.c41
-rw-r--r--gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x16
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/pr69869.c8
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr81440.h4
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr81440_0.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr81440_1.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr83954.h3
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr83954_0.c8
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr83954_1.c7
-rw-r--r--gcc/testsuite/gcc.dg/plugin/must-tail-call-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr81228.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr81661.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr82916.c47
-rw-r--r--gcc/testsuite/gcc.dg/pr83424.c30
-rw-r--r--gcc/testsuite/gcc.dg/pr83552.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr83605.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr83930.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr83985.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr83986.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr84503-1.c68
-rw-r--r--gcc/testsuite/gcc.dg/pr84503-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr84607.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr84628.c8
-rw-r--r--gcc/testsuite/gcc.dg/rtl/x86_64/final.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr83945.c21
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/bounds-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr81782.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr83370.c22
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-combine-sub-abs-into-vabd.c28
-rw-r--r--gcc/testsuite/gcc.target/arm/pr83687.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/i386.exp12
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-10.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-3.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-4.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-5.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-6.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-7.c43
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-8.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-9.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c43
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c42
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c42
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c44
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81481.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82795.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83330.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84310-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84310.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84625.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-10.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-11.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-12.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-13.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-14.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-15.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-16.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-17.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-18.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-19.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-2.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-20.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-21.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-22.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-23.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-24.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-25.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-26.c40
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-3.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-4.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-5.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-6.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-7.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-8.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-9.c21
-rw-r--r--gcc/testsuite/gcc.target/msp430/pr79242.c11
-rw-r--r--gcc/testsuite/gcc.target/nvptx/indirect_call.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c169
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p8.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p9.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-1.c39
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-2.c30
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr81572.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83399.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83629.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83862.c34
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84154-1.c55
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84154-2.c58
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84154-3.c60
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c21
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c34
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c53
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c26
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-5.c56
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-6.c81
-rw-r--r--gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c34
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsxcopy.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-function-pointer-attr.c56
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-function-pointer-nothunk.c59
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-function-pointer-z10.c56
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-function-pointer-z900.c56
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-attr.c42
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-attr.c42
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z10.c43
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z900.c43
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-nothunk.c46
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z10.c43
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z900.c43
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-attr-all.c46
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-attr-neg.c40
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-mem-attr.c46
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-mem-nothunk.c49
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-mem-z10.c46
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-mem-z900.c48
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-reg-attr.c41
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-reg-mixed.c44
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-reg-nothunk.c44
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-reg-z10.c41
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-return-reg-z900.c41
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z10.c78
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z900.c78
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-table-jump-z10.c77
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-table-jump-z900.c78
-rw-r--r--gcc/testsuite/gcc.target/s390/pr84295.c14
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_parameter.f909
-rw-r--r--gcc/testsuite/gfortran.dg/automatic_module_variable.f904
-rw-r--r--gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f906
-rw-r--r--gcc/testsuite/gfortran.dg/class_67.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_45.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_46.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_8.f904
-rw-r--r--gcc/testsuite/gfortran.dg/constant_shape.f907
-rw-r--r--gcc/testsuite/gfortran.dg/data_substring.f906
-rw-r--r--gcc/testsuite/gfortran.dg/deallocate_error_3.f909
-rw-r--r--gcc/testsuite/gfortran.dg/deallocate_error_4.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/dec_parameter_1.f1
-rw-r--r--gcc/testsuite/gfortran.dg/dec_parameter_2.f901
-rw-r--r--gcc/testsuite/gfortran.dg/explicit_shape_1.f907
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr83977.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr84116.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/implied_do_2.f907
-rw-r--r--gcc/testsuite/gfortran.dg/inline_matmul_22.f9044
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_18.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_19.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_17.f909
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_18.f908
-rw-r--r--gcc/testsuite/gfortran.dg/num_images_1.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/pr51434.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/pr71085.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr83864.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/pr83874.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/pr84117.f907
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_29.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_40.f909
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_41.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/shape_9.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/statement_function_1.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/statement_function_2.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/statement_function_3.f15
-rw-r--r--gcc/testsuite/gnat.dg/array11.adb10
-rw-r--r--gcc/testsuite/gnat.dg/disp1.adb (renamed from gcc/testsuite/gnat.dg/dispatch1.adb)5
-rw-r--r--gcc/testsuite/gnat.dg/disp1_pkg.ads (renamed from gcc/testsuite/gnat.dg/dispatch1_p.ads)6
-rw-r--r--gcc/testsuite/gnat.dg/disp2.adb (renamed from gcc/testsuite/gnat.dg/dispatch2.adb)5
-rw-r--r--gcc/testsuite/gnat.dg/disp2_pkg.adb (renamed from gcc/testsuite/gnat.dg/dispatch2_p.adb)7
-rw-r--r--gcc/testsuite/gnat.dg/disp2_pkg.ads (renamed from gcc/testsuite/gnat.dg/dispatch2_p.ads)9
-rw-r--r--gcc/testsuite/gnat.dg/generic_disp.adb (renamed from gcc/testsuite/gnat.dg/generic_dispatch.adb)7
-rw-r--r--gcc/testsuite/gnat.dg/generic_disp_pkg.adb (renamed from gcc/testsuite/gnat.dg/generic_dispatch_p.adb)8
-rw-r--r--gcc/testsuite/gnat.dg/generic_disp_pkg.ads (renamed from gcc/testsuite/gnat.dg/generic_dispatch_p.ads)5
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref1.adb2
-rw-r--r--gcc/testsuite/gnat.dg/null_pointer_deref2.adb2
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow1.adb4
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow2.adb4
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow3.adb4
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow4.adb8
-rw-r--r--gcc/testsuite/gnat.dg/object_overflow5.adb8
-rw-r--r--gcc/testsuite/lib/prune.exp2
-rw-r--r--gcc/testsuite/lib/target-supports.exp11
-rw-r--r--gcc/tree-eh.c88
-rw-r--r--gcc/tree-eh.h1
-rw-r--r--gcc/tree-emutls.c22
-rw-r--r--gcc/tree-if-conv.c5
-rw-r--r--gcc/tree-inline.c20
-rw-r--r--gcc/tree-ssa-loop-im.c53
-rw-r--r--gcc/tree-ssa-phiprop.c8
-rw-r--r--gcc/tree-ssa-pre.c25
-rw-r--r--gcc/tree-ssa-strlen.c10
-rw-r--r--gcc/tree-ssa-uninit.c4
-rw-r--r--gcc/tree-ssa.c3
-rw-r--r--gcc/tree-vect-loop.c4
-rw-r--r--gcc/tree-vect-stmts.c2
-rw-r--r--gcc/tree.c7
-rw-r--r--gnattools/ChangeLog4
-rw-r--r--gotools/ChangeLog4
-rw-r--r--include/ChangeLog4
-rw-r--r--intl/ChangeLog4
-rw-r--r--libada/ChangeLog4
-rw-r--r--libatomic/ChangeLog4
-rw-r--r--libbacktrace/ChangeLog4
-rw-r--r--libcc1/ChangeLog4
-rw-r--r--libcilkrts/ChangeLog4
-rw-r--r--libcpp/ChangeLog20
-rw-r--r--libcpp/include/cpplib.h2
-rw-r--r--libcpp/po/ChangeLog4
-rw-r--r--libcpp/traditional.c18
-rw-r--r--libdecnumber/ChangeLog4
-rw-r--r--libffi/ChangeLog4
-rw-r--r--libgcc/ChangeLog23
-rw-r--r--libgcc/config/libbid/ChangeLog4
-rw-r--r--libgcc/config/xtensa/ieee754-df.S55
-rw-r--r--libgcc/config/xtensa/ieee754-sf.S52
-rw-r--r--libgfortran/ChangeLog11
-rw-r--r--libgfortran/io/transfer.c4
-rw-r--r--libgomp/ChangeLog27
-rw-r--r--libgomp/omp.h.in2
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr84418-1.f9026
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr84418-2.f9035
-rw-r--r--libgomp/testsuite/libgomp.hsa.c/staticvar.c23
-rw-r--r--libhsail-rt/ChangeLog4
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libitm/ChangeLog4
-rw-r--r--libmpx/ChangeLog4
-rw-r--r--libobjc/ChangeLog4
-rw-r--r--liboffloadmic/ChangeLog4
-rw-r--r--libquadmath/ChangeLog4
-rw-r--r--libsanitizer/ChangeLog4
-rw-r--r--libssp/ChangeLog4
-rw-r--r--libstdc++-v3/ChangeLog103
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver2
-rwxr-xr-xlibstdc++-v3/configure36
-rw-r--r--libstdc++-v3/configure.ac6
-rw-r--r--libstdc++-v3/doc/html/index.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bugs.html3
-rw-r--r--libstdc++-v3/doc/html/manual/index.html4
-rw-r--r--libstdc++-v3/doc/html/manual/intro.html2
-rw-r--r--libstdc++-v3/doc/html/manual/status.html103
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml4
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxx2017.xml32
-rw-r--r--libstdc++-v3/doc/xml/manual/status_cxxis29124.xml315
-rw-r--r--libstdc++-v3/include/Makefile.am5
-rw-r--r--libstdc++-v3/include/Makefile.in3
-rw-r--r--libstdc++-v3/include/bits/parse_numbers.h7
-rw-r--r--libstdc++-v3/include/bits/random.h7
-rw-r--r--libstdc++-v3/include/c_global/cstddef2
-rw-r--r--libstdc++-v3/include/std/any15
-rw-r--r--libstdc++-v3/include/std/thread15
-rw-r--r--libstdc++-v3/include/std/type_traits4
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc4
-rw-r--r--libstdc++-v3/testsuite/18_support/byte/81076.cc26
-rw-r--r--libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/any/modifiers/83658.cc74
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/literals/84671.cc26
-rw-r--r--libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc14
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/83833.cc40
-rw-r--r--libstdc++-v3/testsuite/30_threads/async/84532.cc38
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/84532.cc38
-rw-r--r--libvtv/ChangeLog4
-rw-r--r--lto-plugin/ChangeLog4
-rw-r--r--maintainer-scripts/ChangeLog4
-rw-r--r--zlib/ChangeLog4
516 files changed, 14755 insertions, 1517 deletions
diff --git a/ChangeLog b/ChangeLog
index 33b83e8ff8d..670d2bb20fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/config/ChangeLog b/config/ChangeLog
index 1fff74415a7..abce453d1f7 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index e5b4ee8eb97..fb94d319326 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-10-02 Thomas Schwinge <thomas@codesourcery.com>
* gcc_update (files_and_dependencies): Handle libbacktrace.
diff --git a/contrib/header-tools/ChangeLog b/contrib/header-tools/ChangeLog
index 6b3eea0efe8..dfacf7a361f 100644
--- a/contrib/header-tools/ChangeLog
+++ b/contrib/header-tools/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog
index 0bc84db176c..b398ce8a078 100644
--- a/contrib/reghunt/ChangeLog
+++ b/contrib/reghunt/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog
index 0e7d6fc4fc9..87a1afd0573 100644
--- a/contrib/regression/ChangeLog
+++ b/contrib/regression/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 4e1abcba4c8..1472c9fe265 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/BASE-VER b/gcc/BASE-VER
index b26a34e4705..643916c03f1 100644
--- a/gcc/BASE-VER
+++ b/gcc/BASE-VER
@@ -1 +1 @@
-7.2.1
+7.3.1
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 029582575d8..d17cfe5de61 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,1184 @@
+2018-03-06 Denis Chertykov <chertykov@gmail.com>
+
+ Backport from mainline
+ 2018-02-07 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/84209
+ * config/avr/avr.h (GENERAL_REGNO_P, GENERAL_REG_P): New macros.
+ * config/avr/avr.md: Only post-reload split REG-REG moves if
+ either register is GENERAL_REG_P.
+
+2018-03-06 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline
+ 2/16/18 commit 257748 Carl Love <cel@us.ibm.com>
+
+ * config/rs6000/altivec.h: Remove vec_vextract4b and vec_vinsert4b.
+ * config/rs6000/rs6000-builtin.def: Remove macro expansion for
+ VINSERT4B_DI and VINSERT4B.
+ * config/rs6000/rs6000.c: Remove case statements for
+ P9V_BUILTIN_VINSERT4B, P9V_BUILTIN_VINSERT4B_DI,
+ and P9V_BUILTIN_VEC_VINSERT4B.
+ * config/rs6000/rs6000-c.c (altivec_expand_builtin): Remove entries for
+ P9V_BUILTIN_VEC_VEXTRACT4B and P9V_BUILTIN_VEC_VINSERT4B.
+ * config/rs6000/vsx.md: Remove define_expand vinsert4b,
+ define_insn *vinsert4b_internal, define_insn "*vinsert4b_di_internal.
+ * doc/extend.texi: Remove vec_vextract4b, non ABI definitions for
+ vec_insert4b.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-20 Martin Liska <mliska@suse.cz>
+
+ PR c/84310
+ PR target/79747
+ * final.c (shorten_branches): Build align_tab array with one
+ more element.
+ * opts.c (finish_options): Add alignment option limit check.
+ (MAX_CODE_ALIGN): Likewise.
+ (MAX_CODE_ALIGN_VALUE): Likewise.
+ * doc/invoke.texi: Document maximum allowed option value for
+ all -falign-* options.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-19 Martin Liska <mliska@suse.cz>
+
+ PR other/80589
+ * doc/invoke.texi: Fix typo.
+ * params.def (PARAM_MAX_LOOP_HEADER_INSNS): Likewise.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-05 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/84137
+ * doc/gcov.texi: Fix typo in documentation.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-05 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/83879
+ * doc/gcov.texi: Document necessity of --dynamic-list-data when
+ using dlopen functionality.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-12-19 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/82675
+ * loop-unroll.c (unroll_loop_constant_iterations): Allocate one
+ more element in sbitmap.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-05 Martin Liska <mliska@suse.cz>
+
+ * ipa-utils.c (ipa_merge_profiles): Do not merge alias or
+ a function without profile.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-21 Jan Hubicka <hubicka@ucw.cz>
+
+ PR c/84229
+ * ipa-cp.c (determine_versionability): Do not version functions caling
+ va_arg_pack.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-08 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/81360
+ * cgraph.h (symtab_node::output_to_lto_symbol_table_p): Declare
+ * symtab.c: Include builtins.h
+ (symtab_node::output_to_lto_symbol_table_p): Move here
+ from lto-streamer-out.c:output_symbol_p.
+ * lto-streamer-out.c (write_symbol): Turn early exit to assert.
+ (output_symbol_p): Move all logic to symtab.c
+ (produce_symtab): Update.
+
+2018-03-06 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-22 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/81572
+ * lra-int.h (LRA_UNKNOWN_ALT, LRA_NON_CLOBBERED_ALT): New macros.
+ * lra.c (lra_set_insn_recog_data, lra_update_insn_recog_data): Use
+ LRA_UNKNOWN_ALT.
+ * lra-constraints.c (curr_insn_transform): Set up
+ LRA_NON_CLOBBERED_ALT for moves processed on the fast path. Use
+ LRA_UNKNOWN_ALT.
+ (remove_inheritance_pseudos): Use LRA_UNKNOWN_ALT.
+ * lra-eliminations.c (spill_pseudos): Ditto.
+ (process_insn_for_elimination): Ditto.
+ * lra-lives.c (reg_early_clobber_p): Use the new macros.
+ * lra-spills.c (spill_pseudos): Use LRA_UNKNOWN_ALT and
+ LRA_NON_CLOBBERED_ALT.
+
+2018-03-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-03-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84486
+ * tree-ssa-pre.c (create_expression_by_pieces): Remove dead code.
+ When inserting a __builtin_assume_aligned call set the LHS
+ SSA name alignment info accordingly.
+
+ 2018-02-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/84607
+ * genmatch.c (capture_info::walk_match): Do not mark
+ captured expressions without operands as expr_p given
+ they act more like predicates and should be subject to
+ "lost tail" side-effect preserving.
+
+2018-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84524
+ * config/i386/sse.md (*<code><mode>3): Replace <mask_prefix3> with
+ orig,vex.
+ (*<plusminus_insn><mode>3): Likewise. Remove <mask_operand3> uses.
+
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR ipa/84628
+ * expr.c (expand_expr_real_1) <case CALL_EXPR>: Don't emit diagnostics
+ for error or warning attributes if CALL_FROM_THUNK_P is set.
+ Formatting fixes.
+
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/84625
+ * config/i386/i386.c (ix86_print_operand): Use conditional
+ output_operand_lossage instead of gcc_assert if CONST_VECTOR is not
+ zero vector.
+
+ 2018-02-23 Jakub Jelinek <jakub@redhat.com>
+
+ * ipa-prop.c (ipa_vr_ggc_hash_traits::hash): Hash p->min and
+ p->max as pointers rather than using iterative_hash_expr.
+
+ 2017-11-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/82916
+ * gimple-ssa-store-merging.c
+ (pass_store_merging::terminate_all_aliasing_chains): For
+ gimple_store_p stmts also call refs_output_dependent_p.
+
+ 2018-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84444
+ * builtins.c (builtin_mathfn_code): Don't check if CALL_EXPR_FN (t)
+ is ADDR_EXPR.
+
+ 2018-02-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/84425
+ * ipa-inline.c (inline_small_functions): Fix a typo.
+
+ 2018-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/82210
+ * stor-layout.c (place_field): For variable length fields, adjust
+ offset_align afterwards not just based on the field's alignment,
+ but also on the size.
+
+ 2018-02-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * omp-low.c (maybe_remove_omp_member_access_dummy_vars,
+ remove_member_access_dummy_vars): New functions.
+ (lower_omp_for, lower_omp_taskreg, lower_omp_target,
+ lower_omp_1, execute_lower_omp): Use them.
+
+ PR rtl-optimization/84308
+ * shrink-wrap.c (spread_components): Release todo vector.
+
+ 2018-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/84285
+ * gcc.c (STATIC_LIBASAN_LIBS, STATIC_LIBTSAN_LIBS,
+ STATIC_LIBLSAN_LIBS, STATIC_LIBUBSAN_LIBS): Handle -static like
+ -static-lib*san.
+
+ 2018-02-09 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83659
+ * fold-const.c (fold_indirect_ref_1): Use VECTOR_TYPE_P macro.
+ Formatting fixes. Verify first that tree_fits_shwi_p (op01).
+ Sync some changes from cxx_fold_indirect_ref.
+
+ 2018-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-eh.c (operation_could_trap_helper_p): Ignore honor_trapv for
+ *DIV_EXPR and *MOD_EXPR.
+
+ 2018-02-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/81661
+ PR tree-optimization/84117
+ * tree-eh.h (rewrite_to_non_trapping_overflow): Declare.
+ * tree-eh.c: Include gimplify.h.
+ (find_trapping_overflow, replace_trapping_overflow,
+ rewrite_to_non_trapping_overflow): New functions.
+ * tree-vect-loop.c: Include tree-eh.h.
+ (vect_get_loop_niters): Use rewrite_to_non_trapping_overflow.
+
+ 2018-01-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/83986
+ * sched-deps.c (sched_analyze_insn): For frame related insns, add anti
+ dependence against last_pending_memory_flush in addition to
+ pending_jump_insns.
+
+ 2018-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/84040
+ * sched-deps.c (sched_macro_fuse_insns): Return immediately if
+ !insn_set.
+
+ 2018-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83977
+ * tree-inline.c (tree_function_versioning): Remove "omp declare simd"
+ attributes from DECL_ATTRIBUTES (new_decl) without affecting
+ DECL_ATTRIBUTES (old_decl).
+
+ 2018-01-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83945
+ * tree-emutls.c: Include gimplify.h.
+ (lower_emutls_2): New function.
+ (lower_emutls_1): If ADDR_EXPR is a gimple invariant and walk_tree
+ with lower_emutls_2 callback finds some TLS decl in it, unshare_expr
+ it before further processing.
+
+ PR target/83930
+ * simplify-rtx.c (simplify_binary_operation_1) <case UMOD>: Use
+ UINTVAL (trueop1) instead of INTVAL (op1).
+
+ 2018-01-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/83722
+ * gcc.c (try_generate_repro): Pass
+ &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
+ &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
+ do_report_bug.
+
+ 2018-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83605
+ * gimple-ssa-strength-reduction.c: Include tree-eh.h.
+ (find_candidates_dom_walker::before_dom_children): Ignore stmts that
+ can throw.
+
+2018-03-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84039
+ * config/i386/constraints.md (Bs): Replace
+ ix86_indirect_branch_register with
+ TARGET_INDIRECT_BRANCH_REGISTER.
+ (Bw): Likewise.
+ * config/i386/i386.md (indirect_jump): Likewise.
+ (tablejump): Likewise.
+ (*sibcall_memory): Likewise.
+ (*sibcall_value_memory): Likewise.
+ Peepholes of indirect call and jump via memory: Likewise.
+ (*sibcall_GOT_32): Disallowed for TARGET_INDIRECT_BRANCH_REGISTER.
+ (*sibcall_value_GOT_32): Likewise.
+ * config/i386/predicates.md (indirect_branch_operand): Likewise.
+ (GOT_memory_operand): Likewise.
+ (call_insn_operand): Likewise.
+ (sibcall_insn_operand): Likewise.
+ (GOT32_symbol_operand): Likewise.
+ * config/i386/i386.h (TARGET_INDIRECT_BRANCH_REGISTER): New.
+
+2018-03-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_output_indirect_jmp): Update comments.
+
+ 2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84530
+ * config/i386/i386-protos.h (ix86_output_indirect_jmp): Remove
+ the bool argument.
+ (ix86_output_indirect_function_return): New prototype.
+ (ix86_split_simple_return_pop_internal): Likewise.
+ * config/i386/i386.c (indirect_return_via_cx): New.
+ (indirect_return_via_cx_bnd): Likewise.
+ (indirect_thunk_name): Handle return va CX_REG.
+ (output_indirect_thunk_function): Create alias for
+ __x86_return_thunk_[re]cx and __x86_return_thunk_[re]cx_bnd.
+ (ix86_output_indirect_jmp): Remove the bool argument.
+ (ix86_output_indirect_function_return): New function.
+ (ix86_split_simple_return_pop_internal): Likewise.
+ * config/i386/i386.md (*indirect_jump): Don't pass false
+ to ix86_output_indirect_jmp.
+ (*tablejump_1): Likewise.
+ (simple_return_pop_internal): Change it to define_insn_and_split.
+ Call ix86_split_simple_return_pop_internal to split it for
+ -mfunction-return=.
+ (simple_return_indirect_internal): Call
+ ix86_output_indirect_function_return instead of
+ ix86_output_indirect_jmp.
+
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/83790
+ * config/nvptx/nvptx.c (output_init_frag): Don't use generic address
+ spaces for function labels.
+
+2018-02-26 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline: commit 257747 on 2018-02-16.
+
+ * config/rs6000/altivec.h: Add builtin names vec_extract4b
+ vec_insert4b.
+ * config/rs6000/rs6000-builtin.def: Add INSERT4B and EXTRACT4B
+ definitions.
+ * config/rs6000/rs6000-c.c: Add the definitions for
+ P9V_BUILTIN_VEC_EXTRACT4B and P9V_BUILTIN_VEC_INSERT4B.
+ * config/rs6000/rs6000.c (altivec_expand_builtin): Add
+ P9V_BUILTIN_EXTRACT4B and P9V_BUILTIN_INSERT4B case statements.
+ * config/rs6000/vsx.md: Add define_insn extract4b. Add define_expand
+ definition for insert4b and define insn *insert3b_internal.
+ * doc/extend.texi: Add documentation for vec_extract4b.
+
+2018-02-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/83496
+ * reorg.c (steal_delay_list_from_target): Change REDUNDANT array from
+ booleans to RTXes. Call fix_reg_dead_note on every non-null element.
+ (steal_delay_list_from_fallthrough): Call fix_reg_dead_note on a
+ redundant insn, if any.
+ (relax_delay_slots): Likewise.
+ (update_reg_unused_notes): Rename REDUNDANT_INSN to OTHER_INSN.
+
+2018-02-22 Sudakshina Das <sudi.das@arm.com>
+ Bin Cheng <bin.cheng@arm.com>
+
+ Backport from mainline:
+ 2017-12-14 Sudakshina Das <sudi.das@arm.com>
+ Bin Cheng <bin.cheng@arm.com>
+
+ PR target/81228
+ * config/aarch64/aarch64.c (aarch64_select_cc_mode): Move LTGT to
+ CCFPEmode.
+ * config/aarch64/aarch64-simd.md (vec_cmp<mode><v_cmp_result>): Add
+ LTGT.
+
+2018-02-16 Jozef Lawrynowicz <jozefl.gcc@gmail.com>
+
+ PR target/79242
+ * machmode.def: Define a complex mode for PARTIAL_INT.
+ * genmodes.c (complex_class): Return MODE_COMPLEX_INT for
+ MODE_PARTIAL_INT.
+ * doc/rtl.texi: Document CSPImode.
+ * config/msp430/msp430.c (msp430_hard_regno_nregs): Add CPSImode
+ handling.
+ (msp430_hard_regno_nregs_with_padding): Likewise.
+
+2018-02-16 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from trunk
+ 2018-01-10 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/82096
+ * expmed.c (emit_store_flag_force): Swap if const op0
+ and change VOIDmode to mode of op0.
+
+2018-02-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84190
+ * tree-ssa.c (non_rewritable_mem_ref_base): Do not touch
+ volatile accesses if the decl isn't volatile.
+
+2018-02-15 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2018-02-07 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/84154
+ * config/rs6000/rs6000.md (fix_trunc<SFDF:mode><QHI:mode>2):
+ Convert from define_expand to be define_insn_and_split. Rework
+ float/double/_Float128 conversions to QI/HI/SImode to work with
+ both ISA 2.07 (power8) or ISA 3.0 (power9). Fix regression where
+ conversions to QI/HImode types did a store and then a load to
+ truncate the value. For conversions to VSX registers, don't split
+ the insn, instead emit the code directly. Use the code iterator
+ any_fix to combine signed and unsigned conversions.
+ (fix<uns>_trunc<SFDF:mode>si2_p8): Likewise.
+ (fixuns_trunc<SFDF:mode><QHI:mode>2): Likewise.
+ (fix_trunc<IEEE128:mode><QHI:mode>2): Likewise.
+ (fix<uns>_trunc<SFDF:mode><QHI:mode>2): Likewise.
+ (fix_<mode>di2_hw): Likewise.
+ (fixuns_<mode>di2_hw): Likewise.
+ (fix_<mode>si2_hw): Likewise.
+ (fixuns_<mode>si2_hw): Likewise.
+ (fix<uns>_<IEEE128:mode><SDI:mode>2_hw): Likewise.
+ (fix<uns>_trunc<IEEE128:mode><QHI:mode>2): Likewise.
+ (fctiw<u>z_<mode>_smallint): Rename fctiw<u>z_<mode>_smallint to
+ fix<uns>_trunc<SFDF:mode>si2_p8.
+ (fix_trunc<SFDF:mode><QHI:mode>2_internal): Delete, no longer
+ used.
+ (fixuns_trunc<SFDF:mode><QHI:mode>2_internal): Likewise.
+ (fix<uns>_<mode>_mem): Likewise.
+ (fctiw<u>z_<mode>_mem): Likewise.
+ (fix<uns>_<mode>_mem): Likewise.
+ (fix<uns>_trunc<SFDF:mode><QHSI:mode>2_mem): On ISA 3.0, prevent
+ the register allocator from doing a direct move to the GPRs to do
+ a store, and instead use the ISA 3.0 store byte/half-word from
+ vector register instruction. For IEEE 128-bit floating point,
+ also optimize stores of 32-bit ints.
+ (fix<uns>_trunc<IEEE128:mode><QHSI:mode>2_mem): Likewise.
+
+2018-02-15 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
+
+ Back port from mainline
+ 2018-01-30 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
+
+ PR target/83758
+ * config/rs6000/rs6000.c (rs6000_internal_arg_pointer): Only return
+ a reg rtx.
+
+2018-02-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Back port from mainline
+ 2018-02-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84279
+ * config/rs6000/rs6000.c (mem_operand_gpr): Disallow altivec addresses.
+
+2018-02-14 Martin Jambor <mjambor@suse.cz>
+
+ PR c++/83990
+ * ipa-prop.c (ipa_modify_call_arguments): Use location of call
+ statements, also set location of a load to a temporary.
+
+2018-02-10 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.c (hppa_profile_hook): Mark SYMBOL_REF for _mcount as
+ function label.
+
+ Backport from mainline
+ 2018-02-01 Aldy Hernandez <aldyh@redhat.com>
+
+ PR target/84089
+ * config/pa/predicates.md (base14_operand): Handle VOIDmode.
+
+2018-02-09 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2018-02-08 Martin Jambor <mjambor@suse.cz>
+
+ * hsa-gen.c (get_symbol_for_decl): Set program allocation for
+ static local variables.
+
+2018-02-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ PR target/PR84295
+ * config/s390/s390.c (s390_set_current_function): Invoke
+ s390_indirect_branch_settings also if fndecl didn't change.
+
+2018-02-08 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/84113
+ * config/rs6000/altivec.md (*restore_world): Remove LR use.
+ * config/rs6000/predicates.md (restore_world_operation): Adjust op
+ count, remove one USE.
+
+2018-02-08 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-08 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * config/s390/s390-opts.h (enum indirect_branch): Define.
+ * config/s390/s390-protos.h (s390_return_addr_from_memory)
+ (s390_indirect_branch_via_thunk)
+ (s390_indirect_branch_via_inline_thunk): Add function prototypes.
+ (enum s390_indirect_branch_type): Define.
+ * config/s390/s390.c (struct s390_frame_layout, struct
+ machine_function): Remove.
+ (indirect_branch_prez10thunk_mask, indirect_branch_z10thunk_mask)
+ (indirect_branch_table_label_no, indirect_branch_table_name):
+ Define variables.
+ (INDIRECT_BRANCH_NUM_OPTIONS): Define macro.
+ (enum s390_indirect_branch_option): Define.
+ (s390_return_addr_from_memory): New function.
+ (s390_handle_string_attribute): New function.
+ (s390_attribute_table): Add new attribute handler.
+ (s390_execute_label): Handle UNSPEC_EXECUTE_JUMP patterns.
+ (s390_indirect_branch_via_thunk): New function.
+ (s390_indirect_branch_via_inline_thunk): New function.
+ (s390_function_ok_for_sibcall): When jumping via thunk disallow
+ sibling call optimization for non z10 compiles.
+ (s390_emit_call): Force indirect branch target to be a single
+ register. Add r1 clobber for non-z10 compiles.
+ (s390_emit_epilogue): Emit return jump via return_use expander.
+ (s390_reorg): Handle JUMP_INSNs as execute targets.
+ (s390_option_override_internal): Perform validity checks for the
+ new command line options.
+ (s390_indirect_branch_attrvalue): New function.
+ (s390_indirect_branch_settings): New function.
+ (s390_set_current_function): Invoke s390_indirect_branch_settings.
+ (s390_output_indirect_thunk_function): New function.
+ (s390_code_end): Implement target hook.
+ (s390_case_values_threshold): Implement target hook.
+ (TARGET_ASM_CODE_END, TARGET_CASE_VALUES_THRESHOLD): Define target
+ macros.
+ * config/s390/s390.h (struct s390_frame_layout)
+ (struct machine_function): Move here from s390.c.
+ (TARGET_INDIRECT_BRANCH_NOBP_RET)
+ (TARGET_INDIRECT_BRANCH_NOBP_JUMP)
+ (TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK)
+ (TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK)
+ (TARGET_INDIRECT_BRANCH_NOBP_CALL)
+ (TARGET_DEFAULT_INDIRECT_BRANCH_TABLE)
+ (TARGET_INDIRECT_BRANCH_THUNK_NAME_EXRL)
+ (TARGET_INDIRECT_BRANCH_THUNK_NAME_EX)
+ (TARGET_INDIRECT_BRANCH_TABLE): Define macros.
+ * config/s390/s390.md (UNSPEC_EXECUTE_JUMP)
+ (INDIRECT_BRANCH_THUNK_REGNUM): Define constants.
+ (mnemonic attribute): Add values which aren't recognized
+ automatically.
+ ("*cjump_long", "*icjump_long", "*basr", "*basr_r"): Disable
+ pattern for branch conversion. Fix mnemonic attribute.
+ ("*c<code>", "*sibcall_br", "*sibcall_value_br", "*return"): Emit
+ indirect branch via thunk if requested.
+ ("indirect_jump", "<code>"): Expand patterns for branch conversion.
+ ("*indirect_jump"): Disable for branch conversion using out of
+ line thunks.
+ ("indirect_jump_via_thunk<mode>_z10")
+ ("indirect_jump_via_thunk<mode>")
+ ("indirect_jump_via_inlinethunk<mode>_z10")
+ ("indirect_jump_via_inlinethunk<mode>", "*casesi_jump")
+ ("casesi_jump_via_thunk<mode>_z10", "casesi_jump_via_thunk<mode>")
+ ("casesi_jump_via_inlinethunk<mode>_z10")
+ ("casesi_jump_via_inlinethunk<mode>", "*basr_via_thunk<mode>_z10")
+ ("*basr_via_thunk<mode>", "*basr_r_via_thunk_z10")
+ ("*basr_r_via_thunk", "return<mode>_prez10"): New pattern.
+ ("*indirect2_jump"): Disable for branch conversion.
+ ("casesi_jump"): Turn into expander and expand patterns for branch
+ conversion.
+ ("return_use"): New expander.
+ ("*return"): Emit return via thunk and rename it to ...
+ ("*return<mode>"): ... this one.
+ * config/s390/s390.opt: Add new options and and enum for the
+ option values.
+
+2018-02-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84233
+ * tree-ssa-phiprop.c (propagate_with_phi): Use separate
+ changed flag instead of boguously re-using phi_inserted.
+
+2018-02-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_option_override_internal):
+ Display warning message for -mno-speculate-indirect-jumps.
+
+2018-02-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2018-01-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR bootstrap/84017
+ * configure.ac (gcc_cv_as_shf_merge): Disable on Solaris 10/x86.
+ * configure: Regenerate.
+
+2018-02-05 Peter Bergner <bergner@vnet.ibm.com>
+
+ Back port from mainline
+ 2018-02-01 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/56010
+ PR target/83743
+ * config/rs6000/driver-rs6000.c: #include "diagnostic.h".
+ #include "opts.h".
+ (rs6000_supported_cpu_names): New static variable.
+ (linux_cpu_translation_table): Likewise.
+ (elf_platform) <cpu>: Define new static variable and use it.
+ Translate kernel AT_PLATFORM name to canonical name if needed.
+ Error if platform name is unknown.
+
+2018-02-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-02-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_output_function_return): Pass
+ INVALID_REGNUM, instead of -1, as invalid register number to
+ indirect_thunk_name and output_indirect_thunk.
+
+2018-02-01 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2018-01-31 Uros Bizjak <ubizjak@gmail.com>
+
+ PR rtl-optimization/84123
+ * combine.c (change_zero_ext): Check if hard register satisfies
+ can_change_dest_mode before calling gen_lowpart_SUBREG.
+
+2018-02-01 Renlin Li <renlin.li@arm.com>
+
+ Backport from mainline
+ 2018-02-01 Renlin Li <renlin.li@arm.com>
+
+ PR target/83370
+ * config/aarch64/aarch64.c (aarch64_class_max_nregs): Handle
+ TAILCALL_ADDR_REGS.
+ (aarch64_register_move_cost): Likewise.
+ * config/aarch64/aarch64.h (reg_class): Rename CALLER_SAVE_REGS to
+ TAILCALL_ADDR_REGS.
+ (REG_CLASS_NAMES): Likewise.
+ (REG_CLASS_CONTENTS): Rename CALLER_SAVE_REGS to
+ TAILCALL_ADDR_REGS. Remove IP registers.
+ * config/aarch64/aarch64.md (Ucs): Update register constraint.
+
+2018-02-01 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82795
+ * tree-if-conv.c (predicate_mem_writes): Remove bogus assert.
+
+2018-01-31 Richard Biener <rguenther@suse.de>
+ Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-01-29 Richard Biener <rguenther@suse.de>
+ Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ PR bootstrap/80867
+ * tree-vect-stmts.c (vectorizable_call): Don't call
+ targetm.vectorize_builtin_md_vectorized_function if callee is
+ NULL.
+
+2018-01-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/84071
+ * doc/tm.texi.in (WORD_REGISTER_OPERATIONS): Add explicit case.
+ * doc/tm.texi: Regenerate.
+
+2018-01-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/84071
+ * combine.c (record_dead_and_set_regs_1): Record the source unmodified
+ for a paradoxical SUBREG on a WORD_REGISTER_OPERATIONS target.
+
+2018-01-29 Joseph Myers <joseph@codesourcery.com>
+
+ Backport from mainline
+ 2018-01-24 Joseph Myers <joseph@codesourcery.com>
+
+ PR target/68467
+ * config/m68k/m68k.c (m68k_promote_function_mode): New function.
+ (TARGET_PROMOTE_FUNCTION_MODE): New macro.
+
+2018-01-29 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2018-01-26 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/81763
+ * config/i386/i386.md (*andndi3_doubleword): Add earlyclobber
+ to (=&r,r,rm) alternative. Add (=r,0,rm) and (=r,r,0) alternatives.
+
+2018-01-29 Alan Modra <amodra@gmail.com>
+
+ Backport from mainline
+ 2018-01-26 Alan Modra <amodra@gmail.com>
+ PR target/84033
+ * config/rs6000/rs6000.c (rtx_is_swappable_p): Exclude
+ UNSPEC_VBPERMQ.
+
+2018-01-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * doc/invoke.texi: Replace -mfunction-return==@var{choice} with
+ -mfunction-return=@var{choice}.
+
+2018-01-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/83905
+ * config/i386/i386.c (ix86_expand_prologue): Use cost reference
+ of struct ix86_frame.
+ (ix86_expand_epilogue): Likewise. Add a local variable for
+ the reg_save_offset field in struct ix86_frame.
+
+2018-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/83985
+ * dce.c (deletable_insn_p): Return false for separate shrink wrapping
+ REG_CFA_RESTORE insns.
+ (delete_unmarked_insns): Don't ignore separate shrink wrapping
+ REG_CFA_RESTORE insns here.
+
+2018-01-25 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2018-01-17 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (indirect_thunk_name): Declare regno
+ as unsigned int. Compare regno with INVALID_REGNUM.
+ (output_indirect_thunk): Ditto.
+ (output_indirect_thunk_function): Ditto.
+ (ix86_code_end): Declare regno as unsigned int. Use INVALID_REGNUM
+ in the call to output_indirect_thunk_function.
+
+2018-01-25 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2018-01-22 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/83862
+ * config/rs6000/rs6000-protos.h (rs6000_split_signbit): Delete,
+ no longer used.
+ * config/rs6000/rs6000.c (rs6000_split_signbit): Likewise.
+ * config/rs6000/rs6000.md (signbit<mode>2): Change code for IEEE
+ 128-bit to produce an UNSPEC move to get the double word with the
+ signbit and then a shift directly to do signbit.
+ (signbit<mode>2_dm): Replace old IEEE 128-bit signbit
+ implementation with a new version that just does either a direct
+ move or a regular move. Move memory interface to separate insns.
+ Move insns so they are next to the expander.
+ (signbit<mode>2_dm_mem_be): New combiner insns to combine load
+ with signbit move. Split big and little endian case.
+ (signbit<mode>2_dm_mem_le): Likewise.
+ (signbit<mode>2_dm_<su>ext): Delete, no longer used.
+ (signbit<mode>2_dm2): Likewise.
+
+2018-01-25 Peter Bergner <bergner@vnet.ibm.com>
+
+ Back port from mainline
+ 2018-01-10 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/83399
+ * config/rs6000/rs6000.c (print_operand) <'y'>: Use
+ VECTOR_MEM_ALTIVEC_OR_VSX_P.
+ * config/rs6000/vsx.md (*vsx_le_perm_load_<mode> for VSX_D): Use
+ indexed_or_indirect_operand predicate.
+ (*vsx_le_perm_load_<mode> for VSX_W): Likewise.
+ (*vsx_le_perm_load_v8hi): Likewise.
+ (*vsx_le_perm_load_v16qi): Likewise.
+ (*vsx_le_perm_store_<mode> for VSX_D): Likewise.
+ (*vsx_le_perm_store_<mode> for VSX_W): Likewise.
+ (*vsx_le_perm_store_v8hi): Likewise.
+ (*vsx_le_perm_store_v16qi): Likewise.
+ (eight unnamed splitters): Likewise.
+
+2018-01-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
+ New function.
+ (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
+ swap associated with both a load and a store.
+
+2018-01-25 Richard Biener <rguenther@suse.de>
+
+ * BASE-VER: Increment to 7.3.1.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/81443
+ * rtlanal.c (num_sign_bit_copies1) <SUBREG>: Do not propagate results
+ from inner REGs to paradoxical SUBREGs.
+
+2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+ David Edelsohn <dje.gcc@gmail.com>
+
+ PR target/83946
+ * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
+ Change "crset eq" to "crset 2".
+ (*call_value_indirect_nonlocal_sysv<mode>): Likewise.
+ (*call_indirect_aix<mode>_nospec): Likewise.
+ (*call_value_indirect_aix<mode>_nospec): Likewise.
+ (*call_indirect_elfv2<mode>_nospec): Likewise.
+ (*call_value_indirect_elfv2<mode>_nospec): Likewise.
+ (*sibcall_nonlocal_sysv<mode>): Change "crset eq" to "crset 2";
+ change assembly output from . to $.
+ (*sibcall_value_nonlocal_sysv<mode>): Likewise.
+ (indirect_jump<mode>_nospec): Change assembly output from . to $.
+ (*tablejump<mode>_internal1_nospec): Likewise.
+
+2018-01-21 Oleg Endo <olegendo@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-01-21 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/80870
+ * config/sh/sh_optimize_sett_clrt.cc:
+ Use INCLUDE_ALGORITHM and INCLUDE_VECTOR instead of direct includes.
+
+2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_opt_vars): Add entry for
+ -mspeculate-indirect-jumps.
+ * config/rs6000/rs6000.md (*call_indirect_elfv2<mode>): Disable
+ for -mno-speculate-indirect-jumps.
+ (*call_indirect_elfv2<mode>_nospec): New define_insn.
+ (*call_value_indirect_elfv2<mode>): Disable for
+ -mno-speculate-indirect-jumps.
+ (*call_value_indirect_elfv2<mode>_nospec): New define_insn.
+ (indirect_jump): Emit different RTL for
+ -mno-speculate-indirect-jumps.
+ (*indirect_jump<mode>): Disable for
+ -mno-speculate-indirect-jumps.
+ (*indirect_jump<mode>_nospec): New define_insn.
+ (tablejump): Emit different RTL for
+ -mno-speculate-indirect-jumps.
+ (tablejumpsi): Disable for -mno-speculate-indirect-jumps.
+ (tablejumpsi_nospec): New define_expand.
+ (tablejumpdi): Disable for -mno-speculate-indirect-jumps.
+ (tablejumpdi_nospec): New define_expand.
+ (*tablejump<mode>_internal1): Disable for
+ -mno-speculate-indirect-jumps.
+ (*tablejump<mode>_internal1_nospec): New define_insn.
+ * config/rs6000/rs6000.opt (mspeculate-indirect-jumps): New
+ option.
+
+ Backport from mainline
+ 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
+ Generate different code for -mno-speculate-indirect-jumps.
+ (*call_value_indirect_nonlocal_sysv<mode>): Likewise.
+ (*call_indirect_aix<mode>): Disable for
+ -mno-speculate-indirect-jumps.
+ (*call_indirect_aix<mode>_nospec): New define_insn.
+ (*call_value_indirect_aix<mode>): Disable for
+ -mno-speculate-indirect-jumps.
+ (*call_value_indirect_aix<mode>_nospec): New define_insn.
+ (*sibcall_nonlocal_sysv<mode>): Generate different code for
+ -mno-speculate-indirect-jumps.
+ (*sibcall_value_nonlocal_sysv<mode>): Likewise.
+
+2018-01-17 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-12-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81877
+ * tree-ssa-loop-im.c (ref_indep_loop_p): Remove safelen parameters.
+ (outermost_indep_loop): Adjust.
+ (ref_indep_loop_p_1): Likewise. Remove safelen handling again.
+ (can_sm_ref_p): Adjust.
+
+ 2017-12-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81782
+ * tree-ssa-uninit.c (warn_uninitialized_vars): Properly
+ handle accesses outside of zero-sized vars.
+
+2018-01-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mailine
+ 2018-01-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/83687
+ * config/arm/iterators.md (VF): New mode iterator.
+ * config/arm/neon.md (neon_vabd<mode>_2): Use the above.
+ Remove integer-related logic from pattern.
+ (neon_vabd<mode>_3): Likewise.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-04 Martin Liska <mliska@suse.cz>
+
+ PR ipa/82352
+ * ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-03 Martin Liska <mliska@suse.cz>
+
+ PR ipa/83549
+ * cif-code.def (VARIADIC_THUNK): New enum value.
+ * ipa-inline-analysis.c (compute_inline_parameters):
+ Do not inline variadic thunks.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-12-27 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/83552
+ * tree-ssa-strlen.c (fold_strstr_to_strncmp): Assign result
+ of get_string_lenth to a SSA_NAME if not a GIMPLE value.
+
+2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-12-18 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/83424
+ * rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_expand_prologue): Don't use reference
+ of struct ix86_frame.
+ (ix86_expand_epilogue): Likewise.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
+ -mcmodel=large with -mindirect-branch=thunk,
+ -mindirect-branch=thunk-extern, -mfunction-return=thunk and
+ -mfunction-return=thunk-extern.
+ * doc/invoke.texi: Document -mcmodel=large is incompatible with
+ -mindirect-branch=thunk, -mindirect-branch=thunk-extern,
+ -mfunction-return=thunk and -mfunction-return=thunk-extern.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (print_reg): Print the name of the full
+ integer register without '%'.
+ (ix86_print_operand): Handle 'V'.
+ * doc/extend.texi: Document 'V' modifier.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/predicates.md (indirect_branch_operand): Rewrite
+ ix86_indirect_branch_register logic.
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/constraints.md (Bs): Update
+ ix86_indirect_branch_register check. Don't check
+ ix86_indirect_branch_register with GOT_memory_operand.
+ (Bw): Likewise.
+ * config/i386/predicates.md (GOT_memory_operand): Don't check
+ ix86_indirect_branch_register here.
+ (GOT32_symbol_operand): Likewise.
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/predicates.md (constant_call_address_operand):
+ Rewrite ix86_indirect_branch_register logic.
+ (sibcall_insn_operand): Likewise.
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/constraints.md (Bs): Replace
+ ix86_indirect_branch_thunk_register with
+ ix86_indirect_branch_register.
+ (Bw): Likewise.
+ * config/i386/i386.md (indirect_jump): Likewise.
+ (tablejump): Likewise.
+ (*sibcall_memory): Likewise.
+ (*sibcall_value_memory): Likewise.
+ Peepholes of indirect call and jump via memory: Likewise.
+ * config/i386/i386.opt: Likewise.
+ * config/i386/predicates.md (indirect_branch_operand): Likewise.
+ (GOT_memory_operand): Likewise.
+ (call_insn_operand): Likewise.
+ (sibcall_insn_operand): Likewise.
+ (GOT32_symbol_operand): Likewise.
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/constraints.md (Bs): Disallow memory operand for
+ -mindirect-branch-register.
+ (Bw): Likewise.
+ * config/i386/predicates.md (indirect_branch_operand): Likewise.
+ (GOT_memory_operand): Likewise.
+ (call_insn_operand): Likewise.
+ (sibcall_insn_operand): Likewise.
+ (GOT32_symbol_operand): Likewise.
+ * config/i386/i386.md (indirect_jump): Call convert_memory_address
+ for -mindirect-branch-register.
+ (tablejump): Likewise.
+ (*sibcall_memory): Likewise.
+ (*sibcall_value_memory): Likewise.
+ Disallow peepholes of indirect call and jump via memory for
+ -mindirect-branch-register.
+ (*call_pop): Replace m with Bw.
+ (*call_value_pop): Likewise.
+ (*sibcall_pop_memory): Replace m with Bs.
+ * config/i386/i386.opt (mindirect-branch-register): New option.
+ * doc/invoke.texi: Document -mindirect-branch-register option.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/83839
+ * config/i386/i386.c (output_indirect_thunk_function): Use
+ ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO
+ for __x86.return_thunk.
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386-protos.h (ix86_output_function_return): New.
+ * config/i386/i386.c (ix86_set_indirect_branch_type): Also
+ set function_return_type.
+ (indirect_thunk_name): Add ret_p to indicate thunk for function
+ return.
+ (output_indirect_thunk_function): Pass false to
+ indirect_thunk_name.
+ (ix86_output_indirect_branch_via_reg): Likewise.
+ (ix86_output_indirect_branch_via_push): Likewise.
+ (output_indirect_thunk_function): Create alias for function
+ return thunk if regno < 0.
+ (ix86_output_function_return): New function.
+ (ix86_handle_fndecl_attribute): Handle function_return.
+ (ix86_attribute_table): Add function_return.
+ * config/i386/i386.h (machine_function): Add
+ function_return_type.
+ * config/i386/i386.md (simple_return_internal): Use
+ ix86_output_function_return.
+ (simple_return_internal_long): Likewise.
+ * config/i386/i386.opt (mfunction-return=): New option.
+ (indirect_branch): Mention -mfunction-return=.
+ * doc/extend.texi: Document function_return function attribute.
+ * doc/invoke.texi: Document -mfunction-return= option.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386-opts.h (indirect_branch): New.
+ * config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise.
+ * config/i386/i386.c (ix86_using_red_zone): Disallow red-zone
+ with local indirect jump when converting indirect call and jump.
+ (ix86_set_indirect_branch_type): New.
+ (ix86_set_current_function): Call ix86_set_indirect_branch_type.
+ (indirectlabelno): New.
+ (indirect_thunk_needed): Likewise.
+ (indirect_thunk_bnd_needed): Likewise.
+ (indirect_thunks_used): Likewise.
+ (indirect_thunks_bnd_used): Likewise.
+ (INDIRECT_LABEL): Likewise.
+ (indirect_thunk_name): Likewise.
+ (output_indirect_thunk): Likewise.
+ (output_indirect_thunk_function): Likewise.
+ (ix86_output_indirect_branch_via_reg): Likewise.
+ (ix86_output_indirect_branch_via_push): Likewise.
+ (ix86_output_indirect_branch): Likewise.
+ (ix86_output_indirect_jmp): Likewise.
+ (ix86_code_end): Call output_indirect_thunk_function if needed.
+ (ix86_output_call_insn): Call ix86_output_indirect_branch if
+ needed.
+ (ix86_handle_fndecl_attribute): Handle indirect_branch.
+ (ix86_attribute_table): Add indirect_branch.
+ * config/i386/i386.h (machine_function): Add indirect_branch_type
+ and has_local_indirect_jump.
+ * config/i386/i386.md (indirect_jump): Set has_local_indirect_jump
+ to true.
+ (tablejump): Likewise.
+ (*indirect_jump): Use ix86_output_indirect_jmp.
+ (*tablejump_1): Likewise.
+ (simple_return_indirect_internal): Likewise.
+ * config/i386/i386.opt (mindirect-branch=): New option.
+ (indirect_branch): New.
+ (keep): Likewise.
+ (thunk): Likewise.
+ (thunk-inline): Likewise.
+ (thunk-extern): Likewise.
+ * doc/extend.texi: Document indirect_branch function attribute.
+ * doc/invoke.texi: Document -mindirect-branch= option.
+
+2018-01-16 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-29 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/81481
+ * ira-costs.c (scan_one_insn): Don't take into account PIC equiv
+ with a symbol for LRA.
+
+2018-01-15 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2018-01-10 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/83629
+ * config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b,
+ load_toc_v4_PIC_3c): Wrap const term in CONST RTL.
+
+2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ PR target/83330
+ * config/i386/i386.c (ix86_function_arg_advance): Set
+ outgoing_args_on_stack to true if there are outgoing arguments
+ on stack.
+ (ix86_function_arg): Likewise.
+ (ix86_compute_frame_layout): Align stack frame if argument is
+ passed on stack.
+ * config/i386/i386.h (machine_function): Add
+ outgoing_args_on_stack.
+
2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
@@ -8,6 +1189,8 @@
2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
+ 2017-11-06 H.J. Lu <hongjiu.lu@intel.com>
+
* config/i386/i386.c (ix86_can_use_return_insn_p): Use reference
of struct ix86_frame.
(ix86_initial_elimination_offset): Likewise.
@@ -16,6 +1199,8 @@
2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
+ 2017-06-01 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
* config/i386/i386.c (ix86_frame): Moved to ...
* config/i386/i386.h (ix86_frame): Here.
(machine_function): Add frame.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a384ad6e140..d326f67838d 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180115
+20180307
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7f3f1d711a2..73cd991166b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2018-03-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (convert_with_check): Fix typo in the condition
+ guarding the overflow check emitted for the upper bound of a floating-
+ point conversion.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-12-14 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_field): Do not set the alignment
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index bef7f8121f3..c42583a187a 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -9272,7 +9272,7 @@ convert_with_check (Entity_Id gnat_type, tree gnu_expr, bool overflowp,
? tree_int_cst_lt (gnu_out_ub, gnu_in_ub)
: (FLOAT_TYPE_P (gnu_base_type)
? real_less (&TREE_REAL_CST (gnu_out_ub),
- &TREE_REAL_CST (gnu_in_lb))
+ &TREE_REAL_CST (gnu_in_ub))
: 1))
gnu_cond
= build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_cond,
diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog
index bb7f624e613..0e5761be302 100644
--- a/gcc/brig/ChangeLog
+++ b/gcc/brig/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index d7d4f0f7483..75342b786de 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -7538,8 +7538,7 @@ builtin_mathfn_code (const_tree t)
const_tree argtype, parmtype;
const_call_expr_arg_iterator iter;
- if (TREE_CODE (t) != CALL_EXPR
- || TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR)
+ if (TREE_CODE (t) != CALL_EXPR)
return END_BUILTINS;
fndecl = get_callee_fndecl (t);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1d6d4d54940..7a83a0a9062 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,19 @@
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ * c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix
+ argument.
+ (LAZY_HEX_FP_VALUES_CNT): Define.
+ (lazy_hex_fp_values): Allow up to LAZY_HEX_FP_VALUES_CNT lazy hex fp
+ values rather than just 12.
+ (builtin_define_with_hex_fp_value): Likewise.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-12-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index c5fadaa6aa2..041cc64699f 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1119,7 +1119,7 @@ c_cpp_builtins (cpp_reader *pfile)
floatn_nx_types[i].extended ? "X" : "");
sprintf (csuffix, "F%d%s", floatn_nx_types[i].n,
floatn_nx_types[i].extended ? "x" : "");
- builtin_define_float_constants (prefix, csuffix, "%s", NULL,
+ builtin_define_float_constants (prefix, ggc_strdup (csuffix), "%s", NULL,
FLOATN_NX_TYPE_NODE (i));
}
@@ -1566,7 +1566,14 @@ struct GTY(()) lazy_hex_fp_value_struct
int digits;
const char *fp_suffix;
};
-static GTY(()) struct lazy_hex_fp_value_struct lazy_hex_fp_values[12];
+/* Number of the expensive to compute macros we should evaluate lazily.
+ Each builtin_define_float_constants invocation calls
+ builtin_define_with_hex_fp_value 4 times and builtin_define_float_constants
+ is called for FLT, DBL, LDBL and up to NUM_FLOATN_NX_TYPES times for
+ FLTNN*. */
+#define LAZY_HEX_FP_VALUES_CNT (4 * (3 + NUM_FLOATN_NX_TYPES))
+static GTY(()) struct lazy_hex_fp_value_struct
+ lazy_hex_fp_values[LAZY_HEX_FP_VALUES_CNT];
static GTY(()) int lazy_hex_fp_value_count;
static bool
@@ -1611,7 +1618,7 @@ builtin_define_with_hex_fp_value (const char *macro,
char dec_str[64], buf1[256], buf2[256];
/* This is very expensive, so if possible expand them lazily. */
- if (lazy_hex_fp_value_count < 12
+ if (lazy_hex_fp_value_count < LAZY_HEX_FP_VALUES_CNT
&& flag_dump_macros == 0
&& !cpp_get_options (parse_in)->traditional)
{
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index e4446e9582f..b48e7cb422e 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-12-22 Jakub Jelinek <jakub@redhat.com>
PR debug/83550
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index be4eaee71e2..ee053885442 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -321,6 +321,9 @@ public:
or abstract function kept for debug info purposes only. */
bool real_symbol_p (void);
+ /* Return true when the symbol needs to be output to the LTO symbol table. */
+ bool output_to_lto_symbol_table_p (void);
+
/* Determine if symbol declaration is needed. That is, visible to something
either outside this translation unit, something magic in the system
configury. This function is used just during symbol creation. */
diff --git a/gcc/cif-code.def b/gcc/cif-code.def
index a2f05e016f2..966c6d6f323 100644
--- a/gcc/cif-code.def
+++ b/gcc/cif-code.def
@@ -95,6 +95,10 @@ DEFCIFCODE(MISMATCHED_ARGUMENTS, CIF_FINAL_ERROR,
DEFCIFCODE(LTO_MISMATCHED_DECLARATIONS, CIF_FINAL_ERROR,
N_("mismatched declarations during linktime optimization"))
+/* Caller is variadic thunk. */
+DEFCIFCODE(VARIADIC_THUNK, CIF_FINAL_ERROR,
+ N_("variadic thunk call"))
+
/* Call was originally indirect. */
DEFCIFCODE(ORIGINALLY_INDIRECT_CALL, CIF_FINAL_NORMAL,
N_("originally indirect function call not considered for inlining"))
diff --git a/gcc/combine.c b/gcc/combine.c
index ff250aad6a1..064e4f97d01 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -11322,8 +11322,15 @@ change_zero_ext (rtx pat)
x = gen_rtx_LSHIFTRT (inner_mode, XEXP (x, 0), GEN_INT (start));
else
x = XEXP (x, 0);
+
if (mode != inner_mode)
- x = gen_lowpart_SUBREG (mode, x);
+ {
+ if (REG_P (x) && HARD_REGISTER_P (x)
+ && !can_change_dest_mode (x, 0, mode))
+ continue;
+
+ x = gen_lowpart_SUBREG (mode, x);
+ }
}
else if (GET_CODE (x) == ZERO_EXTEND
&& SCALAR_INT_MODE_P (mode)
@@ -11335,7 +11342,13 @@ change_zero_ext (rtx pat)
size = GET_MODE_PRECISION (GET_MODE (XEXP (x, 0)));
x = SUBREG_REG (XEXP (x, 0));
if (GET_MODE (x) != mode)
- x = gen_lowpart_SUBREG (mode, x);
+ {
+ if (REG_P (x) && HARD_REGISTER_P (x)
+ && !can_change_dest_mode (x, 0, mode))
+ continue;
+
+ x = gen_lowpart_SUBREG (mode, x);
+ }
}
else if (GET_CODE (x) == ZERO_EXTEND
&& SCALAR_INT_MODE_P (mode)
@@ -13081,8 +13094,11 @@ record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
if (REG_P (dest))
{
/* If we are setting the whole register, we know its value. Otherwise
- show that we don't know the value. We can handle SUBREG in
- some cases. */
+ show that we don't know the value. We can handle a SUBREG if it's
+ the low part, but we must be careful with paradoxical SUBREGs on
+ RISC architectures because we cannot strip e.g. an extension around
+ a load and record the naked load since the RTL middle-end considers
+ that the upper bits are defined according to LOAD_EXTEND_OP. */
if (GET_CODE (setter) == SET && dest == SET_DEST (setter))
record_value_for_reg (dest, record_dead_insn, SET_SRC (setter));
else if (GET_CODE (setter) == SET
@@ -13091,8 +13107,11 @@ record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
&& GET_MODE_PRECISION (GET_MODE (dest)) <= BITS_PER_WORD
&& subreg_lowpart_p (SET_DEST (setter)))
record_value_for_reg (dest, record_dead_insn,
- gen_lowpart (GET_MODE (dest),
- SET_SRC (setter)));
+ WORD_REGISTER_OPERATIONS
+ && paradoxical_subreg_p (SET_DEST (setter))
+ ? SET_SRC (setter)
+ : gen_lowpart (GET_MODE (dest),
+ SET_SRC (setter)));
else
record_value_for_reg (dest, record_dead_insn, NULL_RTX);
}
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 6e4acbc77f9..df5e62ae7ef 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -2608,6 +2608,7 @@
case UNEQ:
case ORDERED:
case UNORDERED:
+ case LTGT:
break;
default:
gcc_unreachable ();
@@ -2662,6 +2663,15 @@
emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
break;
+ case LTGT:
+ /* LTGT is not guranteed to not generate a FP exception. So let's
+ go the faster way : ((a > b) || (b > a)). */
+ emit_insn (gen_aarch64_cmgt<mode> (operands[0],
+ operands[2], operands[3]));
+ emit_insn (gen_aarch64_cmgt<mode> (tmp, operands[3], operands[2]));
+ emit_insn (gen_ior<v_cmp_result>3 (operands[0], operands[0], tmp));
+ break;
+
case UNORDERED:
/* Operands are ORDERED iff (a > b || b >= a), so we can compute
UNORDERED as !ORDERED. */
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index eb8ba4f4fdb..0c736b79d63 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -4958,13 +4958,13 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
case UNGT:
case UNGE:
case UNEQ:
- case LTGT:
return CCFPmode;
case LT:
case LE:
case GT:
case GE:
+ case LTGT:
return CCFPEmode;
default:
@@ -6017,7 +6017,7 @@ aarch64_class_max_nregs (reg_class_t regclass, machine_mode mode)
{
switch (regclass)
{
- case CALLER_SAVE_REGS:
+ case TAILCALL_ADDR_REGS:
case POINTER_REGS:
case GENERAL_REGS:
case ALL_REGS:
@@ -8145,10 +8145,10 @@ aarch64_register_move_cost (machine_mode mode,
= aarch64_tune_params.regmove_cost;
/* Caller save and pointer regs are equivalent to GENERAL_REGS. */
- if (to == CALLER_SAVE_REGS || to == POINTER_REGS)
+ if (to == TAILCALL_ADDR_REGS || to == POINTER_REGS)
to = GENERAL_REGS;
- if (from == CALLER_SAVE_REGS || from == POINTER_REGS)
+ if (from == TAILCALL_ADDR_REGS || from == POINTER_REGS)
from = GENERAL_REGS;
/* Moving between GPR and stack cost is the same as GP2GP. */
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 31741898392..88eaabf9876 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -457,7 +457,7 @@ extern unsigned aarch64_architecture_version;
enum reg_class
{
NO_REGS,
- CALLER_SAVE_REGS,
+ TAILCALL_ADDR_REGS,
GENERAL_REGS,
STACK_REG,
POINTER_REGS,
@@ -472,7 +472,7 @@ enum reg_class
#define REG_CLASS_NAMES \
{ \
"NO_REGS", \
- "CALLER_SAVE_REGS", \
+ "TAILCALL_ADDR_REGS", \
"GENERAL_REGS", \
"STACK_REG", \
"POINTER_REGS", \
@@ -484,7 +484,7 @@ enum reg_class
#define REG_CLASS_CONTENTS \
{ \
{ 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
- { 0x0007ffff, 0x00000000, 0x00000000 }, /* CALLER_SAVE_REGS */ \
+ { 0x0004ffff, 0x00000000, 0x00000000 }, /* TAILCALL_ADDR_REGS */\
{ 0x7fffffff, 0x00000000, 0x00000003 }, /* GENERAL_REGS */ \
{ 0x80000000, 0x00000000, 0x00000000 }, /* STACK_REG */ \
{ 0xffffffff, 0x00000000, 0x00000003 }, /* POINTER_REGS */ \
diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md
index 9ce3d4efaf3..f575e710cb5 100644
--- a/gcc/config/aarch64/constraints.md
+++ b/gcc/config/aarch64/constraints.md
@@ -21,8 +21,8 @@
(define_register_constraint "k" "STACK_REG"
"@internal The stack register.")
-(define_register_constraint "Ucs" "CALLER_SAVE_REGS"
- "@internal The caller save registers.")
+(define_register_constraint "Ucs" "TAILCALL_ADDR_REGS"
+ "@internal Registers suitable for an indirect tail call")
(define_register_constraint "w" "FP_REGS"
"Floating point and SIMD vector registers.")
diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md
index 971e0450b22..8491edb66aa 100644
--- a/gcc/config/arm/iterators.md
+++ b/gcc/config/arm/iterators.md
@@ -119,6 +119,10 @@
;; All supported vector modes (except singleton DImode).
(define_mode_iterator VDQ [V8QI V16QI V4HI V8HI V2SI V4SI V4HF V8HF V2SF V4SF V2DI])
+;; All supported floating-point vector modes (except V2DF).
+(define_mode_iterator VF [(V4HF "TARGET_NEON_FP16INST")
+ (V8HF "TARGET_NEON_FP16INST") V2SF V4SF])
+
;; All supported vector modes (except those with 64-bit integer elements).
(define_mode_iterator VDQW [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF])
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 2626c7c66d7..971dd4cea51 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -6317,28 +6317,22 @@ if (BYTES_BIG_ENDIAN)
})
(define_insn "neon_vabd<mode>_2"
- [(set (match_operand:VDQ 0 "s_register_operand" "=w")
- (abs:VDQ (minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
- (match_operand:VDQ 2 "s_register_operand" "w"))))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ [(set (match_operand:VF 0 "s_register_operand" "=w")
+ (abs:VF (minus:VF (match_operand:VF 1 "s_register_operand" "w")
+ (match_operand:VF 2 "s_register_operand" "w"))))]
+ "TARGET_NEON && flag_unsafe_math_optimizations"
"vabd.<V_s_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set (attr "type")
- (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
- (const_string "neon_fp_abd_s<q>")
- (const_string "neon_abd<q>")))]
+ [(set_attr "type" "neon_fp_abd_s<q>")]
)
(define_insn "neon_vabd<mode>_3"
- [(set (match_operand:VDQ 0 "s_register_operand" "=w")
- (abs:VDQ (unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "w")
- (match_operand:VDQ 2 "s_register_operand" "w")]
- UNSPEC_VSUB)))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ [(set (match_operand:VF 0 "s_register_operand" "=w")
+ (abs:VF (unspec:VF [(match_operand:VF 1 "s_register_operand" "w")
+ (match_operand:VF 2 "s_register_operand" "w")]
+ UNSPEC_VSUB)))]
+ "TARGET_NEON && flag_unsafe_math_optimizations"
"vabd.<V_if_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set (attr "type")
- (if_then_else (ne (symbol_ref "<Is_float_mode>") (const_int 0))
- (const_string "neon_fp_abd_s<q>")
- (const_string "neon_abd<q>")))]
+ [(set_attr "type" "neon_fp_abd_s<q>")]
)
;; Copy from core-to-neon regs, then extend, not vice-versa
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 3dfa8c3b00b..c7705ca3c21 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -153,6 +153,9 @@ FIXME: DRIVER_SELF_SPECS has changed.
#define FIRST_PSEUDO_REGISTER 36
+#define GENERAL_REGNO_P(N) IN_RANGE (N, 2, 31)
+#define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))
+
#define FIXED_REGISTERS {\
1,1,/* r0 r1 */\
0,0,/* r2 r3 */\
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 3a6dec2b0c0..ee5a1c420c7 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -3362,6 +3362,8 @@
(match_operand:HI 1 "reg_or_0_operand"))]
"optimize
&& reload_completed
+ && GENERAL_REG_P (operands[0])
+ && (operands[1] == const0_rtx || GENERAL_REG_P (operands[1]))
&& (!AVR_HAVE_MOVW
|| const0_rtx == operands[1])"
[(set (match_dup 2) (match_dup 3))
diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index 38d604fdace..0cca766d3a0 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -198,14 +198,16 @@
(define_constraint "Bs"
"@internal Sibcall memory operand."
- (ior (and (not (match_test "TARGET_X32"))
+ (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
+ (not (match_test "TARGET_X32"))
(match_operand 0 "sibcall_memory_operand"))
(and (match_test "TARGET_X32 && Pmode == DImode")
(match_operand 0 "GOT_memory_operand"))))
(define_constraint "Bw"
"@internal Call memory operand."
- (ior (and (not (match_test "TARGET_X32"))
+ (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
+ (not (match_test "TARGET_X32"))
(match_operand 0 "memory_operand"))
(and (match_test "TARGET_X32 && Pmode == DImode")
(match_operand 0 "GOT_memory_operand"))))
diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
index 542cd0f3d67..efcdc3b1a14 100644
--- a/gcc/config/i386/i386-opts.h
+++ b/gcc/config/i386/i386-opts.h
@@ -99,4 +99,17 @@ enum stack_protector_guard {
SSP_GLOBAL /* global canary */
};
+/* This is used to mitigate variant #2 of the speculative execution
+ vulnerabilities on x86 processors identified by CVE-2017-5715, aka
+ Spectre. They convert indirect branches and function returns to
+ call and return thunks to avoid speculative execution via indirect
+ call, jmp and ret. */
+enum indirect_branch {
+ indirect_branch_unset = 0,
+ indirect_branch_keep,
+ indirect_branch_thunk,
+ indirect_branch_thunk_inline,
+ indirect_branch_thunk_extern
+};
+
#endif
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index d2cccf14735..9434e8463c1 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -313,6 +313,10 @@ extern enum attr_cpu ix86_schedule;
#endif
extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
+extern const char * ix86_output_indirect_jmp (rtx call_op);
+extern const char * ix86_output_function_return (bool long_p);
+extern const char * ix86_output_indirect_function_return (rtx ret_op);
+extern void ix86_split_simple_return_pop_internal (rtx);
extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
enum machine_mode mode);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2af4e9a2859..a5b05f9eb5e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4212,12 +4212,23 @@ make_pass_stv (gcc::context *ctxt)
return new pass_stv (ctxt);
}
-/* Return true if a red-zone is in use. */
+/* Return true if a red-zone is in use. We can't use red-zone when
+ there are local indirect jumps, like "indirect_jump" or "tablejump",
+ which jumps to another place in the function, since "call" in the
+ indirect thunk pushes the return address onto stack, destroying
+ red-zone.
+
+ TODO: If we can reserve the first 2 WORDs, for PUSH and, another
+ for CALL, in red-zone, we can allow local indirect jumps with
+ indirect thunk. */
bool
ix86_using_red_zone (void)
{
- return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI;
+ return (TARGET_RED_ZONE
+ && !TARGET_64BIT_MS_ABI
+ && (!cfun->machine->has_local_indirect_jump
+ || cfun->machine->indirect_branch_type == indirect_branch_keep));
}
/* Return a string that documents the current -m options. The caller is
@@ -7148,6 +7159,88 @@ ix86_set_func_type (tree fndecl)
}
}
+/* Set the indirect_branch_type field from the function FNDECL. */
+
+static void
+ix86_set_indirect_branch_type (tree fndecl)
+{
+ if (cfun->machine->indirect_branch_type == indirect_branch_unset)
+ {
+ tree attr = lookup_attribute ("indirect_branch",
+ DECL_ATTRIBUTES (fndecl));
+ if (attr != NULL)
+ {
+ tree args = TREE_VALUE (attr);
+ if (args == NULL)
+ gcc_unreachable ();
+ tree cst = TREE_VALUE (args);
+ if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
+ cfun->machine->indirect_branch_type = indirect_branch_keep;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
+ cfun->machine->indirect_branch_type = indirect_branch_thunk;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
+ cfun->machine->indirect_branch_type = indirect_branch_thunk_inline;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
+ cfun->machine->indirect_branch_type = indirect_branch_thunk_extern;
+ else
+ gcc_unreachable ();
+ }
+ else
+ cfun->machine->indirect_branch_type = ix86_indirect_branch;
+
+ /* -mcmodel=large is not compatible with -mindirect-branch=thunk
+ nor -mindirect-branch=thunk-extern. */
+ if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
+ && ((cfun->machine->indirect_branch_type
+ == indirect_branch_thunk_extern)
+ || (cfun->machine->indirect_branch_type
+ == indirect_branch_thunk)))
+ error ("%<-mindirect-branch=%s%> and %<-mcmodel=large%> are not "
+ "compatible",
+ ((cfun->machine->indirect_branch_type
+ == indirect_branch_thunk_extern)
+ ? "thunk-extern" : "thunk"));
+ }
+
+ if (cfun->machine->function_return_type == indirect_branch_unset)
+ {
+ tree attr = lookup_attribute ("function_return",
+ DECL_ATTRIBUTES (fndecl));
+ if (attr != NULL)
+ {
+ tree args = TREE_VALUE (attr);
+ if (args == NULL)
+ gcc_unreachable ();
+ tree cst = TREE_VALUE (args);
+ if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
+ cfun->machine->function_return_type = indirect_branch_keep;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
+ cfun->machine->function_return_type = indirect_branch_thunk;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
+ cfun->machine->function_return_type = indirect_branch_thunk_inline;
+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
+ cfun->machine->function_return_type = indirect_branch_thunk_extern;
+ else
+ gcc_unreachable ();
+ }
+ else
+ cfun->machine->function_return_type = ix86_function_return;
+
+ /* -mcmodel=large is not compatible with -mfunction-return=thunk
+ nor -mfunction-return=thunk-extern. */
+ if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
+ && ((cfun->machine->function_return_type
+ == indirect_branch_thunk_extern)
+ || (cfun->machine->function_return_type
+ == indirect_branch_thunk)))
+ error ("%<-mfunction-return=%s%> and %<-mcmodel=large%> are not "
+ "compatible",
+ ((cfun->machine->function_return_type
+ == indirect_branch_thunk_extern)
+ ? "thunk-extern" : "thunk"));
+ }
+}
+
/* Establish appropriate back-end context for processing the function
FNDECL. The argument might be NULL to indicate processing at top
level, outside of any function scope. */
@@ -7163,7 +7256,10 @@ ix86_set_current_function (tree fndecl)
one is extern inline and one isn't. Call ix86_set_func_type
to set the func_type field. */
if (fndecl != NULL_TREE)
- ix86_set_func_type (fndecl);
+ {
+ ix86_set_func_type (fndecl);
+ ix86_set_indirect_branch_type (fndecl);
+ }
return;
}
@@ -7183,6 +7279,7 @@ ix86_set_current_function (tree fndecl)
}
ix86_set_func_type (fndecl);
+ ix86_set_indirect_branch_type (fndecl);
tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
if (new_tree == NULL_TREE)
@@ -9752,7 +9849,13 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
/* For pointers passed in memory we expect bounds passed in Bounds
Table. */
if (!nregs)
- cum->bnds_in_bt = chkp_type_bounds_count (type);
+ {
+ /* Track if there are outgoing arguments on stack. */
+ if (cum->caller)
+ cfun->machine->outgoing_args_on_stack = true;
+
+ cum->bnds_in_bt = chkp_type_bounds_count (type);
+ }
}
/* Define where to put the arguments to a function.
@@ -10081,6 +10184,10 @@ ix86_function_arg (cumulative_args_t cum_v, machine_mode omode,
else
arg = function_arg_32 (cum, mode, omode, type, bytes, words);
+ /* Track if there are outgoing arguments on stack. */
+ if (arg == NULL_RTX && cum->caller)
+ cfun->machine->outgoing_args_on_stack = true;
+
return arg;
}
@@ -11920,6 +12027,285 @@ ix86_setup_frame_addresses (void)
# endif
#endif
+/* Label count for call and return thunks. It is used to make unique
+ labels in call and return thunks. */
+static int indirectlabelno;
+
+/* True if call and return thunk functions are needed. */
+static bool indirect_thunk_needed = false;
+/* True if call and return thunk functions with the BND prefix are
+ needed. */
+static bool indirect_thunk_bnd_needed = false;
+
+/* Bit masks of integer registers, which contain branch target, used
+ by call and return thunks functions. */
+static int indirect_thunks_used;
+/* Bit masks of integer registers, which contain branch target, used
+ by call and return thunks functions with the BND prefix. */
+static int indirect_thunks_bnd_used;
+
+/* True if return thunk function via CX is needed. */
+static bool indirect_return_via_cx;
+/* True if return thunk function via CX with the BND prefix is
+ needed. */
+static bool indirect_return_via_cx_bnd;
+
+#ifndef INDIRECT_LABEL
+# define INDIRECT_LABEL "LIND"
+#endif
+
+/* Fills in the label name that should be used for the indirect thunk. */
+
+static void
+indirect_thunk_name (char name[32], unsigned int regno,
+ bool need_bnd_p, bool ret_p)
+{
+ if (regno != INVALID_REGNUM && regno != CX_REG && ret_p)
+ gcc_unreachable ();
+
+ if (USE_HIDDEN_LINKONCE)
+ {
+ const char *bnd = need_bnd_p ? "_bnd" : "";
+ const char *ret = ret_p ? "return" : "indirect";
+ if (regno != INVALID_REGNUM)
+ {
+ const char *reg_prefix;
+ if (LEGACY_INT_REGNO_P (regno))
+ reg_prefix = TARGET_64BIT ? "r" : "e";
+ else
+ reg_prefix = "";
+ sprintf (name, "__x86_%s_thunk%s_%s%s",
+ ret, bnd, reg_prefix, reg_names[regno]);
+ }
+ else
+ sprintf (name, "__x86_%s_thunk%s", ret, bnd);
+ }
+ else
+ {
+ if (regno != INVALID_REGNUM)
+ {
+ if (need_bnd_p)
+ ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno);
+ else
+ ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno);
+ }
+ else
+ {
+ if (ret_p)
+ {
+ if (need_bnd_p)
+ ASM_GENERATE_INTERNAL_LABEL (name, "LRTB", 0);
+ else
+ ASM_GENERATE_INTERNAL_LABEL (name, "LRT", 0);
+ }
+ else
+ {
+ if (need_bnd_p)
+ ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0);
+ else
+ ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0);
+ }
+ }
+ }
+}
+
+/* Output a call and return thunk for indirect branch. If BND_P is
+ true, the BND prefix is needed. If REGNO != -1, the function
+ address is in REGNO and the call and return thunk looks like:
+
+ call L2
+ L1:
+ pause
+ jmp L1
+ L2:
+ mov %REG, (%sp)
+ ret
+
+ Otherwise, the function address is on the top of stack and the
+ call and return thunk looks like:
+
+ call L2
+ L1:
+ pause
+ jmp L1
+ L2:
+ lea WORD_SIZE(%sp), %sp
+ ret
+ */
+
+static void
+output_indirect_thunk (bool need_bnd_p, unsigned int regno)
+{
+ char indirectlabel1[32];
+ char indirectlabel2[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1, INDIRECT_LABEL,
+ indirectlabelno++);
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2, INDIRECT_LABEL,
+ indirectlabelno++);
+
+ /* Call */
+ if (need_bnd_p)
+ fputs ("\tbnd call\t", asm_out_file);
+ else
+ fputs ("\tcall\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel2);
+ fputc ('\n', asm_out_file);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
+
+ /* Pause + lfence. */
+ fprintf (asm_out_file, "\tpause\n\tlfence\n");
+
+ /* Jump. */
+ fputs ("\tjmp\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel1);
+ fputc ('\n', asm_out_file);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
+
+ if (regno != INVALID_REGNUM)
+ {
+ /* MOV. */
+ rtx xops[2];
+ xops[0] = gen_rtx_MEM (word_mode, stack_pointer_rtx);
+ xops[1] = gen_rtx_REG (word_mode, regno);
+ output_asm_insn ("mov\t{%1, %0|%0, %1}", xops);
+ }
+ else
+ {
+ /* LEA. */
+ rtx xops[2];
+ xops[0] = stack_pointer_rtx;
+ xops[1] = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD);
+ output_asm_insn ("lea\t{%E1, %0|%0, %E1}", xops);
+ }
+
+ if (need_bnd_p)
+ fputs ("\tbnd ret\n", asm_out_file);
+ else
+ fputs ("\tret\n", asm_out_file);
+}
+
+/* Output a funtion with a call and return thunk for indirect branch.
+ If BND_P is true, the BND prefix is needed. If REGNO != INVALID_REGNUM,
+ the function address is in REGNO. Otherwise, the function address is
+ on the top of stack. */
+
+static void
+output_indirect_thunk_function (bool need_bnd_p, unsigned int regno)
+{
+ char name[32];
+ tree decl;
+
+ /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */
+ indirect_thunk_name (name, regno, need_bnd_p, false);
+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (name),
+ build_function_type_list (void_type_node, NULL_TREE));
+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+ NULL_TREE, void_type_node);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+
+#if TARGET_MACHO
+ if (TARGET_MACHO)
+ {
+ switch_to_section (darwin_sections[picbase_thunk_section]);
+ fputs ("\t.weak_definition\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ fputs ("\n\t.private_extern\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ putc ('\n', asm_out_file);
+ ASM_OUTPUT_LABEL (asm_out_file, name);
+ DECL_WEAK (decl) = 1;
+ }
+ else
+#endif
+ if (USE_HIDDEN_LINKONCE)
+ {
+ cgraph_node::create (decl)->set_comdat_group (DECL_ASSEMBLER_NAME (decl));
+
+ targetm.asm_out.unique_section (decl, 0);
+ switch_to_section (get_named_section (decl, NULL, 0));
+
+ targetm.asm_out.globalize_label (asm_out_file, name);
+ fputs ("\t.hidden\t", asm_out_file);
+ assemble_name (asm_out_file, name);
+ putc ('\n', asm_out_file);
+ ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl);
+ }
+ else
+ {
+ switch_to_section (text_section);
+ ASM_OUTPUT_LABEL (asm_out_file, name);
+ }
+
+ /* Create alias for __x86_return_thunk/__x86_return_thunk_bnd or
+ __x86_return_thunk_ecx/__x86_return_thunk_ecx_bnd. */
+ bool need_alias;
+ if (regno == INVALID_REGNUM)
+ need_alias = true;
+ else if (regno == CX_REG)
+ {
+ if (need_bnd_p)
+ need_alias = indirect_return_via_cx_bnd;
+ else
+ need_alias = indirect_return_via_cx;
+ }
+ else
+ need_alias = false;
+
+ if (need_alias)
+ {
+ char alias[32];
+
+ indirect_thunk_name (alias, regno, need_bnd_p, true);
+#if TARGET_MACHO
+ if (TARGET_MACHO)
+ {
+ fputs ("\t.weak_definition\t", asm_out_file);
+ assemble_name (asm_out_file, alias);
+ fputs ("\n\t.private_extern\t", asm_out_file);
+ assemble_name (asm_out_file, alias);
+ putc ('\n', asm_out_file);
+ ASM_OUTPUT_LABEL (asm_out_file, alias);
+ }
+#else
+ ASM_OUTPUT_DEF (asm_out_file, alias, name);
+ if (USE_HIDDEN_LINKONCE)
+ {
+ fputs ("\t.globl\t", asm_out_file);
+ assemble_name (asm_out_file, alias);
+ putc ('\n', asm_out_file);
+ fputs ("\t.hidden\t", asm_out_file);
+ assemble_name (asm_out_file, alias);
+ putc ('\n', asm_out_file);
+ }
+#endif
+ }
+
+ DECL_INITIAL (decl) = make_node (BLOCK);
+ current_function_decl = decl;
+ allocate_struct_function (decl, false);
+ init_function_start (decl);
+ /* We're about to hide the function body from callees of final_* by
+ emitting it directly; tell them we're a thunk, if they care. */
+ cfun->is_thunk = true;
+ first_function_block_is_cold = false;
+ /* Make sure unwind info is emitted for the thunk if needed. */
+ final_start_function (emit_barrier (), asm_out_file, 1);
+
+ output_indirect_thunk (need_bnd_p, regno);
+
+ final_end_function ();
+ init_insn_lengths ();
+ free_after_compilation (cfun);
+ set_cfun (NULL);
+ current_function_decl = NULL;
+}
+
static int pic_labels_used;
/* Fills in the label name that should be used for a pc thunk for
@@ -11944,13 +12330,34 @@ static void
ix86_code_end (void)
{
rtx xops[2];
- int regno;
+ unsigned int regno;
+
+ if (indirect_thunk_needed)
+ output_indirect_thunk_function (false, INVALID_REGNUM);
+ if (indirect_thunk_bnd_needed)
+ output_indirect_thunk_function (true, INVALID_REGNUM);
+
+ for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++)
+ {
+ unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1;
+ if ((indirect_thunks_used & (1 << i)))
+ output_indirect_thunk_function (false, regno);
+
+ if ((indirect_thunks_bnd_used & (1 << i)))
+ output_indirect_thunk_function (true, regno);
+ }
for (regno = AX_REG; regno <= SP_REG; regno++)
{
char name[32];
tree decl;
+ if ((indirect_thunks_used & (1 << regno)))
+ output_indirect_thunk_function (false, regno);
+
+ if ((indirect_thunks_bnd_used & (1 << regno)))
+ output_indirect_thunk_function (true, regno);
+
if (!(pic_labels_used & (1 << regno)))
continue;
@@ -12510,11 +12917,16 @@ ix86_compute_frame_layout (void)
frame->va_arg_size = ix86_varargs_gpr_size + ix86_varargs_fpr_size;
offset += frame->va_arg_size;
- /* Align start of frame for local function. */
+ /* Align start of frame for local function. When a function call
+ is removed, it may become a leaf function. But if argument may
+ be passed on stack, we need to align the stack when there is no
+ tail call. */
if (stack_realign_fp
|| offset != frame->sse_reg_save_offset
|| size != 0
|| !crtl->is_leaf
+ || (!crtl->tail_call_emit
+ && cfun->machine->outgoing_args_on_stack)
|| cfun->calls_alloca
|| ix86_current_function_calls_tls_descriptor)
offset = ROUND_UP (offset, stack_alignment_needed);
@@ -13690,7 +14102,7 @@ ix86_expand_prologue (void)
m->fs.sp_valid = true;
ix86_compute_frame_layout ();
- struct ix86_frame &frame = cfun->machine->frame;
+ const struct ix86_frame &frame = cfun->machine->frame;
if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
{
@@ -14358,7 +14770,7 @@ ix86_expand_epilogue (int style)
ix86_finalize_stack_realign_flags ();
ix86_compute_frame_layout ();
- struct ix86_frame &frame = cfun->machine->frame;
+ const struct ix86_frame &frame = cfun->machine->frame;
m->fs.sp_valid = (!frame_pointer_needed
|| (crtl->sp_is_unchanging
@@ -14400,11 +14812,13 @@ ix86_expand_epilogue (int style)
+ UNITS_PER_WORD);
}
+ HOST_WIDE_INT reg_save_offset = frame.reg_save_offset;
+
/* Special care must be taken for the normal return case of a function
using eh_return: the eax and edx registers are marked as saved, but
not restored along this path. Adjust the save location to match. */
if (crtl->calls_eh_return && style != 2)
- frame.reg_save_offset -= 2 * UNITS_PER_WORD;
+ reg_save_offset -= 2 * UNITS_PER_WORD;
/* EH_RETURN requires the use of moves to function properly. */
if (crtl->calls_eh_return)
@@ -14420,11 +14834,11 @@ ix86_expand_epilogue (int style)
else if (TARGET_EPILOGUE_USING_MOVE
&& cfun->machine->use_fast_prologue_epilogue
&& (frame.nregs > 1
- || m->fs.sp_offset != frame.reg_save_offset))
+ || m->fs.sp_offset != reg_save_offset))
restore_regs_via_mov = true;
else if (frame_pointer_needed
&& !frame.nregs
- && m->fs.sp_offset != frame.reg_save_offset)
+ && m->fs.sp_offset != reg_save_offset)
restore_regs_via_mov = true;
else if (frame_pointer_needed
&& TARGET_USE_LEAVE
@@ -14462,7 +14876,7 @@ ix86_expand_epilogue (int style)
rtx t;
if (frame.nregs)
- ix86_emit_restore_regs_using_mov (frame.reg_save_offset, style == 2);
+ ix86_emit_restore_regs_using_mov (reg_save_offset, style == 2);
/* eh_return epilogues need %ecx added to the stack pointer. */
if (style == 2)
@@ -14552,19 +14966,19 @@ ix86_expand_epilogue (int style)
epilogues. */
if (!m->fs.sp_valid
|| (TARGET_SEH
- && (m->fs.sp_offset - frame.reg_save_offset
+ && (m->fs.sp_offset - reg_save_offset
>= SEH_MAX_FRAME_SIZE)))
{
pro_epilogue_adjust_stack (stack_pointer_rtx, hard_frame_pointer_rtx,
GEN_INT (m->fs.fp_offset
- - frame.reg_save_offset),
+ - reg_save_offset),
style, false);
}
- else if (m->fs.sp_offset != frame.reg_save_offset)
+ else if (m->fs.sp_offset != reg_save_offset)
{
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (m->fs.sp_offset
- - frame.reg_save_offset),
+ - reg_save_offset),
style,
m->fs.cfa_reg == stack_pointer_rtx);
}
@@ -17573,6 +17987,7 @@ put_condition_code (enum rtx_code code, machine_mode mode, bool reverse,
If CODE is 'h', pretend the reg is the 'high' byte register.
If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op.
If CODE is 'd', duplicate the operand for AVX instruction.
+ If CODE is 'V', print naked full integer register name without %.
*/
void
@@ -17583,7 +17998,7 @@ print_reg (rtx x, int code, FILE *file)
unsigned int regno;
bool duplicated;
- if (ASSEMBLER_DIALECT == ASM_ATT)
+ if (ASSEMBLER_DIALECT == ASM_ATT && code != 'V')
putc ('%', file);
if (x == pc_rtx)
@@ -17631,6 +18046,14 @@ print_reg (rtx x, int code, FILE *file)
return;
}
+ if (code == 'V')
+ {
+ if (GENERAL_REGNO_P (regno))
+ msize = GET_MODE_SIZE (word_mode);
+ else
+ error ("'V' modifier on non-integer register");
+ }
+
duplicated = code == 'd' && TARGET_AVX;
switch (msize)
@@ -17750,6 +18173,7 @@ print_reg (rtx x, int code, FILE *file)
& -- print some in-use local-dynamic symbol name.
H -- print a memory address offset by 8; used for sse high-parts
Y -- print condition for XOP pcom* instruction.
+ V -- print naked full integer register name without %.
+ -- print a branch hint as 'cs' or 'ds' prefix
; -- print a semicolon (after prefixes due to bug in older gas).
~ -- print "i" if TARGET_AVX2, "f" otherwise.
@@ -17974,6 +18398,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
case 'X':
case 'P':
case 'p':
+ case 'V':
break;
case 's':
@@ -18435,7 +18860,8 @@ ix86_print_operand (FILE *file, rtx x, int code)
since we can in fact encode that into an immediate. */
if (GET_CODE (x) == CONST_VECTOR)
{
- gcc_assert (x == CONST0_RTX (GET_MODE (x)));
+ if (x != CONST0_RTX (GET_MODE (x)))
+ output_operand_lossage ("invalid vector immediate");
x = const0_rtx;
}
@@ -28446,12 +28872,412 @@ ix86_nopic_noplt_attribute_p (rtx call_op)
return false;
}
+/* Output indirect branch via a call and return thunk. CALL_OP is a
+ register which contains the branch target. XASM is the assembly
+ template for CALL_OP. Branch is a tail call if SIBCALL_P is true.
+ A normal call is converted to:
+
+ call __x86_indirect_thunk_reg
+
+ and a tail call is converted to:
+
+ jmp __x86_indirect_thunk_reg
+ */
+
+static void
+ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p)
+{
+ char thunk_name_buf[32];
+ char *thunk_name;
+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
+ int regno = REGNO (call_op);
+
+ if (cfun->machine->indirect_branch_type
+ != indirect_branch_thunk_inline)
+ {
+ if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
+ {
+ int i = regno;
+ if (i >= FIRST_REX_INT_REG)
+ i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
+ if (need_bnd_p)
+ indirect_thunks_bnd_used |= 1 << i;
+ else
+ indirect_thunks_used |= 1 << i;
+ }
+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false);
+ thunk_name = thunk_name_buf;
+ }
+ else
+ thunk_name = NULL;
+
+ if (sibcall_p)
+ {
+ if (thunk_name != NULL)
+ {
+ if (need_bnd_p)
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ else
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ else
+ output_indirect_thunk (need_bnd_p, regno);
+ }
+ else
+ {
+ if (thunk_name != NULL)
+ {
+ if (need_bnd_p)
+ fprintf (asm_out_file, "\tbnd call\t%s\n", thunk_name);
+ else
+ fprintf (asm_out_file, "\tcall\t%s\n", thunk_name);
+ return;
+ }
+
+ char indirectlabel1[32];
+ char indirectlabel2[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1,
+ INDIRECT_LABEL,
+ indirectlabelno++);
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2,
+ INDIRECT_LABEL,
+ indirectlabelno++);
+
+ /* Jump. */
+ if (need_bnd_p)
+ fputs ("\tbnd jmp\t", asm_out_file);
+ else
+ fputs ("\tjmp\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel2);
+ fputc ('\n', asm_out_file);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
+
+ if (thunk_name != NULL)
+ {
+ if (need_bnd_p)
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ else
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ else
+ output_indirect_thunk (need_bnd_p, regno);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
+
+ /* Call. */
+ if (need_bnd_p)
+ fputs ("\tbnd call\t", asm_out_file);
+ else
+ fputs ("\tcall\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel1);
+ fputc ('\n', asm_out_file);
+ }
+}
+
+/* Output indirect branch via a call and return thunk. CALL_OP is
+ the branch target. XASM is the assembly template for CALL_OP.
+ Branch is a tail call if SIBCALL_P is true. A normal call is
+ converted to:
+
+ jmp L2
+ L1:
+ push CALL_OP
+ jmp __x86_indirect_thunk
+ L2:
+ call L1
+
+ and a tail call is converted to:
+
+ push CALL_OP
+ jmp __x86_indirect_thunk
+ */
+
+static void
+ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm,
+ bool sibcall_p)
+{
+ char thunk_name_buf[32];
+ char *thunk_name;
+ char push_buf[64];
+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
+ int regno = -1;
+
+ if (cfun->machine->indirect_branch_type
+ != indirect_branch_thunk_inline)
+ {
+ if (cfun->machine->indirect_branch_type == indirect_branch_thunk)
+ {
+ if (need_bnd_p)
+ indirect_thunk_bnd_needed = true;
+ else
+ indirect_thunk_needed = true;
+ }
+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false);
+ thunk_name = thunk_name_buf;
+ }
+ else
+ thunk_name = NULL;
+
+ snprintf (push_buf, sizeof (push_buf), "push{%c}\t%s",
+ TARGET_64BIT ? 'q' : 'l', xasm);
+
+ if (sibcall_p)
+ {
+ output_asm_insn (push_buf, &call_op);
+ if (thunk_name != NULL)
+ {
+ if (need_bnd_p)
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ else
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ else
+ output_indirect_thunk (need_bnd_p, regno);
+ }
+ else
+ {
+ char indirectlabel1[32];
+ char indirectlabel2[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1,
+ INDIRECT_LABEL,
+ indirectlabelno++);
+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2,
+ INDIRECT_LABEL,
+ indirectlabelno++);
+
+ /* Jump. */
+ if (need_bnd_p)
+ fputs ("\tbnd jmp\t", asm_out_file);
+ else
+ fputs ("\tjmp\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel2);
+ fputc ('\n', asm_out_file);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
+
+ /* An external function may be called via GOT, instead of PLT. */
+ if (MEM_P (call_op))
+ {
+ struct ix86_address parts;
+ rtx addr = XEXP (call_op, 0);
+ if (ix86_decompose_address (addr, &parts)
+ && parts.base == stack_pointer_rtx)
+ {
+ /* Since call will adjust stack by -UNITS_PER_WORD,
+ we must convert "disp(stack, index, scale)" to
+ "disp+UNITS_PER_WORD(stack, index, scale)". */
+ if (parts.index)
+ {
+ addr = gen_rtx_MULT (Pmode, parts.index,
+ GEN_INT (parts.scale));
+ addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+ addr);
+ }
+ else
+ addr = stack_pointer_rtx;
+
+ rtx disp;
+ if (parts.disp != NULL_RTX)
+ disp = plus_constant (Pmode, parts.disp,
+ UNITS_PER_WORD);
+ else
+ disp = GEN_INT (UNITS_PER_WORD);
+
+ addr = gen_rtx_PLUS (Pmode, addr, disp);
+ call_op = gen_rtx_MEM (GET_MODE (call_op), addr);
+ }
+ }
+
+ output_asm_insn (push_buf, &call_op);
+
+ if (thunk_name != NULL)
+ {
+ if (need_bnd_p)
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ else
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ else
+ output_indirect_thunk (need_bnd_p, regno);
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
+
+ /* Call. */
+ if (need_bnd_p)
+ fputs ("\tbnd call\t", asm_out_file);
+ else
+ fputs ("\tcall\t", asm_out_file);
+ assemble_name_raw (asm_out_file, indirectlabel1);
+ fputc ('\n', asm_out_file);
+ }
+}
+
+/* Output indirect branch via a call and return thunk. CALL_OP is
+ the branch target. XASM is the assembly template for CALL_OP.
+ Branch is a tail call if SIBCALL_P is true. */
+
+static void
+ix86_output_indirect_branch (rtx call_op, const char *xasm,
+ bool sibcall_p)
+{
+ if (REG_P (call_op))
+ ix86_output_indirect_branch_via_reg (call_op, sibcall_p);
+ else
+ ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p);
+}
+
+/* Output indirect jump. CALL_OP is the jump target. */
+
+const char *
+ix86_output_indirect_jmp (rtx call_op)
+{
+ if (cfun->machine->indirect_branch_type != indirect_branch_keep)
+ {
+ /* We can't have red-zone since "call" in the indirect thunk
+ pushes the return address onto stack, destroying red-zone. */
+ if (ix86_red_zone_size != 0)
+ gcc_unreachable ();
+
+ ix86_output_indirect_branch (call_op, "%0", true);
+ return "";
+ }
+ else
+ return "%!jmp\t%A0";
+}
+
+/* Output function return. CALL_OP is the jump target. Add a REP
+ prefix to RET if LONG_P is true and function return is kept. */
+
+const char *
+ix86_output_function_return (bool long_p)
+{
+ if (cfun->machine->function_return_type != indirect_branch_keep)
+ {
+ char thunk_name[32];
+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
+
+ if (cfun->machine->function_return_type
+ != indirect_branch_thunk_inline)
+ {
+ bool need_thunk = (cfun->machine->function_return_type
+ == indirect_branch_thunk);
+ indirect_thunk_name (thunk_name, INVALID_REGNUM, need_bnd_p,
+ true);
+ if (need_bnd_p)
+ {
+ indirect_thunk_bnd_needed |= need_thunk;
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ }
+ else
+ {
+ indirect_thunk_needed |= need_thunk;
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ }
+ else
+ output_indirect_thunk (need_bnd_p, INVALID_REGNUM);
+
+ return "";
+ }
+
+ if (!long_p || ix86_bnd_prefixed_insn_p (current_output_insn))
+ return "%!ret";
+
+ return "rep%; ret";
+}
+
+/* Output indirect function return. RET_OP is the function return
+ target. */
+
+const char *
+ix86_output_indirect_function_return (rtx ret_op)
+{
+ if (cfun->machine->function_return_type != indirect_branch_keep)
+ {
+ char thunk_name[32];
+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn);
+ unsigned int regno = REGNO (ret_op);
+ gcc_assert (regno == CX_REG);
+
+ if (cfun->machine->function_return_type
+ != indirect_branch_thunk_inline)
+ {
+ bool need_thunk = (cfun->machine->function_return_type
+ == indirect_branch_thunk);
+ indirect_thunk_name (thunk_name, regno, need_bnd_p, true);
+ if (need_bnd_p)
+ {
+ if (need_thunk)
+ {
+ indirect_return_via_cx_bnd = true;
+ indirect_thunks_bnd_used |= 1 << CX_REG;
+ }
+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
+ }
+ else
+ {
+ if (need_thunk)
+ {
+ indirect_return_via_cx = true;
+ indirect_thunks_used |= 1 << CX_REG;
+ }
+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
+ }
+ }
+ else
+ output_indirect_thunk (need_bnd_p, regno);
+
+ return "";
+ }
+ else
+ return "%!jmp\t%A0";
+}
+
+/* Split simple return with popping POPC bytes from stack to indirect
+ branch with stack adjustment . */
+
+void
+ix86_split_simple_return_pop_internal (rtx popc)
+{
+ struct machine_function *m = cfun->machine;
+ rtx ecx = gen_rtx_REG (SImode, CX_REG);
+ rtx_insn *insn;
+
+ /* There is no "pascal" calling convention in any 64bit ABI. */
+ gcc_assert (!TARGET_64BIT);
+
+ insn = emit_insn (gen_pop (ecx));
+ m->fs.cfa_offset -= UNITS_PER_WORD;
+ m->fs.sp_offset -= UNITS_PER_WORD;
+
+ rtx x = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD);
+ x = gen_rtx_SET (stack_pointer_rtx, x);
+ add_reg_note (insn, REG_CFA_ADJUST_CFA, x);
+ add_reg_note (insn, REG_CFA_REGISTER, gen_rtx_SET (ecx, pc_rtx));
+ RTX_FRAME_RELATED_P (insn) = 1;
+
+ x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, popc);
+ x = gen_rtx_SET (stack_pointer_rtx, x);
+ insn = emit_insn (x);
+ add_reg_note (insn, REG_CFA_ADJUST_CFA, x);
+ RTX_FRAME_RELATED_P (insn) = 1;
+
+ /* Now return address is in ECX. */
+ emit_jump_insn (gen_simple_return_indirect_internal (ecx));
+}
+
/* Output the assembly for a call instruction. */
const char *
ix86_output_call_insn (rtx_insn *insn, rtx call_op)
{
bool direct_p = constant_call_address_operand (call_op, VOIDmode);
+ bool output_indirect_p
+ = (!TARGET_SEH
+ && cfun->machine->indirect_branch_type != indirect_branch_keep);
bool seh_nop_p = false;
const char *xasm;
@@ -28461,10 +29287,21 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
{
if (ix86_nopic_noplt_attribute_p (call_op))
{
+ direct_p = false;
if (TARGET_64BIT)
- xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ {
+ if (output_indirect_p)
+ xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ else
+ xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ }
else
- xasm = "%!jmp\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
+ {
+ if (output_indirect_p)
+ xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
+ else
+ xasm = "%!jmp\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
+ }
}
else
xasm = "%!jmp\t%P0";
@@ -28474,9 +29311,17 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
else if (TARGET_SEH)
xasm = "%!rex.W jmp\t%A0";
else
- xasm = "%!jmp\t%A0";
+ {
+ if (output_indirect_p)
+ xasm = "%0";
+ else
+ xasm = "%!jmp\t%A0";
+ }
- output_asm_insn (xasm, &call_op);
+ if (output_indirect_p && !direct_p)
+ ix86_output_indirect_branch (call_op, xasm, true);
+ else
+ output_asm_insn (xasm, &call_op);
return "";
}
@@ -28514,18 +29359,37 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
{
if (ix86_nopic_noplt_attribute_p (call_op))
{
+ direct_p = false;
if (TARGET_64BIT)
- xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ {
+ if (output_indirect_p)
+ xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ else
+ xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
+ }
else
- xasm = "%!call\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
+ {
+ if (output_indirect_p)
+ xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
+ else
+ xasm = "%!call\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
+ }
}
else
xasm = "%!call\t%P0";
}
else
- xasm = "%!call\t%A0";
+ {
+ if (output_indirect_p)
+ xasm = "%0";
+ else
+ xasm = "%!call\t%A0";
+ }
- output_asm_insn (xasm, &call_op);
+ if (output_indirect_p && !direct_p)
+ ix86_output_indirect_branch (call_op, xasm, false);
+ else
+ output_asm_insn (xasm, &call_op);
if (seh_nop_p)
return "nop";
@@ -41453,7 +42317,7 @@ ix86_handle_struct_attribute (tree *node, tree name, tree, int,
}
static tree
-ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
+ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int,
bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_DECL)
@@ -41462,6 +42326,51 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
name);
*no_add_attrs = true;
}
+
+ if (is_attribute_p ("indirect_branch", name))
+ {
+ tree cst = TREE_VALUE (args);
+ if (TREE_CODE (cst) != STRING_CST)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute requires a string constant argument",
+ name);
+ *no_add_attrs = true;
+ }
+ else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
+ {
+ warning (OPT_Wattributes,
+ "argument to %qE attribute is not "
+ "(keep|thunk|thunk-inline|thunk-extern)", name);
+ *no_add_attrs = true;
+ }
+ }
+
+ if (is_attribute_p ("function_return", name))
+ {
+ tree cst = TREE_VALUE (args);
+ if (TREE_CODE (cst) != STRING_CST)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute requires a string constant argument",
+ name);
+ *no_add_attrs = true;
+ }
+ else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
+ {
+ warning (OPT_Wattributes,
+ "argument to %qE attribute is not "
+ "(keep|thunk|thunk-inline|thunk-extern)", name);
+ *no_add_attrs = true;
+ }
+ }
+
return NULL_TREE;
}
@@ -45770,6 +46679,10 @@ static const struct attribute_spec ix86_attribute_table[] =
ix86_handle_interrupt_attribute, false },
{ "no_caller_saved_registers", 0, 0, false, true, true,
ix86_handle_no_caller_saved_registers_attribute, false },
+ { "indirect_branch", 1, 1, true, false, false,
+ ix86_handle_fndecl_attribute, false },
+ { "function_return", 1, 1, true, false, false,
+ ix86_handle_fndecl_attribute, false },
/* End element. */
{ NULL, 0, 0, false, false, false, NULL, false }
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index f9b91286a01..32a01d03073 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2609,6 +2609,16 @@ struct GTY(()) machine_function {
/* Function type. */
ENUM_BITFIELD(function_type) func_type : 2;
+ /* How to generate indirec branch. */
+ ENUM_BITFIELD(indirect_branch) indirect_branch_type : 3;
+
+ /* If true, the current function has local indirect jumps, like
+ "indirect_jump" or "tablejump". */
+ BOOL_BITFIELD has_local_indirect_jump : 1;
+
+ /* How to generate function return. */
+ ENUM_BITFIELD(indirect_branch) function_return_type : 3;
+
/* If true, the current function is a function specified with
the "interrupt" or "no_caller_saved_registers" attribute. */
BOOL_BITFIELD no_caller_saved_registers : 1;
@@ -2620,6 +2630,9 @@ struct GTY(()) machine_function {
pass arguments and can be used for indirect sibcall. */
BOOL_BITFIELD arg_reg_available : 1;
+ /* Nonzero if the function places outgoing arguments on stack. */
+ BOOL_BITFIELD outgoing_args_on_stack : 1;
+
/* During prologue/epilogue generation, the current frame state.
Otherwise, the frame state at the end of the prologue. */
struct machine_frame_state fs;
@@ -2706,6 +2719,11 @@ extern void debug_dispatch_window (int);
#define TARGET_RECIP_VEC_DIV ((recip_mask & RECIP_MASK_VEC_DIV) != 0)
#define TARGET_RECIP_VEC_SQRT ((recip_mask & RECIP_MASK_VEC_SQRT) != 0)
+
+#define TARGET_INDIRECT_BRANCH_REGISTER \
+ (ix86_indirect_branch_register \
+ || cfun->machine->indirect_branch_type != indirect_branch_keep)
+
#define IX86_HLE_ACQUIRE (1 << 16)
#define IX86_HLE_RELEASE (1 << 17)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index dbe88f40c8f..10abb165bd9 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8584,14 +8584,14 @@
})
(define_insn "*andndi3_doubleword"
- [(set (match_operand:DI 0 "register_operand" "=r,&r")
+ [(set (match_operand:DI 0 "register_operand" "=&r,r,r,&r")
(and:DI
- (not:DI (match_operand:DI 1 "register_operand" "r,0"))
- (match_operand:DI 2 "nonimmediate_operand" "rm,rm")))
+ (not:DI (match_operand:DI 1 "register_operand" "r,0,r,0"))
+ (match_operand:DI 2 "nonimmediate_operand" "rm,rm,0,rm")))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_STV && TARGET_SSE2"
"#"
- [(set_attr "isa" "bmi,*")])
+ [(set_attr "isa" "bmi,bmi,bmi,*")])
(define_split
[(set (match_operand:DI 0 "register_operand")
@@ -11625,15 +11625,20 @@
[(set (pc) (match_operand 0 "indirect_branch_operand"))]
""
{
- if (TARGET_X32)
+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
})
(define_insn "*indirect_jump"
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))]
""
- "%!jmp\t%A0"
- [(set_attr "type" "ibr")
+ "* return ix86_output_indirect_jmp (operands[0]);"
+ [(set (attr "type")
+ (if_then_else (match_test "(cfun->machine->indirect_branch_type
+ != indirect_branch_keep)")
+ (const_string "multi")
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
@@ -11674,16 +11679,21 @@
OPTAB_DIRECT);
}
- if (TARGET_X32)
+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
})
(define_insn "*tablejump_1"
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))
(use (label_ref (match_operand 1)))]
""
- "%!jmp\t%A0"
- [(set_attr "type" "ibr")
+ "* return ix86_output_indirect_jmp (operands[0]);"
+ [(set (attr "type")
+ (if_then_else (match_test "(cfun->machine->indirect_branch_type
+ != indirect_branch_keep)")
+ (const_string "multi")
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
@@ -11842,7 +11852,10 @@
(match_operand:SI 0 "register_no_elim_operand" "U")
(match_operand:SI 1 "GOT32_symbol_operand"))))
(match_operand 2))]
- "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)"
+ "!TARGET_MACHO
+ && !TARGET_64BIT
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (insn)"
{
rtx fnaddr = gen_rtx_PLUS (SImode, operands[0], operands[1]);
fnaddr = gen_const_mem (SImode, fnaddr);
@@ -11861,7 +11874,7 @@
[(call (mem:QI (match_operand:W 0 "memory_operand" "m"))
(match_operand 1))
(unspec [(const_int 0)] UNSPEC_PEEPSIB)]
- "!TARGET_X32"
+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
"* return ix86_output_call_insn (insn, operands[0]);"
[(set_attr "type" "call")])
@@ -11870,7 +11883,9 @@
(match_operand:W 1 "memory_operand"))
(call (mem:QI (match_dup 0))
(match_operand 3))]
- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
+ "!TARGET_X32
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (peep2_next_insn (1))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
[(parallel [(call (mem:QI (match_dup 1))
@@ -11883,7 +11898,9 @@
(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
(call (mem:QI (match_dup 0))
(match_operand 3))]
- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
+ "!TARGET_X32
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (peep2_next_insn (2))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
@@ -11905,7 +11922,7 @@
})
(define_insn "*call_pop"
- [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lmBz"))
+ [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lBwBz"))
(match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -11925,7 +11942,7 @@
[(set_attr "type" "call")])
(define_insn "*sibcall_pop_memory"
- [(call (mem:QI (match_operand:SI 0 "memory_operand" "m"))
+ [(call (mem:QI (match_operand:SI 0 "memory_operand" "Bs"))
(match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -11979,7 +11996,9 @@
[(set (match_operand:W 0 "register_operand")
(match_operand:W 1 "memory_operand"))
(set (pc) (match_dup 0))]
- "!TARGET_X32 && peep2_reg_dead_p (2, operands[0])"
+ "!TARGET_X32
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && peep2_reg_dead_p (2, operands[0])"
[(set (pc) (match_dup 1))])
;; Call subroutine, returning value in operand 0
@@ -12039,7 +12058,10 @@
(match_operand:SI 1 "register_no_elim_operand" "U")
(match_operand:SI 2 "GOT32_symbol_operand"))))
(match_operand 3)))]
- "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)"
+ "!TARGET_MACHO
+ && !TARGET_64BIT
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (insn)"
{
rtx fnaddr = gen_rtx_PLUS (SImode, operands[1], operands[2]);
fnaddr = gen_const_mem (SImode, fnaddr);
@@ -12060,7 +12082,7 @@
(call (mem:QI (match_operand:W 1 "memory_operand" "m"))
(match_operand 2)))
(unspec [(const_int 0)] UNSPEC_PEEPSIB)]
- "!TARGET_X32"
+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
"* return ix86_output_call_insn (insn, operands[1]);"
[(set_attr "type" "callv")])
@@ -12070,7 +12092,9 @@
(set (match_operand 2)
(call (mem:QI (match_dup 0))
(match_operand 3)))]
- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1))
+ "!TARGET_X32
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (peep2_next_insn (1))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
[(parallel [(set (match_dup 2)
@@ -12085,7 +12109,9 @@
(set (match_operand 2)
(call (mem:QI (match_dup 0))
(match_operand 3)))]
- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2))
+ "!TARGET_X32
+ && !TARGET_INDIRECT_BRANCH_REGISTER
+ && SIBLING_CALL_P (peep2_next_insn (2))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
[(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
@@ -12110,7 +12136,7 @@
(define_insn "*call_value_pop"
[(set (match_operand 0)
- (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lmBz"))
+ (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lBwBz"))
(match_operand 2)))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
@@ -12305,7 +12331,7 @@
(define_insn "simple_return_internal"
[(simple_return)]
"reload_completed"
- "%!ret"
+ "* return ix86_output_function_return (false);"
[(set_attr "length" "1")
(set_attr "atom_unit" "jeu")
(set_attr "length_immediate" "0")
@@ -12327,23 +12353,21 @@
[(simple_return)
(unspec [(const_int 0)] UNSPEC_REP)]
"reload_completed"
-{
- if (ix86_bnd_prefixed_insn_p (insn))
- return "%!ret";
-
- return "rep%; ret";
-}
+ "* return ix86_output_function_return (true);"
[(set_attr "length" "2")
(set_attr "atom_unit" "jeu")
(set_attr "length_immediate" "0")
(set_attr "prefix_rep" "1")
(set_attr "modrm" "0")])
-(define_insn "simple_return_pop_internal"
+(define_insn_and_split "simple_return_pop_internal"
[(simple_return)
(use (match_operand:SI 0 "const_int_operand"))]
"reload_completed"
"%!ret\t%0"
+ "&& cfun->machine->function_return_type != indirect_branch_keep"
+ [(const_int 0)]
+ "ix86_split_simple_return_pop_internal (operands[0]); DONE;"
[(set_attr "length" "3")
(set_attr "atom_unit" "jeu")
(set_attr "length_immediate" "2")
@@ -12354,8 +12378,12 @@
[(simple_return)
(use (match_operand:SI 0 "register_operand" "r"))]
"reload_completed"
- "%!jmp\t%A0"
- [(set_attr "type" "ibr")
+ "* return ix86_output_indirect_function_return (operands[0]);"
+ [(set (attr "type")
+ (if_then_else (match_test "(cfun->machine->indirect_branch_type
+ != indirect_branch_keep)")
+ (const_string "multi")
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index 9384e29b1de..b90da9f89ec 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -927,3 +927,31 @@ Attempt to avoid generating instruction sequences containing ret bytes.
mgeneral-regs-only
Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Var(ix86_target_flags) Save
Generate code which uses only the general registers.
+
+mindirect-branch=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep)
+Convert indirect call and jump to call and return thunks.
+
+mfunction-return=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_function_return) Init(indirect_branch_keep)
+Convert function return to call and return thunk.
+
+Enum
+Name(indirect_branch) Type(enum indirect_branch)
+Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
+
+EnumValue
+Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
+
+EnumValue
+Enum(indirect_branch) String(thunk) Value(indirect_branch_thunk)
+
+EnumValue
+Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline)
+
+EnumValue
+Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
+
+mindirect-branch-register
+Target Report Var(ix86_indirect_branch_register) Init(0)
+Force indirect call and jump via register.
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 2fc2c60f6ac..77e97e17f1a 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -635,7 +635,8 @@
;; Test for a valid operand for indirect branch.
(define_predicate "indirect_branch_operand"
(ior (match_operand 0 "register_operand")
- (and (not (match_test "TARGET_X32"))
+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
+ (not (match_test "TARGET_X32"))
(match_operand 0 "memory_operand"))))
;; Return true if OP is a memory operands that can be used in sibcalls.
@@ -678,20 +679,22 @@
(ior (match_test "constant_call_address_operand
(op, mode == VOIDmode ? mode : Pmode)")
(match_operand 0 "call_register_no_elim_operand")
- (ior (and (not (match_test "TARGET_X32"))
- (match_operand 0 "memory_operand"))
- (and (match_test "TARGET_X32 && Pmode == DImode")
- (match_operand 0 "GOT_memory_operand")))))
+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
+ (ior (and (not (match_test "TARGET_X32"))
+ (match_operand 0 "memory_operand"))
+ (and (match_test "TARGET_X32 && Pmode == DImode")
+ (match_operand 0 "GOT_memory_operand"))))))
;; Similarly, but for tail calls, in which we cannot allow memory references.
(define_special_predicate "sibcall_insn_operand"
(ior (match_test "constant_call_address_operand
(op, mode == VOIDmode ? mode : Pmode)")
(match_operand 0 "register_no_elim_operand")
- (ior (and (not (match_test "TARGET_X32"))
- (match_operand 0 "sibcall_memory_operand"))
- (and (match_test "TARGET_X32 && Pmode == DImode")
- (match_operand 0 "GOT_memory_operand")))))
+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
+ (ior (and (not (match_test "TARGET_X32"))
+ (match_operand 0 "sibcall_memory_operand"))
+ (and (match_test "TARGET_X32 && Pmode == DImode")
+ (match_operand 0 "GOT_memory_operand"))))))
;; Return true if OP is a 32-bit GOT symbol operand.
(define_predicate "GOT32_symbol_operand"
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 80cda39bacf..1cd6efb300e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -9938,11 +9938,11 @@
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
"@
p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
- vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
+ vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sseiadd")
(set_attr "prefix_data16" "1,*")
- (set_attr "prefix" "<mask_prefix3>")
+ (set_attr "prefix" "orig,vex")
(set_attr "mode" "<sseinsnmode>")])
(define_insn "*<plusminus_insn><mode>3_mask"
@@ -11822,7 +11822,7 @@
(eq_attr "mode" "TI"))
(const_string "1")
(const_string "*")))
- (set_attr "prefix" "<mask_prefix3>")
+ (set_attr "prefix" "orig,vex")
(set (attr "mode")
(cond [(and (match_test "<MODE_SIZE> == 16")
(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index c14ce86d810..68504b84abb 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -185,6 +185,8 @@ static bool m68k_output_addr_const_extra (FILE *, rtx);
static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
static enum flt_eval_method
m68k_excess_precision (enum excess_precision_type);
+static machine_mode m68k_promote_function_mode (const_tree, machine_mode,
+ int *, const_tree, int);
/* Initialize the GCC target structure. */
@@ -332,6 +334,9 @@ m68k_excess_precision (enum excess_precision_type);
#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE m68k_promote_function_mode
+
static const struct attribute_spec m68k_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
@@ -6571,4 +6576,20 @@ m68k_excess_precision (enum excess_precision_type type)
return FLT_EVAL_METHOD_UNPREDICTABLE;
}
+/* Implement TARGET_PROMOTE_FUNCTION_MODE. */
+
+static machine_mode
+m68k_promote_function_mode (const_tree type, machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return)
+{
+ /* Promote libcall arguments narrower than int to match the normal C
+ ABI (for which promotions are handled via
+ TARGET_PROMOTE_PROTOTYPES). */
+ if (type == NULL_TREE && !for_return && (mode == QImode || mode == HImode))
+ return SImode;
+ return mode;
+}
+
#include "gt-m68k.h"
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 710a97b2958..c1f0d5b0026 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -905,6 +905,8 @@ msp430_hard_regno_nregs (int regno ATTRIBUTE_UNUSED,
{
if (mode == PSImode && msp430x)
return 1;
+ if (mode == CPSImode && msp430x)
+ return 2;
return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1)
/ UNITS_PER_WORD);
}
@@ -927,6 +929,8 @@ msp430_hard_regno_nregs_with_padding (int regno ATTRIBUTE_UNUSED,
{
if (mode == PSImode)
return 2;
+ if (mode == CPSImode)
+ return 4;
return msp430_hard_regno_nregs (regno, mode);
}
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index e89b314f6ce..70a8f0de245 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -1875,9 +1875,15 @@ output_init_frag (rtx sym)
if (sym)
{
- fprintf (asm_out_file, "generic(");
+ bool function = (SYMBOL_REF_DECL (sym)
+ && (TREE_CODE (SYMBOL_REF_DECL (sym)) == FUNCTION_DECL));
+ if (!function)
+ fprintf (asm_out_file, "generic(");
output_address (VOIDmode, sym);
- fprintf (asm_out_file, val ? ") + " : ")");
+ if (!function)
+ fprintf (asm_out_file, ")");
+ if (val)
+ fprintf (asm_out_file, " + ");
}
if (!sym || val)
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 27dcdeab3d2..e6ac34acec9 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -4562,13 +4562,17 @@ hppa_profile_hook (int label_no)
lcla2 and load_offset_label_address insn patterns. */
rtx reg = gen_reg_rtx (SImode);
rtx_code_label *label_rtx = gen_label_rtx ();
- rtx mcount = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (Pmode, "_mcount"));
int reg_parm_stack_space = REG_PARM_STACK_SPACE (NULL_TREE);
- rtx arg_bytes, begin_label_rtx;
+ rtx arg_bytes, begin_label_rtx, mcount, sym;
rtx_insn *call_insn;
char begin_label_name[16];
bool use_mcount_pcrel_call;
+ /* Set up call destination. */
+ sym = gen_rtx_SYMBOL_REF (Pmode, "_mcount");
+ pa_encode_label (sym);
+ mcount = gen_rtx_MEM (Pmode, sym);
+
/* If we can reach _mcount with a pc-relative call, we can optimize
loading the address of the current function. This requires linker
long branch stub support. */
diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index 75187eeb406..8f1be3e0fd6 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -277,6 +277,9 @@
case HImode:
return true;
+ case VOIDmode:
+ return false;
+
default:
return (INTVAL (op) % GET_MODE_SIZE (mode)) == 0;
}
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index b9de05a72f0..e04c3a50a9e 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -398,8 +398,8 @@
#define vec_vctzd __builtin_vec_vctzd
#define vec_vctzh __builtin_vec_vctzh
#define vec_vctzw __builtin_vec_vctzw
-#define vec_vextract4b __builtin_vec_vextract4b
-#define vec_vinsert4b __builtin_vec_vinsert4b
+#define vec_extract4b __builtin_vec_extract4b
+#define vec_insert4b __builtin_vec_insert4b
#define vec_vprtyb __builtin_vec_vprtyb
#define vec_vprtybd __builtin_vec_vprtybd
#define vec_vprtybw __builtin_vec_vprtybw
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 06c7582c5a5..53c6eb81154 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -414,7 +414,6 @@
(define_insn "*restore_world"
[(match_parallel 0 "restore_world_operation"
[(return)
- (use (reg:SI LR_REGNO))
(use (match_operand:SI 1 "call_operand" "s"))
(clobber (match_operand:SI 2 "gpc_reg_operand" "=r"))])]
"TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT"
diff --git a/gcc/config/rs6000/driver-rs6000.c b/gcc/config/rs6000/driver-rs6000.c
index 8215abbd625..04936bd9b9b 100644
--- a/gcc/config/rs6000/driver-rs6000.c
+++ b/gcc/config/rs6000/driver-rs6000.c
@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tm.h"
+#include "diagnostic.h"
+#include "opts.h"
#include <stdlib.h>
#ifdef _AIX
@@ -36,6 +38,44 @@ along with GCC; see the file COPYING3. If not see
# include <sys/sysctl.h>
#endif
+#ifdef __linux__
+/* Canonical GCC cpu name table. */
+static const char *rs6000_supported_cpu_names[] =
+{
+#define RS6000_CPU(NAME, CPU, FLAGS) NAME,
+#include "rs6000-cpus.def"
+#undef RS6000_CPU
+};
+
+/* This table holds a list of cpus where their Linux AT_PLATFORM name differs
+ from their GCC canonical name. The first column in a row contains the GCC
+ canonical cpu name and the other columns in that row contain AT_PLATFORM
+ names that should be mapped to the canonical name. */
+
+static const char *linux_cpu_translation_table[][4] = {
+ { "403", "ppc403", NULL },
+ { "405", "ppc405", NULL },
+ { "440", "ppc440", "ppc440gp", NULL },
+ { "476", "ppc470", NULL },
+ { "601", "ppc601", NULL },
+ { "603", "ppc603", NULL },
+ { "604", "ppc604", NULL },
+ { "7400", "ppc7400", NULL },
+ { "7450", "ppc7450", NULL },
+ { "750", "ppc750", NULL },
+ { "823", "ppc823", NULL },
+ { "8540", "ppc8540", NULL },
+ { "8548", "ppc8548", NULL },
+ { "970", "ppc970", NULL },
+ { "cell", "ppc-cell-be", NULL },
+ { "e500mc", "ppce500mc", NULL },
+ { "e5500", "ppce5500", NULL },
+ { "e6500", "ppce6500", NULL },
+ { "power7", "power7+", NULL },
+ { NULL } /* End of table sentinel. */
+};
+#endif
+
const char *host_detect_local_cpu (int argc, const char **argv);
#if GCC_VERSION >= 0
@@ -156,14 +196,19 @@ detect_processor_freebsd (void)
#ifdef __linux__
-/* Returns AT_PLATFORM if present, otherwise generic PowerPC. */
+/* Returns the canonical AT_PLATFORM if present, otherwise NULL. */
static const char *
elf_platform (void)
{
- int fd;
+ /* Used to cache the result we determine below. */
+ static const char *cpu = NULL;
- fd = open ("/proc/self/auxv", O_RDONLY);
+ /* Use the cached AT_PLATFORM cpu name if we've already determined it. */
+ if (cpu != NULL)
+ return cpu;
+
+ int fd = open ("/proc/self/auxv", O_RDONLY);
if (fd != -1)
{
@@ -177,15 +222,51 @@ elf_platform (void)
if (n > 0)
{
for (av = (ElfW(auxv_t) *) buf; av->a_type != AT_NULL; ++av)
- switch (av->a_type)
+ if (av->a_type == AT_PLATFORM)
{
- case AT_PLATFORM:
- return (const char *) av->a_un.a_val;
-
- default:
+ /* Cache the result. */
+ cpu = (const char *) av->a_un.a_val;
break;
}
}
+
+ /* Verify that CPU is either a valid -mcpu=<cpu> option name, or is a
+ valid alternative name. If it is a valid alternative name, then use
+ the canonical name. */
+ if (cpu != NULL)
+ {
+ size_t i, j;
+ char *s;
+
+ /* Check if AT_PLATFORM is a GCC canonical cpu name. */
+ for (i = 0; i < ARRAY_SIZE (rs6000_supported_cpu_names); i++)
+ if (!strcmp (cpu, rs6000_supported_cpu_names[i]))
+ return cpu;
+
+ /* Check if AT_PLATFORM can be translated to a canonical cpu name. */
+ for (i = 0; linux_cpu_translation_table[i][0] != NULL; i++)
+ {
+ const char *canonical = linux_cpu_translation_table[i][0];
+ for (j = 1; linux_cpu_translation_table[i][j] != NULL; j++)
+ if (!strcmp (cpu, linux_cpu_translation_table[i][j]))
+ {
+ /* Cache the result. */
+ cpu = canonical;
+ return cpu;
+ }
+ }
+
+ /* The kernel returned an AT_PLATFORM name we do not support. */
+ auto_vec <const char *> candidates;
+ for (i = 0; i < ARRAY_SIZE (rs6000_supported_cpu_names); i++)
+ candidates.safe_push (rs6000_supported_cpu_names[i]);
+ candidates_list_and_hint (cpu, s, candidates);
+ fatal_error (
+ input_location,
+ "Unsupported cpu name returned from kernel for -mcpu=native: %s\n"
+ "Please use an explicit cpu name. Valid cpu names are: %s",
+ cpu, s);
+ }
}
return NULL;
}
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 0d816e5e6d9..a9e4ef56580 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -1468,13 +1468,12 @@
rtx elt;
int count = XVECLEN (op, 0);
- if (count != 59)
+ if (count != 58)
return 0;
index = 0;
if (GET_CODE (XVECEXP (op, 0, index++)) != RETURN
|| GET_CODE (XVECEXP (op, 0, index++)) != USE
- || GET_CODE (XVECEXP (op, 0, index++)) != USE
|| GET_CODE (XVECEXP (op, 0, index++)) != CLOBBER)
return 0;
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index a39f9363515..00e8e602095 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -2034,8 +2034,8 @@ BU_P9V_AV_2 (VEXTUWRX, "vextuwrx", CONST, vextuwrx)
/* Insert/extract 4 byte word into a vector. */
BU_P9V_VSX_2 (VEXTRACT4B, "vextract4b", CONST, vextract4b)
-BU_P9V_VSX_3 (VINSERT4B, "vinsert4b", CONST, vinsert4b)
-BU_P9V_VSX_3 (VINSERT4B_DI, "vinsert4b_di", CONST, vinsert4b_di)
+BU_P9V_VSX_3 (INSERT4B, "insert4b", CONST, insert4b)
+BU_P9V_VSX_2 (EXTRACT4B, "extract4b", CONST, extract4b)
/* 3 argument vector functions returning void, treated as SPECIAL,
added in ISA 3.0 (power9). */
@@ -2084,10 +2084,11 @@ BU_P9V_OVERLOAD_2 (LXVL, "lxvl")
BU_P9V_OVERLOAD_2 (VEXTULX, "vextulx")
BU_P9V_OVERLOAD_2 (VEXTURX, "vexturx")
BU_P9V_OVERLOAD_2 (VEXTRACT4B, "vextract4b")
+BU_P9V_OVERLOAD_2 (EXTRACT4B, "extract4b")
/* ISA 3.0 Vector scalar overloaded 3 argument functions */
BU_P9V_OVERLOAD_3 (STXVL, "stxvl")
-BU_P9V_OVERLOAD_3 (VINSERT4B, "vinsert4b")
+BU_P9V_OVERLOAD_3 (INSERT4B, "insert4b")
/* Overloaded CMPNE support was implemented prior to Power 9,
so is not mentioned here. */
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index d9905f7b2f6..c6fd52439eb 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -5047,6 +5047,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_INTDI, RS6000_BTI_V16QI, RS6000_BTI_UINTSI, 0 },
{ P9V_BUILTIN_VEC_VEXTRACT4B, P9V_BUILTIN_VEXTRACT4B,
RS6000_BTI_INTDI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_UINTSI, 0 },
+ { P9V_BUILTIN_VEC_EXTRACT4B, P9V_BUILTIN_EXTRACT4B,
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, 0 },
{ P9V_BUILTIN_VEC_VEXTULX, P9V_BUILTIN_VEXTUBLX,
RS6000_BTI_INTQI, RS6000_BTI_UINTSI,
@@ -5101,27 +5103,12 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B,
- RS6000_BTI_V16QI, RS6000_BTI_V4SI,
- RS6000_BTI_V16QI, RS6000_BTI_UINTSI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B,
- RS6000_BTI_V16QI, RS6000_BTI_unsigned_V4SI,
- RS6000_BTI_V16QI, RS6000_BTI_UINTSI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B,
+ { P9V_BUILTIN_VEC_INSERT4B, P9V_BUILTIN_INSERT4B,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_V4SI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P9V_BUILTIN_VEC_INSERT4B, P9V_BUILTIN_INSERT4B,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V4SI,
- RS6000_BTI_unsigned_V16QI, RS6000_BTI_UINTSI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B_DI,
- RS6000_BTI_V16QI, RS6000_BTI_INTDI,
- RS6000_BTI_V16QI, RS6000_BTI_UINTDI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B_DI,
- RS6000_BTI_V16QI, RS6000_BTI_UINTDI,
- RS6000_BTI_V16QI, RS6000_BTI_UINTDI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B_DI,
- RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTDI,
- RS6000_BTI_unsigned_V16QI, RS6000_BTI_UINTDI },
- { P9V_BUILTIN_VEC_VINSERT4B, P9V_BUILTIN_VINSERT4B_DI,
- RS6000_BTI_unsigned_V16QI, RS6000_BTI_UINTDI,
- RS6000_BTI_unsigned_V16QI, RS6000_BTI_UINTDI },
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
{ P8V_BUILTIN_VEC_VADDECUQ, P8V_BUILTIN_VADDECUQ,
RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI },
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 0692510b98e..8962f5e8c2f 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -139,7 +139,6 @@ extern bool rs6000_emit_set_const (rtx, rtx);
extern int rs6000_emit_cmove (rtx, rtx, rtx, rtx);
extern int rs6000_emit_vector_cond_expr (rtx, rtx, rtx, rtx, rtx, rtx);
extern void rs6000_emit_minmax (rtx, enum rtx_code, rtx, rtx);
-extern void rs6000_split_signbit (rtx, rtx);
extern void rs6000_expand_atomic_compare_and_swap (rtx op[]);
extern void rs6000_expand_atomic_exchange (rtx op[]);
extern void rs6000_expand_atomic_op (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 323b218d229..0d7fc51a5f5 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5563,6 +5563,11 @@ rs6000_option_override_internal (bool global_init_p)
if (TARGET_LINK_STACK == -1)
SET_TARGET_LINK_STACK (rs6000_cpu == PROCESSOR_PPC476 && flag_pic);
+ /* Deprecate use of -mno-speculate-indirect-jumps. */
+ if (!rs6000_speculate_indirect_jumps)
+ warning (0, "%qs is deprecated and not recommended in any circumstances",
+ "-mno-speculate-indirect-jumps");
+
return ret;
}
@@ -8558,6 +8563,12 @@ mem_operand_gpr (rtx op, machine_mode mode)
int extra;
rtx addr = XEXP (op, 0);
+ /* Don't allow altivec type addresses like (mem (and (plus ...))).
+ See PR target/84279. */
+
+ if (GET_CODE (addr) == AND)
+ return false;
+
op = address_offset (addr);
if (op == NULL_RTX)
return true;
@@ -16374,6 +16385,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
case P9V_BUILTIN_VEXTRACT4B:
case P9V_BUILTIN_VEC_VEXTRACT4B:
+ case P9V_BUILTIN_VEC_EXTRACT4B:
arg1 = CALL_EXPR_ARG (exp, 1);
STRIP_NOPS (arg1);
@@ -16388,9 +16400,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
}
break;
- case P9V_BUILTIN_VINSERT4B:
- case P9V_BUILTIN_VINSERT4B_DI:
- case P9V_BUILTIN_VEC_VINSERT4B:
+ case P9V_BUILTIN_VEC_INSERT4B:
arg2 = CALL_EXPR_ARG (exp, 2);
STRIP_NOPS (arg2);
@@ -16400,7 +16410,7 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
if (TREE_CODE (arg2) != INTEGER_CST || TREE_INT_CST_LOW (arg2) > 12)
{
- error ("third argument to vec_vinsert4b must be 0..12");
+ error ("third argument to vec_insert4b must be 0..12");
return expand_call (exp, target, false);
}
break;
@@ -23980,7 +23990,7 @@ print_operand (FILE *file, rtx x, int code)
/* Fall through. Must be [reg+reg]. */
}
- if (VECTOR_MEM_ALTIVEC_P (GET_MODE (x))
+ if (VECTOR_MEM_ALTIVEC_OR_VSX_P (GET_MODE (x))
&& GET_CODE (tmp) == AND
&& GET_CODE (XEXP (tmp, 1)) == CONST_INT
&& INTVAL (XEXP (tmp, 1)) == -16)
@@ -25907,49 +25917,6 @@ rs6000_emit_minmax (rtx dest, enum rtx_code code, rtx op0, rtx op1)
emit_move_insn (dest, target);
}
-/* Split a signbit operation on 64-bit machines with direct move. Also allow
- for the value to come from memory or if it is already loaded into a GPR. */
-
-void
-rs6000_split_signbit (rtx dest, rtx src)
-{
- machine_mode d_mode = GET_MODE (dest);
- machine_mode s_mode = GET_MODE (src);
- rtx dest_di = (d_mode == DImode) ? dest : gen_lowpart (DImode, dest);
- rtx shift_reg = dest_di;
-
- gcc_assert (FLOAT128_IEEE_P (s_mode) && TARGET_POWERPC64);
-
- if (MEM_P (src))
- {
- rtx mem = (WORDS_BIG_ENDIAN
- ? adjust_address (src, DImode, 0)
- : adjust_address (src, DImode, 8));
- emit_insn (gen_rtx_SET (dest_di, mem));
- }
-
- else
- {
- unsigned int r = reg_or_subregno (src);
-
- if (INT_REGNO_P (r))
- shift_reg = gen_rtx_REG (DImode, r + (BYTES_BIG_ENDIAN == 0));
-
- else
- {
- /* Generate the special mfvsrd instruction to get it in a GPR. */
- gcc_assert (VSX_REGNO_P (r));
- if (s_mode == KFmode)
- emit_insn (gen_signbitkf2_dm2 (dest_di, src));
- else
- emit_insn (gen_signbittf2_dm2 (dest_di, src));
- }
- }
-
- emit_insn (gen_lshrdi3 (dest_di, shift_reg, GEN_INT (63)));
- return;
-}
-
/* A subroutine of the atomic operation splitters. Jump to LABEL if
COND is true. Mark the jump as unlikely to be taken. */
@@ -31988,8 +31955,9 @@ rs6000_internal_arg_pointer (void)
emit_insn_after (pat, get_insns ());
pop_topmost_sequence ();
}
- return plus_constant (Pmode, cfun->machine->split_stack_arg_pointer,
- FIRST_PARM_OFFSET (current_function_decl));
+ rtx ret = plus_constant (Pmode, cfun->machine->split_stack_arg_pointer,
+ FIRST_PARM_OFFSET (current_function_decl));
+ return copy_to_reg (ret);
}
return virtual_incoming_args_rtx;
}
@@ -39223,6 +39191,9 @@ static struct rs6000_opt_var const rs6000_opt_vars[] =
{ "sched-epilog",
offsetof (struct gcc_options, x_TARGET_SCHED_PROLOG),
offsetof (struct cl_target_option, x_TARGET_SCHED_PROLOG), },
+ { "speculate-indirect-jumps",
+ offsetof (struct gcc_options, x_rs6000_speculate_indirect_jumps),
+ offsetof (struct cl_target_option, x_rs6000_speculate_indirect_jumps), },
{ "gen-cell-microcode",
offsetof (struct gcc_options, x_rs6000_gen_cell_microcode),
offsetof (struct cl_target_option, x_rs6000_gen_cell_microcode), },
@@ -41654,6 +41625,38 @@ insn_is_swap_p (rtx insn)
return 1;
}
+/* Return 1 iff UID, known to reference a swap, is both fed by a load
+ and a feeder of a store. */
+static unsigned int
+swap_feeds_both_load_and_store (swap_web_entry *insn_entry)
+{
+ rtx insn = insn_entry->insn;
+ struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
+ df_ref def, use;
+ struct df_link *link = 0;
+ rtx_insn *load = 0, *store = 0;
+ bool fed_by_load = 0;
+ bool feeds_store = 0;
+
+ FOR_EACH_INSN_INFO_USE (use, insn_info)
+ {
+ link = DF_REF_CHAIN (use);
+ load = DF_REF_INSN (link->ref);
+ if (insn_is_load_p (load) && insn_is_swap_p (load))
+ fed_by_load = 1;
+ }
+
+ FOR_EACH_INSN_INFO_DEF (def, insn_info)
+ {
+ link = DF_REF_CHAIN (def);
+ store = DF_REF_INSN (link->ref);
+ if (insn_is_store_p (store) && insn_is_swap_p (store))
+ feeds_store = 1;
+ }
+
+ return fed_by_load && feeds_store;
+}
+
/* Return TRUE if insn is a swap fed by a load from the constant pool. */
static bool
const_load_sequence_p (swap_web_entry *insn_entry, rtx insn)
@@ -41857,6 +41860,7 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
{
default:
break;
+ case UNSPEC_VBPERMQ:
case UNSPEC_VMRGH_DIRECT:
case UNSPEC_VMRGL_DIRECT:
case UNSPEC_VPACK_SIGN_SIGN_SAT:
@@ -43126,6 +43130,14 @@ rs6000_analyze_swaps (function *fun)
&& !insn_entry[i].is_swap && !insn_entry[i].is_swappable)
root->web_not_optimizable = 1;
+ /* If we have a swap that is both fed by a permuting load
+ and a feeder of a permuting store, then the optimization
+ isn't appropriate. (Consider vec_xl followed by vec_xst_be.) */
+ else if (insn_entry[i].is_swap && !insn_entry[i].is_load
+ && !insn_entry[i].is_store
+ && swap_feeds_both_load_and_store (&insn_entry[i]))
+ root->web_not_optimizable = 1;
+
/* If we have permuting loads or stores that are not accompanied
by a register swap, the optimization isn't appropriate. */
else if (insn_entry[i].is_load && insn_entry[i].is_swap)
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 8c3ccda8d91..e83f80b7121 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -544,7 +544,7 @@
(define_code_attr su [(sign_extend "s")
(zero_extend "u")
(fix "s")
- (unsigned_fix "s")
+ (unsigned_fix "u")
(float "s")
(unsigned_float "u")])
@@ -4757,12 +4757,19 @@
{
if (FLOAT128_IEEE_P (<MODE>mode))
{
+ rtx dest = operands[0];
+ rtx src = operands[1];
+ rtx tmp = gen_reg_rtx (DImode);
+ rtx dest_di = gen_lowpart (DImode, dest);
+
if (<MODE>mode == KFmode)
- emit_insn (gen_signbitkf2_dm (operands[0], operands[1]));
+ emit_insn (gen_signbitkf2_dm (tmp, src));
else if (<MODE>mode == TFmode)
- emit_insn (gen_signbittf2_dm (operands[0], operands[1]));
+ emit_insn (gen_signbittf2_dm (tmp, src));
else
gcc_unreachable ();
+
+ emit_insn (gen_lshrdi3 (dest_di, tmp, GEN_INT (63)));
DONE;
}
operands[2] = gen_reg_rtx (DFmode);
@@ -4783,6 +4790,66 @@
}
})
+;; Optimize IEEE 128-bit signbit on 64-bit systems with direct move to avoid
+;; multiple direct moves. If we used a SUBREG:DI of the Floa128 type, the
+;; register allocator would typically move the entire _Float128 item to GPRs (2
+;; instructions on ISA 3.0, 3-4 instructions on ISA 2.07).
+;;
+;; After register allocation, if the _Float128 had originally been in GPRs, the
+;; split allows the post reload phases to eliminate the move, and do the shift
+;; directly with the register that contains the signbit.
+(define_insn_and_split "signbit<mode>2_dm"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
+ (unspec:DI [(match_operand:SIGNBIT 1 "gpc_reg_operand" "wa,r")]
+ UNSPEC_SIGNBIT))]
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "@
+ mfvsrd %0,%x1
+ #"
+ "&& reload_completed && int_reg_operand (operands[1], <MODE>mode)"
+ [(set (match_dup 0)
+ (match_dup 2))]
+{
+ operands[2] = gen_highpart (DImode, operands[1]);
+}
+ [(set_attr "type" "mftgpr,*")])
+
+;; Optimize IEEE 128-bit signbit on to avoid loading the value into a vector
+;; register and then doing a direct move if the value comes from memory. On
+;; little endian, we have to load the 2nd double-word to get the sign bit.
+(define_insn_and_split "*signbit<mode>2_dm_mem"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=b")
+ (unspec:DI [(match_operand:SIGNBIT 1 "memory_operand" "m")]
+ UNSPEC_SIGNBIT))]
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "#"
+ "&& 1"
+ [(set (match_dup 0)
+ (match_dup 2))]
+{
+ rtx dest = operands[0];
+ rtx src = operands[1];
+ rtx addr = XEXP (src, 0);
+
+ if (WORDS_BIG_ENDIAN)
+ operands[2] = adjust_address (src, DImode, 0);
+
+ else if (REG_P (addr) || SUBREG_P (addr))
+ operands[2] = adjust_address (src, DImode, 8);
+
+ else if (GET_CODE (addr) == PLUS && REG_P (XEXP (addr, 0))
+ && CONST_INT_P (XEXP (addr, 1)) && mem_operand_gpr (src, DImode))
+ operands[2] = adjust_address (src, DImode, 8);
+
+ else
+ {
+ rtx tmp = can_create_pseudo_p () ? gen_reg_rtx (DImode) : dest;
+ emit_insn (gen_rtx_SET (tmp, addr));
+ operands[2] = change_address (src, DImode,
+ gen_rtx_PLUS (DImode, tmp, GEN_INT (8)));
+ }
+})
+
(define_expand "copysign<mode>3"
[(set (match_dup 3)
(abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))
@@ -4812,54 +4879,6 @@
operands[5] = CONST0_RTX (<MODE>mode);
})
-;; Optimize signbit on 64-bit systems with direct move to avoid doing the store
-;; and load.
-(define_insn_and_split "signbit<mode>2_dm"
- [(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r")
- (unspec:SI
- [(match_operand:SIGNBIT 1 "input_operand" "wa,m,r")]
- UNSPEC_SIGNBIT))]
- "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
- "#"
- "&& reload_completed"
- [(const_int 0)]
-{
- rs6000_split_signbit (operands[0], operands[1]);
- DONE;
-}
- [(set_attr "length" "8,8,4")
- (set_attr "type" "mftgpr,load,integer")])
-
-(define_insn_and_split "*signbit<mode>2_dm_<su>ext"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
- (any_extend:DI
- (unspec:SI
- [(match_operand:SIGNBIT 1 "input_operand" "wa,m,r")]
- UNSPEC_SIGNBIT)))]
- "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
- "#"
- "&& reload_completed"
- [(const_int 0)]
-{
- rs6000_split_signbit (operands[0], operands[1]);
- DONE;
-}
- [(set_attr "length" "8,8,4")
- (set_attr "type" "mftgpr,load,integer")])
-
-;; MODES_TIEABLE_P doesn't allow DImode to be tied with the various floating
-;; point types, which makes normal SUBREG's problematical. Instead use a
-;; special pattern to avoid using a normal movdi.
-(define_insn "signbit<mode>2_dm2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
- (unspec:DI [(match_operand:SIGNBIT 1 "gpc_reg_operand" "wa")
- (const_int 0)]
- UNSPEC_SIGNBIT))]
- "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
- "mfvsrd %0,%x1"
- [(set_attr "type" "mftgpr")])
-
-
;; Use an unspec rather providing an if-then-else in RTL, to prevent the
;; compiler from optimizing -0.0
(define_insn "copysign<mode>3_fcpsgn"
@@ -5694,45 +5713,59 @@
xscvdpsxds %x0,%x1"
[(set_attr "type" "fp")])
-(define_expand "fix_trunc<SFDF:mode><QHI:mode>2"
- [(parallel [(set (match_operand:<QHI:MODE> 0 "nonimmediate_operand")
- (fix:QHI (match_operand:SFDF 1 "gpc_reg_operand")))
- (clobber (match_scratch:DI 2))])]
- "TARGET_P9_VECTOR && TARGET_DIRECT_MOVE_64BIT
- && TARGET_VSX_SMALL_INTEGER"
+;; If we have ISA 3.0, QI/HImode values can go in both VSX registers and GPR
+;; registers. If we have ISA 2.07, we don't allow QI/HImode values in the
+;; vector registers, so we need to do direct moves to the GPRs, but SImode
+;; values can go in VSX registers. Keeping the direct move part through
+;; register allocation prevents the register allocator from doing a direct move
+;; of the SImode value to a GPR, and then a store/load.
+(define_insn_and_split "fix<uns>_trunc<SFDF:mode><QHI:mode>2"
+ [(set (match_operand:<QHI:MODE> 0 "gpc_reg_operand" "=wJ,wJwK,r")
+ (any_fix:QHI (match_operand:SFDF 1 "gpc_reg_operand" "wJ,wJwK,wa")))
+ (clobber (match_scratch:SI 2 "=X,X,wi"))]
+ "TARGET_DIRECT_MOVE"
+ "@
+ fctiw<u>z %0,%1
+ xscvdp<su>xws %x0,%x1
+ #"
+ "&& reload_completed && int_reg_operand (operands[0], <QHI:MODE>mode)"
+ [(set (match_dup 2)
+ (any_fix:SI (match_dup 1)))
+ (set (match_dup 3)
+ (match_dup 2))]
{
- if (MEM_P (operands[0]))
- operands[0] = rs6000_address_for_fpconvert (operands[0]);
-})
+ operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]));
+}
+ [(set_attr "length" "4,4,8")
+ (set_attr "type" "fp")])
-(define_insn_and_split "*fix_trunc<SFDF:mode><QHI:mode>2_internal"
- [(set (match_operand:<QHI:MODE> 0 "reg_or_indexed_operand" "=wIwJ,rZ")
- (fix:QHI
- (match_operand:SFDF 1 "gpc_reg_operand" "<SFDF:Fv>,<SFDF:Fv>")))
- (clobber (match_scratch:DI 2 "=X,wi"))]
- "TARGET_P9_VECTOR && TARGET_DIRECT_MOVE_64BIT
- && TARGET_VSX_SMALL_INTEGER"
+(define_insn "*fix<uns>_trunc<SFDF:mode>si2_p8"
+ [(set (match_operand:SI 0 "gpc_reg_operand" "=d,wa")
+ (any_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "d,wa")))]
+ "TARGET_DIRECT_MOVE"
+ "@
+ fctiw<u>z %0,%1
+ xscvdp<su>xws %x0,%x1"
+ [(set_attr "type" "fp")])
+
+;; Keep the convert and store together through register allocation to prevent
+;; the register allocator from getting clever and doing a direct move to a GPR
+;; and then store for reg+offset stores.
+(define_insn_and_split "*fix<uns>_trunc<SFDF:mode><QHSI:mode>2_mem"
+ [(set (match_operand:QHSI 0 "memory_operand" "=Z")
+ (any_fix:QHSI (match_operand:SFDF 1 "gpc_reg_operand" "wa")))
+ (clobber (match_scratch:SI 2 "=wa"))]
+ "(<QHSI:MODE>mode == SImode && TARGET_P8_VECTOR) || TARGET_P9_VECTOR"
"#"
"&& reload_completed"
- [(const_int 0)]
+ [(set (match_dup 2)
+ (any_fix:SI (match_dup 1)))
+ (set (match_dup 0)
+ (match_dup 3))]
{
- rtx dest = operands[0];
- rtx src = operands[1];
-
- if (vsx_register_operand (dest, <QHI:MODE>mode))
- {
- rtx di_dest = gen_rtx_REG (DImode, REGNO (dest));
- emit_insn (gen_fix_trunc<SFDF:mode>di2 (di_dest, src));
- }
- else
- {
- rtx tmp = operands[2];
- rtx tmp2 = gen_rtx_REG (<QHI:MODE>mode, REGNO (tmp));
-
- emit_insn (gen_fix_trunc<SFDF:mode>di2 (tmp, src));
- emit_move_insn (dest, tmp2);
- }
- DONE;
+ operands[3] = (<QHSI:MODE>mode == SImode
+ ? operands[2]
+ : gen_rtx_REG (<QHSI:MODE>mode, REGNO (operands[2])));
})
(define_expand "fixuns_trunc<mode>si2"
@@ -5801,75 +5834,6 @@
xscvdpuxds %x0,%x1"
[(set_attr "type" "fp")])
-(define_expand "fixuns_trunc<SFDF:mode><QHI:mode>2"
- [(parallel [(set (match_operand:<QHI:MODE> 0 "nonimmediate_operand")
- (unsigned_fix:QHI (match_operand:SFDF 1 "gpc_reg_operand")))
- (clobber (match_scratch:DI 2))])]
- "TARGET_P9_VECTOR && TARGET_DIRECT_MOVE_64BIT
- && TARGET_VSX_SMALL_INTEGER"
-{
- if (MEM_P (operands[0]))
- operands[0] = rs6000_address_for_fpconvert (operands[0]);
-})
-
-(define_insn_and_split "*fixuns_trunc<SFDF:mode><QHI:mode>2_internal"
- [(set (match_operand:<QHI:MODE> 0 "reg_or_indexed_operand" "=wIwJ,rZ")
- (unsigned_fix:QHI
- (match_operand:SFDF 1 "gpc_reg_operand" "<SFDF:Fv>,<SFDF:Fv>")))
- (clobber (match_scratch:DI 2 "=X,wi"))]
- "TARGET_P9_VECTOR && TARGET_DIRECT_MOVE_64BIT
- && TARGET_VSX_SMALL_INTEGER"
- "#"
- "&& reload_completed"
- [(const_int 0)]
-{
- rtx dest = operands[0];
- rtx src = operands[1];
-
- if (vsx_register_operand (dest, <QHI:MODE>mode))
- {
- rtx di_dest = gen_rtx_REG (DImode, REGNO (dest));
- emit_insn (gen_fixuns_trunc<SFDF:mode>di2 (di_dest, src));
- }
- else
- {
- rtx tmp = operands[2];
- rtx tmp2 = gen_rtx_REG (<QHI:MODE>mode, REGNO (tmp));
-
- emit_insn (gen_fixuns_trunc<SFDF:mode>di2 (tmp, src));
- emit_move_insn (dest, tmp2);
- }
- DONE;
-})
-
-;; If -mvsx-small-integer, we can represent the FIX operation directly. On
-;; older machines, we have to use an UNSPEC to produce a SImode and move it
-;; to another location, since SImode is not allowed in vector registers.
-(define_insn "*fctiw<u>z_<mode>_smallint"
- [(set (match_operand:SI 0 "vsx_register_operand" "=d,wi")
- (any_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
- && TARGET_VSX_SMALL_INTEGER"
- "@
- fctiw<u>z %0,%1
- xscvdp<su>xws %x0,%x1"
- [(set_attr "type" "fp")])
-
-;; Combiner pattern to prevent moving the result of converting a floating point
-;; value to 32-bit integer to GPR in order to save it.
-(define_insn_and_split "*fctiw<u>z_<mode>_mem"
- [(set (match_operand:SI 0 "memory_operand" "=Z")
- (any_fix:SI (match_operand:SFDF 1 "gpc_reg_operand" "wa")))
- (clobber (match_scratch:SI 2 "=wa"))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
- && TARGET_VSX_SMALL_INTEGER"
- "#"
- "&& reload_completed"
- [(set (match_dup 2)
- (any_fix:SI (match_dup 1)))
- (set (match_dup 0)
- (match_dup 2))])
-
;; Here, we use (set (reg) (unspec:DI [(fix:SI ...)] UNSPEC_FCTIWZ))
;; rather than (set (subreg:SI (reg)) (fix:SI ...))
;; because the first makes it clear that operand 0 is not live
@@ -10662,27 +10626,33 @@
(define_insn "load_toc_v4_PIC_2"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
- (minus:SI (match_operand:SI 2 "immediate_operand" "s")
- (match_operand:SI 3 "immediate_operand" "s")))))]
+ (mem:SI (plus:SI
+ (match_operand:SI 1 "gpc_reg_operand" "b")
+ (const
+ (minus:SI (match_operand:SI 2 "immediate_operand" "s")
+ (match_operand:SI 3 "immediate_operand" "s"))))))]
"TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
"lwz %0,%2-%3(%1)"
[(set_attr "type" "load")])
(define_insn "load_toc_v4_PIC_3b"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
- (high:SI
- (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
- (match_operand:SI 3 "symbol_ref_operand" "s")))))]
+ (plus:SI
+ (match_operand:SI 1 "gpc_reg_operand" "b")
+ (high:SI
+ (const
+ (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
+ (match_operand:SI 3 "symbol_ref_operand" "s"))))))]
"TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
"addis %0,%1,%2-%3@ha")
(define_insn "load_toc_v4_PIC_3c"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
- (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
- (match_operand:SI 3 "symbol_ref_operand" "s"))))]
+ (lo_sum:SI
+ (match_operand:SI 1 "gpc_reg_operand" "b")
+ (const
+ (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
+ (match_operand:SI 3 "symbol_ref_operand" "s")))))]
"TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
"addi %0,%1,%2-%3@l")
@@ -10996,10 +10966,35 @@
else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn ("creqv 6,6,6", operands);
- return "b%T0l";
+ if (rs6000_speculate_indirect_jumps
+ || which_alternative == 1 || which_alternative == 3)
+ return "b%T0l";
+ else
+ return "crset 2\;beq%T0l-";
}
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
- (set_attr "length" "4,4,8,8")])
+ (set (attr "length")
+ (cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 0))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "8")
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "12")
+ (eq (symbol_ref "which_alternative") (const_int 3))
+ (const_string "8")]
+ (const_string "4")))])
(define_insn_and_split "*call_nonlocal_sysv<mode>"
[(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
@@ -11084,10 +11079,35 @@
else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
output_asm_insn ("creqv 6,6,6", operands);
- return "b%T1l";
+ if (rs6000_speculate_indirect_jumps
+ || which_alternative == 1 || which_alternative == 3)
+ return "b%T1l";
+ else
+ return "crset 2\;beq%T1l-";
}
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
- (set_attr "length" "4,4,8,8")])
+ (set (attr "length")
+ (cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 0))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "8")
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "12")
+ (eq (symbol_ref "which_alternative") (const_int 3))
+ (const_string "8")]
+ (const_string "4")))])
(define_insn_and_split "*call_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
@@ -11212,11 +11232,22 @@
(use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
(set (reg:P TOC_REGNUM) (unspec [(match_operand:P 3 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX"
+ "DEFAULT_ABI == ABI_AIX && rs6000_speculate_indirect_jumps"
"<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
+(define_insn "*call_indirect_aix<mode>_nospec"
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
+ (match_operand 1 "" "g,g"))
+ (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 3 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
+ (clobber (reg:P LR_REGNO))]
+ "DEFAULT_ABI == ABI_AIX && !rs6000_speculate_indirect_jumps"
+ "crset 2\;<ptrload> 2,%2\;beq%T0l-\;<ptrload> 2,%3(1)"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "16")])
+
(define_insn "*call_value_indirect_aix<mode>"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
@@ -11224,11 +11255,23 @@
(use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
(set (reg:P TOC_REGNUM) (unspec [(match_operand:P 4 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_AIX"
+ "DEFAULT_ABI == ABI_AIX && rs6000_speculate_indirect_jumps"
"<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "12")])
+(define_insn "*call_value_indirect_aix<mode>_nospec"
+ [(set (match_operand 0 "" "")
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
+ (match_operand 2 "" "g,g")))
+ (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 4 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
+ (clobber (reg:P LR_REGNO))]
+ "DEFAULT_ABI == ABI_AIX && !rs6000_speculate_indirect_jumps"
+ "crset 2\;<ptrload> 2,%3\;beq%T1l-\;<ptrload> 2,%4(1)"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "16")])
+
;; Call to indirect functions with the ELFv2 ABI.
;; Operand0 is the addresss of the function to call
;; Operand2 is the offset of the stack location holding the current TOC pointer
@@ -11238,22 +11281,44 @@
(match_operand 1 "" "g,g"))
(set (reg:P TOC_REGNUM) (unspec [(match_operand:P 2 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_ELFv2"
+ "DEFAULT_ABI == ABI_ELFv2 && rs6000_speculate_indirect_jumps"
"b%T0l\;<ptrload> 2,%2(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
+;; Variant with deliberate misprediction.
+(define_insn "*call_indirect_elfv2<mode>_nospec"
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
+ (match_operand 1 "" "g,g"))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 2 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
+ (clobber (reg:P LR_REGNO))]
+ "DEFAULT_ABI == ABI_ELFv2 && !rs6000_speculate_indirect_jumps"
+ "crset 2\;beq%T0l-\;<ptrload> 2,%2(1)"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
(define_insn "*call_value_indirect_elfv2<mode>"
[(set (match_operand 0 "" "")
(call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
(match_operand 2 "" "g,g")))
(set (reg:P TOC_REGNUM) (unspec [(match_operand:P 3 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
(clobber (reg:P LR_REGNO))]
- "DEFAULT_ABI == ABI_ELFv2"
+ "DEFAULT_ABI == ABI_ELFv2 && rs6000_speculate_indirect_jumps"
"b%T1l\;<ptrload> 2,%3(1)"
[(set_attr "type" "jmpreg")
(set_attr "length" "8")])
+; Variant with deliberate misprediction.
+(define_insn "*call_value_indirect_elfv2<mode>_nospec"
+ [(set (match_operand 0 "" "")
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
+ (match_operand 2 "" "g,g")))
+ (set (reg:P TOC_REGNUM) (unspec:P [(match_operand:P 3 "const_int_operand" "n,n")] UNSPEC_TOCSLOT))
+ (clobber (reg:P LR_REGNO))]
+ "DEFAULT_ABI == ABI_ELFv2 && !rs6000_speculate_indirect_jumps"
+ "crset 2\;beq%T1l-\;<ptrload> 2,%3(1)"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
;; Call subroutine returning any type.
(define_expand "untyped_call"
@@ -11430,7 +11495,13 @@
output_asm_insn (\"creqv 6,6,6\", operands);
if (which_alternative >= 2)
- return \"b%T0\";
+ {
+ if (rs6000_speculate_indirect_jumps)
+ return \"b%T0\";
+ else
+ /* Can use CR0 since it is volatile across sibcalls. */
+ return \"crset 2\;beq%T0-\;b $\";
+ }
else if (DEFAULT_ABI == ABI_V4 && flag_pic)
{
gcc_assert (!TARGET_SECURE_PLT);
@@ -11440,7 +11511,28 @@
return \"b %z0\";
}"
[(set_attr "type" "branch")
- (set_attr "length" "4,8,4,8")])
+ (set (attr "length")
+ (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+ (const_string "4")
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "12")
+ (and (eq (symbol_ref "which_alternative") (const_int 3))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 3))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "16")]
+ (const_string "4")))])
(define_insn "*sibcall_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
@@ -11460,7 +11552,13 @@
output_asm_insn (\"creqv 6,6,6\", operands);
if (which_alternative >= 2)
- return \"b%T1\";
+ {
+ if (rs6000_speculate_indirect_jumps)
+ return \"b%T1\";
+ else
+ /* Can use CR0 since it is volatile across sibcalls. */
+ return \"crset 2\;beq%T1-\;b $\";
+ }
else if (DEFAULT_ABI == ABI_V4 && flag_pic)
{
gcc_assert (!TARGET_SECURE_PLT);
@@ -11470,7 +11568,28 @@
return \"b %z1\";
}"
[(set_attr "type" "branch")
- (set_attr "length" "4,8,4,8")])
+ (set (attr "length")
+ (cond [(eq (symbol_ref "which_alternative") (const_int 0))
+ (const_string "4")
+ (eq (symbol_ref "which_alternative") (const_int 1))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "4")
+ (and (eq (symbol_ref "which_alternative") (const_int 2))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "12")
+ (and (eq (symbol_ref "which_alternative") (const_int 3))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 1)))
+ (const_string "8")
+ (and (eq (symbol_ref "which_alternative") (const_int 3))
+ (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0)))
+ (const_string "16")]
+ (const_string "4")))])
;; AIX ABI sibling call patterns.
@@ -12846,16 +12965,35 @@
[(set_attr "type" "jmpreg")])
(define_expand "indirect_jump"
- [(set (pc) (match_operand 0 "register_operand" ""))])
+ [(set (pc) (match_operand 0 "register_operand"))]
+ ""
+{
+ if (!rs6000_speculate_indirect_jumps) {
+ rtx ccreg = gen_reg_rtx (CCmode);
+ if (Pmode == DImode)
+ emit_jump_insn (gen_indirect_jumpdi_nospec (operands[0], ccreg));
+ else
+ emit_jump_insn (gen_indirect_jumpsi_nospec (operands[0], ccreg));
+ DONE;
+ }
+})
(define_insn "*indirect_jump<mode>"
[(set (pc) (match_operand:P 0 "register_operand" "c,*l"))]
- ""
+ "rs6000_speculate_indirect_jumps"
"@
bctr
blr"
[(set_attr "type" "jmpreg")])
+(define_insn "indirect_jump<mode>_nospec"
+ [(set (pc) (match_operand:P 0 "register_operand" "c,*l"))
+ (clobber (match_operand:CC 1 "cc_reg_operand" "=y,y"))]
+ "!rs6000_speculate_indirect_jumps"
+ "crset %E1\;beq%T0- %1\;b $"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
;; Table jump for switch statements:
(define_expand "tablejump"
[(use (match_operand 0 "" ""))
@@ -12863,10 +13001,23 @@
""
"
{
- if (TARGET_32BIT)
- emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
+ if (rs6000_speculate_indirect_jumps)
+ {
+ if (TARGET_32BIT)
+ emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
+ else
+ emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
+ }
else
- emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
+ {
+ rtx ccreg = gen_reg_rtx (CCmode);
+ rtx jump;
+ if (TARGET_32BIT)
+ jump = gen_tablejumpsi_nospec (operands[0], operands[1], ccreg);
+ else
+ jump = gen_tablejumpdi_nospec (operands[0], operands[1], ccreg);
+ emit_jump_insn (jump);
+ }
DONE;
}")
@@ -12876,13 +13027,28 @@
(match_dup 2)))
(parallel [(set (pc) (match_dup 3))
(use (label_ref (match_operand 1 "" "")))])]
- "TARGET_32BIT"
+ "TARGET_32BIT && rs6000_speculate_indirect_jumps"
"
{ operands[0] = force_reg (SImode, operands[0]);
operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
operands[3] = gen_reg_rtx (SImode);
}")
+(define_expand "tablejumpsi_nospec"
+ [(set (match_dup 4)
+ (plus:SI (match_operand:SI 0)
+ (match_dup 3)))
+ (parallel [(set (pc)
+ (match_dup 4))
+ (use (label_ref (match_operand 1)))
+ (clobber (match_operand 2))])]
+ "TARGET_32BIT && !rs6000_speculate_indirect_jumps"
+{
+ operands[0] = force_reg (SImode, operands[0]);
+ operands[3] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
+ operands[4] = gen_reg_rtx (SImode);
+})
+
(define_expand "tablejumpdi"
[(set (match_dup 4)
(sign_extend:DI (match_operand:SI 0 "lwa_operand" "")))
@@ -12891,23 +13057,50 @@
(match_dup 2)))
(parallel [(set (pc) (match_dup 3))
(use (label_ref (match_operand 1 "" "")))])]
- "TARGET_64BIT"
+ "TARGET_64BIT && rs6000_speculate_indirect_jumps"
"
{ operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
operands[3] = gen_reg_rtx (DImode);
operands[4] = gen_reg_rtx (DImode);
}")
+(define_expand "tablejumpdi_nospec"
+ [(set (match_dup 5)
+ (sign_extend:DI (match_operand:SI 0 "lwa_operand")))
+ (set (match_dup 4)
+ (plus:DI (match_dup 5)
+ (match_dup 3)))
+ (parallel [(set (pc)
+ (match_dup 4))
+ (use (label_ref (match_operand 1)))
+ (clobber (match_operand 2))])]
+ "TARGET_64BIT && !rs6000_speculate_indirect_jumps"
+{
+ operands[3] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
+ operands[4] = gen_reg_rtx (DImode);
+ operands[5] = gen_reg_rtx (DImode);
+})
+
(define_insn "*tablejump<mode>_internal1"
[(set (pc)
(match_operand:P 0 "register_operand" "c,*l"))
(use (label_ref (match_operand 1 "" "")))]
- ""
+ "rs6000_speculate_indirect_jumps"
"@
bctr
blr"
[(set_attr "type" "jmpreg")])
+(define_insn "*tablejump<mode>_internal1_nospec"
+ [(set (pc)
+ (match_operand:P 0 "register_operand" "c,*l"))
+ (use (label_ref (match_operand 1)))
+ (clobber (match_operand:CC 2 "cc_reg_operand" "=y,y"))]
+ "!rs6000_speculate_indirect_jumps"
+ "crset %E2\;beq%T0- %2\;b $"
+ [(set_attr "type" "jmpreg")
+ (set_attr "length" "12")])
+
(define_insn "nop"
[(unspec [(const_int 0)] UNSPEC_NOP)]
""
@@ -14574,49 +14767,45 @@
(set_attr "length" "8")])
;; Conversion between IEEE 128-bit and integer types
-(define_insn "fix_<mode>di2_hw"
- [(set (match_operand:DI 0 "altivec_register_operand" "=v")
- (fix:DI (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
- "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
- "xscvqpsdz %0,%1"
- [(set_attr "type" "vecfloat")
- (set_attr "size" "128")])
-(define_insn "fixuns_<mode>di2_hw"
- [(set (match_operand:DI 0 "altivec_register_operand" "=v")
- (unsigned_fix:DI (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
- "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
- "xscvqpudz %0,%1"
- [(set_attr "type" "vecfloat")
- (set_attr "size" "128")])
-
-(define_insn "fix_<mode>si2_hw"
- [(set (match_operand:SI 0 "altivec_register_operand" "=v")
- (fix:SI (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
- "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
- "xscvqpswz %0,%1"
+;; The fix function for DImode and SImode was declared earlier as a
+;; define_expand. It calls into rs6000_expand_float128_convert if we don't
+;; have IEEE 128-bit hardware support. QImode and HImode are not provided
+;; unless we have the IEEE 128-bit hardware.
+;;
+;; Unlike the code for converting SFmode/DFmode to QImode/HImode, we don't have
+;; to provide a GPR target that used direct move and a conversion in the GPR
+;; which works around QImode/HImode not being allowed in vector registers in
+;; ISA 2.07 (power8).
+(define_insn "fix<uns>_<IEEE128:mode><SDI:mode>2_hw"
+ [(set (match_operand:SDI 0 "altivec_register_operand" "=v")
+ (any_fix:SDI (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
+ "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<IEEE128:MODE>mode)"
+ "xscvqp<su><wd>z %0,%1"
[(set_attr "type" "vecfloat")
(set_attr "size" "128")])
-(define_insn "fixuns_<mode>si2_hw"
- [(set (match_operand:SI 0 "altivec_register_operand" "=v")
- (unsigned_fix:SI (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
- "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
- "xscvqpuwz %0,%1"
+(define_insn "fix<uns>_trunc<IEEE128:mode><QHI:mode>2"
+ [(set (match_operand:QHI 0 "altivec_register_operand" "=v")
+ (any_fix:QHI
+ (match_operand:IEEE128 1 "altivec_register_operand" "v")))]
+ "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<IEEE128:MODE>mode)"
+ "xscvqp<su>wz %0,%1"
[(set_attr "type" "vecfloat")
(set_attr "size" "128")])
-;; Combiner pattern to prevent moving the result of converting an IEEE 128-bit
-;; floating point value to 32-bit integer to GPR in order to save it.
-(define_insn_and_split "*fix<uns>_<mode>_mem"
- [(set (match_operand:SI 0 "memory_operand" "=Z")
- (any_fix:SI (match_operand:IEEE128 1 "altivec_register_operand" "v")))
- (clobber (match_scratch:SI 2 "=v"))]
+;; Combiner patterns to prevent moving the result of converting an IEEE 128-bit
+;; floating point value to 8/16/32-bit integer to GPR in order to save it.
+(define_insn_and_split "*fix<uns>_trunc<IEEE128:mode><QHSI:mode>2_mem"
+ [(set (match_operand:QHSI 0 "memory_operand" "=Z")
+ (any_fix:QHSI
+ (match_operand:IEEE128 1 "altivec_register_operand" "v")))
+ (clobber (match_scratch:QHSI 2 "=v"))]
"TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
"#"
"&& reload_completed"
[(set (match_dup 2)
- (any_fix:SI (match_dup 1)))
+ (any_fix:QHSI (match_dup 1)))
(set (match_dup 0)
(match_dup 2))])
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index a232d5749be..ce0210a5533 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -700,3 +700,8 @@ Use the given offset for addressing the stack-protector guard.
TargetVariable
long rs6000_stack_protector_guard_offset = 0
+
+;; -mno-speculate-indirect-jumps adds deliberate misprediction to indirect
+;; branches via the CTR.
+mspeculate-indirect-jumps
+Target Undocumented Var(rs6000_speculate_indirect_jumps) Init(1) Save
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 449574b893c..e63ed24476a 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -385,7 +385,7 @@
;; VSX moves so they match first.
(define_insn_and_split "*vsx_le_perm_load_<mode>"
[(set (match_operand:VSX_D 0 "vsx_register_operand" "=<VSa>")
- (match_operand:VSX_D 1 "memory_operand" "Z"))]
+ (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
@@ -408,7 +408,7 @@
(define_insn_and_split "*vsx_le_perm_load_<mode>"
[(set (match_operand:VSX_W 0 "vsx_register_operand" "=<VSa>")
- (match_operand:VSX_W 1 "memory_operand" "Z"))]
+ (match_operand:VSX_W 1 "indexed_or_indirect_operand" "Z"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
@@ -433,7 +433,7 @@
(define_insn_and_split "*vsx_le_perm_load_v8hi"
[(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
- (match_operand:V8HI 1 "memory_operand" "Z"))]
+ (match_operand:V8HI 1 "indexed_or_indirect_operand" "Z"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
@@ -462,7 +462,7 @@
(define_insn_and_split "*vsx_le_perm_load_v16qi"
[(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
- (match_operand:V16QI 1 "memory_operand" "Z"))]
+ (match_operand:V16QI 1 "indexed_or_indirect_operand" "Z"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
@@ -498,7 +498,7 @@
(set_attr "length" "8")])
(define_insn "*vsx_le_perm_store_<mode>"
- [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
+ [(set (match_operand:VSX_D 0 "indexed_or_indirect_operand" "=Z")
(match_operand:VSX_D 1 "vsx_register_operand" "+<VSa>"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
@@ -506,7 +506,7 @@
(set_attr "length" "12")])
(define_split
- [(set (match_operand:VSX_D 0 "memory_operand" "")
+ [(set (match_operand:VSX_D 0 "indexed_or_indirect_operand" "")
(match_operand:VSX_D 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && !reload_completed"
[(set (match_dup 2)
@@ -525,7 +525,7 @@
;; The post-reload split requires that we re-permute the source
;; register in case it is still live.
(define_split
- [(set (match_operand:VSX_D 0 "memory_operand" "")
+ [(set (match_operand:VSX_D 0 "indexed_or_indirect_operand" "")
(match_operand:VSX_D 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && reload_completed"
[(set (match_dup 1)
@@ -543,7 +543,7 @@
"")
(define_insn "*vsx_le_perm_store_<mode>"
- [(set (match_operand:VSX_W 0 "memory_operand" "=Z")
+ [(set (match_operand:VSX_W 0 "indexed_or_indirect_operand" "=Z")
(match_operand:VSX_W 1 "vsx_register_operand" "+<VSa>"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
@@ -551,7 +551,7 @@
(set_attr "length" "12")])
(define_split
- [(set (match_operand:VSX_W 0 "memory_operand" "")
+ [(set (match_operand:VSX_W 0 "indexed_or_indirect_operand" "")
(match_operand:VSX_W 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && !reload_completed"
[(set (match_dup 2)
@@ -572,7 +572,7 @@
;; The post-reload split requires that we re-permute the source
;; register in case it is still live.
(define_split
- [(set (match_operand:VSX_W 0 "memory_operand" "")
+ [(set (match_operand:VSX_W 0 "indexed_or_indirect_operand" "")
(match_operand:VSX_W 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && reload_completed"
[(set (match_dup 1)
@@ -593,7 +593,7 @@
"")
(define_insn "*vsx_le_perm_store_v8hi"
- [(set (match_operand:V8HI 0 "memory_operand" "=Z")
+ [(set (match_operand:V8HI 0 "indexed_or_indirect_operand" "=Z")
(match_operand:V8HI 1 "vsx_register_operand" "+wa"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
@@ -601,7 +601,7 @@
(set_attr "length" "12")])
(define_split
- [(set (match_operand:V8HI 0 "memory_operand" "")
+ [(set (match_operand:V8HI 0 "indexed_or_indirect_operand" "")
(match_operand:V8HI 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && !reload_completed"
[(set (match_dup 2)
@@ -626,7 +626,7 @@
;; The post-reload split requires that we re-permute the source
;; register in case it is still live.
(define_split
- [(set (match_operand:V8HI 0 "memory_operand" "")
+ [(set (match_operand:V8HI 0 "indexed_or_indirect_operand" "")
(match_operand:V8HI 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && reload_completed"
[(set (match_dup 1)
@@ -653,7 +653,7 @@
"")
(define_insn "*vsx_le_perm_store_v16qi"
- [(set (match_operand:V16QI 0 "memory_operand" "=Z")
+ [(set (match_operand:V16QI 0 "indexed_or_indirect_operand" "=Z")
(match_operand:V16QI 1 "vsx_register_operand" "+wa"))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR"
"#"
@@ -661,7 +661,7 @@
(set_attr "length" "12")])
(define_split
- [(set (match_operand:V16QI 0 "memory_operand" "")
+ [(set (match_operand:V16QI 0 "indexed_or_indirect_operand" "")
(match_operand:V16QI 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && !reload_completed"
[(set (match_dup 2)
@@ -694,7 +694,7 @@
;; The post-reload split requires that we re-permute the source
;; register in case it is still live.
(define_split
- [(set (match_operand:V16QI 0 "memory_operand" "")
+ [(set (match_operand:V16QI 0 "indexed_or_indirect_operand" "")
(match_operand:V16QI 1 "vsx_register_operand" ""))]
"!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && reload_completed"
[(set (match_dup 1)
@@ -4084,46 +4084,21 @@
;; Vector insert/extract word at arbitrary byte values. Note, the little
;; endian version needs to adjust the byte number, and the V4SI element in
-;; vinsert4b.
-(define_expand "vextract4b"
- [(set (match_operand:DI 0 "gpc_reg_operand")
- (unspec:DI [(match_operand:V16QI 1 "vsx_register_operand")
- (match_operand:QI 2 "const_0_to_12_operand")]
- UNSPEC_XXEXTRACTUW))]
+;; insert4b.
+(define_insn "extract4b"
+ [(set (match_operand:V2DI 0 "vsx_register_operand")
+ (unspec:V2DI [(match_operand:V16QI 1 "vsx_register_operand" "wa")
+ (match_operand:QI 2 "const_0_to_12_operand" "n")]
+ UNSPEC_XXEXTRACTUW))]
"TARGET_P9_VECTOR"
{
if (!VECTOR_ELT_ORDER_BIG)
operands[2] = GEN_INT (12 - INTVAL (operands[2]));
-})
-
-(define_insn_and_split "*vextract4b_internal"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=wj,r")
- (unspec:DI [(match_operand:V16QI 1 "vsx_register_operand" "wa,v")
- (match_operand:QI 2 "const_0_to_12_operand" "n,n")]
- UNSPEC_XXEXTRACTUW))]
- "TARGET_P9_VECTOR"
- "@
- xxextractuw %x0,%x1,%2
- #"
- "&& reload_completed && int_reg_operand (operands[0], DImode)"
- [(const_int 0)]
-{
- rtx op0 = operands[0];
- rtx op1 = operands[1];
- rtx op2 = operands[2];
- rtx op0_si = gen_rtx_REG (SImode, REGNO (op0));
- rtx op1_v4si = gen_rtx_REG (V4SImode, REGNO (op1));
- emit_move_insn (op0, op2);
- if (VECTOR_ELT_ORDER_BIG)
- emit_insn (gen_vextuwlx (op0_si, op0_si, op1_v4si));
- else
- emit_insn (gen_vextuwrx (op0_si, op0_si, op1_v4si));
- DONE;
-}
- [(set_attr "type" "vecperm")])
+ return "xxextractuw %x0,%x1,%2";
+})
-(define_expand "vinsert4b"
+(define_expand "insert4b"
[(set (match_operand:V16QI 0 "vsx_register_operand")
(unspec:V16QI [(match_operand:V4SI 1 "vsx_register_operand")
(match_operand:V16QI 2 "vsx_register_operand")
@@ -4141,7 +4116,7 @@
}
})
-(define_insn "*vinsert4b_internal"
+(define_insn "*insert4b_internal"
[(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
(unspec:V16QI [(match_operand:V4SI 1 "vsx_register_operand" "wa")
(match_operand:V16QI 2 "vsx_register_operand" "0")
@@ -4151,26 +4126,42 @@
"xxinsertw %x0,%x1,%3"
[(set_attr "type" "vecperm")])
-(define_expand "vinsert4b_di"
- [(set (match_operand:V16QI 0 "vsx_register_operand")
- (unspec:V16QI [(match_operand:DI 1 "vsx_register_operand")
- (match_operand:V16QI 2 "vsx_register_operand")
- (match_operand:QI 3 "const_0_to_12_operand")]
- UNSPEC_XXINSERTW))]
+(define_expand "vextract4b"
+ [(set (match_operand:DI 0 "gpc_reg_operand")
+ (unspec:DI [(match_operand:V16QI 1 "vsx_register_operand")
+ (match_operand:QI 2 "const_0_to_12_operand")]
+ UNSPEC_XXEXTRACTUW))]
"TARGET_P9_VECTOR"
{
if (!VECTOR_ELT_ORDER_BIG)
- operands[3] = GEN_INT (12 - INTVAL (operands[3]));
+ operands[2] = GEN_INT (12 - INTVAL (operands[2]));
})
-(define_insn "*vinsert4b_di_internal"
- [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
- (unspec:V16QI [(match_operand:DI 1 "vsx_register_operand" "wj")
- (match_operand:V16QI 2 "vsx_register_operand" "0")
- (match_operand:QI 3 "const_0_to_12_operand" "n")]
- UNSPEC_XXINSERTW))]
+(define_insn_and_split "*vextract4b_internal"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=wj,r")
+ (unspec:DI [(match_operand:V16QI 1 "vsx_register_operand" "wa,v")
+ (match_operand:QI 2 "const_0_to_12_operand" "n,n")]
+ UNSPEC_XXEXTRACTUW))]
"TARGET_P9_VECTOR"
- "xxinsertw %x0,%x1,%3"
+ "@
+ xxextractuw %x0,%x1,%2
+ #"
+ "&& reload_completed && int_reg_operand (operands[0], DImode)"
+ [(const_int 0)]
+{
+ rtx op0 = operands[0];
+ rtx op1 = operands[1];
+ rtx op2 = operands[2];
+ rtx op0_si = gen_rtx_REG (SImode, REGNO (op0));
+ rtx op1_v4si = gen_rtx_REG (V4SImode, REGNO (op1));
+
+ emit_move_insn (op0, op2);
+ if (VECTOR_ELT_ORDER_BIG)
+ emit_insn (gen_vextuwlx (op0_si, op0_si, op1_v4si));
+ else
+ emit_insn (gen_vextuwrx (op0_si, op0_si, op1_v4si));
+ DONE;
+}
[(set_attr "type" "vecperm")])
diff --git a/gcc/config/s390/s390-opts.h b/gcc/config/s390/s390-opts.h
index 6d506e2c9e3..6ec891e877d 100644
--- a/gcc/config/s390/s390-opts.h
+++ b/gcc/config/s390/s390-opts.h
@@ -43,4 +43,13 @@ enum processor_type
PROCESSOR_max
};
+
+/* Values for -mindirect-branch and -mfunction-return options. */
+enum indirect_branch {
+ indirect_branch_unset = 0,
+ indirect_branch_keep,
+ indirect_branch_thunk,
+ indirect_branch_thunk_inline,
+ indirect_branch_thunk_extern
+};
#endif
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 3fdb32059cd..3fb3268c306 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -53,6 +53,7 @@ extern int s390_class_max_nregs (enum reg_class, machine_mode);
extern int s390_cannot_change_mode_class (machine_mode, machine_mode,
enum reg_class);
extern bool s390_function_arg_vector (machine_mode, const_tree);
+extern bool s390_return_addr_from_memory(void);
#if S390_USE_TARGET_ATTRIBUTE
extern tree s390_valid_target_attribute_tree (tree args,
struct gcc_options *opts,
@@ -147,6 +148,17 @@ extern int s390_compare_and_branch_condition_mask (rtx);
extern bool s390_extzv_shift_ok (int, int, unsigned HOST_WIDE_INT);
extern void s390_asm_output_function_label (FILE *, const char *, tree);
+enum s390_indirect_branch_type
+ {
+ s390_indirect_branch_type_jump = 0,
+ s390_indirect_branch_type_call,
+ s390_indirect_branch_type_return
+ };
+extern void s390_indirect_branch_via_thunk (unsigned int regno,
+ unsigned int return_addr_regno,
+ rtx comparison_operator,
+ enum s390_indirect_branch_type type);
+extern void s390_indirect_branch_via_inline_thunk (rtx execute_target);
#endif /* RTX_CODE */
/* s390-c.c routines */
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index c408d59efd2..bc8e71a883d 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -377,84 +377,6 @@ struct s390_address
bool literal_pool;
};
-/* The following structure is embedded in the machine
- specific part of struct function. */
-
-struct GTY (()) s390_frame_layout
-{
- /* Offset within stack frame. */
- HOST_WIDE_INT gprs_offset;
- HOST_WIDE_INT f0_offset;
- HOST_WIDE_INT f4_offset;
- HOST_WIDE_INT f8_offset;
- HOST_WIDE_INT backchain_offset;
-
- /* Number of first and last gpr where slots in the register
- save area are reserved for. */
- int first_save_gpr_slot;
- int last_save_gpr_slot;
-
- /* Location (FP register number) where GPRs (r0-r15) should
- be saved to.
- 0 - does not need to be saved at all
- -1 - stack slot */
-#define SAVE_SLOT_NONE 0
-#define SAVE_SLOT_STACK -1
- signed char gpr_save_slots[16];
-
- /* Number of first and last gpr to be saved, restored. */
- int first_save_gpr;
- int first_restore_gpr;
- int last_save_gpr;
- int last_restore_gpr;
-
- /* Bits standing for floating point registers. Set, if the
- respective register has to be saved. Starting with reg 16 (f0)
- at the rightmost bit.
- Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- fpr 15 13 11 9 14 12 10 8 7 5 3 1 6 4 2 0
- reg 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 */
- unsigned int fpr_bitmap;
-
- /* Number of floating point registers f8-f15 which must be saved. */
- int high_fprs;
-
- /* Set if return address needs to be saved.
- This flag is set by s390_return_addr_rtx if it could not use
- the initial value of r14 and therefore depends on r14 saved
- to the stack. */
- bool save_return_addr_p;
-
- /* Size of stack frame. */
- HOST_WIDE_INT frame_size;
-};
-
-/* Define the structure for the machine field in struct function. */
-
-struct GTY(()) machine_function
-{
- struct s390_frame_layout frame_layout;
-
- /* Literal pool base register. */
- rtx base_reg;
-
- /* True if we may need to perform branch splitting. */
- bool split_branches_pending_p;
-
- bool has_landing_pad_p;
-
- /* True if the current function may contain a tbegin clobbering
- FPRs. */
- bool tbegin_p;
-
- /* For -fsplit-stack support: A stack local which holds a pointer to
- the stack arguments for a function with a variable number of
- arguments. This is set at the start of the function and is used
- to initialize the overflow_arg_area field of the va_list
- structure. */
- rtx split_stack_varargs_pointer;
-};
-
/* Few accessor macros for struct cfun->machine->s390_frame_layout. */
#define cfun_frame_layout (cfun->machine->frame_layout)
@@ -495,6 +417,33 @@ struct GTY(()) machine_function
bytes on a z10 (or higher) CPU. */
#define PREDICT_DISTANCE (TARGET_Z10 ? 384 : 2048)
+/* Masks per jump target register indicating which thunk need to be
+ generated. */
+static GTY(()) int indirect_branch_prez10thunk_mask = 0;
+static GTY(()) int indirect_branch_z10thunk_mask = 0;
+
+#define INDIRECT_BRANCH_NUM_OPTIONS 4
+
+enum s390_indirect_branch_option
+ {
+ s390_opt_indirect_branch_jump = 0,
+ s390_opt_indirect_branch_call,
+ s390_opt_function_return_reg,
+ s390_opt_function_return_mem
+ };
+
+static GTY(()) int indirect_branch_table_label_no[INDIRECT_BRANCH_NUM_OPTIONS] = { 0 };
+const char *indirect_branch_table_label[INDIRECT_BRANCH_NUM_OPTIONS] = \
+ { "LJUMP", "LCALL", "LRETREG", "LRETMEM" };
+const char *indirect_branch_table_name[INDIRECT_BRANCH_NUM_OPTIONS] = \
+ { ".s390_indirect_jump", ".s390_indirect_call",
+ ".s390_return_reg", ".s390_return_mem" };
+
+bool
+s390_return_addr_from_memory ()
+{
+ return cfun_gpr_save_slot(RETURN_REGNUM) == SAVE_SLOT_STACK;
+}
/* Indicate which ABI has been used for passing vector args.
0 - no vector type arguments have been passed where the ABI is relevant
@@ -1148,9 +1097,83 @@ s390_handle_vectorbool_attribute (tree *node, tree name ATTRIBUTE_UNUSED,
return NULL_TREE;
}
+/* Check syntax of function decl attributes having a string type value. */
+
+static tree
+s390_handle_string_attribute (tree *node, tree name ATTRIBUTE_UNUSED,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs)
+{
+ tree cst;
+
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute only applies to functions",
+ name);
+ *no_add_attrs = true;
+ }
+
+ cst = TREE_VALUE (args);
+
+ if (TREE_CODE (cst) != STRING_CST)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute requires a string constant argument",
+ name);
+ *no_add_attrs = true;
+ }
+
+ if (is_attribute_p ("indirect_branch", name)
+ || is_attribute_p ("indirect_branch_call", name)
+ || is_attribute_p ("function_return", name)
+ || is_attribute_p ("function_return_reg", name)
+ || is_attribute_p ("function_return_mem", name))
+ {
+ if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
+ {
+ warning (OPT_Wattributes,
+ "argument to %qE attribute is not "
+ "(keep|thunk|thunk-extern)", name);
+ *no_add_attrs = true;
+ }
+ }
+
+ if (is_attribute_p ("indirect_branch_jump", name)
+ && strcmp (TREE_STRING_POINTER (cst), "keep") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
+ {
+ warning (OPT_Wattributes,
+ "argument to %qE attribute is not "
+ "(keep|thunk|thunk-inline|thunk-extern)", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
static const struct attribute_spec s390_attribute_table[] = {
- { "hotpatch", 2, 2, true, false, false, s390_handle_hotpatch_attribute, false },
- { "s390_vector_bool", 0, 0, false, true, false, s390_handle_vectorbool_attribute, true },
+ { "hotpatch", 2, 2, true, false, false,
+ s390_handle_hotpatch_attribute, false },
+ { "s390_vector_bool", 0, 0, false, true, false,
+ s390_handle_vectorbool_attribute, true },
+ { "indirect_branch", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+ { "indirect_branch_jump", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+ { "indirect_branch_call", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+ { "function_return", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+ { "function_return_reg", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+ { "function_return_mem", 1, 1, true, false, false,
+ s390_handle_string_attribute, false },
+
/* End element. */
{ NULL, 0, 0, false, false, false, NULL, false }
};
@@ -8583,11 +8606,25 @@ s390_find_constant (struct constant_pool *pool, rtx val,
static rtx
s390_execute_label (rtx insn)
{
- if (NONJUMP_INSN_P (insn)
+ if (INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == PARALLEL
&& GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == UNSPEC
- && XINT (XVECEXP (PATTERN (insn), 0, 0), 1) == UNSPEC_EXECUTE)
- return XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 2);
+ && (XINT (XVECEXP (PATTERN (insn), 0, 0), 1) == UNSPEC_EXECUTE
+ || XINT (XVECEXP (PATTERN (insn), 0, 0), 1) == UNSPEC_EXECUTE_JUMP))
+ {
+ if (XINT (XVECEXP (PATTERN (insn), 0, 0), 1) == UNSPEC_EXECUTE)
+ return XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 2);
+ else
+ {
+ gcc_assert (JUMP_P (insn));
+ /* For jump insns as execute target:
+ - There is one operand less in the parallel (the
+ modification register of the execute is always 0).
+ - The execute target label is wrapped into an
+ if_then_else in order to hide it from jump analysis. */
+ return XEXP (XVECEXP (XVECEXP (PATTERN (insn), 0, 0), 0, 0), 0);
+ }
+ }
return NULL_RTX;
}
@@ -11273,7 +11310,6 @@ s390_emit_epilogue (bool sibcall)
rtx frame_pointer, return_reg, cfa_restores = NULL_RTX;
int area_bottom, area_top, offset = 0;
int next_offset;
- rtvec p;
int i;
if (TARGET_TPF_PROFILING)
@@ -11427,10 +11463,15 @@ s390_emit_epilogue (bool sibcall)
if (cfun_gpr_save_slot (RETURN_REGNUM) == SAVE_SLOT_STACK)
{
int return_regnum = find_unused_clobbered_reg();
- if (!return_regnum)
- return_regnum = 4;
+ if (!return_regnum
+ || (TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION
+ && !TARGET_CPU_Z10
+ && return_regnum == INDIRECT_BRANCH_THUNK_REGNUM))
+ {
+ gcc_assert (INDIRECT_BRANCH_THUNK_REGNUM != 4);
+ return_regnum = 4;
+ }
return_reg = gen_rtx_REG (Pmode, return_regnum);
-
addr = plus_constant (Pmode, frame_pointer,
offset + cfun_frame_layout.gprs_offset
+ (RETURN_REGNUM
@@ -11466,16 +11507,7 @@ s390_emit_epilogue (bool sibcall)
s390_restore_gprs_from_fprs ();
if (! sibcall)
- {
-
- /* Return to caller. */
-
- p = rtvec_alloc (2);
-
- RTVEC_ELT (p, 0) = ret_rtx;
- RTVEC_ELT (p, 1) = gen_rtx_USE (VOIDmode, return_reg);
- emit_jump_insn (gen_rtx_PARALLEL (VOIDmode, p));
- }
+ emit_jump_insn (gen_return_use (return_reg));
}
/* Implement TARGET_SET_UP_BY_PROLOGUE. */
@@ -13053,6 +13085,112 @@ s390_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
final_end_function ();
}
+/* Output either an indirect jump or a an indirect call
+ (RETURN_ADDR_REGNO != INVALID_REGNUM) with target register REGNO
+ using a branch trampoline disabling branch target prediction. */
+
+void
+s390_indirect_branch_via_thunk (unsigned int regno,
+ unsigned int return_addr_regno,
+ rtx comparison_operator,
+ enum s390_indirect_branch_type type)
+{
+ enum s390_indirect_branch_option option;
+
+ if (type == s390_indirect_branch_type_return)
+ {
+ if (s390_return_addr_from_memory ())
+ option = s390_opt_function_return_mem;
+ else
+ option = s390_opt_function_return_reg;
+ }
+ else if (type == s390_indirect_branch_type_jump)
+ option = s390_opt_indirect_branch_jump;
+ else if (type == s390_indirect_branch_type_call)
+ option = s390_opt_indirect_branch_call;
+ else
+ gcc_unreachable ();
+
+ if (TARGET_INDIRECT_BRANCH_TABLE)
+ {
+ char label[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (label,
+ indirect_branch_table_label[option],
+ indirect_branch_table_label_no[option]++);
+ ASM_OUTPUT_LABEL (asm_out_file, label);
+ }
+
+ if (return_addr_regno != INVALID_REGNUM)
+ {
+ gcc_assert (comparison_operator == NULL_RTX);
+ fprintf (asm_out_file, " \tbrasl\t%%r%d,", return_addr_regno);
+ }
+ else
+ {
+ fputs (" \tjg", asm_out_file);
+ if (comparison_operator != NULL_RTX)
+ print_operand (asm_out_file, comparison_operator, 'C');
+
+ fputs ("\t", asm_out_file);
+ }
+
+ if (TARGET_CPU_Z10)
+ fprintf (asm_out_file,
+ TARGET_INDIRECT_BRANCH_THUNK_NAME_EXRL "\n",
+ regno);
+ else
+ fprintf (asm_out_file,
+ TARGET_INDIRECT_BRANCH_THUNK_NAME_EX "\n",
+ INDIRECT_BRANCH_THUNK_REGNUM, regno);
+
+ if ((option == s390_opt_indirect_branch_jump
+ && cfun->machine->indirect_branch_jump == indirect_branch_thunk)
+ || (option == s390_opt_indirect_branch_call
+ && cfun->machine->indirect_branch_call == indirect_branch_thunk)
+ || (option == s390_opt_function_return_reg
+ && cfun->machine->function_return_reg == indirect_branch_thunk)
+ || (option == s390_opt_function_return_mem
+ && cfun->machine->function_return_mem == indirect_branch_thunk))
+ {
+ if (TARGET_CPU_Z10)
+ indirect_branch_z10thunk_mask |= (1 << regno);
+ else
+ indirect_branch_prez10thunk_mask |= (1 << regno);
+ }
+}
+
+/* Output an inline thunk for indirect jumps. EXECUTE_TARGET can
+ either be an address register or a label pointing to the location
+ of the jump instruction. */
+
+void
+s390_indirect_branch_via_inline_thunk (rtx execute_target)
+{
+ if (TARGET_INDIRECT_BRANCH_TABLE)
+ {
+ char label[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (label,
+ indirect_branch_table_label[s390_opt_indirect_branch_jump],
+ indirect_branch_table_label_no[s390_opt_indirect_branch_jump]++);
+ ASM_OUTPUT_LABEL (asm_out_file, label);
+ }
+
+ if (!TARGET_ZARCH)
+ fputs ("\t.machinemode zarch\n", asm_out_file);
+
+ if (REG_P (execute_target))
+ fprintf (asm_out_file, "\tex\t%%r0,0(%%r%d)\n", REGNO (execute_target));
+ else
+ output_asm_insn ("exrl\t%%r0,%0", &execute_target);
+
+ if (!TARGET_ZARCH)
+ fputs ("\t.machinemode esa\n", asm_out_file);
+
+ fputs ("0:\tj\t0b\n", asm_out_file);
+}
+
static bool
s390_valid_pointer_mode (machine_mode mode)
{
@@ -13158,6 +13296,14 @@ s390_function_ok_for_sibcall (tree decl, tree exp)
if (!TARGET_64BIT && flag_pic && decl && !targetm.binds_local_p (decl))
return false;
+ /* The thunks for indirect branches require r1 if no exrl is
+ available. r1 might not be available when doing a sibling
+ call. */
+ if (TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && !TARGET_CPU_Z10
+ && !decl)
+ return false;
+
/* Register 6 on s390 is available as an argument register but unfortunately
"caller saved". This makes functions needing this register for arguments
not suitable for sibcalls. */
@@ -13191,9 +13337,13 @@ s390_emit_call (rtx addr_location, rtx tls_call, rtx result_reg,
{
bool plt_call = false;
rtx_insn *insn;
- rtx call;
- rtx clobber;
- rtvec vec;
+ rtx vec[4] = { NULL_RTX };
+ int elts = 0;
+ rtx *call = &vec[0];
+ rtx *clobber_ret_reg = &vec[1];
+ rtx *use = &vec[2];
+ rtx *clobber_thunk_reg = &vec[3];
+ int i;
/* Direct function calls need special treatment. */
if (GET_CODE (addr_location) == SYMBOL_REF)
@@ -13245,26 +13395,58 @@ s390_emit_call (rtx addr_location, rtx tls_call, rtx result_reg,
addr_location = gen_rtx_REG (Pmode, SIBCALL_REGNUM);
}
+ if (TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && GET_CODE (addr_location) != SYMBOL_REF
+ && !plt_call)
+ {
+ /* Indirect branch thunks require the target to be a single GPR. */
+ addr_location = force_reg (Pmode, addr_location);
+
+ /* Without exrl the indirect branch thunks need an additional
+ register for larl;ex */
+ if (!TARGET_CPU_Z10)
+ {
+ *clobber_thunk_reg = gen_rtx_REG (Pmode, INDIRECT_BRANCH_THUNK_REGNUM);
+ *clobber_thunk_reg = gen_rtx_CLOBBER (VOIDmode, *clobber_thunk_reg);
+ }
+ }
+
addr_location = gen_rtx_MEM (QImode, addr_location);
- call = gen_rtx_CALL (VOIDmode, addr_location, const0_rtx);
+ *call = gen_rtx_CALL (VOIDmode, addr_location, const0_rtx);
if (result_reg != NULL_RTX)
- call = gen_rtx_SET (result_reg, call);
+ *call = gen_rtx_SET (result_reg, *call);
if (retaddr_reg != NULL_RTX)
{
- clobber = gen_rtx_CLOBBER (VOIDmode, retaddr_reg);
+ *clobber_ret_reg = gen_rtx_CLOBBER (VOIDmode, retaddr_reg);
if (tls_call != NULL_RTX)
- vec = gen_rtvec (3, call, clobber,
- gen_rtx_USE (VOIDmode, tls_call));
- else
- vec = gen_rtvec (2, call, clobber);
+ *use = gen_rtx_USE (VOIDmode, tls_call);
+ }
+
+
+ for (i = 0; i < 4; i++)
+ if (vec[i] != NULL_RTX)
+ elts++;
+
+ if (elts > 1)
+ {
+ rtvec v;
+ int e = 0;
+
+ v = rtvec_alloc (elts);
+ for (i = 0; i < 4; i++)
+ if (vec[i] != NULL_RTX)
+ {
+ RTVEC_ELT (v, e) = vec[i];
+ e++;
+ }
- call = gen_rtx_PARALLEL (VOIDmode, vec);
+ *call = gen_rtx_PARALLEL (VOIDmode, v);
}
- insn = emit_call_insn (call);
+ insn = emit_call_insn (*call);
/* 31-bit PLT stubs and tls calls use the GOT register implicitly. */
if ((!TARGET_64BIT && plt_call) || tls_call != NULL_RTX)
@@ -14046,7 +14228,16 @@ s390_reorg (void)
target = emit_label (XEXP (label, 0));
INSN_ADDRESSES_NEW (target, -1);
- target = emit_insn (s390_execute_target (insn));
+ if (JUMP_P (insn))
+ {
+ target = emit_jump_insn (s390_execute_target (insn));
+ /* This is important in order to keep a table jump
+ pointing at the jump table label. Only this makes it
+ being recognized as table jump. */
+ JUMP_LABEL (target) = JUMP_LABEL (insn);
+ }
+ else
+ target = emit_insn (s390_execute_target (insn));
INSN_ADDRESSES_NEW (target, -1);
}
}
@@ -14699,6 +14890,42 @@ s390_option_override_internal (bool main_args_p,
if (TARGET_64BIT && !TARGET_ZARCH_P (opts->x_target_flags))
error ("64-bit ABI not supported in ESA/390 mode");
+ if (opts->x_s390_indirect_branch == indirect_branch_thunk_inline
+ || opts->x_s390_indirect_branch_call == indirect_branch_thunk_inline
+ || opts->x_s390_function_return == indirect_branch_thunk_inline
+ || opts->x_s390_function_return_reg == indirect_branch_thunk_inline
+ || opts->x_s390_function_return_mem == indirect_branch_thunk_inline)
+ error ("thunk-inline is only supported with -mindirect-branch-jump");
+
+ if (opts->x_s390_indirect_branch != indirect_branch_keep)
+ {
+ if (!opts_set->x_s390_indirect_branch_call)
+ opts->x_s390_indirect_branch_call = opts->x_s390_indirect_branch;
+
+ if (!opts_set->x_s390_indirect_branch_jump)
+ opts->x_s390_indirect_branch_jump = opts->x_s390_indirect_branch;
+ }
+
+ if (opts->x_s390_function_return != indirect_branch_keep)
+ {
+ if (!opts_set->x_s390_function_return_reg)
+ opts->x_s390_function_return_reg = opts->x_s390_function_return;
+
+ if (!opts_set->x_s390_function_return_mem)
+ opts->x_s390_function_return_mem = opts->x_s390_function_return;
+ }
+
+ if (!TARGET_CPU_ZARCH)
+ {
+ if (opts->x_s390_indirect_branch_call != indirect_branch_keep
+ || opts->x_s390_indirect_branch_jump != indirect_branch_keep)
+ error ("-mindirect-branch* options require -march=z900 or higher");
+ if (opts->x_s390_function_return_reg != indirect_branch_keep
+ || opts->x_s390_function_return_mem != indirect_branch_keep)
+ error ("-mfunction-return* options require -march=z900 or higher");
+ }
+
+
/* Enable hardware transactions if available and not explicitly
disabled by user. E.g. with -m31 -march=zEC12 -mzarch */
if (!TARGET_OPT_HTM_P (opts_set->x_target_flags))
@@ -15267,6 +15494,79 @@ s390_valid_target_attribute_p (tree fndecl,
return ret;
}
+/* Set VAL to correct enum value according to the indirect-branch or
+ function-return attribute in ATTR. */
+
+static inline void
+s390_indirect_branch_attrvalue (tree attr, enum indirect_branch *val)
+{
+ const char *str = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)));
+ if (strcmp (str, "keep") == 0)
+ *val = indirect_branch_keep;
+ else if (strcmp (str, "thunk") == 0)
+ *val = indirect_branch_thunk;
+ else if (strcmp (str, "thunk-inline") == 0)
+ *val = indirect_branch_thunk_inline;
+ else if (strcmp (str, "thunk-extern") == 0)
+ *val = indirect_branch_thunk_extern;
+}
+
+/* Memorize the setting for -mindirect-branch* and -mfunction-return*
+ from either the cmdline or the function attributes in
+ cfun->machine. */
+
+static void
+s390_indirect_branch_settings (tree fndecl)
+{
+ tree attr;
+
+ if (!fndecl)
+ return;
+
+ /* Initialize with the cmdline options and let the attributes
+ override it. */
+ cfun->machine->indirect_branch_jump = s390_indirect_branch_jump;
+ cfun->machine->indirect_branch_call = s390_indirect_branch_call;
+
+ cfun->machine->function_return_reg = s390_function_return_reg;
+ cfun->machine->function_return_mem = s390_function_return_mem;
+
+ if ((attr = lookup_attribute ("indirect_branch",
+ DECL_ATTRIBUTES (fndecl))))
+ {
+ s390_indirect_branch_attrvalue (attr,
+ &cfun->machine->indirect_branch_jump);
+ s390_indirect_branch_attrvalue (attr,
+ &cfun->machine->indirect_branch_call);
+ }
+
+ if ((attr = lookup_attribute ("indirect_branch_jump",
+ DECL_ATTRIBUTES (fndecl))))
+ s390_indirect_branch_attrvalue (attr, &cfun->machine->indirect_branch_jump);
+
+ if ((attr = lookup_attribute ("indirect_branch_call",
+ DECL_ATTRIBUTES (fndecl))))
+ s390_indirect_branch_attrvalue (attr, &cfun->machine->indirect_branch_call);
+
+ if ((attr = lookup_attribute ("function_return",
+ DECL_ATTRIBUTES (fndecl))))
+ {
+ s390_indirect_branch_attrvalue (attr,
+ &cfun->machine->function_return_reg);
+ s390_indirect_branch_attrvalue (attr,
+ &cfun->machine->function_return_mem);
+ }
+
+ if ((attr = lookup_attribute ("function_return_reg",
+ DECL_ATTRIBUTES (fndecl))))
+ s390_indirect_branch_attrvalue (attr, &cfun->machine->function_return_reg);
+
+ if ((attr = lookup_attribute ("function_return_mem",
+ DECL_ATTRIBUTES (fndecl))))
+ s390_indirect_branch_attrvalue (attr, &cfun->machine->function_return_mem);
+}
+
+
/* Restore targets globals from NEW_TREE and invalidate s390_previous_fndecl
cache. */
@@ -15293,7 +15593,10 @@ s390_set_current_function (tree fndecl)
several times in the course of compiling a function, and we don't want to
slow things down too much or call target_reinit when it isn't safe. */
if (fndecl == s390_previous_fndecl)
- return;
+ {
+ s390_indirect_branch_settings (fndecl);
+ return;
+ }
tree old_tree;
if (s390_previous_fndecl == NULL_TREE)
@@ -15317,6 +15620,8 @@ s390_set_current_function (tree fndecl)
if (old_tree != new_tree)
s390_activate_target_options (new_tree);
s390_previous_fndecl = fndecl;
+
+ s390_indirect_branch_settings (fndecl);
}
#endif
@@ -15598,6 +15903,186 @@ s390_asan_shadow_offset (void)
return TARGET_64BIT ? HOST_WIDE_INT_1U << 52 : HOST_WIDE_INT_UC (0x20000000);
}
+#ifdef HAVE_GAS_HIDDEN
+# define USE_HIDDEN_LINKONCE 1
+#else
+# define USE_HIDDEN_LINKONCE 0
+#endif
+
+/* Output an indirect branch trampoline for target register REGNO. */
+
+static void
+s390_output_indirect_thunk_function (unsigned int regno, bool z10_p)
+{
+ tree decl;
+ char thunk_label[32];
+ int i;
+
+ if (z10_p)
+ sprintf (thunk_label, TARGET_INDIRECT_BRANCH_THUNK_NAME_EXRL, regno);
+ else
+ sprintf (thunk_label, TARGET_INDIRECT_BRANCH_THUNK_NAME_EX,
+ INDIRECT_BRANCH_THUNK_REGNUM, regno);
+
+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (thunk_label),
+ build_function_type_list (void_type_node, NULL_TREE));
+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL,
+ NULL_TREE, void_type_node);
+ TREE_PUBLIC (decl) = 1;
+ TREE_STATIC (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+
+ if (USE_HIDDEN_LINKONCE)
+ {
+ cgraph_node::create (decl)->set_comdat_group (DECL_ASSEMBLER_NAME (decl));
+
+ targetm.asm_out.unique_section (decl, 0);
+ switch_to_section (get_named_section (decl, NULL, 0));
+
+ targetm.asm_out.globalize_label (asm_out_file, thunk_label);
+ fputs ("\t.hidden\t", asm_out_file);
+ assemble_name (asm_out_file, thunk_label);
+ putc ('\n', asm_out_file);
+ ASM_DECLARE_FUNCTION_NAME (asm_out_file, thunk_label, decl);
+ }
+ else
+ {
+ switch_to_section (text_section);
+ ASM_OUTPUT_LABEL (asm_out_file, thunk_label);
+ }
+
+ DECL_INITIAL (decl) = make_node (BLOCK);
+ current_function_decl = decl;
+ allocate_struct_function (decl, false);
+ init_function_start (decl);
+ cfun->is_thunk = true;
+ first_function_block_is_cold = false;
+ final_start_function (emit_barrier (), asm_out_file, 1);
+
+ /* This makes CFI at least usable for indirect jumps.
+
+ Stopping in the thunk: backtrace will point to the thunk target
+ is if it was interrupted by a signal. For a call this means that
+ the call chain will be: caller->callee->thunk */
+ if (flag_asynchronous_unwind_tables)
+ {
+ fputs ("\t.cfi_signal_frame\n", asm_out_file);
+ fprintf (asm_out_file, "\t.cfi_return_column %d\n", regno);
+ for (i = 0; i < FPR15_REGNUM; i++)
+ fprintf (asm_out_file, "\t.cfi_same_value %s\n", reg_names[i]);
+ }
+
+ if (z10_p)
+ {
+ /* exrl 0,1f */
+
+ /* We generate a thunk for z10 compiled code although z10 is
+ currently not enabled. Tell the assembler to accept the
+ instruction. */
+ if (!TARGET_CPU_Z10)
+ {
+ fputs ("\t.machine push\n", asm_out_file);
+ fputs ("\t.machine z10\n", asm_out_file);
+ }
+ /* We use exrl even if -mzarch hasn't been specified on the
+ command line so we have to tell the assembler to accept
+ it. */
+ if (!TARGET_ZARCH)
+ fputs ("\t.machinemode zarch\n", asm_out_file);
+
+ fputs ("\texrl\t0,1f\n", asm_out_file);
+
+ if (!TARGET_ZARCH)
+ fputs ("\t.machinemode esa\n", asm_out_file);
+
+ if (!TARGET_CPU_Z10)
+ fputs ("\t.machine pop\n", asm_out_file);
+ }
+ else if (TARGET_CPU_ZARCH)
+ {
+ /* larl %r1,1f */
+ fprintf (asm_out_file, "\tlarl\t%%r%d,1f\n",
+ INDIRECT_BRANCH_THUNK_REGNUM);
+
+ /* ex 0,0(%r1) */
+ fprintf (asm_out_file, "\tex\t0,0(%%r%d)\n",
+ INDIRECT_BRANCH_THUNK_REGNUM);
+ }
+ else
+ gcc_unreachable ();
+
+ /* 0: j 0b */
+ fputs ("0:\tj\t0b\n", asm_out_file);
+
+ /* 1: br <regno> */
+ fprintf (asm_out_file, "1:\tbr\t%%r%d\n", regno);
+
+ final_end_function ();
+ init_insn_lengths ();
+ free_after_compilation (cfun);
+ set_cfun (NULL);
+ current_function_decl = NULL;
+}
+
+/* Implement the asm.code_end target hook. */
+
+static void
+s390_code_end (void)
+{
+ int i;
+
+ for (i = 1; i < 16; i++)
+ {
+ if (indirect_branch_z10thunk_mask & (1 << i))
+ s390_output_indirect_thunk_function (i, true);
+
+ if (indirect_branch_prez10thunk_mask & (1 << i))
+ s390_output_indirect_thunk_function (i, false);
+ }
+
+ if (TARGET_INDIRECT_BRANCH_TABLE)
+ {
+ int o;
+ int i;
+
+ for (o = 0; o < INDIRECT_BRANCH_NUM_OPTIONS; o++)
+ {
+ if (indirect_branch_table_label_no[o] == 0)
+ continue;
+
+ switch_to_section (get_section (indirect_branch_table_name[o],
+ 0,
+ NULL_TREE));
+ for (i = 0; i < indirect_branch_table_label_no[o]; i++)
+ {
+ char label_start[32];
+
+ ASM_GENERATE_INTERNAL_LABEL (label_start,
+ indirect_branch_table_label[o], i);
+
+ fputs ("\t.long\t", asm_out_file);
+ assemble_name_raw (asm_out_file, label_start);
+ fputs ("-.\n", asm_out_file);
+ }
+ switch_to_section (current_function_section ());
+ }
+ }
+}
+
+/* Implement the TARGET_CASE_VALUES_THRESHOLD target hook. */
+
+unsigned int
+s390_case_values_threshold (void)
+{
+ /* Disabling branch prediction for indirect jumps makes jump tables
+ much more expensive. */
+ if (TARGET_INDIRECT_BRANCH_NOBP_JUMP)
+ return 20;
+
+ return default_case_values_threshold ();
+}
+
/* Initialize GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -15854,6 +16339,12 @@ s390_asan_shadow_offset (void)
#undef TARGET_OPTION_RESTORE
#define TARGET_OPTION_RESTORE s390_function_specific_restore
+#undef TARGET_ASM_CODE_END
+#define TARGET_ASM_CODE_END s390_code_end
+
+#undef TARGET_CASE_VALUES_THRESHOLD
+#define TARGET_CASE_VALUES_THRESHOLD s390_case_values_threshold
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-s390.h"
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index a372981ff3a..68e3876f51d 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -1120,4 +1120,124 @@ extern const int processor_flags_table[];
s390_register_target_pragmas (); \
} while (0)
+#ifndef USED_FOR_TARGET
+/* The following structure is embedded in the machine
+ specific part of struct function. */
+
+struct GTY (()) s390_frame_layout
+{
+ /* Offset within stack frame. */
+ HOST_WIDE_INT gprs_offset;
+ HOST_WIDE_INT f0_offset;
+ HOST_WIDE_INT f4_offset;
+ HOST_WIDE_INT f8_offset;
+ HOST_WIDE_INT backchain_offset;
+
+ /* Number of first and last gpr where slots in the register
+ save area are reserved for. */
+ int first_save_gpr_slot;
+ int last_save_gpr_slot;
+
+ /* Location (FP register number) where GPRs (r0-r15) should
+ be saved to.
+ 0 - does not need to be saved at all
+ -1 - stack slot */
+#define SAVE_SLOT_NONE 0
+#define SAVE_SLOT_STACK -1
+ signed char gpr_save_slots[16];
+
+ /* Number of first and last gpr to be saved, restored. */
+ int first_save_gpr;
+ int first_restore_gpr;
+ int last_save_gpr;
+ int last_restore_gpr;
+
+ /* Bits standing for floating point registers. Set, if the
+ respective register has to be saved. Starting with reg 16 (f0)
+ at the rightmost bit.
+ Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+ fpr 15 13 11 9 14 12 10 8 7 5 3 1 6 4 2 0
+ reg 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 */
+ unsigned int fpr_bitmap;
+
+ /* Number of floating point registers f8-f15 which must be saved. */
+ int high_fprs;
+
+ /* Set if return address needs to be saved.
+ This flag is set by s390_return_addr_rtx if it could not use
+ the initial value of r14 and therefore depends on r14 saved
+ to the stack. */
+ bool save_return_addr_p;
+
+ /* Size of stack frame. */
+ HOST_WIDE_INT frame_size;
+};
+
+
+/* Define the structure for the machine field in struct function. */
+
+struct GTY(()) machine_function
+{
+ struct s390_frame_layout frame_layout;
+
+ /* Literal pool base register. */
+ rtx base_reg;
+
+ /* True if we may need to perform branch splitting. */
+ bool split_branches_pending_p;
+
+ bool has_landing_pad_p;
+
+ /* True if the current function may contain a tbegin clobbering
+ FPRs. */
+ bool tbegin_p;
+
+ /* For -fsplit-stack support: A stack local which holds a pointer to
+ the stack arguments for a function with a variable number of
+ arguments. This is set at the start of the function and is used
+ to initialize the overflow_arg_area field of the va_list
+ structure. */
+ rtx split_stack_varargs_pointer;
+
+ enum indirect_branch indirect_branch_jump;
+ enum indirect_branch indirect_branch_call;
+
+ enum indirect_branch function_return_mem;
+ enum indirect_branch function_return_reg;
+};
+#endif
+
+#define TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION \
+ (cfun->machine->function_return_reg != indirect_branch_keep \
+ || cfun->machine->function_return_mem != indirect_branch_keep)
+
+#define TARGET_INDIRECT_BRANCH_NOBP_RET \
+ ((cfun->machine->function_return_reg != indirect_branch_keep \
+ && !s390_return_addr_from_memory ()) \
+ || (cfun->machine->function_return_mem != indirect_branch_keep \
+ && s390_return_addr_from_memory ()))
+
+#define TARGET_INDIRECT_BRANCH_NOBP_JUMP \
+ (cfun->machine->indirect_branch_jump != indirect_branch_keep)
+
+#define TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK \
+ (cfun->machine->indirect_branch_jump == indirect_branch_thunk \
+ || cfun->machine->indirect_branch_jump == indirect_branch_thunk_extern)
+
+#define TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK \
+ (cfun->machine->indirect_branch_jump == indirect_branch_thunk_inline)
+
+#define TARGET_INDIRECT_BRANCH_NOBP_CALL \
+ (cfun->machine->indirect_branch_call != indirect_branch_keep)
+
+#ifndef TARGET_DEFAULT_INDIRECT_BRANCH_TABLE
+#define TARGET_DEFAULT_INDIRECT_BRANCH_TABLE 0
+#endif
+
+#define TARGET_INDIRECT_BRANCH_THUNK_NAME_EXRL "__s390_indirect_jump_r%d"
+#define TARGET_INDIRECT_BRANCH_THUNK_NAME_EX "__s390_indirect_jump_r%duse_r%d"
+
+#define TARGET_INDIRECT_BRANCH_TABLE s390_indirect_branch_table
+
+
#endif /* S390_H */
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 7b6d09bcb41..1778d60b5da 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -89,6 +89,7 @@
UNSPEC_LTREF
UNSPEC_INSN
UNSPEC_EXECUTE
+ UNSPEC_EXECUTE_JUMP
; Atomic Support
UNSPEC_MB
@@ -302,6 +303,8 @@
[
; Sibling call register.
(SIBCALL_REGNUM 1)
+ ; A call-clobbered reg which can be used in indirect branch thunks
+ (INDIRECT_BRANCH_THUNK_REGNUM 1)
; Literal pool base register.
(BASE_REGNUM 13)
; Return address register.
@@ -471,7 +474,10 @@
z196_cracked"
(const_string "none"))
-(define_attr "mnemonic" "bcr_flush,unknown" (const_string "unknown"))
+; mnemonics which only get defined through if_then_else currently
+; don't get added to the list values automatically and hence need to
+; be listed here.
+(define_attr "mnemonic" "b,bas,bc,bcr_flush,unknown" (const_string "unknown"))
;; Length in bytes.
@@ -9069,7 +9075,7 @@
(match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
(match_operand 0 "address_operand" "ZQZR")
(pc)))]
- ""
+ "!TARGET_INDIRECT_BRANCH_NOBP_JUMP"
{
if (get_attr_op_type (insn) == OP_TYPE_RR)
return "b%C1r\t%0";
@@ -9079,6 +9085,9 @@
[(set (attr "op_type")
(if_then_else (match_operand 0 "register_operand" "")
(const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "bcr") (const_string "bc")))
(set_attr "type" "branch")
(set_attr "atype" "agen")])
@@ -9090,8 +9099,26 @@
(ANY_RETURN)
(pc)))]
"s390_can_use_<code>_insn ()"
- "b%C0r\t%%r14"
- [(set_attr "op_type" "RR")
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_RET)
+ {
+ s390_indirect_branch_via_thunk (RETURN_REGNUM,
+ INVALID_REGNUM,
+ operands[0],
+ s390_indirect_branch_type_return);
+ return "";
+ }
+ else
+ return "b%C0r\t%%r14";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "brcl")
+ (const_string "bcr")))
(set_attr "type" "jsr")
(set_attr "atype" "agen")])
@@ -9144,7 +9171,7 @@
(match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)])
(pc)
(match_operand 0 "address_operand" "ZQZR")))]
- ""
+ "!TARGET_INDIRECT_BRANCH_NOBP_JUMP"
{
if (get_attr_op_type (insn) == OP_TYPE_RR)
return "b%D1r\t%0";
@@ -9154,6 +9181,9 @@
[(set (attr "op_type")
(if_then_else (match_operand 0 "register_operand" "")
(const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "bcr") (const_string "bc")))
(set_attr "type" "branch")
(set_attr "atype" "agen")])
@@ -9658,21 +9688,144 @@
;
else
operands[0] = force_reg (Pmode, operands[0]);
+
+ if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK)
+ {
+ operands[0] = force_reg (Pmode, operands[0]);
+ if (TARGET_CPU_Z10)
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_indirect_jump_via_thunkdi_z10 (operands[0]));
+ else
+ emit_jump_insn (gen_indirect_jump_via_thunksi_z10 (operands[0]));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_indirect_jump_via_thunkdi (operands[0]));
+ else
+ emit_jump_insn (gen_indirect_jump_via_thunksi (operands[0]));
+ }
+ DONE;
+ }
+
+ if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK)
+ {
+ operands[0] = force_reg (Pmode, operands[0]);
+ rtx label_ref = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
+ if (TARGET_CPU_Z10)
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_indirect_jump_via_inlinethunkdi_z10 (operands[0],
+ label_ref));
+ else
+ emit_jump_insn (gen_indirect_jump_via_inlinethunksi_z10 (operands[0],
+ label_ref));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_indirect_jump_via_inlinethunkdi (operands[0],
+ label_ref,
+ force_reg (Pmode, label_ref)));
+ else
+ emit_jump_insn (gen_indirect_jump_via_inlinethunksi (operands[0],
+ label_ref,
+ force_reg (Pmode, label_ref)));
+ }
+ DONE;
+ }
})
-; The first constraint must be an "extra address constraint" in order
-; to trigger address reloading in LRA/reload
(define_insn "*indirect_jump"
[(set (pc)
- (match_operand 0 "address_operand" "ZR,a"))]
- ""
- "@
- b\t%a0
- br\t%0"
- [(set_attr "op_type" "RX,RR")
+ (match_operand 0 "address_operand" "ZR"))]
+ "!TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK"
+{
+ if (get_attr_op_type (insn) == OP_TYPE_RR)
+ return "br\t%0";
+ else
+ return "b\t%a0";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "br") (const_string "b")))
(set_attr "type" "branch")
- (set_attr "atype" "agen")
- (set_attr "cpu_facility" "*")])
+ (set_attr "atype" "agen")])
+
+(define_insn "indirect_jump_via_thunk<mode>_z10"
+ [(set (pc)
+ (match_operand:P 0 "register_operand" "a"))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK
+ && TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_jump);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "jg")
+ (set_attr "type" "branch")
+ (set_attr "atype" "agen")])
+
+(define_insn "indirect_jump_via_thunk<mode>"
+ [(set (pc)
+ (match_operand:P 0 "register_operand" " a"))
+ (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK
+ && !TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_jump);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "jg")
+ (set_attr "type" "branch")
+ (set_attr "atype" "agen")])
+
+
+; The label_ref is wrapped into an if_then_else in order to hide it
+; from mark_jump_label. Without this the label_ref would become the
+; ONLY jump target of that jump breaking the control flow graph.
+(define_insn "indirect_jump_via_inlinethunk<mode>_z10"
+ [(unspec [(if_then_else (match_operand:P 1 "larl_operand" "X")
+ (const_int 0)
+ (const_int 0))
+ (const_int 0)] UNSPEC_EXECUTE_JUMP)
+ (set (pc) (match_operand:P 0 "register_operand" "a"))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK
+ && TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_inline_thunk (operands[1]);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "type" "branch")
+ (set_attr "length" "10")])
+
+(define_insn "indirect_jump_via_inlinethunk<mode>"
+ [(unspec [(if_then_else (match_operand:P 1 "larl_operand" "X")
+ (const_int 0)
+ (const_int 0))
+ (match_operand:P 2 "register_operand" "a")] UNSPEC_EXECUTE_JUMP)
+ (set (pc) (match_operand:P 0 "register_operand" "a"))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK
+ && !TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_inline_thunk (operands[2]);
+ return "";
+}
+ [(set_attr "op_type" "RX")
+ (set_attr "type" "branch")
+ (set_attr "length" "8")])
; FIXME: LRA does not appear to be able to deal with MEMs being
; checked against address constraints like ZR above. So make this a
@@ -9680,7 +9833,7 @@
(define_insn "*indirect2_jump"
[(set (pc)
(match_operand 0 "nonimmediate_operand" "a,T"))]
- ""
+ "!TARGET_INDIRECT_BRANCH_NOBP_JUMP"
"@
br\t%0
bi\t%0"
@@ -9693,11 +9846,74 @@
; casesi instruction pattern(s).
;
-(define_insn "casesi_jump"
- [(set (pc) (match_operand 0 "address_operand" "ZR"))
- (use (label_ref (match_operand 1 "" "")))]
+(define_expand "casesi_jump"
+ [(parallel
+ [(set (pc) (match_operand 0 "address_operand"))
+ (use (label_ref (match_operand 1 "")))])]
""
{
+ if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK)
+ {
+ operands[0] = force_reg (GET_MODE (operands[0]), operands[0]);
+
+ if (TARGET_CPU_Z10)
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_casesi_jump_via_thunkdi_z10 (operands[0],
+ operands[1]));
+ else
+ emit_jump_insn (gen_casesi_jump_via_thunksi_z10 (operands[0],
+ operands[1]));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_casesi_jump_via_thunkdi (operands[0],
+ operands[1]));
+ else
+ emit_jump_insn (gen_casesi_jump_via_thunksi (operands[0],
+ operands[1]));
+ }
+ DONE;
+ }
+
+ if (TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK)
+ {
+ operands[0] = force_reg (Pmode, operands[0]);
+ rtx label_ref = gen_rtx_LABEL_REF (VOIDmode, gen_label_rtx ());
+ if (TARGET_CPU_Z10)
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_casesi_jump_via_inlinethunkdi_z10 (operands[0],
+ operands[1],
+ label_ref));
+ else
+ emit_jump_insn (gen_casesi_jump_via_inlinethunksi_z10 (operands[0],
+ operands[1],
+ label_ref));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_casesi_jump_via_inlinethunkdi (operands[0],
+ operands[1],
+ label_ref,
+ force_reg (Pmode, label_ref)));
+ else
+ emit_jump_insn (gen_casesi_jump_via_inlinethunksi (operands[0],
+ operands[1],
+ label_ref,
+ force_reg (Pmode, label_ref)));
+ }
+ DONE;
+ }
+})
+
+(define_insn "*casesi_jump"
+ [(set (pc) (match_operand 0 "address_operand" "ZR"))
+ (use (label_ref (match_operand 1 "" "")))]
+ "!TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK"
+{
if (get_attr_op_type (insn) == OP_TYPE_RR)
return "br\t%0";
else
@@ -9706,9 +9922,85 @@
[(set (attr "op_type")
(if_then_else (match_operand 0 "register_operand" "")
(const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "br") (const_string "b")))
+ (set_attr "type" "branch")
+ (set_attr "atype" "agen")])
+
+(define_insn "casesi_jump_via_thunk<mode>_z10"
+ [(set (pc) (match_operand:P 0 "register_operand" "a"))
+ (use (label_ref (match_operand 1 "" "")))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK
+ && TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_jump);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "jg")
+ (set_attr "type" "branch")
+ (set_attr "atype" "agen")])
+
+(define_insn "casesi_jump_via_thunk<mode>"
+ [(set (pc) (match_operand:P 0 "register_operand" "a"))
+ (use (label_ref (match_operand 1 "" "")))
+ (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_THUNK
+ && !TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_jump);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "jg")
(set_attr "type" "branch")
(set_attr "atype" "agen")])
+
+; The label_ref is wrapped into an if_then_else in order to hide it
+; from mark_jump_label. Without this the label_ref would become the
+; ONLY jump target of that jump breaking the control flow graph.
+(define_insn "casesi_jump_via_inlinethunk<mode>_z10"
+ [(unspec [(if_then_else (match_operand:P 2 "larl_operand" "X")
+ (const_int 0)
+ (const_int 0))
+ (const_int 0)] UNSPEC_EXECUTE_JUMP)
+ (set (pc) (match_operand:P 0 "register_operand" "a"))
+ (use (label_ref (match_operand 1 "" "")))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK
+ && TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_inline_thunk (operands[2]);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "type" "cs")
+ (set_attr "length" "10")])
+
+(define_insn "casesi_jump_via_inlinethunk<mode>"
+ [(unspec [(if_then_else (match_operand:P 2 "larl_operand" "X")
+ (const_int 0)
+ (const_int 0))
+ (match_operand:P 3 "register_operand" "a")] UNSPEC_EXECUTE_JUMP)
+ (set (pc) (match_operand:P 0 "register_operand" "a"))
+ (use (label_ref (match_operand 1 "" "")))]
+ "TARGET_INDIRECT_BRANCH_NOBP_JUMP_INLINE_THUNK
+ && !TARGET_CPU_Z10"
+{
+ s390_indirect_branch_via_inline_thunk (operands[3]);
+ return "";
+}
+ [(set_attr "op_type" "RX")
+ (set_attr "type" "cs")
+ (set_attr "length" "8")])
+
(define_expand "casesi"
[(match_operand:SI 0 "general_operand" "")
(match_operand:SI 1 "general_operand" "")
@@ -9813,8 +10105,27 @@
(match_operand 0 "const_int_operand" "n"))]
"SIBLING_CALL_P (insn)
&& GET_MODE (XEXP (XEXP (PATTERN (insn), 0), 0)) == Pmode"
- "br\t%%r1"
- [(set_attr "op_type" "RR")
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_CALL)
+ {
+ gcc_assert (TARGET_CPU_Z10);
+ s390_indirect_branch_via_thunk (SIBCALL_REGNUM,
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+ }
+ else
+ return "br\t%%r1";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL")
+ (const_string "jg")
+ (const_string "br")))
(set_attr "type" "branch")
(set_attr "atype" "agen")])
@@ -9854,8 +10165,27 @@
(match_operand 1 "const_int_operand" "n")))]
"SIBLING_CALL_P (insn)
&& GET_MODE (XEXP (XEXP (XEXP (PATTERN (insn), 1), 0), 0)) == Pmode"
- "br\t%%r1"
- [(set_attr "op_type" "RR")
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_CALL)
+ {
+ gcc_assert (TARGET_CPU_Z10);
+ s390_indirect_branch_via_thunk (SIBCALL_REGNUM,
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+ }
+ else
+ return "br\t%%r1";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_CALL")
+ (const_string "jg")
+ (const_string "br")))
(set_attr "type" "branch")
(set_attr "atype" "agen")])
@@ -9921,7 +10251,9 @@
[(call (mem:QI (match_operand 0 "address_operand" "ZR"))
(match_operand 1 "const_int_operand" "n"))
(clobber (match_operand 2 "register_operand" "=r"))]
- "!SIBLING_CALL_P (insn) && GET_MODE (operands[2]) == Pmode"
+ "!TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && !SIBLING_CALL_P (insn)
+ && GET_MODE (operands[2]) == Pmode"
{
if (get_attr_op_type (insn) == OP_TYPE_RR)
return "basr\t%2,%0";
@@ -9931,6 +10263,50 @@
[(set (attr "op_type")
(if_then_else (match_operand 0 "register_operand" "")
(const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 0 "register_operand" "")
+ (const_string "basr") (const_string "bas")))
+ (set_attr "type" "jsr")
+ (set_attr "atype" "agen")
+ (set_attr "z196prop" "z196_cracked")])
+
+(define_insn "*basr_via_thunk<mode>_z10"
+ [(call (mem:QI (match_operand:P 0 "register_operand" "a"))
+ (match_operand 1 "const_int_operand" "n"))
+ (clobber (match_operand:P 2 "register_operand" "=&r"))]
+ "TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && TARGET_CPU_Z10
+ && !SIBLING_CALL_P (insn)"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ REGNO (operands[2]),
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "brasl")
+ (set_attr "type" "jsr")
+ (set_attr "atype" "agen")
+ (set_attr "z196prop" "z196_cracked")])
+
+(define_insn "*basr_via_thunk<mode>"
+ [(call (mem:QI (match_operand:P 0 "register_operand" "a"))
+ (match_operand 1 "const_int_operand" "n"))
+ (clobber (match_operand:P 2 "register_operand" "=&r"))
+ (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))]
+ "TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && !TARGET_CPU_Z10
+ && !SIBLING_CALL_P (insn)"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ REGNO (operands[2]),
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "brasl")
(set_attr "type" "jsr")
(set_attr "atype" "agen")
(set_attr "z196prop" "z196_cracked")])
@@ -9982,7 +10358,9 @@
(call (mem:QI (match_operand 1 "address_operand" "ZR"))
(match_operand 2 "const_int_operand" "n")))
(clobber (match_operand 3 "register_operand" "=r"))]
- "!SIBLING_CALL_P (insn) && GET_MODE (operands[3]) == Pmode"
+ "!TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && !SIBLING_CALL_P (insn)
+ && GET_MODE (operands[3]) == Pmode"
{
if (get_attr_op_type (insn) == OP_TYPE_RR)
return "basr\t%3,%1";
@@ -9992,6 +10370,54 @@
[(set (attr "op_type")
(if_then_else (match_operand 1 "register_operand" "")
(const_string "RR") (const_string "RX")))
+ (set (attr "mnemonic")
+ (if_then_else (match_operand 1 "register_operand" "")
+ (const_string "basr") (const_string "bas")))
+ (set_attr "type" "jsr")
+ (set_attr "atype" "agen")
+ (set_attr "z196prop" "z196_cracked")])
+
+(define_insn "*basr_r_via_thunk_z10"
+ [(set (match_operand 0 "" "")
+ (call (mem:QI (match_operand 1 "register_operand" "a"))
+ (match_operand 2 "const_int_operand" "n")))
+ (clobber (match_operand 3 "register_operand" "=&r"))]
+ "TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && TARGET_CPU_Z10
+ && !SIBLING_CALL_P (insn)
+ && GET_MODE (operands[3]) == Pmode"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[1]),
+ REGNO (operands[3]),
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "brasl")
+ (set_attr "type" "jsr")
+ (set_attr "atype" "agen")
+ (set_attr "z196prop" "z196_cracked")])
+
+(define_insn "*basr_r_via_thunk"
+ [(set (match_operand 0 "" "")
+ (call (mem:QI (match_operand 1 "register_operand" "a"))
+ (match_operand 2 "const_int_operand" "n")))
+ (clobber (match_operand 3 "register_operand" "=&r"))
+ (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))]
+ "TARGET_INDIRECT_BRANCH_NOBP_CALL
+ && !TARGET_CPU_Z10
+ && !SIBLING_CALL_P (insn)
+ && GET_MODE (operands[3]) == Pmode"
+{
+ s390_indirect_branch_via_thunk (REGNO (operands[1]),
+ REGNO (operands[3]),
+ NULL_RTX,
+ s390_indirect_branch_type_call);
+ return "";
+}
+ [(set_attr "op_type" "RIL")
+ (set_attr "mnemonic" "brasl")
(set_attr "type" "jsr")
(set_attr "atype" "agen")
(set_attr "z196prop" "z196_cracked")])
@@ -10737,17 +11163,101 @@
(define_insn "<code>"
[(ANY_RETURN)]
"s390_can_use_<code>_insn ()"
- "br\t%%r14"
- [(set_attr "op_type" "RR")
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_RET)
+ {
+ /* The target is always r14 so there is no clobber
+ of r1 needed for pre z10 targets. */
+ s390_indirect_branch_via_thunk (RETURN_REGNUM,
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_return);
+ return "";
+ }
+ else
+ return "br\t%%r14";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "jg")
+ (const_string "br")))
(set_attr "type" "jsr")
(set_attr "atype" "agen")])
-(define_insn "*return"
+
+(define_expand "return_use"
+ [(parallel
+ [(return)
+ (use (match_operand 0 "register_operand" "a"))])]
+ ""
+{
+ if (!TARGET_CPU_Z10
+ && TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION)
+ {
+ if (TARGET_64BIT)
+ emit_jump_insn (gen_returndi_prez10 (operands[0]));
+ else
+ emit_jump_insn (gen_returnsi_prez10 (operands[0]));
+ DONE;
+ }
+})
+
+(define_insn "*return<mode>"
[(return)
- (use (match_operand 0 "register_operand" "a"))]
- "GET_MODE (operands[0]) == Pmode"
- "br\t%0"
- [(set_attr "op_type" "RR")
+ (use (match_operand:P 0 "register_operand" "a"))]
+ "TARGET_CPU_Z10 || !TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION"
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_RET)
+ {
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_return);
+ return "";
+ }
+ else
+ return "br\t%0";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "jg")
+ (const_string "br")))
+ (set_attr "type" "jsr")
+ (set_attr "atype" "agen")])
+
+(define_insn "return<mode>_prez10"
+ [(return)
+ (use (match_operand:P 0 "register_operand" "a"))
+ (clobber (reg:P INDIRECT_BRANCH_THUNK_REGNUM))]
+ "!TARGET_CPU_Z10 && TARGET_INDIRECT_BRANCH_NOBP_RET_OPTION"
+{
+ if (TARGET_INDIRECT_BRANCH_NOBP_RET)
+ {
+ s390_indirect_branch_via_thunk (REGNO (operands[0]),
+ INVALID_REGNUM,
+ NULL_RTX,
+ s390_indirect_branch_type_return);
+ return "";
+ }
+ else
+ return "br\t%0";
+}
+ [(set (attr "op_type")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "RIL")
+ (const_string "RR")))
+ (set (attr "mnemonic")
+ (if_then_else (match_test "TARGET_INDIRECT_BRANCH_NOBP_RET")
+ (const_string "jg")
+ (const_string "br")))
(set_attr "type" "jsr")
(set_attr "atype" "agen")])
diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt
index 28ba631e259..85d09855280 100644
--- a/gcc/config/s390/s390.opt
+++ b/gcc/config/s390/s390.opt
@@ -229,3 +229,62 @@ values are small, non-negative integers. The default branch cost is
mlra
Target Report Var(s390_lra_flag) Init(1) Save
Use LRA instead of reload.
+
+mindirect-branch=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_indirect_branch) Init(indirect_branch_keep)
+Wrap all indirect branches into execute in order to disable branch
+prediction.
+
+mindirect-branch-jump=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_indirect_branch_jump) Init(indirect_branch_keep)
+Wrap indirect table jumps and computed gotos into execute in order to
+disable branch prediction. Using thunk or thunk-extern with this
+option requires the thunks to be considered signal handlers to order to
+generate correct CFI. For environments where unwinding (e.g. for
+exceptions) is required please use thunk-inline instead.
+
+mindirect-branch-call=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_indirect_branch_call) Init(indirect_branch_keep)
+Wrap all indirect calls into execute in order to disable branch prediction.
+
+mfunction-return=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_function_return) Init(indirect_branch_keep)
+Wrap all indirect return branches into execute in order to disable branch
+prediction.
+
+mfunction-return-mem=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_function_return_mem) Init(indirect_branch_keep)
+Wrap indirect return branches into execute in order to disable branch
+prediction. This affects only branches where the return address is
+going to be restored from memory.
+
+mfunction-return-reg=
+Target Report RejectNegative Joined Enum(indirect_branch) Var(s390_function_return_reg) Init(indirect_branch_keep)
+Wrap indirect return branches into execute in order to disable branch
+prediction. This affects only branches where the return address
+doesn't need to be restored from memory.
+
+Enum
+Name(indirect_branch) Type(enum indirect_branch)
+Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
+
+EnumValue
+Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
+
+EnumValue
+Enum(indirect_branch) String(thunk) Value(indirect_branch_thunk)
+
+EnumValue
+Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline)
+
+EnumValue
+Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
+
+mindirect-branch-table
+Target Report Var(s390_indirect_branch_table) Init(TARGET_DEFAULT_INDIRECT_BRANCH_TABLE)
+Generate sections .s390_indirect_jump, .s390_indirect_call,
+.s390_return_reg, and .s390_return_mem to contain the indirect branch
+locations which have been patched as part of using one of the
+-mindirect-branch* or -mfunction-return* options. The sections
+consist of an array of 32 bit elements. Each entry holds the offset
+from the entry to the patched location.
diff --git a/gcc/config/sh/sh_optimize_sett_clrt.cc b/gcc/config/sh/sh_optimize_sett_clrt.cc
index 449261e86de..ca3440a79a2 100644
--- a/gcc/config/sh/sh_optimize_sett_clrt.cc
+++ b/gcc/config/sh/sh_optimize_sett_clrt.cc
@@ -18,6 +18,8 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
+#define INCLUDE_ALGORITHM
+#define INCLUDE_VECTOR
#include "system.h"
#include "coretypes.h"
#include "backend.h"
@@ -27,9 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "cfgrtl.h"
#include "tree-pass.h"
-#include <vector>
-#include <algorithm>
-
/*
This pass tries to eliminate unnecessary sett or clrt instructions in cases
where the ccreg value is already known to be the same as the constant set
diff --git a/gcc/configure b/gcc/configure
index 9351f2848e5..f63729f150f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23572,6 +23572,14 @@ $as_echo "$gcc_cv_as_shf_merge" >&6; }
fi
+case "$target" in
+ i?86-*-solaris2.10* | x86_64-*-solaris2.10*)
+ # SHF_MERGE support in Solaris 10/x86 ld is broken.
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_as_shf_merge=no
+ fi
+ ;;
+esac
cat >>confdefs.h <<_ACEOF
#define HAVE_GAS_SHF_MERGE `if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 520fe58f70f..0cdbf8e7a9e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2946,6 +2946,14 @@ if test $gcc_cv_as_shf_merge = no; then
[elf,2,12,0], [--fatal-warnings],
[.section .rodata.str, "aMS", %progbits, 1])
fi
+case "$target" in
+ i?86-*-solaris2.10* | x86_64-*-solaris2.10*)
+ # SHF_MERGE support in Solaris 10/x86 ld is broken.
+ if test x"$gnu_ld" = xno; then
+ gcc_cv_as_shf_merge=no
+ fi
+ ;;
+esac
AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
[`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
[Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 99b594717d2..6e5aeb07782 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,260 @@
+2018-03-07 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 2018-03-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/84684
+ * constexpr.c (cxx_bind_parameters_in_call): Unshare evaluated
+ arguments.
+
+2018-03-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/84686 - missing volatile loads.
+ * cvt.c (convert_to_void): Call maybe_undo_parenthesized_ref.
+
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-02-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84558
+ * constexpr.c (cxx_eval_vec_init_1): For reuse, treat NULL eltinit like
+ a valid constant initializer. Formatting fixes.
+
+ PR c++/84557
+ * parser.c (cp_parser_omp_var_list_no_open): Only call
+ cp_parser_lookup_name_simple on names satisfying identifier_p.
+ (cp_parser_oacc_routine): Likewise.
+
+ 2018-02-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84445
+ * class.c (fixed_type_or_null) <case CALL_EXPR>: Only test
+ TREE_HAS_CONSTRUCTOR if instance is not an internal function call.
+
+ PR c++/84449
+ * tree.c (bot_manip): If build_cplus_new or break_out_target_exprs
+ returns error_mark_node, return it immediately.
+ (break_out_target_exprs): If cp_walk_tree with bot_manip returns
+ error_mark_node, return error_mark_node.
+
+ 2018-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84448
+ * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
+ either operand is error_mark_node, set current.lhs to that instead of
+ creating a binary op with error_mark_node operands.
+
+ PR c++/84430
+ * constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
+
+ 2018-02-16 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84192
+ * constexpr.c (cxx_eval_constant_expression) <case RETURN_EXPR>: Don't
+ set *jump_target to anything if jump_target is NULL.
+
+ 2018-02-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84341
+ * parser.c (cp_parser_binary_expression): Use build_min instead of
+ build2_loc to build the no_toplevel_fold_p toplevel binary expression.
+
+ 2018-02-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * tree.c (cp_free_lang_data): Revert 2018-01-23 change.
+
+ 2018-02-09 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83659
+ * constexpr.c (cxx_fold_indirect_ref): Sync some changes from
+ fold_indirect_ref_1. Verify first that tree_fits_shwi_p (op01).
+ Formatting fixes.
+
+ 2018-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84082
+ * parser.c (cp_parser_dot_deref_incomplete): New function.
+ (cp_parser_postfix_dot_deref_expression): Use it.
+
+ 2018-01-31 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83993
+ * constexpr.c (cxx_eval_outermost_constant_expr): Build NOP_EXPR
+ around non-constant ADDR_EXPRs rather than clearing TREE_CONSTANT
+ on ADDR_EXPR.
+
+ 2018-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84031
+ * decl.c (find_decomp_class_base): Ignore unnamed bitfields. Ignore
+ recursive calls that return ret.
+ (cp_finish_decomp): Ignore unnamed bitfields.
+
+ 2018-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
+ DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
+
+ PR c++/83958
+ * decl.c (cp_finish_decomp): Diagnose if reference structure binding
+ refers to incomplete type.
+
+ 2018-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83824
+ * parser.c (attr_chainon): New function.
+ (cp_parser_label_for_labeled_statement, cp_parser_decl_specifier_seq,
+ cp_parser_namespace_definition, cp_parser_init_declarator,
+ cp_parser_type_specifier_seq, cp_parser_parameter_declaration,
+ cp_parser_gnu_attributes_opt): Use it.
+ (cp_parser_member_declaration, cp_parser_objc_class_ivars,
+ cp_parser_objc_struct_declaration): Likewise. Don't reset
+ prefix_attributes if attributes is error_mark_node.
+
+ 2018-01-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83817
+ * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
+ is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
+ instead of CALL_FROM_THUNK_P.
+
+2018-03-02 Jason Merrill <jason@redhat.com>
+
+ Fix MIPS16 ICE.
+ * pt.c (type_dependent_expression_p): Check DECL_LANG_SPECIFIC.
+
+2018-02-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/84489 - dependent default template argument
+ * pt.c (type_unification_real): Handle early substitution failure.
+
+2018-03-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/71569 - decltype of template.
+ * parser.c (cp_parser_decltype_expr): Handle missing template args.
+
+2018-03-01 Jason Merrill <jason@redhat.com>
+ Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/71569 - ICE with redundant args on member variable template.
+ * decl.c (start_decl): Handle partial specialization of member
+ variable template.
+ * pt.c (determine_specialization): Allow partial specialization
+ of member variable template without specializing enclosing class.
+ (process_partial_specialization): Improve error message.
+
+2018-02-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/71784 - ICE with ref-qualifier and explicit specialization.
+ * pt.c (determine_specialization): Check ref-qualifier.
+
+2018-02-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/84496 - ICE with generic lambda in lambda.
+ * pt.c (type_dependent_expression_p): Fix dependency checking of
+ functions without DECL_TEMPLATE_INFO.
+
+2018-02-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/84441 - ICE with base initialized from ?:
+ * call.c (unsafe_copy_elision_p): Handle COND_EXPR.
+
+ PR c++/84520 - ICE with generic lambda in NSDMI.
+ * lambda.c (lambda_expr_this_capture): Don't look for fake NSDMI
+ 'this' in a generic lambda instantiation.
+
+2018-02-26 Jason Merrill <jason@redhat.com>
+ Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR c++/81589 - error with is_trivially_constructible.
+ * method.c (constructible_expr): Set cp_unevaluated.
+
+2018-02-25 Jason Merrill <jason@redhat.com>
+
+ PR c++/84015 - ICE with class deduction and auto template parm.
+ * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
+
+2018-02-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-08-29 Jason Merrill <jason@redhat.com>
+
+ Fix lambdas in template default argument of inherited ctor.
+ * method.c (synthesized_method_base_walk): Replace an inherited
+ template with its specialization.
+ (synthesized_method_walk): Make inheriting_ctor a pointer.
+ (maybe_explain_implicit_delete, explain_implicit_non_constexpr)
+ (deduce_inheriting_ctor, implicitly_declare_fn): Adjust.
+
+2018-02-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/84151 - unnecessary volatile load with static member.
+ * call.c (build_new_method_call_1): Avoid loading from a volatile
+ lvalue used as the object argument for a static member function.
+
+ PR c++/81853 - using-directive and constexpr.
+ * constexpr.c (cxx_eval_constant_expression): Handle USING_STMT.
+
+ PR c++/84420 - ICE with structured binding in lambda.
+ * lambda.c (is_capture_proxy): Check DECL_DECOMPOSITION_P.
+
+ PR c++/83835 - C++17 error with constructor ctors.
+ * call.c (build_special_member_call): Set TARGET_EXPR_DIRECT_INIT_P.
+
+ PR c++/82664 - ICE with reference to function template parm.
+ * pt.c (convert_nontype_argument_function): Avoid obfuscationg
+ NOP_EXPRs.
+
+ PR c++/82764 - C++17 ICE with empty base
+ * class.c (build_base_field_1): Set DECL_SIZE to zero for empty base.
+
+ PR c++/83227 - C++17 ICE with init-list derived-to-base conversion.
+ * call.c (convert_like_real): Don't use the copy-list-initialization
+ shortcut for ck_base.
+
+ PR c++/84045 - ICE with typedef and noexcept.
+ * except.c (build_noexcept_spec): Use strip_typedefs_expr.
+
+2018-01-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/82461 - constexpr list-initialized member
+ * constexpr.c (potential_constant_expression_1): Check
+ TARGET_EXPR_DIRECT_INIT_P.
+
+2018-01-26 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/82878
+ PR c++/78495
+ * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited
+ ctor.
+ * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference
+ inhibibition check removed in previous c++/78495 change.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/81843 - ICE with variadic member template.
+ PR c++/72801
+ * pt.c (unify_pack_expansion): Don't try to deduce enclosing
+ template args.
+
+ PR c++/82331 - ICE with variadic partial specialization of auto
+ * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
+ around call to tsubst.
+
+ PR c++/82760 - memory corruption with aligned new.
+ * call.c (build_operator_new_call): Update *args if we add the
+ align_arg.
+
2018-01-02 Jakub Jelinek <jakub@redhat.com>
PR c++/83556
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 09279555b65..87729ac01e8 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -375,18 +375,10 @@ build_call_a (tree function, int n, tree *argarray)
TREE_HAS_CONSTRUCTOR (function) = (decl && DECL_CONSTRUCTOR_P (decl));
- if (current_function_decl && decl
- && flag_new_inheriting_ctors
- && DECL_INHERITED_CTOR (current_function_decl)
- && (DECL_INHERITED_CTOR (current_function_decl)
- == DECL_CLONED_FUNCTION (decl)))
- /* Pass arguments directly to the inherited constructor. */
- CALL_FROM_THUNK_P (function) = true;
-
/* Don't pass empty class objects by value. This is useful
for tags in STL, which are used to control overload resolution.
We don't need to handle other cases of copying empty classes. */
- else if (! decl || ! DECL_BUILT_IN (decl))
+ if (! decl || ! DECL_BUILT_IN (decl))
for (i = 0; i < n; i++)
{
tree arg = CALL_EXPR_ARG (function, i);
@@ -4344,6 +4336,8 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
= vec_copy_and_insert (*args, align_arg, 1);
cand = perform_overload_resolution (fns, align_args, &candidates,
&any_viable_p, tf_none);
+ if (cand)
+ *args = align_args;
/* If no aligned allocation function matches, try again without the
alignment. */
}
@@ -6884,6 +6878,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& DECL_INHERITED_CTOR (current_function_decl))
return expr;
+ if (TREE_CODE (expr) == TARGET_EXPR
+ && TARGET_EXPR_LIST_INIT_P (expr))
+ /* Copy-list-initialization doesn't actually involve a copy. */
+ return expr;
+
/* Fall through. */
case ck_base:
if (convs->kind == ck_base && !convs->need_temporary_p)
@@ -6909,10 +6908,6 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
flags |= LOOKUP_ONLYCONVERTING;
if (convs->rvaluedness_matches_p)
flags |= LOOKUP_PREFER_RVALUE;
- if (TREE_CODE (expr) == TARGET_EXPR
- && TARGET_EXPR_LIST_INIT_P (expr))
- /* Copy-list-initialization doesn't actually involve a copy. */
- return expr;
expr = build_temp (expr, totype, flags, &diag_kind, complain);
if (diag_kind && complain)
{
@@ -7523,6 +7518,15 @@ unsafe_copy_elision_p (tree target, tree exp)
/* build_compound_expr pushes COMPOUND_EXPR inside TARGET_EXPR. */
while (TREE_CODE (init) == COMPOUND_EXPR)
init = TREE_OPERAND (init, 1);
+ if (TREE_CODE (init) == COND_EXPR)
+ {
+ /* We'll end up copying from each of the arms of the COND_EXPR directly
+ into the target, so look at them. */
+ if (tree op = TREE_OPERAND (init, 1))
+ if (unsafe_copy_elision_p (target, op))
+ return true;
+ return unsafe_copy_elision_p (target, TREE_OPERAND (init, 2));
+ }
return (TREE_CODE (init) == AGGR_INIT_EXPR
&& !AGGR_INIT_VIA_CTOR_P (init));
}
@@ -8397,6 +8401,9 @@ build_special_member_call (tree instance, tree name, vec<tree, va_gc> **args,
{
if (is_dummy_object (instance))
return arg;
+ else if (TREE_CODE (arg) == TARGET_EXPR)
+ TARGET_EXPR_DIRECT_INIT_P (arg) = true;
+
if ((complain & tf_error)
&& (flags & LOOKUP_DELEGATING_CONS))
check_self_delegation (arg);
@@ -8849,8 +8856,14 @@ build_new_method_call_1 (tree instance, tree fns, vec<tree, va_gc> **args,
if (TREE_CODE (TREE_TYPE (fn)) != METHOD_TYPE
&& !is_dummy_object (instance)
&& TREE_SIDE_EFFECTS (instance))
- call = build2 (COMPOUND_EXPR, TREE_TYPE (call),
- instance, call);
+ {
+ /* But avoid the implicit lvalue-rvalue conversion when 'a'
+ is volatile. */
+ tree a = instance;
+ if (TREE_THIS_VOLATILE (a))
+ a = build_this (a);
+ call = build2 (COMPOUND_EXPR, TREE_TYPE (call), a, call);
+ }
else if (call != error_mark_node
&& DECL_DESTRUCTOR_P (cand->fn)
&& !VOID_TYPE_P (TREE_TYPE (call)))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c6f8f3fa41d..5a4c9840acf 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4532,8 +4532,14 @@ build_base_field_1 (tree t, tree basetype, tree *&next_field)
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
DECL_FIELD_CONTEXT (decl) = t;
- DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
- DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
+ if (is_empty_class (basetype))
+ /* CLASSTYPE_SIZE is one byte, but the field needs to have size zero. */
+ DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = size_zero_node;
+ else
+ {
+ DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
+ DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
+ }
SET_DECL_ALIGN (decl, CLASSTYPE_ALIGN (basetype));
DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
SET_DECL_MODE (decl, TYPE_MODE (basetype));
@@ -7592,7 +7598,8 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
case CALL_EXPR:
/* This is a call to a constructor, hence it's never zero. */
- if (TREE_HAS_CONSTRUCTOR (instance))
+ if (CALL_EXPR_FN (instance)
+ && TREE_HAS_CONSTRUCTOR (instance))
{
if (nonnull)
*nonnull = 1;
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 9082230b9d5..49dab47c149 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1274,6 +1274,8 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
if (!*non_constant_p)
{
+ /* Don't share a CONSTRUCTOR that might be changed. */
+ arg = unshare_constructor (arg);
/* Make sure the binding has the same type as the parm. But
only for constant args. */
if (TREE_CODE (type) != REFERENCE_TYPE)
@@ -2895,9 +2897,8 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
if (!lvalue_p (init))
eltinit = move (eltinit);
eltinit = force_rvalue (eltinit, tf_warning_or_error);
- eltinit = (cxx_eval_constant_expression
- (&new_ctx, eltinit, lval,
- non_constant_p, overflow_p));
+ eltinit = cxx_eval_constant_expression (&new_ctx, eltinit, lval,
+ non_constant_p, overflow_p);
}
if (*non_constant_p && !ctx->quiet)
break;
@@ -2910,12 +2911,13 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
else
CONSTRUCTOR_APPEND_ELT (*p, idx, eltinit);
/* Reuse the result of cxx_eval_constant_expression call
- from the first iteration to all others if it is a constant
- initializer that doesn't require relocations. */
+ from the first iteration to all others if it is a constant
+ initializer that doesn't require relocations. */
if (reuse
&& max > 1
- && (initializer_constant_valid_p (eltinit, TREE_TYPE (eltinit))
- == null_pointer_node))
+ && (eltinit == NULL_TREE
+ || (initializer_constant_valid_p (eltinit, TREE_TYPE (eltinit))
+ == null_pointer_node)))
{
if (new_ctx.ctor != ctx->ctor)
eltinit = new_ctx.ctor;
@@ -2966,9 +2968,9 @@ cxx_eval_vec_init (const constexpr_ctx *ctx, tree t,
static tree
cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
{
- tree sub, subtype;
+ tree sub = op0;
+ tree subtype;
- sub = op0;
STRIP_NOPS (sub);
subtype = TREE_TYPE (sub);
if (!POINTER_TYPE_P (subtype))
@@ -3023,7 +3025,8 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
{
tree part_width = TYPE_SIZE (type);
tree index = bitsize_int (0);
- return fold_build3_loc (loc, BIT_FIELD_REF, type, op, part_width, index);
+ return fold_build3_loc (loc, BIT_FIELD_REF, type, op, part_width,
+ index);
}
/* Also handle conversion to an empty base class, which
is represented with a NOP_EXPR. */
@@ -3063,19 +3066,31 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
/* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */
if (VECTOR_TYPE_P (op00type)
&& (same_type_ignoring_top_level_qualifiers_p
- (type, TREE_TYPE (op00type))))
+ (type, TREE_TYPE (op00type)))
+ /* POINTER_PLUS_EXPR second operand is sizetype, unsigned,
+ but we want to treat offsets with MSB set as negative.
+ For the code below negative offsets are invalid and
+ TYPE_SIZE of the element is something unsigned, so
+ check whether op01 fits into HOST_WIDE_INT, which
+ implies it is from 0 to INTTYPE_MAXIMUM (HOST_WIDE_INT), and
+ then just use unsigned HOST_WIDE_INT because we want to treat
+ the value as unsigned. */
+ && tree_fits_shwi_p (op01))
{
- HOST_WIDE_INT offset = tree_to_shwi (op01);
tree part_width = TYPE_SIZE (type);
- unsigned HOST_WIDE_INT part_widthi = tree_to_shwi (part_width)/BITS_PER_UNIT;
- unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
- tree index = bitsize_int (indexi);
-
- if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type))
- return fold_build3_loc (loc,
- BIT_FIELD_REF, type, op00,
- part_width, index);
-
+ unsigned HOST_WIDE_INT max_offset
+ = (tree_to_uhwi (part_width) / BITS_PER_UNIT
+ * TYPE_VECTOR_SUBPARTS (op00type));
+ if (tree_int_cst_sign_bit (op01) == 0
+ && compare_tree_int (op01, max_offset) == -1)
+ {
+ unsigned HOST_WIDE_INT offset = tree_to_uhwi (op01);
+ unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
+ tree index = bitsize_int (indexi);
+ return fold_build3_loc (loc,
+ BIT_FIELD_REF, type, op00,
+ part_width, index);
+ }
}
/* ((foo*)&complexfoo)[1] => __imag__ complexfoo */
else if (TREE_CODE (op00type) == COMPLEX_TYPE
@@ -3132,7 +3147,8 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
{
tree type_domain;
tree min_val = size_zero_node;
- tree newsub = cxx_fold_indirect_ref (loc, TREE_TYPE (subtype), sub, NULL);
+ tree newsub
+ = cxx_fold_indirect_ref (loc, TREE_TYPE (subtype), sub, NULL);
if (newsub)
sub = newsub;
else
@@ -4170,7 +4186,16 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
lval,
non_constant_p, overflow_p);
- *jump_target = t;
+ if (jump_target)
+ *jump_target = t;
+ else
+ {
+ /* Can happen with ({ return true; }) && false; passed to
+ maybe_constant_value. There is nothing to jump over in this
+ case, and the bug will be diagnosed later. */
+ gcc_assert (ctx->quiet);
+ *non_constant_p = true;
+ }
break;
case SAVE_EXPR:
@@ -4640,6 +4665,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
jump_target);
break;
+ case USING_STMT:
+ r = void_node;
+ break;
+
default:
if (STATEMENT_CODE_P (TREE_CODE (t)))
{
@@ -4763,8 +4792,12 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
return error_mark_node;
else if (non_constant_p && TREE_CONSTANT (r))
{
- /* This isn't actually constant, so unset TREE_CONSTANT. */
- if (EXPR_P (r))
+ /* This isn't actually constant, so unset TREE_CONSTANT.
+ Don't clear TREE_CONSTANT on ADDR_EXPR, as the middle-end requires
+ it to be set if it is invariant address, even when it is not
+ a valid C++ constant expression. Wrap it with a NOP_EXPR
+ instead. */
+ if (EXPR_P (r) && TREE_CODE (r) != ADDR_EXPR)
r = copy_node (r);
else if (TREE_CODE (r) == CONSTRUCTOR)
r = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (r), r);
@@ -5453,6 +5486,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
case OMP_PARALLEL:
case OMP_TASK:
case OMP_FOR:
+ case OMP_SIMD:
case OMP_DISTRIBUTE:
case OMP_TASKLOOP:
case OMP_TEAMS:
@@ -5627,7 +5661,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
return RECUR (TREE_OPERAND (t, 1), want_rval);
case TARGET_EXPR:
- if (!literal_type_p (TREE_TYPE (t)))
+ if (!TARGET_EXPR_DIRECT_INIT_P (t)
+ && !literal_type_p (TREE_TYPE (t)))
{
if (flags & tf_error)
{
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index b0e010e18ce..b3c6374416a 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1107,6 +1107,14 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
&& omp_var_to_track (stmt))
omp_cxx_notice_variable (wtd->omp_ctx, stmt);
+ /* Don't dereference parms in a thunk, pass the references through. */
+ if ((TREE_CODE (stmt) == CALL_EXPR && CALL_FROM_THUNK_P (stmt))
+ || (TREE_CODE (stmt) == AGGR_INIT_EXPR && AGGR_INIT_FROM_THUNK_P (stmt)))
+ {
+ *walk_subtrees = 0;
+ return NULL;
+ }
+
/* Dereference invisible reference parms. */
if (wtd->handle_invisiref_parm_p && is_invisiref_parm (stmt))
{
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 5f4b5e30a5f..5d3a47ec640 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1053,6 +1053,8 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
|| TREE_TYPE (expr) == error_mark_node)
return error_mark_node;
+ expr = maybe_undo_parenthesized_ref (expr);
+
if (implicit == ICV_CAST)
mark_exp_read (expr);
else
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6bb7f6efe4f..730a6f1be37 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5042,19 +5042,17 @@ start_decl (const cp_declarator *declarator,
if (field == NULL_TREE
|| !(VAR_P (field) || variable_template_p (field)))
error ("%q+#D is not a static data member of %q#T", decl, context);
+ else if (variable_template_p (field)
+ && (DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_SPECIALIZATION (decl)))
+ /* OK, specialization was already checked. */;
else if (variable_template_p (field) && !this_tmpl)
{
- if (DECL_LANG_SPECIFIC (decl)
- && DECL_TEMPLATE_SPECIALIZATION (decl))
- /* OK, specialization was already checked. */;
- else
- {
- error_at (DECL_SOURCE_LOCATION (decl),
- "non-member-template declaration of %qD", decl);
- inform (DECL_SOURCE_LOCATION (field), "does not match "
- "member template declaration here");
- return error_mark_node;
- }
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "non-member-template declaration of %qD", decl);
+ inform (DECL_SOURCE_LOCATION (field), "does not match "
+ "member template declaration here");
+ return error_mark_node;
}
else
{
@@ -7213,7 +7211,9 @@ find_decomp_class_base (location_t loc, tree type, tree ret)
{
bool member_seen = false;
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else if (ret)
return type;
@@ -7252,7 +7252,7 @@ find_decomp_class_base (location_t loc, tree type, tree ret)
tree t = find_decomp_class_base (loc, TREE_TYPE (base_binfo), ret);
if (t == error_mark_node)
return error_mark_node;
- if (t != NULL_TREE)
+ if (t != NULL_TREE && t != ret)
{
if (ret == type)
{
@@ -7263,9 +7263,6 @@ find_decomp_class_base (location_t loc, tree type, tree ret)
}
else if (orig_ret != NULL_TREE)
return t;
- else if (ret == t)
- /* OK, found the same base along another path. We'll complain
- in convert_to_base if it's ambiguous. */;
else if (ret != NULL_TREE)
{
error_at (loc, "cannot decompose class type %qT: its base "
@@ -7466,6 +7463,12 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
type = complete_type (TREE_TYPE (type));
if (type == error_mark_node)
goto error_out;
+ if (!COMPLETE_TYPE_P (type))
+ {
+ error_at (loc, "structured binding refers to incomplete type %qT",
+ type);
+ goto error_out;
+ }
}
tree eltype = NULL_TREE;
@@ -7640,7 +7643,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
goto error_out;
}
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else
eltscnt++;
@@ -7655,7 +7660,9 @@ cp_finish_decomp (tree decl, tree first, unsigned int count)
}
unsigned int i = 0;
for (tree field = TYPE_FIELDS (btype); field; field = TREE_CHAIN (field))
- if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_ARTIFICIAL (field)
+ || (DECL_C_BIT_FIELD (field) && !DECL_NAME (field)))
continue;
else
{
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index f65b717c32b..3487dec9275 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1218,6 +1218,10 @@ build_noexcept_spec (tree expr, int complain)
{
gcc_assert (processing_template_decl
|| TREE_CODE (expr) == DEFERRED_NOEXCEPT);
+ if (TREE_CODE (expr) != DEFERRED_NOEXCEPT)
+ /* Avoid problems with a function type built with a dependent typedef
+ being reused in another scope (c++/84045). */
+ expr = strip_typedefs_expr (expr);
return build_tree_list (expr, NULL_TREE);
}
}
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index a9ddba83fc0..08874794eaf 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -262,6 +262,7 @@ is_capture_proxy (tree decl)
return (VAR_P (decl)
&& DECL_HAS_VALUE_EXPR_P (decl)
&& !DECL_ANON_UNION_VAR_P (decl)
+ && !DECL_DECOMPOSITION_P (decl)
&& LAMBDA_FUNCTION_P (DECL_CONTEXT (decl)));
}
@@ -712,11 +713,14 @@ lambda_expr_this_capture (tree lambda, bool add_capture_p)
lambda_stack);
if (LAMBDA_EXPR_EXTRA_SCOPE (tlambda)
+ && !COMPLETE_TYPE_P (LAMBDA_EXPR_CLOSURE (tlambda))
&& TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (tlambda)) == FIELD_DECL)
{
/* In an NSDMI, we don't have a function to look up the decl in,
but the fake 'this' pointer that we're using for parsing is
- in scope_chain. */
+ in scope_chain. But if the closure is already complete, we're
+ in an instantiation of a generic lambda, and the fake 'this'
+ is gone. */
init = scope_chain->x_current_class_ptr;
gcc_checking_assert
(init && (TREE_TYPE (TREE_TYPE (init))
@@ -1072,7 +1076,6 @@ maybe_add_lambda_conv_op (tree type)
}
}
-
if (generic_lambda_p)
{
if (decltype_call)
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index c7b67589924..a2d4c071efa 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1165,6 +1165,7 @@ constructible_expr (tree to, tree from)
{
tree ctype = to;
vec<tree, va_gc> *args = NULL;
+ cp_unevaluated cp_uneval_guard;
if (TREE_CODE (to) != REFERENCE_TYPE)
to = cp_build_reference_type (to, /*rval*/false);
tree ob = build_stub_object (to);
@@ -1430,7 +1431,7 @@ static tree
synthesized_method_base_walk (tree binfo, tree base_binfo,
int quals, bool copy_arg_p,
bool move_p, bool ctor_p,
- tree inheriting_ctor, tree inherited_parms,
+ tree *inheriting_ctor, tree inherited_parms,
tree fnname, int flags, bool diag,
tree *spec_p, bool *trivial_p,
bool *deleted_p, bool *constexpr_p)
@@ -1441,8 +1442,9 @@ synthesized_method_base_walk (tree binfo, tree base_binfo,
if (copy_arg_p)
argtype = build_stub_type (BINFO_TYPE (base_binfo), quals, move_p);
- else if ((inherited_binfo
- = binfo_inherited_from (binfo, base_binfo, inheriting_ctor)))
+ else if (inheriting_ctor
+ && (inherited_binfo
+ = binfo_inherited_from (binfo, base_binfo, *inheriting_ctor)))
{
argtype = inherited_parms;
/* Don't check access on the inherited constructor. */
@@ -1464,6 +1466,12 @@ synthesized_method_base_walk (tree binfo, tree base_binfo,
if (defer != dk_no_deferred)
pop_deferring_access_checks ();
+ /* Replace an inherited template with the appropriate specialization. */
+ if (inherited_binfo && rval
+ && DECL_P (*inheriting_ctor) && DECL_P (rval)
+ && DECL_CONTEXT (*inheriting_ctor) == DECL_CONTEXT (rval))
+ *inheriting_ctor = DECL_CLONED_FUNCTION (rval);
+
process_subob_fn (rval, spec_p, trivial_p, deleted_p,
constexpr_p, diag, BINFO_TYPE (base_binfo));
if (ctor_p &&
@@ -1498,7 +1506,7 @@ static void
synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
tree *spec_p, bool *trivial_p, bool *deleted_p,
bool *constexpr_p, bool diag,
- tree inheriting_ctor, tree inherited_parms)
+ tree *inheriting_ctor, tree inherited_parms)
{
tree binfo, base_binfo, fnname;
int i;
@@ -1553,7 +1561,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
}
gcc_assert ((sfk == sfk_inheriting_constructor)
- == (inheriting_ctor != NULL_TREE));
+ == (inheriting_ctor && *inheriting_ctor != NULL_TREE));
/* If that user-written default constructor would satisfy the
requirements of a constexpr constructor (7.1.5), the
@@ -1628,7 +1636,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p,
tree scope = push_scope (ctype);
int flags = LOOKUP_NORMAL | LOOKUP_SPECULATIVE;
- if (!inheriting_ctor)
+ if (sfk != sfk_inheriting_constructor)
flags |= LOOKUP_DEFAULTED;
tsubst_flags_t complain = diag ? tf_warning_or_error : tf_none;
@@ -1731,9 +1739,9 @@ get_defaulted_eh_spec (tree decl)
tree parm_type = TREE_VALUE (parms);
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
tree spec = empty_except_spec;
+ tree inh = DECL_INHERITED_CTOR (decl);
synthesized_method_walk (ctype, sfk, const_p, &spec, NULL, NULL,
- NULL, false, DECL_INHERITED_CTOR (decl),
- parms);
+ NULL, false, &inh, parms);
return spec;
}
@@ -1810,10 +1818,11 @@ maybe_explain_implicit_delete (tree decl)
tree raises = NULL_TREE;
bool deleted_p = false;
tree scope = push_scope (ctype);
+ tree inh = DECL_INHERITED_CTOR (decl);
synthesized_method_walk (ctype, sfk, const_p,
&raises, NULL, &deleted_p, NULL, false,
- DECL_INHERITED_CTOR (decl), parms);
+ &inh, parms);
if (deleted_p)
{
inform (DECL_SOURCE_LOCATION (decl),
@@ -1821,7 +1830,7 @@ maybe_explain_implicit_delete (tree decl)
"definition would be ill-formed:", decl);
synthesized_method_walk (ctype, sfk, const_p,
NULL, NULL, NULL, NULL, true,
- DECL_INHERITED_CTOR (decl), parms);
+ &inh, parms);
}
else if (!comp_except_specs
(TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl)),
@@ -1850,11 +1859,12 @@ explain_implicit_non_constexpr (tree decl)
{
tree parm_type = TREE_VALUE (FUNCTION_FIRST_USER_PARMTYPE (decl));
bool const_p = CP_TYPE_CONST_P (non_reference (parm_type));
+ tree inh = DECL_INHERITED_CTOR (decl);
bool dummy;
synthesized_method_walk (DECL_CLASS_CONTEXT (decl),
special_function_p (decl), const_p,
NULL, NULL, NULL, &dummy, true,
- DECL_INHERITED_CTOR (decl),
+ &inh,
FUNCTION_FIRST_USER_PARMTYPE (decl));
}
@@ -1869,22 +1879,25 @@ deduce_inheriting_ctor (tree decl)
gcc_assert (DECL_INHERITED_CTOR (decl));
tree spec;
bool trivial, constexpr_, deleted;
+ tree inh = DECL_INHERITED_CTOR (decl);
synthesized_method_walk (DECL_CONTEXT (decl), sfk_inheriting_constructor,
false, &spec, &trivial, &deleted, &constexpr_,
/*diag*/false,
- DECL_INHERITED_CTOR (decl),
+ &inh,
FUNCTION_FIRST_USER_PARMTYPE (decl));
if (TREE_CODE (inherited_ctor_binfo (decl)) != TREE_BINFO)
/* Inherited the same constructor from different base subobjects. */
deleted = true;
DECL_DELETED_FN (decl) = deleted;
TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl), spec);
+ SET_DECL_INHERITED_CTOR (decl, inh);
tree clone;
FOR_EACH_CLONE (clone, decl)
{
DECL_DELETED_FN (clone) = deleted;
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone), spec);
+ SET_DECL_INHERITED_CTOR (clone, inh);
}
}
@@ -1999,12 +2012,12 @@ implicitly_declare_fn (special_function_kind kind, tree type,
raises = unevaluated_noexcept_spec ();
synthesized_method_walk (type, kind, const_p, NULL, &trivial_p,
&deleted_p, &constexpr_p, false,
- inherited_ctor, inherited_parms);
+ &inherited_ctor, inherited_parms);
}
else
synthesized_method_walk (type, kind, const_p, &raises, &trivial_p,
&deleted_p, &constexpr_p, false,
- inherited_ctor, inherited_parms);
+ &inherited_ctor, inherited_parms);
/* Don't bother marking a deleted constructor as constexpr. */
if (deleted_p)
constexpr_p = false;
@@ -2120,7 +2133,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
input_location = DECL_SOURCE_LOCATION (fn);
synthesized_method_walk (type, kind, const_p,
NULL, NULL, NULL, NULL, true,
- NULL_TREE, NULL_TREE);
+ NULL, NULL_TREE);
input_location = loc;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 29aa76b5dab..ede8ca8097c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7252,6 +7252,60 @@ cp_parser_postfix_open_square_expression (cp_parser *parser,
return postfix_expression;
}
+/* A subroutine of cp_parser_postfix_dot_deref_expression. Handle dot
+ dereference of incomplete type, returns true if error_mark_node should
+ be returned from caller, otherwise adjusts *SCOPE, *POSTFIX_EXPRESSION
+ and *DEPENDENT_P. */
+
+bool
+cp_parser_dot_deref_incomplete (tree *scope, cp_expr *postfix_expression,
+ bool *dependent_p)
+{
+ /* In a template, be permissive by treating an object expression
+ of incomplete type as dependent (after a pedwarn). */
+ diagnostic_t kind = (processing_template_decl
+ && MAYBE_CLASS_TYPE_P (*scope) ? DK_PEDWARN : DK_ERROR);
+
+ switch (TREE_CODE (*postfix_expression))
+ {
+ case CAST_EXPR:
+ case REINTERPRET_CAST_EXPR:
+ case CONST_CAST_EXPR:
+ case STATIC_CAST_EXPR:
+ case DYNAMIC_CAST_EXPR:
+ case IMPLICIT_CONV_EXPR:
+ case VIEW_CONVERT_EXPR:
+ case NON_LVALUE_EXPR:
+ kind = DK_ERROR;
+ break;
+ case OVERLOAD:
+ /* Don't emit any diagnostic for OVERLOADs. */
+ kind = DK_IGNORED;
+ break;
+ default:
+ /* Avoid clobbering e.g. DECLs. */
+ if (!EXPR_P (*postfix_expression))
+ kind = DK_ERROR;
+ break;
+ }
+
+ if (kind == DK_IGNORED)
+ return false;
+
+ location_t exploc = location_of (*postfix_expression);
+ cxx_incomplete_type_diagnostic (exploc, *postfix_expression, *scope, kind);
+ if (!MAYBE_CLASS_TYPE_P (*scope))
+ return true;
+ if (kind == DK_ERROR)
+ *scope = *postfix_expression = error_mark_node;
+ else if (processing_template_decl)
+ {
+ *dependent_p = true;
+ *scope = TREE_TYPE (*postfix_expression) = NULL_TREE;
+ }
+ return false;
+}
+
/* A subroutine of cp_parser_postfix_expression that also gets hijacked
by cp_parser_builtin_offsetof. We're looking for
@@ -7316,23 +7370,9 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
{
scope = complete_type (scope);
if (!COMPLETE_TYPE_P (scope)
- /* Avoid clobbering e.g. OVERLOADs or DECLs. */
- && EXPR_P (postfix_expression))
- {
- /* In a template, be permissive by treating an object expression
- of incomplete type as dependent (after a pedwarn). */
- diagnostic_t kind = (processing_template_decl
- ? DK_PEDWARN
- : DK_ERROR);
- cxx_incomplete_type_diagnostic
- (location_of (postfix_expression),
- postfix_expression, scope, kind);
- if (processing_template_decl)
- {
- dependent_p = true;
- scope = TREE_TYPE (postfix_expression) = NULL_TREE;
- }
- }
+ && cp_parser_dot_deref_incomplete (&scope, &postfix_expression,
+ &dependent_p))
+ return error_mark_node;
}
if (!dependent_p)
@@ -9030,12 +9070,20 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p,
if (no_toplevel_fold_p
&& lookahead_prec <= current.prec
&& sp == stack)
- current.lhs = build2_loc (combined_loc,
- current.tree_type,
- TREE_CODE_CLASS (current.tree_type)
- == tcc_comparison
- ? boolean_type_node : TREE_TYPE (current.lhs),
- current.lhs, rhs);
+ {
+ if (current.lhs == error_mark_node || rhs == error_mark_node)
+ current.lhs = error_mark_node;
+ else
+ {
+ current.lhs
+ = build_min (current.tree_type,
+ TREE_CODE_CLASS (current.tree_type)
+ == tcc_comparison
+ ? boolean_type_node : TREE_TYPE (current.lhs),
+ current.lhs.get_value (), rhs.get_value ());
+ SET_EXPR_LOCATION (current.lhs, combined_loc);
+ }
+ }
else
{
current.lhs = build_x_binary_op (combined_loc, current.tree_type,
@@ -10743,6 +10791,18 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr,
"attributes at the beginning of statement are ignored");
}
+/* Append ATTR to attribute list ATTRS. */
+
+static tree
+attr_chainon (tree attrs, tree attr)
+{
+ if (attrs == error_mark_node)
+ return error_mark_node;
+ if (attr == error_mark_node)
+ return error_mark_node;
+ return chainon (attrs, attr);
+}
+
/* Parse the label for a labeled-statement, i.e.
identifier :
@@ -10862,7 +10922,7 @@ cp_parser_label_for_labeled_statement (cp_parser* parser, tree attributes)
else if (!cp_parser_parse_definitely (parser))
;
else
- attributes = chainon (attributes, attrs);
+ attributes = attr_chainon (attributes, attrs);
}
if (attributes != NULL_TREE)
@@ -13194,8 +13254,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
else
{
decl_specs->std_attributes
- = chainon (decl_specs->std_attributes,
- attrs);
+ = attr_chainon (decl_specs->std_attributes, attrs);
if (decl_specs->locations[ds_std_attribute] == 0)
decl_specs->locations[ds_std_attribute] = token->location;
}
@@ -13203,9 +13262,8 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
}
}
- decl_specs->attributes
- = chainon (decl_specs->attributes,
- attrs);
+ decl_specs->attributes
+ = attr_chainon (decl_specs->attributes, attrs);
if (decl_specs->locations[ds_attribute] == 0)
decl_specs->locations[ds_attribute] = token->location;
continue;
@@ -13688,6 +13746,10 @@ cp_parser_decltype_expr (cp_parser *parser,
expr = cp_parser_lookup_name_simple (parser, expr,
id_expr_start_token->location);
+ if (expr && TREE_CODE (expr) == TEMPLATE_DECL)
+ /* A template without args is not a complete id-expression. */
+ expr = error_mark_node;
+
if (expr
&& expr != error_mark_node
&& TREE_CODE (expr) != TYPE_DECL
@@ -13753,6 +13815,9 @@ cp_parser_decltype_expr (cp_parser *parser,
expression. */
cp_parser_abort_tentative_parse (parser);
+ /* Commit to the tentative_firewall so we get syntax errors. */
+ cp_parser_commit_to_tentative_parse (parser);
+
/* Parse a full expression. */
expr = cp_parser_expression (parser, /*pidk=*/NULL, /*cast_p=*/false,
/*decltype_p=*/true);
@@ -18220,7 +18285,7 @@ cp_parser_namespace_definition (cp_parser* parser)
if (post_ident_attribs)
{
if (attribs)
- attribs = chainon (attribs, post_ident_attribs);
+ attribs = attr_chainon (attribs, post_ident_attribs);
else
attribs = post_ident_attribs;
}
@@ -19394,7 +19459,7 @@ cp_parser_init_declarator (cp_parser* parser,
decl = grokfield (declarator, decl_specifiers,
initializer, !is_non_constant_init,
/*asmspec=*/NULL_TREE,
- chainon (attributes, prefix_attributes));
+ attr_chainon (attributes, prefix_attributes));
if (decl && TREE_CODE (decl) == FUNCTION_DECL)
cp_parser_save_default_args (parser, decl);
cp_finalize_omp_declare_simd (parser, decl);
@@ -20789,9 +20854,9 @@ cp_parser_type_specifier_seq (cp_parser* parser,
/* Check for attributes first. */
if (cp_next_tokens_can_be_attribute_p (parser))
{
- type_specifier_seq->attributes =
- chainon (type_specifier_seq->attributes,
- cp_parser_attributes_opt (parser));
+ type_specifier_seq->attributes
+ = attr_chainon (type_specifier_seq->attributes,
+ cp_parser_attributes_opt (parser));
continue;
}
@@ -21270,8 +21335,8 @@ cp_parser_parameter_declaration (cp_parser *parser,
parser->default_arg_ok_p = saved_default_arg_ok_p;
/* After the declarator, allow more attributes. */
decl_specifiers.attributes
- = chainon (decl_specifiers.attributes,
- cp_parser_attributes_opt (parser));
+ = attr_chainon (decl_specifiers.attributes,
+ cp_parser_attributes_opt (parser));
/* If the declarator is a template parameter pack, remember that and
clear the flag in the declarator itself so we don't get errors
@@ -23261,7 +23326,7 @@ cp_parser_member_declaration (cp_parser* parser)
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
/* Create the bitfield declaration. */
decl = grokbitfield (identifier
@@ -23318,7 +23383,7 @@ cp_parser_member_declaration (cp_parser* parser)
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
/* If it's an `=', then we have a constant-initializer or a
pure-specifier. It is not correct to parse the
@@ -23432,10 +23497,13 @@ cp_parser_member_declaration (cp_parser* parser)
cp_finalize_oacc_routine (parser, decl, false);
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
/* If there is any qualification still in effect, clear it
now; we will be starting fresh with the next declarator. */
@@ -24547,7 +24615,7 @@ cp_parser_gnu_attributes_opt (cp_parser* parser)
cp_parser_skip_to_end_of_statement (parser);
/* Add these new attributes to the list. */
- attributes = chainon (attributes, attribute_list);
+ attributes = attr_chainon (attributes, attribute_list);
}
return attributes;
@@ -29725,7 +29793,7 @@ cp_parser_objc_class_ivars (cp_parser* parser)
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
+ attributes = attr_chainon (prefix_attributes, attributes);
if (width)
/* Create the bitfield declaration. */
@@ -29742,10 +29810,13 @@ cp_parser_objc_class_ivars (cp_parser* parser)
objc_add_instance_variable (decl);
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
token = cp_lexer_peek_token (parser->lexer);
@@ -30275,8 +30346,8 @@ cp_parser_objc_struct_declaration (cp_parser *parser)
which are not. */
first_attribute = attributes;
/* Combine the attributes. */
- attributes = chainon (prefix_attributes, attributes);
-
+ attributes = attr_chainon (prefix_attributes, attributes);
+
decl = grokfield (declarator, &declspecs,
NULL_TREE, /*init_const_expr_p=*/false,
NULL_TREE, attributes);
@@ -30285,10 +30356,13 @@ cp_parser_objc_struct_declaration (cp_parser *parser)
return error_mark_node;
/* Reset PREFIX_ATTRIBUTES. */
- while (attributes && TREE_CHAIN (attributes) != first_attribute)
- attributes = TREE_CHAIN (attributes);
- if (attributes)
- TREE_CHAIN (attributes) = NULL_TREE;
+ if (attributes != error_mark_node)
+ {
+ while (attributes && TREE_CHAIN (attributes) != first_attribute)
+ attributes = TREE_CHAIN (attributes);
+ if (attributes)
+ TREE_CHAIN (attributes) = NULL_TREE;
+ }
DECL_CHAIN (decl) = decls;
decls = decl;
@@ -30888,7 +30962,10 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
if (name == error_mark_node)
goto skip_comma;
- decl = cp_parser_lookup_name_simple (parser, name, token->location);
+ if (identifier_p (name))
+ decl = cp_parser_lookup_name_simple (parser, name, token->location);
+ else
+ decl = name;
if (decl == error_mark_node)
cp_parser_name_lookup_error (parser, name, decl, NLE_NULL,
token->location);
@@ -37448,7 +37525,9 @@ cp_parser_oacc_routine (cp_parser *parser, cp_token *pragma_tok,
/*template_p=*/NULL,
/*declarator_p=*/false,
/*optional_p=*/false);
- tree decl = cp_parser_lookup_name_simple (parser, name, name_loc);
+ tree decl = (identifier_p (name)
+ ? cp_parser_lookup_name_simple (parser, name, name_loc)
+ : name);
if (name != error_mark_node && decl == error_mark_node)
cp_parser_name_lookup_error (parser, name, decl, NLE_NULL, name_loc);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 61fe2a3a14d..9815df63c28 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2072,7 +2072,8 @@ determine_specialization (tree template_id,
/* We shouldn't be specializing a member template of an
unspecialized class template; we already gave an error in
check_specialization_scope, now avoid crashing. */
- if (template_count && DECL_CLASS_SCOPE_P (decl)
+ if (!VAR_P (decl)
+ && template_count && DECL_CLASS_SCOPE_P (decl)
&& template_class_depth (DECL_CONTEXT (decl)) > 0)
{
gcc_assert (errorcount);
@@ -2175,10 +2176,17 @@ determine_specialization (tree template_id,
that the const qualification is the same. Since
get_bindings does not try to merge the "this" parameter,
we must do the comparison explicitly. */
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
- && !same_type_p (TREE_VALUE (fn_arg_types),
- TREE_VALUE (decl_arg_types)))
- continue;
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ {
+ if (!same_type_p (TREE_VALUE (fn_arg_types),
+ TREE_VALUE (decl_arg_types)))
+ continue;
+
+ /* And the ref-qualification. */
+ if (type_memfn_rqual (TREE_TYPE (decl))
+ != type_memfn_rqual (TREE_TYPE (fn)))
+ continue;
+ }
/* Skip the "this" parameter and, for constructors of
classes with virtual bases, the VTT parameter. A
@@ -2284,6 +2292,11 @@ determine_specialization (tree template_id,
decl_arg_types))
continue;
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
+ && (type_memfn_rqual (TREE_TYPE (decl))
+ != type_memfn_rqual (TREE_TYPE (fn))))
+ continue;
+
// If the deduced arguments do not satisfy the constraints,
// this is not a candidate.
if (flag_concepts && !constraints_satisfied_p (fn))
@@ -4601,10 +4614,13 @@ process_partial_specialization (tree decl)
{
if (!flag_concepts)
error ("partial specialization %q+D does not specialize "
- "any template arguments", decl);
+ "any template arguments; to define the primary template, "
+ "remove the template argument list", decl);
else
error ("partial specialization %q+D does not specialize any "
- "template arguments and is not more constrained than", decl);
+ "template arguments and is not more constrained than "
+ "the primary template; to define the primary template, "
+ "remove the template argument list", decl);
inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here");
}
@@ -6032,7 +6048,12 @@ convert_nontype_argument_function (tree type, tree expr,
accept:
if (TREE_CODE (type) == REFERENCE_TYPE)
- fn = build_address (fn);
+ {
+ if (REFERENCE_REF_P (fn))
+ fn = TREE_OPERAND (fn, 0);
+ else
+ fn = build_address (fn);
+ }
if (!same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (fn)))
fn = build_nop (type, fn);
@@ -17492,7 +17513,10 @@ tsubst_copy_and_build (tree t,
CALL_EXPR_REVERSE_ARGS (function) = rev;
if (thk)
{
- CALL_FROM_THUNK_P (function) = true;
+ if (TREE_CODE (function) == CALL_EXPR)
+ CALL_FROM_THUNK_P (function) = true;
+ else
+ AGGR_INIT_FROM_THUNK_P (function) = true;
/* The thunk location is not interesting. */
SET_EXPR_LOCATION (function, UNKNOWN_LOCATION);
}
@@ -19467,10 +19491,10 @@ type_unification_real (tree tparms,
if (DECL_P (parm))
input_location = DECL_SOURCE_LOCATION (parm);
arg = tsubst_template_arg (arg, full_targs, complain, NULL_TREE);
- if (!uses_template_parms (arg))
+ if (arg != error_mark_node && !uses_template_parms (arg))
arg = convert_template_argument (parm, arg, full_targs, complain,
i, NULL_TREE);
- else if (saw_undeduced < 2)
+ else if (saw_undeduced == 1)
arg = NULL_TREE;
else
arg = error_mark_node;
@@ -20068,6 +20092,7 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
/* Add in any args remembered from an earlier partial instantiation. */
targs = add_to_template_args (PACK_EXPANSION_EXTRA_ARGS (parm), targs);
+ int levels = TMPL_ARGS_DEPTH (targs);
packed_args = expand_template_argument_pack (packed_args);
@@ -20083,6 +20108,8 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
/* Determine the index and level of this parameter pack. */
template_parm_level_and_index (parm_pack, &level, &idx);
+ if (level < levels)
+ continue;
/* Keep track of the parameter packs and their corresponding
argument packs. */
@@ -20686,7 +20713,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
template-parameter exactly, except that a template-argument
deduced from an array bound may be of any integral type.
The non-type parameter might use already deduced type parameters. */
+ ++processing_template_decl;
tparm = tsubst (TREE_TYPE (parm), targs, 0, NULL_TREE);
+ --processing_template_decl;
if (tree a = type_uses_auto (tparm))
{
tparm = do_auto_deduction (tparm, arg, a, complain, adc_unify);
@@ -24060,20 +24089,21 @@ type_dependent_expression_p (tree expression)
&& (any_dependent_template_arguments_p
(INNERMOST_TEMPLATE_ARGS (DECL_TI_ARGS (expression)))))
return true;
+ }
- /* Otherwise, if the decl isn't from a dependent scope, it can't be
- type-dependent. Checking this is important for functions with auto
- return type, which looks like a dependent type. */
- if (TREE_CODE (expression) == FUNCTION_DECL
- && undeduced_auto_decl (expression)
- && (!DECL_CLASS_SCOPE_P (expression)
- || !dependent_type_p (DECL_CONTEXT (expression)))
- && (!DECL_FRIEND_CONTEXT (expression)
- || !dependent_type_p (DECL_FRIEND_CONTEXT (expression)))
- && !DECL_LOCAL_FUNCTION_P (expression))
- {
- return false;
- }
+ /* Otherwise, if the decl isn't from a dependent scope, it can't be
+ type-dependent. Checking this is important for functions with auto
+ return type, which looks like a dependent type. */
+ if (TREE_CODE (expression) == FUNCTION_DECL
+ && undeduced_auto_decl (expression)
+ && (!DECL_CLASS_SCOPE_P (expression)
+ || !dependent_type_p (DECL_CONTEXT (expression)))
+ && (!DECL_LANG_SPECIFIC (expression)
+ || !DECL_FRIEND_CONTEXT (expression)
+ || !dependent_type_p (DECL_FRIEND_CONTEXT (expression)))
+ && !DECL_LOCAL_FUNCTION_P (expression))
+ {
+ return false;
}
/* Always dependent, on the number of arguments if nothing else. */
@@ -25140,7 +25170,7 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level,
// Substitute ttargs into ttparms to fix references to
// other template parameters.
ttparms = tsubst_template_parms_level (ttparms, ttargs,
- complain);
+ complain|tf_partial);
// Now substitute again with args based on tparms, to reduce
// the level of the ttparms.
ttargs = current_template_args ();
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 6501f127d7c..65277584aa2 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2589,6 +2589,8 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
{
u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1),
tf_warning_or_error);
+ if (u == error_mark_node)
+ return u;
if (AGGR_INIT_ZERO_FIRST (TREE_OPERAND (t, 1)))
AGGR_INIT_ZERO_FIRST (TREE_OPERAND (u, 1)) = true;
}
@@ -2606,6 +2608,8 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
(splay_tree_value) TREE_OPERAND (u, 0));
TREE_OPERAND (u, 1) = break_out_target_exprs (TREE_OPERAND (u, 1));
+ if (TREE_OPERAND (u, 1) == error_mark_node)
+ return error_mark_node;
/* Replace the old expression with the new version. */
*tp = u;
@@ -2718,7 +2722,8 @@ break_out_target_exprs (tree t)
target_remap = splay_tree_new (splay_tree_compare_pointers,
/*splay_tree_delete_key_fn=*/NULL,
/*splay_tree_delete_value_fn=*/NULL);
- cp_walk_tree (&t, bot_manip, target_remap, NULL);
+ if (cp_walk_tree (&t, bot_manip, target_remap, NULL) == error_mark_node)
+ t = error_mark_node;
cp_walk_tree (&t, bot_replace, target_remap, NULL);
if (!--target_remap_count)
diff --git a/gcc/dce.c b/gcc/dce.c
index 7534d2abadf..f7f41e8e71f 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -131,6 +131,12 @@ deletable_insn_p (rtx_insn *insn, bool fast, bitmap arg_stores)
&& REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER)
return false;
+ /* Callee-save restores are needed. */
+ if (RTX_FRAME_RELATED_P (insn)
+ && crtl->shrink_wrapped_separate
+ && find_reg_note (insn, REG_CFA_RESTORE, NULL))
+ return false;
+
body = PATTERN (insn);
switch (GET_CODE (body))
{
@@ -589,15 +595,6 @@ delete_unmarked_insns (void)
if (!dbg_cnt (dce))
continue;
- if (crtl->shrink_wrapped_separate
- && find_reg_note (insn, REG_CFA_RESTORE, NULL))
- {
- if (dump_file)
- fprintf (dump_file, "DCE: NOT deleting insn %d, it's a "
- "callee-save restore\n", INSN_UID (insn));
- continue;
- }
-
if (dump_file)
fprintf (dump_file, "DCE: Deleting insn %d\n", INSN_UID (insn));
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ba309d01a9b..977664ffd11 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -5540,6 +5540,25 @@ Specify which floating-point unit to use. You must specify the
@code{target("fpmath=sse,387")} option as
@code{target("fpmath=sse+387")} because the comma would separate
different options.
+
+@item indirect_branch("@var{choice}")
+@cindex @code{indirect_branch} function attribute, x86
+On x86 targets, the @code{indirect_branch} attribute causes the compiler
+to convert indirect call and jump with @var{choice}. @samp{keep}
+keeps indirect call and jump unmodified. @samp{thunk} converts indirect
+call and jump to call and return thunk. @samp{thunk-inline} converts
+indirect call and jump to inlined call and return thunk.
+@samp{thunk-extern} converts indirect call and jump to external call
+and return thunk provided in a separate object file.
+
+@item function_return("@var{choice}")
+@cindex @code{function_return} function attribute, x86
+On x86 targets, the @code{function_return} attribute causes the compiler
+to convert function return with @var{choice}. @samp{keep} keeps function
+return unmodified. @samp{thunk} converts function return to call and
+return thunk. @samp{thunk-inline} converts function return to inlined
+call and return thunk. @samp{thunk-extern} converts function return to
+external call and return thunk provided in a separate object file.
@end table
On the x86, the inliner does not inline a
@@ -8759,6 +8778,9 @@ The table below shows the list of supported modifiers and their effects.
@tab @code{2}
@end multitable
+@code{V} is a special modifier which prints the name of the full integer
+register without @code{%}.
+
@anchor{x86floatingpointasmoperands}
@subsubsection x86 Floating-Point @code{asm} Operands
@@ -18102,14 +18124,11 @@ vector unsigned short vec_vctzh (vector unsigned short);
vector int vec_vctzw (vector int);
vector unsigned int vec_vctzw (vector int);
-long long vec_vextract4b (const vector signed char, const int);
-long long vec_vextract4b (const vector unsigned char, const int);
-
-vector signed char vec_insert4b (vector int, vector signed char, const int);
+long long vec_extract4b (const vector unsigned char, const int);
+vector unsigned char vec_insert4b (vector signed int, vector unsigned char,
+ const int);
vector unsigned char vec_insert4b (vector unsigned int, vector unsigned char,
const int);
-vector signed char vec_insert4b (long long, vector signed char, const int);
-vector unsigned char vec_insert4b (long long, vector unsigned char, const int);
vector int vec_vprtyb (vector int);
vector unsigned int vec_vprtyb (vector unsigned int);
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 88b8d6d9071..4c232113ca3 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -322,7 +322,7 @@ program source code. The format is
Additional block information may succeed each line, when requested by
command line option. The @var{execution_count} is @samp{-} for lines
containing no code. Unexecuted lines are marked @samp{#####} or
-@samp{====}, depending on whether they are reachable by
+@samp{=====}, depending on whether they are reachable by
non-exceptional paths or only exceptional paths such as C++ exception
handlers, respectively. Given @samp{-a} option, unexecuted blocks are
marked @samp{$$$$$} or @samp{%%%%%}, depending on whether a basic block
@@ -618,6 +618,8 @@ Instrumented applications use a static destructor with priority 99
to invoke the @code{__gcov_dump} function. Thus @code{__gcov_dump}
is executed after all user defined static destructors,
as well as handlers registered with @code{atexit}.
+If an executable loads a dynamic shared object via dlopen functionality,
+@option{-Wl,--dynamic-list-data} is needed to dump all profile data.
@c man end
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index e02b95f353a..f150453d369 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1209,7 +1209,9 @@ See RS/6000 and PowerPC Options.
-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
-malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
--mmitigate-rop -mgeneral-regs-only}
+-mmitigate-rop -mgeneral-regs-only @gol
+-mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
+-mindirect-branch-register}
@emph{x86 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
@@ -8129,7 +8131,7 @@ This flag is enabled by default at @option{-O2} and higher and depends on
@item -fisolate-erroneous-paths-attribute
@opindex fisolate-erroneous-paths-attribute
-Detect paths that trigger erroneous or undefined behavior due a null value
+Detect paths that trigger erroneous or undefined behavior due to a null value
being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
attribute. Isolate those paths from the main control flow and turn the
statement with erroneous or undefined behavior into a trap. This is not
@@ -8687,6 +8689,7 @@ Some assemblers only support this flag when @var{n} is a power of two;
in that case, it is rounded up.
If @var{n} is not specified or is zero, use a machine-dependent default.
+The maximum allowed @var{n} option value is 65536.
Enabled at levels @option{-O2}, @option{-O3}.
@@ -8712,6 +8715,7 @@ are greater than this value, then their values are used instead.
If @var{n} is not specified or is zero, use a machine-dependent default
which is very likely to be @samp{1}, meaning no alignment.
+The maximum allowed @var{n} option value is 65536.
Enabled at levels @option{-O2}, @option{-O3}.
@@ -8725,6 +8729,7 @@ operations.
@option{-fno-align-loops} and @option{-falign-loops=1} are
equivalent and mean that loops are not aligned.
+The maximum allowed @var{n} option value is 65536.
If @var{n} is not specified or is zero, use a machine-dependent default.
@@ -8742,6 +8747,7 @@ need be executed.
equivalent and mean that loops are not aligned.
If @var{n} is not specified or is zero, use a machine-dependent default.
+The maximum allowed @var{n} option value is 65536.
Enabled at levels @option{-O2}, @option{-O3}.
@@ -25705,6 +25711,43 @@ Generate code that uses only the general-purpose registers. This
prevents the compiler from using floating-point, vector, mask and bound
registers.
+@item -mindirect-branch=@var{choice}
+@opindex -mindirect-branch
+Convert indirect call and jump with @var{choice}. The default is
+@samp{keep}, which keeps indirect call and jump unmodified.
+@samp{thunk} converts indirect call and jump to call and return thunk.
+@samp{thunk-inline} converts indirect call and jump to inlined call
+and return thunk. @samp{thunk-extern} converts indirect call and jump
+to external call and return thunk provided in a separate object file.
+You can control this behavior for a specific function by using the
+function attribute @code{indirect_branch}. @xref{Function Attributes}.
+
+Note that @option{-mcmodel=large} is incompatible with
+@option{-mindirect-branch=thunk} nor
+@option{-mindirect-branch=thunk-extern} since the thunk function may
+not be reachable in large code model.
+
+@item -mfunction-return=@var{choice}
+@opindex -mfunction-return
+Convert function return with @var{choice}. The default is @samp{keep},
+which keeps function return unmodified. @samp{thunk} converts function
+return to call and return thunk. @samp{thunk-inline} converts function
+return to inlined call and return thunk. @samp{thunk-extern} converts
+function return to external call and return thunk provided in a separate
+object file. You can control this behavior for a specific function by
+using the function attribute @code{function_return}.
+@xref{Function Attributes}.
+
+Note that @option{-mcmodel=large} is incompatible with
+@option{-mfunction-return=thunk} nor
+@option{-mfunction-return=thunk-extern} since the thunk function may
+not be reachable in large code model.
+
+
+@item -mindirect-branch-register
+@opindex -mindirect-branch-register
+Force indirect call and jump via register.
+
@end table
These @samp{-m} switches are supported in addition to the above
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index b02e5a16bfe..ebe2a63d370 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -1291,10 +1291,11 @@ point values. The floating point values are in @code{QFmode},
@findex CDImode
@findex CTImode
@findex COImode
-@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode
+@findex CPSImode
+@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode, CPSImode
These modes stand for a complex number represented as a pair of integer
values. The integer values are in @code{QImode}, @code{HImode},
-@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode},
+@code{SImode}, @code{DImode}, @code{TImode}, @code{OImode}, and @code{PSImode},
respectively.
@findex BND32mode
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 2790dd6a5d5..b7fc8bda006 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10654,8 +10654,12 @@ five otherwise. This is best for most machines.
@defmac WORD_REGISTER_OPERATIONS
Define this macro to 1 if operations between registers with integral mode
-smaller than a word are always performed on the entire register.
-Most RISC machines have this property and most CISC machines do not.
+smaller than a word are always performed on the entire register. To be
+more explicit, if you start with a pair of @code{word_mode} registers with
+known values and you do a subword, for example @code{QImode}, addition on
+the low part of the registers, then the compiler may consider that the
+result has a known value in @code{word_mode} too if the macro is defined
+to 1. Most RISC machines have this property and most CISC machines do not.
@end defmac
@deftypefn {Target Hook} {unsigned int} TARGET_MIN_ARITHMETIC_PRECISION (void)
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index dff6cf8e038..c52bce7e122 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7583,8 +7583,12 @@ is in effect.
@defmac WORD_REGISTER_OPERATIONS
Define this macro to 1 if operations between registers with integral mode
-smaller than a word are always performed on the entire register.
-Most RISC machines have this property and most CISC machines do not.
+smaller than a word are always performed on the entire register. To be
+more explicit, if you start with a pair of @code{word_mode} registers with
+known values and you do a subword, for example @code{QImode}, addition on
+the low part of the registers, then the compiler may consider that the
+result has a known value in @code{word_mode} too if the macro is defined
+to 1. Most RISC machines have this property and most CISC machines do not.
@end defmac
@hook TARGET_MIN_ARITHMETIC_PRECISION
diff --git a/gcc/expmed.c b/gcc/expmed.c
index e9f634aa27d..30001ac0a71 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -5886,6 +5886,18 @@ emit_store_flag_force (rtx target, enum rtx_code code, rtx op0, rtx op1,
if (tem != 0)
return tem;
+ /* If one operand is constant, make it the second one. Only do this
+ if the other operand is not constant as well. */
+
+ if (swap_commutative_operands_p (op0, op1))
+ {
+ std::swap (op0, op1);
+ code = swap_condition (code);
+ }
+
+ if (mode == VOIDmode)
+ mode = GET_MODE (op0);
+
if (!target)
target = gen_reg_rtx (word_mode);
diff --git a/gcc/expr.c b/gcc/expr.c
index c09bfbbc4d8..c0dbd643831 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10871,18 +10871,30 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
tree fndecl = get_callee_fndecl (exp), attr;
if (fndecl
+ /* Don't diagnose the error attribute in thunks, those are
+ artificially created. */
+ && !CALL_FROM_THUNK_P (exp)
&& (attr = lookup_attribute ("error",
DECL_ATTRIBUTES (fndecl))) != NULL)
- error ("%Kcall to %qs declared with attribute error: %s",
- exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
- TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ {
+ const char *ident = lang_hooks.decl_printable_name (fndecl, 1);
+ error ("%Kcall to %qs declared with attribute error: %s", exp,
+ identifier_to_locale (ident),
+ TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ }
if (fndecl
+ /* Don't diagnose the warning attribute in thunks, those are
+ artificially created. */
+ && !CALL_FROM_THUNK_P (exp)
&& (attr = lookup_attribute ("warning",
DECL_ATTRIBUTES (fndecl))) != NULL)
- warning_at (tree_nonartificial_location (exp),
- 0, "%Kcall to %qs declared with attribute warning: %s",
- exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
- TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ {
+ const char *ident = lang_hooks.decl_printable_name (fndecl, 1);
+ warning_at (tree_nonartificial_location (exp), 0,
+ "%Kcall to %qs declared with attribute warning: %s",
+ exp, identifier_to_locale (ident),
+ TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ }
/* Check for a built-in function. */
if (fndecl && DECL_BUILT_IN (fndecl))
diff --git a/gcc/final.c b/gcc/final.c
index 820162b2d28..20af67816bb 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -906,7 +906,7 @@ shorten_branches (rtx_insn *first)
char *varying_length;
rtx body;
int uid;
- rtx align_tab[MAX_CODE_ALIGN];
+ rtx align_tab[MAX_CODE_ALIGN + 1];
/* Compute maximum UID and allocate label_align / uid_shuid. */
max_uid = get_max_uid ();
@@ -1015,7 +1015,7 @@ shorten_branches (rtx_insn *first)
alignment of n. */
uid_align = XCNEWVEC (rtx, max_uid);
- for (i = MAX_CODE_ALIGN; --i >= 0;)
+ for (i = MAX_CODE_ALIGN + 1; --i >= 0;)
align_tab[i] = NULL_RTX;
seq = get_last_insn ();
for (; seq; seq = PREV_INSN (seq))
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 8152ccfda53..0781f4212b7 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -14082,6 +14082,7 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
{
tree op = TREE_OPERAND (sub, 0);
tree optype = TREE_TYPE (op);
+
/* *&CONST_DECL -> to the value of the const decl. */
if (TREE_CODE (op) == CONST_DECL)
return DECL_INITIAL (op);
@@ -14115,12 +14116,13 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
&& type == TREE_TYPE (optype))
return fold_build1_loc (loc, REALPART_EXPR, type, op);
/* *(foo *)&vectorfoo => BIT_FIELD_REF<vectorfoo,...> */
- else if (TREE_CODE (optype) == VECTOR_TYPE
+ else if (VECTOR_TYPE_P (optype)
&& type == TREE_TYPE (optype))
{
tree part_width = TYPE_SIZE (type);
tree index = bitsize_int (0);
- return fold_build3_loc (loc, BIT_FIELD_REF, type, op, part_width, index);
+ return fold_build3_loc (loc, BIT_FIELD_REF, type, op, part_width,
+ index);
}
}
@@ -14138,8 +14140,17 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
op00type = TREE_TYPE (op00);
/* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */
- if (TREE_CODE (op00type) == VECTOR_TYPE
- && type == TREE_TYPE (op00type))
+ if (VECTOR_TYPE_P (op00type)
+ && type == TREE_TYPE (op00type)
+ /* POINTER_PLUS_EXPR second operand is sizetype, unsigned,
+ but we want to treat offsets with MSB set as negative.
+ For the code below negative offsets are invalid and
+ TYPE_SIZE of the element is something unsigned, so
+ check whether op01 fits into HOST_WIDE_INT, which
+ implies it is from 0 to INTTYPE_MAXIMUM (HOST_WIDE_INT), and
+ then just use unsigned HOST_WIDE_INT because we want to treat
+ the value as unsigned. */
+ && tree_fits_shwi_p (op01))
{
tree part_width = TYPE_SIZE (type);
unsigned HOST_WIDE_INT max_offset
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0d1607d2ddd..55cf7d573ee 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,223 @@
-2012-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
+2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/56667
+ * primary.c (match_sym_complex_part): Give the matcher for an implied
+ do-loop a chance to run.
+
+2018-03-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83076
+ * resolve.c (resolve_fl_derived0): Add caf_token fields for
+ allocatable and pointer scalars, when -fcoarray selected.
+ * trans-types.c (gfc_copy_dt_decls_ifequal): Copy the token
+ field as well as the backend_decl.
+ (gfc_get_derived_type): Flag GFC_FCOARRAY_LIB for module
+ derived types that are not vtypes. Components with caf_token
+ attribute are pvoid types. For a component requiring it, find
+ the caf_token field and have the component token field point to
+ its backend_decl.
+
+2018-03-03 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/71085
+ * trans-expr.c (gfc_apply_interface_mapping_to_expr): Do not
+ dereference NULL pointer.
+
+2018-03-03 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/51434
+ * simplify.c (gfc_simplify_transfer): Resolve mold.
+
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/80965
+ * resolve.c (build_loc_call): Change symtree name from 'loc' to
+ '_loc'.
+
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk.
+ PR fortran/78990
+ * expr.c (gfc_is_class_array_function): Renamed from
+ 'gfc_is_alloc_class_array_function' and modified to return true
+ for pointers as well as allocatable results.
+ * gfortran.h : Change of name for prototype of above function.
+ * trans-array.c (gfc_add_loop_ss_code): Force finalization of
+ class array results.
+ (build_class_array_ref): Change assertion into a condition.
+ (build_class_array_ref): Set the se class_vptr for class array
+ function results.
+ (gfc_walk_function_expr): Reference gfc_is_class_array_function
+ as above.
+ * trans-decl.c (get_proc_result): Move it up before
+ gfc_trans_deferred_vars.
+ (gfc_trans_deferred_vars): Nullify explicit return class arrays
+ on entry.
+ * trans-expr.c (gfc_conv_class_to_class): Allow conversion of
+ class array functions that have an se class_vptr and use it
+ for the result vptr.
+ (gfc_conv_subref_array_arg): Rename reference to the above
+ function.
+ (gfc_conv_procedure_call): Ditto. Add the se pre block to the
+ loop pre block before the function is evaluated. Do not
+ finalize class pointer results.
+ (arrayfunc_assign_needs_temporary, gfc_trans_assignment_1) More
+ renamed references.
+ * trans-intrinsic.c (gfc_conv_intrinsic_size): Ditto.
+
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-02-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/84418
+ * trans-openmp.c (gfc_trans_omp_clauses): For OMP_CLAUSE_LINEAR_REF
+ kind set OMP_CLAUSE_LINEAR_STEP to TYPE_SIZE_UNIT times last_step.
+
+ 2018-01-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/84116
+ * openmp.c (gfc_match_omp_clauses): If all the linear
+ gfc_match_omp_variable_list calls failed, don't gfc_free_omp_namelist
+ nor set *head = NULL. Formatting fixes.
+
+2018-02-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ ChangeLog for r257972
+ PR fortran/83633
+ * decl.c (variable_decl): Check that an explicit-shape-array with
+ nonconstant bounds is allowed.
+
+2018-02-25 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/78238
+ Backport from trunk
+ * gfortran.h (gfc_integer_4_kind): Define.
+ * resolve.c (resolve_select_type): Make sure that the
+ kind of c->high is gfc_integer_4_kind.
+
+2018-02-24 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/30792
+ * decl.c (gfc_match_data): Check for invalid substring in
+ data-implied-do
+
+2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84511
+ * trans-io.c (transfer_expr): Deal with C_LOC in transfer statement.
+
+2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84346
+ * interface.c (compare_actual_formal): Issue error if keyword is
+ used in a statement function.
+
+2018-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/84506
+ * trans-io.c (set_parameter_value_inquire): Adjust range check of
+ negative unit values for kind=8 units to the kind=4 negative limit.
+
+2018-02-22 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/81116
+ PR fortran/84495
+ * gfortran.dg/realloc_on_assignment_29.f90: New test.
+
+2018-02-19 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/82007
+ * resolve.c (resolve_transfer): Delete code looking for 'DT'
+ format specifiers in format strings. Set formatted to true if a
+ format string or format label is present.
+ * trans-io.c (get_dtio_proc): Likewise. (transfer_expr): Fix
+ whitespace.
+
+2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/84270
+ * frontend-passes (scalarized_expr): If the expression
+ is an assumed size array, leave in the last reference
+ and pass AR_SECTION instead of AR_FULL to gfc_resolve
+ in order to avoid an error.
+
+2018-02-13 Alastair McKinstry <alastair.mckinstry@sceal.ie>
+ Janne Blomqvist <jb@gcc.gnu.org>
+
+ * module.c (dump_module): Use lbasename to ensure that module
+ files are reproducible.
+
+2018-02-12 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/68560
+ * trans-intrinsic.c (gfc_conv_intrinsic_shape): New function.
+ (gfc_conv_intrinsic_function): Call it.
+
+2018-02-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/35299
+ ChangeLog for r257566
+ * resolve.c (resolve_formal_arglist): Update error message.
+
+2018-02-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/54223
+ PR fortran/84276
+ * interface.c (compare_actual_formal): Add in_statement_function
+ bool parameter. Skip check of INTENT attribute for statement
+ functions. Arguments to a statement function cannot be optional,
+ issue error for missing argument.
+ (gfc_procedure_use, gfc_ppc_use, gfc_arglist_matches_symbol): Use
+ in_statement_function.
+
+2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/82994
+ * match.c (gfc_match_deallocate): Check for NULL pointer.
+
+2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/82049
+ * match.c (gfc_match_type_spec): If the charlen is non-NULL, then
+ try to resolve it. While here return early if possible.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83900
+ * simplify.c (gfc_simplify_matmul): Set return type correctly.
+
+2018-01019 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83900
+ * simplify.c (gfc_simplify_matmul): Delete bogus assertion.
+
+2018-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport of r250734 from mainline
+ PR fortran/80768
+ * check.c (gfc_check_num_images): Fix typo.
+
+2018-01-18 Harald Anlauf <anlauf@gmx.de>
+
+ Backport from mainline
+ PR fortran/83864
+ * expr.c (gfc_apply_init): Do not dereference NULL pointer.
+
+2018-01-17 Harald Anlauf <anlauf@gmx.de>
+
+ Backport from mainline
+ PR fortran/83874
+ * decl.c (add_init_expr_to_sym): Do not dereference NULL pointer.
+
+2018-01-13 Steven G. Kargl <kargl@gcc.gnu.org>
Backport from mainline
PR fortran/78814
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index ea8cc6e072c..6e62d409e7b 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5156,7 +5156,7 @@ gfc_check_num_images (gfc_expr *distance, gfc_expr *failed)
return false;
if (!gfc_notify_std (GFC_STD_F2008_TS, "FAILED= argument to "
- "NUM_IMAGES at %L", &distance->where))
+ "NUM_IMAGES at %L", &failed->where))
return false;
}
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 1cbf23819a9..6d3d28af127 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -573,6 +573,20 @@ gfc_match_data (void)
if (m != MATCH_YES)
goto cleanup;
+ if (new_data->var->iter.var
+ && new_data->var->iter.var->ts.type == BT_INTEGER
+ && new_data->var->iter.var->symtree->n.sym->attr.implied_index == 1
+ && new_data->var->list
+ && new_data->var->list->expr
+ && new_data->var->list->expr->ts.type == BT_CHARACTER
+ && new_data->var->list->expr->ref
+ && new_data->var->list->expr->ref->type == REF_SUBSTRING)
+ {
+ gfc_error ("Invalid substring in data-implied-do at %L in DATA "
+ "statement", &new_data->var->list->expr->where);
+ goto cleanup;
+ }
+
m = top_val_list (new_data);
if (m != MATCH_YES)
goto cleanup;
@@ -1692,7 +1706,7 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
}
else if (init->expr_type == EXPR_ARRAY)
{
- if (init->ts.u.cl)
+ if (init->ts.u.cl && init->ts.u.cl->length)
{
const gfc_expr *length = init->ts.u.cl->length;
if (length->expr_type != EXPR_CONSTANT)
@@ -2183,7 +2197,10 @@ variable_decl (int elem)
/* At this point, we know for sure if the symbol is PARAMETER and can thus
determine (and check) whether it can be implied-shape. If it
was parsed as assumed-size, change it because PARAMETERs can not
- be assumed-size. */
+ be assumed-size.
+
+ An explicit-shape-array cannot appear under several conditions.
+ That check is done here as well. */
if (as)
{
if (as->type == AS_IMPLIED_SHAPE && current_attr.flavor != FL_PARAMETER)
@@ -2205,6 +2222,50 @@ variable_decl (int elem)
m = MATCH_ERROR;
goto cleanup;
}
+
+ /* F2018:C830 (R816) An explicit-shape-spec whose bounds are not
+ constant expressions shall appear only in a subprogram, derived
+ type definition, BLOCK construct, or interface body. */
+ if (as->type == AS_EXPLICIT
+ && gfc_current_state () != COMP_BLOCK
+ && gfc_current_state () != COMP_DERIVED
+ && gfc_current_state () != COMP_FUNCTION
+ && gfc_current_state () != COMP_INTERFACE
+ && gfc_current_state () != COMP_SUBROUTINE)
+ {
+ gfc_expr *e;
+ bool not_constant = false;
+
+ for (int i = 0; i < as->rank; i++)
+ {
+ e = gfc_copy_expr (as->lower[i]);
+ gfc_resolve_expr (e);
+ gfc_simplify_expr (e, 0);
+ if (e && (e->expr_type != EXPR_CONSTANT))
+ {
+ not_constant = true;
+ break;
+ }
+ gfc_free_expr (e);
+
+ e = gfc_copy_expr (as->upper[i]);
+ gfc_resolve_expr (e);
+ gfc_simplify_expr (e, 0);
+ if (e && (e->expr_type != EXPR_CONSTANT))
+ {
+ not_constant = true;
+ break;
+ }
+ gfc_free_expr (e);
+ }
+
+ if (not_constant)
+ {
+ gfc_error ("Explicit shaped array with nonconstant bounds at %C");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+ }
}
char_len = NULL;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index bcf66bb445b..f302ef70b86 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4130,7 +4130,8 @@ gfc_apply_init (gfc_typespec *ts, symbol_attribute *attr, gfc_expr *init)
if (init->expr_type == EXPR_CONSTANT)
gfc_set_constant_character_len (len, init, -1);
else if (init
- && init->ts.u.cl
+ && init->ts.type == BT_CHARACTER
+ && init->ts.u.cl && init->ts.u.cl->length
&& mpz_cmp (ts->u.cl->length->value.integer,
init->ts.u.cl->length->value.integer))
{
@@ -4761,14 +4762,15 @@ gfc_is_alloc_class_scalar_function (gfc_expr *expr)
/* Determine if an expression is a function with an allocatable class array
result. */
bool
-gfc_is_alloc_class_array_function (gfc_expr *expr)
+gfc_is_class_array_function (gfc_expr *expr)
{
if (expr->expr_type == EXPR_FUNCTION
&& expr->value.function.esym
&& expr->value.function.esym->result
&& expr->value.function.esym->result->ts.type == BT_CLASS
&& CLASS_DATA (expr->value.function.esym->result)->attr.dimension
- && CLASS_DATA (expr->value.function.esym->result)->attr.allocatable)
+ && (CLASS_DATA (expr->value.function.esym->result)->attr.allocatable
+ || CLASS_DATA (expr->value.function.esym->result)->attr.pointer))
return true;
return false;
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 082e2353790..8a5829a3358 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -232,21 +232,25 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
return 0;
expr2 = gfc_discard_nops (co->expr2);
- if (expr2->expr_type != EXPR_VARIABLE)
- return 0;
- found_substr = false;
- for (ref = expr2->ref; ref; ref = ref->next)
+ if (expr2->expr_type == EXPR_VARIABLE)
{
- if (ref->type == REF_SUBSTRING)
+ found_substr = false;
+ for (ref = expr2->ref; ref; ref = ref->next)
{
- found_substr = true;
- break;
+ if (ref->type == REF_SUBSTRING)
+ {
+ found_substr = true;
+ break;
+ }
}
+ if (!found_substr)
+ return 0;
}
- if (!found_substr)
+ else if (expr2->expr_type != EXPR_OP
+ || expr2->value.op.op != INTRINSIC_CONCAT)
return 0;
-
+
if (!gfc_check_dependency (expr1, expr2, true))
return 0;
@@ -619,7 +623,8 @@ constant_string_length (gfc_expr *e)
/* Return length of char symbol, if constant. */
- if (e->symtree->n.sym->ts.u.cl && e->symtree->n.sym->ts.u.cl->length
+ if (e->symtree && e->symtree->n.sym->ts.u.cl
+ && e->symtree->n.sym->ts.u.cl->length
&& e->symtree->n.sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
return gfc_copy_expr (e->symtree->n.sym->ts.u.cl->length);
@@ -2750,10 +2755,26 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index, int count_index)
is the lbound of a full ref. */
int j;
gfc_array_ref *ar;
+ int to;
ar = &ref->u.ar;
- ar->type = AR_FULL;
- for (j = 0; j < ar->dimen; j++)
+
+ /* For assumed size, we need to keep around the final
+ reference in order not to get an error on resolution
+ below, and we cannot use AR_FULL. */
+
+ if (ar->as->type == AS_ASSUMED_SIZE)
+ {
+ ar->type = AR_SECTION;
+ to = ar->dimen - 1;
+ }
+ else
+ {
+ to = ar->dimen;
+ ar->type = AR_FULL;
+ }
+
+ for (j = 0; j < to; j++)
{
gfc_free_expr (ar->start[j]);
ar->start[j] = NULL;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 293655078a4..e5287c5d8d9 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -863,7 +863,7 @@ typedef struct
unsigned alloc_comp:1, pointer_comp:1, proc_pointer_comp:1,
private_comp:1, zero_comp:1, coarray_comp:1, lock_comp:1,
event_comp:1, defined_assign_comp:1, unlimited_polymorphic:1,
- has_dtio_procs:1;
+ has_dtio_procs:1, caf_token:1;
/* This is a temporary selector for SELECT TYPE or an associate
variable for SELECT_TYPE or ASSOCIATE. */
@@ -2856,6 +2856,8 @@ extern int gfc_charlen_int_kind;
extern int gfc_numeric_storage_size;
extern int gfc_character_storage_size;
+#define gfc_integer_4_kind 4
+
/* symbol.c */
void gfc_clear_new_implicit (void);
bool gfc_add_new_implicit_range (int, int);
@@ -3145,7 +3147,7 @@ bool gfc_expr_check_typed (gfc_expr*, gfc_namespace*, bool);
gfc_component * gfc_get_proc_ptr_comp (gfc_expr *);
bool gfc_is_proc_ptr_comp (gfc_expr *);
bool gfc_is_alloc_class_scalar_function (gfc_expr *);
-bool gfc_is_alloc_class_array_function (gfc_expr *);
+bool gfc_is_class_array_function (gfc_expr *);
bool gfc_ref_this_image (gfc_ref *ref);
bool gfc_is_coindexed (gfc_expr *);
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 2e5732a8810..162f7772970 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2791,7 +2791,8 @@ is_procptr_result (gfc_expr *expr)
static bool
compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
- int ranks_must_agree, int is_elemental, locus *where)
+ int ranks_must_agree, int is_elemental,
+ bool in_statement_function, locus *where)
{
gfc_actual_arglist **new_arg, *a, *actual;
gfc_formal_arglist *f;
@@ -2820,6 +2821,13 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
for (a = actual; a; a = a->next, f = f->next)
{
+ if (a->name != NULL && in_statement_function)
+ {
+ gfc_error ("Keyword argument %qs at %L is invalid in "
+ "a statement function", a->name, &a->expr->where);
+ return false;
+ }
+
/* Look for keywords but ignore g77 extensions like %VAL. */
if (a->name != NULL && a->name[0] != '%')
{
@@ -3143,8 +3151,9 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
}
/* Check intent = OUT/INOUT for definable actual argument. */
- if ((f->sym->attr.intent == INTENT_OUT
- || f->sym->attr.intent == INTENT_INOUT))
+ if (!in_statement_function
+ && (f->sym->attr.intent == INTENT_OUT
+ || f->sym->attr.intent == INTENT_INOUT))
{
const char* context = (where
? _("actual argument to INTENT = OUT/INOUT")
@@ -3249,7 +3258,8 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
"at %L", where);
return false;
}
- if (!f->sym->attr.optional)
+ if (!f->sym->attr.optional
+ || (in_statement_function && f->sym->attr.optional))
{
if (where)
gfc_error ("Missing actual argument for argument %qs at %L",
@@ -3535,6 +3545,7 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
bool
gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
{
+ gfc_actual_arglist *a;
gfc_formal_arglist *dummy_args;
/* Warn about calls with an implicit interface. Special case
@@ -3561,8 +3572,6 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
if (sym->attr.if_source == IFSRC_UNKNOWN)
{
- gfc_actual_arglist *a;
-
if (sym->attr.pointer)
{
gfc_error ("The pointer object %qs at %L must have an explicit "
@@ -3654,9 +3663,12 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
dummy_args = gfc_sym_get_dummy_args (sym);
- if (!compare_actual_formal (ap, dummy_args, 0, sym->attr.elemental, where))
+ /* For a statement function, check that types and type parameters of actual
+ arguments and dummy arguments match. */
+ if (!compare_actual_formal (ap, dummy_args, 0, sym->attr.elemental,
+ sym->attr.proc == PROC_ST_FUNCTION, where))
return false;
-
+
if (!check_intents (dummy_args, *ap))
return false;
@@ -3703,7 +3715,7 @@ gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
}
if (!compare_actual_formal (ap, comp->ts.interface->formal, 0,
- comp->attr.elemental, where))
+ comp->attr.elemental, false, where))
return;
check_intents (comp->ts.interface->formal, *ap);
@@ -3728,7 +3740,7 @@ gfc_arglist_matches_symbol (gfc_actual_arglist** args, gfc_symbol* sym)
dummy_args = gfc_sym_get_dummy_args (sym);
r = !sym->attr.elemental;
- if (compare_actual_formal (args, dummy_args, r, !r, NULL))
+ if (compare_actual_formal (args, dummy_args, r, !r, false, NULL))
{
check_intents (dummy_args, *args);
if (warn_aliasing)
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 78fd6a4ba11..682f7b021b0 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2001,12 +2001,17 @@ gfc_match_type_spec (gfc_typespec *ts)
{
match m;
locus old_locus;
- char name[GFC_MAX_SYMBOL_LEN + 1];
+ char c, name[GFC_MAX_SYMBOL_LEN + 1];
gfc_clear_ts (ts);
gfc_gobble_whitespace ();
old_locus = gfc_current_locus;
+ /* If c isn't [a-z], then return immediately. */
+ c = gfc_peek_ascii_char ();
+ if (!ISALPHA(c))
+ return MATCH_NO;
+
if (match_derived_type_spec (ts) == MATCH_YES)
{
/* Enforce F03:C401. */
@@ -2045,6 +2050,8 @@ gfc_match_type_spec (gfc_typespec *ts)
ts->type = BT_CHARACTER;
m = gfc_match_char_spec (ts);
+ if (ts->u.cl && ts->u.cl->length)
+ gfc_resolve_expr (ts->u.cl->length);
if (m == MATCH_NO)
m = MATCH_YES;
@@ -4404,8 +4411,8 @@ gfc_match_deallocate (void)
&& (tail->expr->ref->type == REF_COMPONENT
|| tail->expr->ref->type == REF_ARRAY));
if (sym && sym->ts.type == BT_CLASS)
- b2 = !(CLASS_DATA (sym)->attr.allocatable
- || CLASS_DATA (sym)->attr.class_pointer);
+ b2 = !(CLASS_DATA (sym) && (CLASS_DATA (sym)->attr.allocatable
+ || CLASS_DATA (sym)->attr.class_pointer));
else
b2 = sym && !(sym->attr.allocatable || sym->attr.pointer
|| sym->attr.proc_pointer);
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index e8cba1455aa..055e58bad08 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6063,8 +6063,10 @@ dump_module (const char *name, int dump_flag)
gfc_fatal_error ("Can't open module file %qs for writing at %C: %s",
filename_tmp, xstrerror (errno));
+ /* Use lbasename to ensure module files are reproducible regardless
+ of the build path (see the reproducible builds project). */
gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
- MOD_VERSION, gfc_source_file);
+ MOD_VERSION, lbasename (gfc_source_file));
/* Write the module itself. */
iomode = IO_OUTPUT;
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 7b88d6fbeba..746785c8893 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -1312,23 +1312,21 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
else if (gfc_match_omp_variable_list (" val (",
&c->lists[OMP_LIST_LINEAR],
false, NULL, &head)
- == MATCH_YES)
+ == MATCH_YES)
linear_op = OMP_LINEAR_VAL;
else if (gfc_match_omp_variable_list (" uval (",
&c->lists[OMP_LIST_LINEAR],
false, NULL, &head)
- == MATCH_YES)
+ == MATCH_YES)
linear_op = OMP_LINEAR_UVAL;
else if (gfc_match_omp_variable_list ("",
&c->lists[OMP_LIST_LINEAR],
false, &end_colon, &head)
- == MATCH_YES)
+ == MATCH_YES)
linear_op = OMP_LINEAR_DEFAULT;
else
{
- gfc_free_omp_namelist (*head);
gfc_current_locus = old_loc;
- *head = NULL;
break;
}
if (linear_op != OMP_LINEAR_DEFAULT)
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index b97b4a1ca59..c0ab09e7f50 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1247,8 +1247,22 @@ match_sym_complex_part (gfc_expr **result)
if (sym->attr.flavor != FL_PARAMETER)
{
- gfc_error ("Expected PARAMETER symbol in complex constant at %C");
- return MATCH_ERROR;
+ /* Give the matcher for implied do-loops a chance to run. This yields
+ a much saner error message for "write(*,*) (i, i=1, 6" where the
+ right parenthesis is missing. */
+ char c;
+ gfc_gobble_whitespace ();
+ c = gfc_peek_ascii_char ();
+ if (c == '=' || c == ',')
+ {
+ m = MATCH_NO;
+ }
+ else
+ {
+ gfc_error ("Expected PARAMETER symbol in complex constant at %C");
+ m = MATCH_ERROR;
+ }
+ return m;
}
if (!sym->value)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 8e7babfe9e9..1074470eaf6 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -512,8 +512,11 @@ resolve_formal_arglist (gfc_symbol *proc)
{
if (sym->as != NULL)
{
- gfc_error ("Argument %qs of statement function at %L must "
- "be scalar", sym->name, &sym->declared_at);
+ /* F03:C1263 (R1238) The function-name and each dummy-arg-name
+ shall be specified, explicitly or implicitly, to be scalar. */
+ gfc_error ("Argument '%s' of statement function '%s' at %L "
+ "must be scalar", sym->name, proc->name,
+ &proc->declared_at);
continue;
}
@@ -8495,7 +8498,7 @@ build_loc_call (gfc_expr *sym_expr)
gfc_expr *loc_call;
loc_call = gfc_get_expr ();
loc_call->expr_type = EXPR_FUNCTION;
- gfc_get_sym_tree ("loc", gfc_current_ns, &loc_call->symtree, false);
+ gfc_get_sym_tree ("_loc", gfc_current_ns, &loc_call->symtree, false);
loc_call->symtree->n.sym->attr.flavor = FL_PROCEDURE;
loc_call->symtree->n.sym->attr.intrinsic = 1;
loc_call->symtree->n.sym->result = loc_call->symtree->n.sym;
@@ -8548,6 +8551,9 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
code->expr1->symtree->n.sym->ts = code->expr2->ts;
selector_type = CLASS_DATA (code->expr2)->ts.u.derived;
+ if (code->expr2->rank && CLASS_DATA (code->expr1)->as)
+ CLASS_DATA (code->expr1)->as->rank = code->expr2->rank;
+
/* F2008: C803 The selector expression must not be coindexed. */
if (gfc_is_coindexed (code->expr2))
{
@@ -8742,7 +8748,7 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
{
vtab = gfc_find_derived_vtab (c->ts.u.derived);
gcc_assert (vtab);
- c->high = gfc_get_int_expr (gfc_default_integer_kind, NULL,
+ c->high = gfc_get_int_expr (gfc_integer_4_kind, NULL,
c->ts.u.derived->hash_value);
}
else
@@ -8751,6 +8757,13 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
gcc_assert (vtab && CLASS_DATA (vtab)->initializer);
e = CLASS_DATA (vtab)->initializer;
c->high = gfc_copy_expr (e);
+ if (c->high->ts.kind != gfc_integer_4_kind)
+ {
+ gfc_typespec ts;
+ ts.kind = gfc_integer_4_kind;
+ ts.type = BT_INTEGER;
+ gfc_convert_type_warn (c->high, &ts, 2, 0);
+ }
}
e = gfc_lval_expr_from_sym (vtab);
@@ -8996,19 +9009,9 @@ resolve_transfer (gfc_code *code)
else
derived = ts->u.derived->components->ts.u.derived;
- if (dt->format_expr)
- {
- char *fmt;
- fmt = gfc_widechar_to_char (dt->format_expr->value.character.string,
- -1);
- if (strtok (fmt, "DT") != NULL)
- formatted = true;
- }
- else if (dt->format_label == &format_asterisk)
- {
- /* List directed io must call the formatted DTIO procedure. */
- formatted = true;
- }
+ /* Determine when to use the formatted DTIO procedure. */
+ if (dt && (dt->format_expr || dt->format_label))
+ formatted = true;
write = dt->dt_io_kind->value.iokind == M_WRITE
|| dt->dt_io_kind->value.iokind == M_PRINT;
@@ -13799,6 +13802,31 @@ resolve_fl_derived0 (gfc_symbol *sym)
if (!success)
return false;
+ /* Now add the caf token field, where needed. */
+ if (flag_coarray != GFC_FCOARRAY_NONE
+ && !sym->attr.is_class && !sym->attr.vtype)
+ {
+ for (c = sym->components; c; c = c->next)
+ if (!c->attr.dimension && !c->attr.codimension
+ && (c->attr.allocatable || c->attr.pointer))
+ {
+ char name[GFC_MAX_SYMBOL_LEN+9];
+ gfc_component *token;
+ sprintf (name, "_caf_%s", c->name);
+ token = gfc_find_component (sym, name, true, true, NULL);
+ if (token == NULL)
+ {
+ if (!gfc_add_component (sym, name, &token))
+ return false;
+ token->ts.type = BT_VOID;
+ token->ts.kind = gfc_default_integer_kind;
+ token->attr.access = ACCESS_PRIVATE;
+ token->attr.artificial = 1;
+ token->attr.caf_token = 1;
+ }
+ }
+ }
+
check_defined_assignments (sym);
if (!sym->attr.defined_assign_comp && super_type)
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index a9d8c7534b8..c537e645060 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "gfortran.h"
#include "arith.h"
#include "intrinsic.h"
+#include "match.h"
#include "target-memory.h"
#include "constructor.h"
#include "version.h" /* For version_string. */
@@ -4202,10 +4203,23 @@ gfc_simplify_matmul (gfc_expr *matrix_a, gfc_expr *matrix_b)
|| !is_constant_array_expr (matrix_b))
return NULL;
- gcc_assert (gfc_compare_types (&matrix_a->ts, &matrix_b->ts));
- result = gfc_get_array_expr (matrix_a->ts.type,
- matrix_a->ts.kind,
- &matrix_a->where);
+ /* MATMUL should do mixed-mode arithmetic. Set the result type. */
+ if (matrix_a->ts.type != matrix_b->ts.type)
+ {
+ gfc_expr e;
+ e.expr_type = EXPR_OP;
+ gfc_clear_ts (&e.ts);
+ e.value.op.op = INTRINSIC_NONE;
+ e.value.op.op1 = matrix_a;
+ e.value.op.op2 = matrix_b;
+ gfc_type_convert_binary (&e, 1);
+ result = gfc_get_array_expr (e.ts.type, e.ts.kind, &matrix_a->where);
+ }
+ else
+ {
+ result = gfc_get_array_expr (matrix_a->ts.type, matrix_a->ts.kind,
+ &matrix_a->where);
+ }
if (matrix_a->rank == 1 && matrix_b->rank == 2)
{
@@ -6566,10 +6580,12 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
unsigned char *buffer;
size_t result_length;
+ if (!gfc_is_constant_expr (source) || !gfc_is_constant_expr (size))
+ return NULL;
- if (!gfc_is_constant_expr (source)
- || (gfc_init_expr_flag && !gfc_is_constant_expr (mold))
- || !gfc_is_constant_expr (size))
+ if (!gfc_resolve_expr (mold))
+ return NULL;
+ if (gfc_init_expr_flag && !gfc_is_constant_expr (mold))
return NULL;
if (!gfc_calculate_transfer_sizes (source, mold, size, &source_size,
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 96fe8d431a3..10790dce6b3 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2652,6 +2652,8 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
gfc_init_se (&se, NULL);
se.loop = loop;
se.ss = ss;
+ if (gfc_is_class_array_function (expr))
+ expr->must_finalize = 1;
gfc_conv_expr (&se, expr);
gfc_add_block_to_block (&outer_loop->pre, &se.pre);
gfc_add_block_to_block (&outer_loop->post, &se.post);
@@ -3102,7 +3104,7 @@ build_class_array_ref (gfc_se *se, tree base, tree index)
{
if (expr == NULL
|| (expr->ts.type != BT_CLASS
- && !gfc_is_alloc_class_array_function (expr)
+ && !gfc_is_class_array_function (expr)
&& !gfc_is_class_array_ref (expr, NULL)))
return false;
@@ -3132,12 +3134,12 @@ build_class_array_ref (gfc_se *se, tree base, tree index)
}
if (class_ref == NULL && expr && expr->symtree->n.sym->attr.function
- && expr->symtree->n.sym == expr->symtree->n.sym->result)
+ && expr->symtree->n.sym == expr->symtree->n.sym->result
+ && expr->symtree->n.sym->backend_decl == current_function_decl)
{
- gcc_assert (expr->symtree->n.sym->backend_decl == current_function_decl);
decl = gfc_get_fake_result_decl (expr->symtree->n.sym, 0);
}
- else if (expr && gfc_is_alloc_class_array_function (expr))
+ else if (expr && gfc_is_class_array_function (expr))
{
size = NULL_TREE;
decl = NULL_TREE;
@@ -3160,6 +3162,8 @@ build_class_array_ref (gfc_se *se, tree base, tree index)
if (decl == NULL_TREE)
return false;
+
+ se->class_vptr = gfc_evaluate_now (gfc_class_vptr_get (decl), &se->pre);
}
else if (class_ref == NULL)
{
@@ -7125,7 +7129,11 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
else
{
/* Otherwise make a new one. */
- parmtype = gfc_get_element_type (TREE_TYPE (desc));
+ if (expr->ts.type == BT_CHARACTER && expr->ts.deferred)
+ parmtype = gfc_typenode_for_spec (&expr->ts);
+ else
+ parmtype = gfc_get_element_type (TREE_TYPE (desc));
+
parmtype = gfc_get_array_type_bounds (parmtype, loop.dimen, codim,
loop.from, loop.to, 0,
GFC_ARRAY_UNKNOWN, false);
@@ -10007,7 +10015,7 @@ gfc_walk_function_expr (gfc_ss * ss, gfc_expr * expr)
if (!sym)
sym = expr->symtree->n.sym;
- if (gfc_is_alloc_class_array_function (expr))
+ if (gfc_is_class_array_function (expr))
return gfc_get_array_ss (ss, expr,
CLASS_DATA (expr->value.function.esym->result)->as->rank,
GFC_SS_FUNCTION);
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 5f2f76b7cbe..796fd6da008 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4142,6 +4142,24 @@ gfc_null_and_pass_deferred_len (gfc_symbol *sym, stmtblock_t *init,
return tmp;
}
+
+/* Get the result expression for a procedure. */
+
+static tree
+get_proc_result (gfc_symbol* sym)
+{
+ if (sym->attr.subroutine || sym == sym->result)
+ {
+ if (current_fake_result_decl != NULL)
+ return TREE_VALUE (current_fake_result_decl);
+
+ return NULL_TREE;
+ }
+
+ return sym->result->backend_decl;
+}
+
+
/* Generate function entry and exit code, and add it to the function body.
This includes:
Allocation and initialization of array variables.
@@ -4251,6 +4269,21 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
else
gcc_assert (flag_f2c && proc_sym->ts.type == BT_COMPLEX);
}
+ else if (proc_sym == proc_sym->result && IS_CLASS_ARRAY (proc_sym))
+ {
+ /* Nullify explicit return class arrays on entry. */
+ tree type;
+ tmp = get_proc_result (proc_sym);
+ if (tmp && GFC_CLASS_TYPE_P (TREE_TYPE (tmp)))
+ {
+ gfc_start_block (&init);
+ tmp = gfc_class_data_get (tmp);
+ type = TREE_TYPE (gfc_conv_descriptor_data_get (tmp));
+ gfc_conv_descriptor_data_set (&init, tmp, build_int_cst (type, 0));
+ gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
+ }
+ }
+
/* Initialize the INTENT(OUT) derived type dummy arguments. This
should be done here so that the offsets and lbounds of arrays
@@ -5981,23 +6014,6 @@ create_main_function (tree fndecl)
}
-/* Get the result expression for a procedure. */
-
-static tree
-get_proc_result (gfc_symbol* sym)
-{
- if (sym->attr.subroutine || sym == sym->result)
- {
- if (current_fake_result_decl != NULL)
- return TREE_VALUE (current_fake_result_decl);
-
- return NULL_TREE;
- }
-
- return sym->result->backend_decl;
-}
-
-
/* Generate an appropriate return-statement for a procedure. */
tree
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b022704e7fd..49486c5328a 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -960,6 +960,7 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
}
if ((ref == NULL || class_ref == ref)
+ && !(gfc_is_class_array_function (e) && parmse->class_vptr != NULL_TREE)
&& (!class_ts.u.derived->components->as
|| class_ts.u.derived->components->as->rank != -1))
return;
@@ -1030,8 +1031,11 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
First we have to find the corresponding class reference. */
tmp = NULL_TREE;
- if (class_ref == NULL
- && e->symtree && e->symtree->n.sym->ts.type == BT_CLASS)
+ if (gfc_is_class_array_function (e)
+ && parmse->class_vptr != NULL_TREE)
+ tmp = parmse->class_vptr;
+ else if (class_ref == NULL
+ && e->symtree && e->symtree->n.sym->ts.type == BT_CLASS)
{
tmp = e->symtree->n.sym->backend_decl;
@@ -1063,7 +1067,11 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
if (TREE_CODE (TREE_TYPE (tmp)) == REFERENCE_TYPE)
tmp = build_fold_indirect_ref_loc (input_location, tmp);
- vptr = gfc_class_vptr_get (tmp);
+ if (!(gfc_is_class_array_function (e) && parmse->class_vptr))
+ vptr = gfc_class_vptr_get (tmp);
+ else
+ vptr = tmp;
+
gfc_add_modify (&block, ctree,
fold_convert (TREE_TYPE (ctree), vptr));
@@ -4307,6 +4315,8 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping,
if (expr->value.function.esym == NULL
&& expr->value.function.isym != NULL
+ && expr->value.function.actual
+ && expr->value.function.actual->expr
&& expr->value.function.actual->expr->symtree
&& gfc_map_intrinsic_function (expr, mapping))
break;
@@ -4435,7 +4445,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
/* Reset the offset for the function call since the loop
is zero based on the data pointer. Note that the temp
comes first in the loop chain since it is added second. */
- if (gfc_is_alloc_class_array_function (expr))
+ if (gfc_is_class_array_function (expr))
{
tmp = loop.ss->loop_chain->info->data.array.descriptor;
gfc_conv_descriptor_offset_set (&loop.pre, tmp,
@@ -4484,7 +4494,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, int g77,
dimen = rse.ss->dimen;
/* Skip the write-out loop for this case. */
- if (gfc_is_alloc_class_array_function (expr))
+ if (gfc_is_class_array_function (expr))
goto class_array_fcn;
/* Calculate the bounds of the scalarization. */
@@ -4778,7 +4788,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
gcc_assert ((!comp && gfc_return_by_reference (sym)
&& sym->result->attr.dimension)
|| (comp && comp->attr.dimension)
- || gfc_is_alloc_class_array_function (expr));
+ || gfc_is_class_array_function (expr));
gcc_assert (se->loop != NULL);
/* Access the previously obtained result. */
gfc_conv_tmp_array_ref (se);
@@ -5461,7 +5471,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
fsym ? fsym->attr.intent : INTENT_INOUT,
fsym && fsym->attr.pointer);
- else if (gfc_is_alloc_class_array_function (e)
+ else if (gfc_is_class_array_function (e)
&& fsym && fsym->ts.type == BT_DERIVED)
/* See previous comment. For function actual argument,
the write out is not needed so the intent is set as
@@ -6302,7 +6312,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
call the finalization function of the temporary. Note that the
nullification of allocatable components needed by the result
is done in gfc_trans_assignment_1. */
- if (expr && ((gfc_is_alloc_class_array_function (expr)
+ if (expr && ((gfc_is_class_array_function (expr)
&& se->ss && se->ss->loop)
|| gfc_is_alloc_class_scalar_function (expr))
&& se->expr && GFC_CLASS_TYPE_P (TREE_TYPE (se->expr))
@@ -6313,6 +6323,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
int n;
if (se->ss && se->ss->loop)
{
+ gfc_add_block_to_block (&se->ss->loop->pre, &se->pre);
se->expr = gfc_evaluate_now (se->expr, &se->ss->loop->pre);
tmp = gfc_class_data_get (se->expr);
info->descriptor = tmp;
@@ -6335,6 +6346,11 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
CLASS_DATA (expr->value.function.esym->result)->attr);
}
+ if ((gfc_is_class_array_function (expr)
+ || gfc_is_alloc_class_scalar_function (expr))
+ && CLASS_DATA (expr->value.function.esym->result)->attr.pointer)
+ goto no_finalization;
+
final_fndecl = gfc_class_vtab_final_get (se->expr);
is_final = fold_build2_loc (input_location, NE_EXPR,
logical_type_node,
@@ -6365,6 +6381,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
tmp = gfc_call_free (tmp);
gfc_add_expr_to_block (&se->post, tmp);
}
+
+no_finalization:
expr->must_finalize = 0;
}
@@ -8835,7 +8853,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
gfc_add_expr_to_block (&block, tmp);
}
}
- else if (gfc_bt_struct (ts.type) || ts.type == BT_CLASS)
+ else if (gfc_bt_struct (ts.type) || ts.type == BT_CLASS || ts.type == BT_COMPLEX)
{
gfc_add_block_to_block (&block, &lse->pre);
gfc_add_block_to_block (&block, &rse->pre);
@@ -8871,7 +8889,7 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2)
gfc_symbol *sym = expr1->symtree->n.sym;
/* Play it safe with class functions assigned to a derived type. */
- if (gfc_is_alloc_class_array_function (expr2)
+ if (gfc_is_class_array_function (expr2)
&& expr1->ts.type == BT_DERIVED)
return true;
@@ -9878,7 +9896,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
rss = NULL;
if ((expr1->ts.type == BT_DERIVED)
- && (gfc_is_alloc_class_array_function (expr2)
+ && (gfc_is_class_array_function (expr2)
|| gfc_is_alloc_class_scalar_function (expr2)))
expr2->must_finalize = 1;
@@ -10085,7 +10103,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
a scalar to array assignment, this is done in gfc_trans_scalar_assign
as part of the deep copy. */
if (!scalar_to_array && expr1->ts.type == BT_DERIVED
- && (gfc_is_alloc_class_array_function (expr2)
+ && (gfc_is_class_array_function (expr2)
|| gfc_is_alloc_class_scalar_function (expr2)))
{
tmp = rse.expr;
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 1ca00c132f2..05a1a7aa346 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -5478,6 +5478,22 @@ gfc_conv_intrinsic_ibits (gfc_se * se, gfc_expr * expr)
}
static void
+gfc_conv_intrinsic_shape (gfc_se *se, gfc_expr *expr)
+{
+ gfc_actual_arglist *s, *k;
+ gfc_expr *e;
+
+ /* Remove the KIND argument, if present. */
+ s = expr->value.function.actual;
+ k = s->next;
+ e = k->expr;
+ gfc_free_expr (e);
+ k->expr = NULL;
+
+ gfc_conv_intrinsic_funcall (se, expr);
+}
+
+static void
gfc_conv_intrinsic_shift (gfc_se * se, gfc_expr * expr, bool right_shift,
bool arithmetic)
{
@@ -6601,7 +6617,7 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)
gfc_add_class_array_ref (actual->expr);
argse.data_not_needed = 1;
- if (gfc_is_alloc_class_array_function (actual->expr))
+ if (gfc_is_class_array_function (actual->expr))
{
/* For functions that return a class array conv_expr_descriptor is not
able to get the descriptor right. Therefore this special case. */
@@ -8589,6 +8605,10 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
conv_generic_with_optional_char_arg (se, expr, 1, 3);
break;
+ case GFC_ISYM_SHAPE:
+ gfc_conv_intrinsic_shape (se, expr);
+ break;
+
default:
gfc_conv_intrinsic_funcall (se, expr);
break;
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index af8ee02494d..ecdecd50f36 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -639,12 +639,12 @@ set_parameter_value_inquire (stmtblock_t *block, tree var,
/* Don't evaluate the UNIT number multiple times. */
se.expr = gfc_evaluate_now (se.expr, &se.pre);
- /* UNIT numbers should be greater than zero. */
+ /* UNIT numbers should be greater than the min. */
i = gfc_validate_kind (BT_INTEGER, 4, false);
+ val = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].pedantic_min_int, 4);
cond1 = build2_loc (input_location, LT_EXPR, logical_type_node,
se.expr,
- fold_convert (TREE_TYPE (se.expr),
- integer_zero_node));
+ fold_convert (TREE_TYPE (se.expr), val));
/* UNIT numbers should be less than the max. */
val = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].huge, 4);
cond2 = build2_loc (input_location, GT_EXPR, logical_type_node,
@@ -2214,25 +2214,9 @@ get_dtio_proc (gfc_typespec * ts, gfc_code * code, gfc_symbol **dtio_sub)
bool formatted = false;
gfc_dt *dt = code->ext.dt;
- if (dt)
- {
- char *fmt = NULL;
-
- if (dt->format_label == &format_asterisk)
- {
- /* List directed io must call the formatted DTIO procedure. */
- formatted = true;
- }
- else if (dt->format_expr)
- fmt = gfc_widechar_to_char (dt->format_expr->value.character.string,
- -1);
- else if (dt->format_label)
- fmt = gfc_widechar_to_char (dt->format_label->format->value.character.string,
- -1);
- if (fmt && strtok (fmt, "DT") != NULL)
- formatted = true;
-
- }
+ /* Determine when to use the formatted DTIO procedure. */
+ if (dt && (dt->format_expr || dt->format_label))
+ formatted = true;
if (ts->type == BT_CLASS)
derived = ts->u.derived->components->ts.u.derived;
@@ -2293,6 +2277,16 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr,
ts->kind = gfc_index_integer_kind;
}
+ /* gfortran reaches here for "print *, c_loc(xxx)". */
+ if (ts->type == BT_VOID
+ && code->expr1 && code->expr1->ts.type == BT_VOID
+ && code->expr1->symtree
+ && strcmp (code->expr1->symtree->name, "c_loc") == 0)
+ {
+ ts->type = BT_INTEGER;
+ ts->kind = gfc_index_integer_kind;
+ }
+
kind = ts->kind;
function = NULL;
arg2 = NULL;
@@ -2442,8 +2436,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr,
{
/* Recurse into the elements of the derived type. */
expr = gfc_evaluate_now (addr_expr, &se->pre);
- expr = build_fold_indirect_ref_loc (input_location,
- expr);
+ expr = build_fold_indirect_ref_loc (input_location, expr);
/* Make sure that the derived type has been built. An external
function, if only referenced in an io statement, requires this
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 4cef0b2be6e..e9a3b46e6e3 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1949,9 +1949,32 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
}
else
{
- tree type = gfc_typenode_for_spec (&n->sym->ts);
- OMP_CLAUSE_LINEAR_STEP (node)
- = fold_convert (type, last_step);
+ if (kind == OMP_CLAUSE_LINEAR_REF)
+ {
+ tree type;
+ if (n->sym->attr.flavor == FL_PROCEDURE)
+ {
+ type = gfc_get_function_type (n->sym);
+ type = build_pointer_type (type);
+ }
+ else
+ type = gfc_sym_type (n->sym);
+ if (POINTER_TYPE_P (type))
+ type = TREE_TYPE (type);
+ /* Otherwise to be determined what exactly
+ should be done. */
+ tree t = fold_convert (sizetype, last_step);
+ t = size_binop (MULT_EXPR, t,
+ TYPE_SIZE_UNIT (type));
+ OMP_CLAUSE_LINEAR_STEP (node) = t;
+ }
+ else
+ {
+ tree type
+ = gfc_typenode_for_spec (&n->sym->ts);
+ OMP_CLAUSE_LINEAR_STEP (node)
+ = fold_convert (type, last_step);
+ }
}
if (n->sym->attr.dimension || n->sym->attr.allocatable)
OMP_CLAUSE_LINEAR_ARRAY (node) = 1;
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 8c2c8a69cac..724c0fa979f 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1804,7 +1804,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted)
TREE_NO_WARNING (decl) = 1;
}
- if (flag_coarray == GFC_FCOARRAY_LIB && codimen)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
decl = gfc_add_field_to_struct_1 (fat_type,
get_identifier ("token"),
@@ -2334,6 +2334,7 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next)
{
to_cm->backend_decl = from_cm->backend_decl;
+ to_cm->caf_token = from_cm->caf_token;
if (from_cm->ts.type == BT_UNION)
gfc_get_union_type (to_cm->ts.u.derived);
else if (from_cm->ts.type == BT_DERIVED
@@ -2444,6 +2445,10 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
gfc_dt_list *dt;
gfc_namespace *ns;
tree tmp;
+ bool coarray_flag;
+
+ coarray_flag = flag_coarray == GFC_FCOARRAY_LIB
+ && derived->module && !derived->attr.vtype;
if (derived->attr.unlimited_polymorphic
|| (flag_coarray == GFC_FCOARRAY_LIB
@@ -2636,7 +2641,9 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
field_type = build_pointer_type (tmp);
}
else if (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS)
- field_type = c->ts.u.derived->backend_decl;
+ field_type = c->ts.u.derived->backend_decl;
+ else if (c->attr.caf_token)
+ field_type = pvoid_type_node;
else
{
if (c->ts.type == BT_CHARACTER && !c->ts.deferred)
@@ -2715,19 +2722,6 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
gcc_assert (field);
if (!c->backend_decl)
c->backend_decl = field;
-
- /* Do not add a caf_token field for classes' data components. */
- if (codimen && !c->attr.dimension && !c->attr.codimension
- && (c->attr.allocatable || c->attr.pointer)
- && c->caf_token == NULL_TREE && strcmp ("_data", c->name) != 0)
- {
- char caf_name[GFC_MAX_SYMBOL_LEN];
- snprintf (caf_name, GFC_MAX_SYMBOL_LEN, "_caf_%s", c->name);
- c->caf_token = gfc_add_field_to_struct (typenode,
- get_identifier (caf_name),
- pvoid_type_node, &chain);
- TREE_NO_WARNING (c->caf_token) = 1;
- }
}
/* Now lay out the derived type, including the fields. */
@@ -2753,6 +2747,24 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
copy_derived_types:
+ for (c = derived->components; c; c = c->next)
+ {
+ /* Do not add a caf_token field for class container components. */
+ if ((codimen || coarray_flag)
+ && !c->attr.dimension && !c->attr.codimension
+ && (c->attr.allocatable || c->attr.pointer)
+ && !derived->attr.is_class)
+ {
+ char caf_name[GFC_MAX_SYMBOL_LEN];
+ gfc_component *token;
+ snprintf (caf_name, GFC_MAX_SYMBOL_LEN, "_caf_%s", c->name);
+ token = gfc_find_component (derived, caf_name, true, true, NULL);
+ gcc_assert (token);
+ c->caf_token = token->backend_decl;
+ TREE_NO_WARNING (c->caf_token) = 1;
+ }
+ }
+
for (dt = gfc_derived_types; dt; dt = dt->next)
gfc_copy_dt_decls_ifequal (derived, dt->derived, false);
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c48178f1aa3..eced0d53aae 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -677,7 +677,7 @@ proper position among the other output files. */
#ifndef LIBASAN_SPEC
#define STATIC_LIBASAN_LIBS \
- " %{static-libasan:%:include(libsanitizer.spec)%(link_libasan)}"
+ " %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)}"
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@@ -695,7 +695,7 @@ proper position among the other output files. */
#ifndef LIBTSAN_SPEC
#define STATIC_LIBTSAN_LIBS \
- " %{static-libtsan:%:include(libsanitizer.spec)%(link_libtsan)}"
+ " %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)}"
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@@ -713,7 +713,7 @@ proper position among the other output files. */
#ifndef LIBLSAN_SPEC
#define STATIC_LIBLSAN_LIBS \
- " %{static-liblsan:%:include(libsanitizer.spec)%(link_liblsan)}"
+ " %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}"
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@@ -731,7 +731,7 @@ proper position among the other output files. */
#ifndef LIBUBSAN_SPEC
#define STATIC_LIBUBSAN_LIBS \
- " %{static-libubsan:%:include(libsanitizer.spec)%(link_libubsan)}"
+ " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
"} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
@@ -6970,8 +6970,8 @@ try_generate_repro (const char **argv)
/* In final attempt we append compiler options and preprocesssed code to last
generated .out file with configuration and backtrace. */
- char **output = &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1];
- do_report_bug (new_argv, nargs, stderr_commented, output);
+ char **err = &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1];
+ do_report_bug (new_argv, nargs, stderr_commented, err);
}
out:
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 5621aa05b59..3527e499cbf 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -2054,7 +2054,11 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg,
if (c->what
&& (e = dyn_cast <expr *> (c->what)))
{
- info[where].expr_p = true;
+ /* Zero-operand expression captures like ADDR_EXPR@0 are
+ similar as predicates -- if they are not mentioned in
+ the result we have to force them to have no side-effects. */
+ if (e->ops.length () != 0)
+ info[where].expr_p = true;
info[where].force_single_use |= e->force_single_use;
}
}
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index e56c08b4d30..2af6556d8ac 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -116,6 +116,7 @@ complex_class (enum mode_class c)
switch (c)
{
case MODE_INT: return MODE_COMPLEX_INT;
+ case MODE_PARTIAL_INT: return MODE_COMPLEX_INT;
case MODE_FLOAT: return MODE_COMPLEX_FLOAT;
default:
error ("no complex class for class %s", mode_class_names[c]);
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 17a95a50b1f..bb04245ea1f 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -812,12 +812,14 @@ pass_store_merging::terminate_all_aliasing_chains (imm_store_chain_info
{
struct store_immediate_info *info;
unsigned int i;
+ tree store_lhs
+ = gimple_store_p (stmt) ? gimple_get_lhs (stmt) : NULL_TREE;
FOR_EACH_VEC_ELT ((*chain_info)->m_store_info, i, info)
{
- if (ref_maybe_used_by_stmt_p (stmt,
- gimple_assign_lhs (info->stmt))
- || stmt_may_clobber_ref_p (stmt,
- gimple_assign_lhs (info->stmt)))
+ tree lhs = gimple_assign_lhs (info->stmt);
+ if (ref_maybe_used_by_stmt_p (stmt, lhs)
+ || stmt_may_clobber_ref_p (stmt, lhs)
+ || (store_lhs && refs_output_dependent_p (store_lhs, lhs)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 2c67d97b28f..2b68c2b1b0a 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "tree-ssa-address.h"
#include "tree-affine.h"
+#include "tree-eh.h"
#include "builtins.h"
/* Information about a strength reduction candidate. Each statement
@@ -1699,6 +1700,9 @@ find_candidates_dom_walker::before_dom_children (basic_block bb)
{
gimple *gs = gsi_stmt (gsi);
+ if (stmt_could_throw_p (gs))
+ continue;
+
if (gimple_vuse (gs) && gimple_assign_single_p (gs))
slsr_process_ref (gs);
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index f4b7c412a9b..2d6cdbea429 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 7b69d64ac97..e2256990a90 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -917,9 +917,13 @@ get_symbol_for_decl (tree decl)
else if (lookup_attribute ("hsa_group_segment",
DECL_ATTRIBUTES (decl)))
segment = BRIG_SEGMENT_GROUP;
- else if (TREE_STATIC (decl)
- || lookup_attribute ("hsa_global_segment",
- DECL_ATTRIBUTES (decl)))
+ else if (TREE_STATIC (decl))
+ {
+ segment = BRIG_SEGMENT_GLOBAL;
+ allocation = BRIG_ALLOCATION_PROGRAM;
+ }
+ else if (lookup_attribute ("hsa_global_segment",
+ DECL_ATTRIBUTES (decl)))
segment = BRIG_SEGMENT_GLOBAL;
else
segment = BRIG_SEGMENT_PRIVATE;
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 716c8cc3a1f..f5dcfc0341b 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -621,6 +621,24 @@ determine_versionability (struct cgraph_node *node,
reason = "calls comdat-local function";
}
+ /* Functions calling BUILT_IN_VA_ARG_PACK and BUILT_IN_VA_ARG_PACK_LEN
+ works only when inlined. Cloning them may still lead to better code
+ becuase ipa-cp will not give up on cloning further. If the function is
+ external this however leads to wrong code becuase we may end up producing
+ offline copy of the function. */
+ if (DECL_EXTERNAL (node->decl))
+ for (cgraph_edge *edge = node->callees; !reason && edge;
+ edge = edge->next_callee)
+ if (DECL_BUILT_IN (edge->callee->decl)
+ && DECL_BUILT_IN_CLASS (edge->callee->decl) == BUILT_IN_NORMAL)
+ {
+ if (DECL_FUNCTION_CODE (edge->callee->decl) == BUILT_IN_VA_ARG_PACK)
+ reason = "external function which calls va_arg_pack";
+ if (DECL_FUNCTION_CODE (edge->callee->decl)
+ == BUILT_IN_VA_ARG_PACK_LEN)
+ reason = "external function which calls va_arg_pack_len";
+ }
+
if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n",
node->name (), node->order, reason);
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index b9a5b4f2546..95fad30e83a 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1116,6 +1116,17 @@ sem_function::merge (sem_item *alias_item)
return false;
}
+ if (!original->in_same_comdat_group_p (alias)
+ || original->comdat_local_p ())
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "Not unifying; alias nor wrapper cannot be created; "
+ "across comdat group boundary\n\n");
+
+ return false;
+ }
+
/* See if original is in a section that can be discarded if the main
symbol is not used. */
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 97338e19f3a..0674e6b9cbc 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2994,6 +2994,11 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
info->inlinable = false;
node->callees->inline_failed = CIF_CHKP;
}
+ else if (stdarg_p (TREE_TYPE (node->decl)))
+ {
+ info->inlinable = false;
+ node->callees->inline_failed = CIF_VARIADIC_THUNK;
+ }
else
info->inlinable = true;
}
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 0dfdd551577..0c25635f4c8 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1773,7 +1773,7 @@ inline_small_functions (void)
struct cgraph_node *n2;
int id = dfs->scc_no + 1;
for (n2 = node; n2;
- n2 = ((struct ipa_dfs_info *) node->aux)->next_cycle)
+ n2 = ((struct ipa_dfs_info *) n2->aux)->next_cycle)
{
struct inline_summary *info2 = inline_summaries->get (n2);
if (info2->scc_no)
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 9cc19cec204..de2a1deb423 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -111,12 +111,13 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *>
typedef value_range *compare_type;
static hashval_t
hash (const value_range *p)
- {
- gcc_checking_assert (!p->equiv);
- hashval_t t = (hashval_t) p->type;
- t = iterative_hash_expr (p->min, t);
- return iterative_hash_expr (p->max, t);
- }
+ {
+ gcc_checking_assert (!p->equiv);
+ inchash::hash hstate (p->type);
+ hstate.add_ptr (p->min);
+ hstate.add_ptr (p->max);
+ return hstate.end ();
+ }
static bool
equal (const value_range *a, const value_range *b)
{
@@ -4352,8 +4353,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
gcc_checking_assert (adj->offset % BITS_PER_UNIT == 0);
base = gimple_call_arg (stmt, adj->base_index);
- loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base)
- : EXPR_LOCATION (base);
+ loc = gimple_location (stmt);
if (TREE_CODE (base) != ADDR_EXPR
&& POINTER_TYPE_P (TREE_TYPE (base)))
@@ -4445,6 +4445,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
else
expr = create_tmp_reg (TREE_TYPE (expr));
gimple_assign_set_lhs (tem, expr);
+ gimple_set_location (tem, loc);
gsi_insert_before (&gsi, tem, GSI_SAME_STMT);
}
}
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 959e31a68e6..f7dd29f925c 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -404,6 +404,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
if (!dst->count)
return;
+ if (!src->count || src->alias)
+ return;
if (symtab->dump_file)
{
fprintf (symtab->dump_file, "Merging profiles of %s/%i to %s/%i\n",
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 9cf01194225..6b7cbcd3727 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1485,7 +1485,10 @@ scan_one_insn (rtx_insn *insn)
&& targetm.legitimate_constant_p (GET_MODE (SET_DEST (set)),
XEXP (note, 0))
&& REG_N_SETS (REGNO (SET_DEST (set))) == 1))
- && general_operand (SET_SRC (set), GET_MODE (SET_SRC (set))))
+ && general_operand (SET_SRC (set), GET_MODE (SET_SRC (set)))
+ /* LRA does not use equiv with a symbol for PIC code. */
+ && (! ira_use_lra_p || ! pic_offset_table_rtx
+ || ! contains_symbol_ref_p (XEXP (note, 0))))
{
enum reg_class cl = GENERAL_REGS;
rtx reg = SET_DEST (set);
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog
index 83e96394f93..e77a00f6139 100644
--- a/gcc/jit/ChangeLog
+++ b/gcc/jit/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 3d48a8fb7bc..21959f716b1 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -477,7 +477,7 @@ unroll_loop_constant_iterations (struct loop *loop)
exit_mod = niter % (max_unroll + 1);
- auto_sbitmap wont_exit (max_unroll + 1);
+ auto_sbitmap wont_exit (max_unroll + 2);
bitmap_ones (wont_exit);
auto_vec<edge> remove_edges;
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 4818cd1104b..b3b45e92b6a 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3724,7 +3724,13 @@ curr_insn_transform (bool check_only_p)
curr_insn_set = single_set (curr_insn);
if (curr_insn_set != NULL_RTX && simple_move_p ())
- return false;
+ {
+ /* We assume that the corresponding insn alternative has no
+ earlier clobbers. If it is not the case, don't define move
+ cost equal to 2 for the corresponding register classes. */
+ lra_set_used_insn_alternative (curr_insn, LRA_NON_CLOBBERED_ALT);
+ return false;
+ }
no_input_reloads_p = no_output_reloads_p = false;
goal_alt_number = -1;
@@ -3832,7 +3838,7 @@ curr_insn_transform (bool check_only_p)
if (change_p)
/* If we've changed the instruction then any alternative that
we chose previously may no longer be valid. */
- lra_set_used_insn_alternative (curr_insn, -1);
+ lra_set_used_insn_alternative (curr_insn, LRA_UNKNOWN_ALT);
if (! check_only_p && curr_insn_set != NULL_RTX
&& check_and_process_move (&change_p, &sec_mem_p))
@@ -3840,7 +3846,7 @@ curr_insn_transform (bool check_only_p)
try_swapped:
- reused_alternative_num = check_only_p ? -1 : curr_id->used_insn_alternative;
+ reused_alternative_num = check_only_p ? LRA_UNKNOWN_ALT : curr_id->used_insn_alternative;
if (lra_dump_file != NULL && reused_alternative_num >= 0)
fprintf (lra_dump_file, "Reusing alternative %d for insn #%u\n",
reused_alternative_num, INSN_UID (curr_insn));
@@ -6738,7 +6744,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
}
lra_push_insn_and_update_insn_regno_info (curr_insn);
lra_set_used_insn_alternative_by_uid
- (INSN_UID (curr_insn), -1);
+ (INSN_UID (curr_insn), LRA_UNKNOWN_ALT);
done_p = true;
if (lra_dump_file != NULL)
{
@@ -6777,7 +6783,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
constraints pass. */
lra_push_insn_and_update_insn_regno_info (curr_insn);
lra_set_used_insn_alternative_by_uid
- (INSN_UID (curr_insn), -1);
+ (INSN_UID (curr_insn), LRA_UNKNOWN_ALT);
}
else if (restored_regs_p)
/* The instruction has been restored to the form that
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index ab51b673826..13bf8d375d8 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -1178,7 +1178,7 @@ spill_pseudos (HARD_REG_SET set)
if (bitmap_bit_p (&to_process, INSN_UID (insn)))
{
lra_push_insn (insn);
- lra_set_used_insn_alternative (insn, -1);
+ lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT);
}
bitmap_clear (&to_process);
}
@@ -1411,7 +1411,7 @@ process_insn_for_elimination (rtx_insn *insn, bool final_p, bool first_p)
}
lra_update_insn_regno_info (insn);
lra_push_insn (insn);
- lra_set_used_insn_alternative (insn, -1);
+ lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT);
}
}
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 405071708b1..59b08ec73ef 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -202,15 +202,20 @@ struct lra_static_insn_data
const struct operand_alternative *operand_alternative;
};
+/* Negative insn alternative numbers used for special cases. */
+#define LRA_UNKNOWN_ALT -1
+#define LRA_NON_CLOBBERED_ALT -2
+
/* LRA internal info about an insn (LRA internal insn
representation). */
struct lra_insn_recog_data
{
/* The insn code. */
int icode;
- /* The alternative should be used for the insn, -1 if invalid, or we
- should try to use any alternative, or the insn is a debug
- insn. */
+ /* The alternative should be used for the insn, LRA_UNKNOWN_ALT if
+ unknown, or we should assume any alternative, or the insn is a
+ debug insn. LRA_NON_CLOBBERED_ALT means ignoring any earlier
+ clobbers for the insn. */
int used_insn_alternative;
/* SP offset before the insn relative to one at the func start. */
HOST_WIDE_INT sp_offset;
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 5d4015b5ab9..bb8ab25d4ef 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -593,7 +593,9 @@ static inline bool
reg_early_clobber_p (const struct lra_insn_reg *reg, int n_alt)
{
return (reg->early_clobber
- && (n_alt < 0 || TEST_BIT (reg->early_clobber_alts, n_alt)));
+ && (n_alt == LRA_UNKNOWN_ALT
+ || (n_alt != LRA_NON_CLOBBERED_ALT
+ && TEST_BIT (reg->early_clobber_alts, n_alt))));
}
/* Process insns of the basic block BB to update pseudo live ranges,
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 492fc182cf0..73f293a08f7 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -503,7 +503,7 @@ spill_pseudos (void)
INSN_UID (insn));
lra_push_insn (insn);
if (lra_reg_spill_p || targetm.different_addr_displacement_p ())
- lra_set_used_insn_alternative (insn, -1);
+ lra_set_used_insn_alternative (insn, LRA_UNKNOWN_ALT);
}
else if (CALL_P (insn)
/* Presence of any pseudo in CALL_INSN_FUNCTION_USAGE
diff --git a/gcc/lra.c b/gcc/lra.c
index 1230b25e7e1..a0c9797e2fd 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -946,7 +946,7 @@ lra_set_insn_recog_data (rtx_insn *insn)
data = XNEW (struct lra_insn_recog_data);
lra_insn_recog_data[uid] = data;
data->insn = insn;
- data->used_insn_alternative = -1;
+ data->used_insn_alternative = LRA_UNKNOWN_ALT;
data->icode = icode;
data->regs = NULL;
if (DEBUG_INSN_P (insn))
@@ -1187,7 +1187,7 @@ lra_update_insn_recog_data (rtx_insn *insn)
return data;
}
insn_static_data = data->insn_static_data;
- data->used_insn_alternative = -1;
+ data->used_insn_alternative = LRA_UNKNOWN_ALT;
if (DEBUG_INSN_P (insn))
return data;
if (data->icode < 0)
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index b96b9df63b7..89313727068 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2524,13 +2524,10 @@ write_symbol (struct streamer_tree_cache_d *cache,
const char *comdat;
unsigned char c;
- /* None of the following kinds of symbols are needed in the
- symbol table. */
- if (!TREE_PUBLIC (t)
- || is_builtin_fn (t)
- || DECL_ABSTRACT_P (t)
- || (VAR_P (t) && DECL_HARD_REGISTER (t)))
- return;
+ gcc_checking_assert (TREE_PUBLIC (t)
+ && !is_builtin_fn (t)
+ && !DECL_ABSTRACT_P (t)
+ && (!VAR_P (t) || !DECL_HARD_REGISTER (t)));
gcc_assert (VAR_OR_FUNCTION_DECL_P (t));
@@ -2618,45 +2615,6 @@ write_symbol (struct streamer_tree_cache_d *cache,
lto_write_data (&slot_num, 4);
}
-/* Return true if NODE should appear in the plugin symbol table. */
-
-bool
-output_symbol_p (symtab_node *node)
-{
- struct cgraph_node *cnode;
- if (!node->real_symbol_p ())
- return false;
- /* We keep external functions in symtab for sake of inlining
- and devirtualization. We do not want to see them in symbol table as
- references unless they are really used. */
- cnode = dyn_cast <cgraph_node *> (node);
- if (cnode && (!node->definition || DECL_EXTERNAL (cnode->decl))
- && cnode->callers)
- return true;
-
- /* Ignore all references from external vars initializers - they are not really
- part of the compilation unit until they are used by folding. Some symbols,
- like references to external construction vtables can not be referred to at all.
- We decide this at can_refer_decl_in_current_unit_p. */
- if (!node->definition || DECL_EXTERNAL (node->decl))
- {
- int i;
- struct ipa_ref *ref;
- for (i = 0; node->iterate_referring (i, ref); i++)
- {
- if (ref->use == IPA_REF_ALIAS)
- continue;
- if (is_a <cgraph_node *> (ref->referring))
- return true;
- if (!DECL_EXTERNAL (ref->referring->decl))
- return true;
- }
- return false;
- }
- return true;
-}
-
-
/* Write an IL symbol table to OB.
SET and VSET are cgraph/varpool node sets we are outputting. */
@@ -2681,7 +2639,7 @@ produce_symtab (struct output_block *ob)
{
symtab_node *node = lsei_node (lsei);
- if (!output_symbol_p (node) || DECL_EXTERNAL (node->decl))
+ if (DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ())
continue;
write_symbol (cache, node->decl, &seen, false);
}
@@ -2690,7 +2648,7 @@ produce_symtab (struct output_block *ob)
{
symtab_node *node = lsei_node (lsei);
- if (!output_symbol_p (node) || !DECL_EXTERNAL (node->decl))
+ if (!DECL_EXTERNAL (node->decl) || !node->output_to_lto_symbol_table_p ())
continue;
write_symbol (cache, node->decl, &seen, false);
}
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index faf216000a5..1ebbb907ec1 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,80 @@
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-23 Martin Liska <mliska@suse.cz>
+
+ PR lto/81440
+ * lto-symtab.c (lto_symtab_merge): Handle and do not warn about
+ trailing arrays at the end of a struct.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-08 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto-partition.c (lto_balanced_map): Watch overflow.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-08 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/81360
+ * lto.c (unify_scc): Register prevailing trees, not trees to be freed.
+ (read_cgraph_and_symbols): Use
+ symtab_node::output_to_lto_symbol_table_p.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-30 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto.c (register_resolution): Remove forgotten sanity check.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-30 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/81004
+ * lto.c: Include builtins.h
+ (register_resolution): Merge resolutions in case trees was
+ merged across units.
+ (lto_maybe_register_decl): Break out from ...
+ (lto_read_decls): ... here.
+ (unify_scc): Also register decls here.
+ (read_cgraph_and_symbols): Sanity check that all resolutions was
+ read.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR lto/83954
+ * lto-symtab.c (warn_type_compatibility_p): Do not recurse into the
+ component type of array types with non-aliased component.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-30 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/83954
+ * lto-symtab.c (warn_type_compatibility_p): Silence false positive
+ for type match warning on arrays of pointers.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-10-13 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto-lang.c (lto_post_options): Clean shlib flag when not doing PIC.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index ca8945e53bb..fdd6ae08a1c 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -840,11 +840,13 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
flag_pie is 2. */
flag_pie = MAX (flag_pie, flag_pic);
flag_pic = flag_pie;
+ flag_shlib = 0;
break;
case LTO_LINKER_OUTPUT_EXEC: /* Normal executable */
flag_pic = 0;
flag_pie = 0;
+ flag_shlib = 0;
break;
case LTO_LINKER_OUTPUT_UNKNOWN:
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 34e8e9c6cde..f291960c050 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -756,7 +756,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
if (npartitions < n_lto_partitions)
partition_size = total_size / (n_lto_partitions - npartitions);
else
- partition_size = INT_MAX;
+ /* Watch for overflow. */
+ partition_size = INT_MAX / 16;
if (partition_size < PARAM_VALUE (MIN_PARTITION_SIZE))
partition_size = PARAM_VALUE (MIN_PARTITION_SIZE);
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index bd4490c2b62..10c3fbe49f3 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -283,11 +283,25 @@ warn_type_compatibility_p (tree prevailing_type, tree type,
alias_set_type set1 = get_alias_set (type);
alias_set_type set2 = get_alias_set (prevailing_type);
- if (set1 && set2 && set1 != set2
- && (!POINTER_TYPE_P (type) || !POINTER_TYPE_P (prevailing_type)
+ if (set1 && set2 && set1 != set2)
+ {
+ tree t1 = type, t2 = prevailing_type;
+
+ /* Alias sets of arrays with aliased components are the same as alias
+ sets of the inner types. */
+ while (TREE_CODE (t1) == ARRAY_TYPE
+ && !TYPE_NONALIASED_COMPONENT (t1)
+ && TREE_CODE (t2) == ARRAY_TYPE
+ && !TYPE_NONALIASED_COMPONENT (t2))
+ {
+ t1 = TREE_TYPE (t1);
+ t2 = TREE_TYPE (t2);
+ }
+ if ((!POINTER_TYPE_P (t1) || !POINTER_TYPE_P (t2))
|| (set1 != TYPE_ALIAS_SET (ptr_type_node)
- && set2 != TYPE_ALIAS_SET (ptr_type_node))))
- lev |= 5;
+ && set2 != TYPE_ALIAS_SET (ptr_type_node)))
+ lev |= 5;
+ }
}
return lev;
@@ -351,18 +365,31 @@ lto_symtab_merge (symtab_node *prevailing, symtab_node *entry)
return false;
if (DECL_SIZE (decl) && DECL_SIZE (prevailing_decl)
- && !tree_int_cst_equal (DECL_SIZE (decl), DECL_SIZE (prevailing_decl))
+ && !tree_int_cst_equal (DECL_SIZE (decl), DECL_SIZE (prevailing_decl)))
+ {
+ if (!DECL_COMMON (decl) && !DECL_EXTERNAL (decl))
+ return false;
+
+ tree type = TREE_TYPE (decl);
+
+ /* For record type, check for array at the end of the structure. */
+ if (TREE_CODE (type) == RECORD_TYPE)
+ {
+ tree field = TYPE_FIELDS (type);
+ while (DECL_CHAIN (field) != NULL_TREE)
+ field = DECL_CHAIN (field);
+
+ return TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE;
+ }
/* As a special case do not warn about merging
int a[];
and
int a[]={1,2,3};
here the first declaration is COMMON
and sizeof(a) == sizeof (int). */
- && ((!DECL_COMMON (decl) && !DECL_EXTERNAL (decl))
- || TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE
- || TYPE_SIZE (TREE_TYPE (decl))
- != TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl)))))
- return false;
+ else if (TREE_CODE (type) == ARRAY_TYPE)
+ return (TYPE_SIZE (decl) == TYPE_SIZE (TREE_TYPE (type)));
+ }
return true;
}
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index a7d5e450ea0..8a82f923b6e 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "lto-symtab.h"
#include "stringpool.h"
#include "fold-const.h"
+#include "builtins.h"
/* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver. */
@@ -829,12 +830,19 @@ static void
register_resolution (struct lto_file_decl_data *file_data, tree decl,
enum ld_plugin_symbol_resolution resolution)
{
+ bool existed;
if (resolution == LDPR_UNKNOWN)
return;
if (!file_data->resolution_map)
file_data->resolution_map
= new hash_map<tree, ld_plugin_symbol_resolution>;
- file_data->resolution_map->put (decl, resolution);
+ ld_plugin_symbol_resolution_t &res
+ = file_data->resolution_map->get_or_insert (decl, &existed);
+ if (!existed
+ || resolution == LDPR_PREVAILING_DEF_IRONLY
+ || resolution == LDPR_PREVAILING_DEF
+ || resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
+ res = resolution;
}
/* Register DECL with the global symbol table and change its
@@ -877,6 +885,18 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl,
decl, get_resolution (data_in, ix));
}
+/* Check if T is a decl and needs register its resolution info. */
+
+static void
+lto_maybe_register_decl (struct data_in *data_in, tree t, unsigned ix)
+{
+ if (TREE_CODE (t) == VAR_DECL)
+ lto_register_var_decl_in_symtab (data_in, t, ix);
+ else if (TREE_CODE (t) == FUNCTION_DECL
+ && !DECL_BUILT_IN (t))
+ lto_register_function_decl_in_symtab (data_in, t, ix);
+}
+
/* For the type T re-materialize it in the type variant list and
the pointer/reference-to chains. */
@@ -1607,7 +1627,10 @@ unify_scc (struct data_in *data_in, unsigned from,
/* Fixup the streamer cache with the prevailing nodes according
to the tree node mapping computed by compare_tree_sccs. */
if (len == 1)
- streamer_tree_cache_replace_tree (cache, pscc->entries[0], from);
+ {
+ lto_maybe_register_decl (data_in, pscc->entries[0], from);
+ streamer_tree_cache_replace_tree (cache, pscc->entries[0], from);
+ }
else
{
tree *map2 = XALLOCAVEC (tree, 2 * len);
@@ -1619,8 +1642,12 @@ unify_scc (struct data_in *data_in, unsigned from,
qsort (map2, len, 2 * sizeof (tree), cmp_tree);
qsort (map, len, 2 * sizeof (tree), cmp_tree);
for (unsigned i = 0; i < len; ++i)
- streamer_tree_cache_replace_tree (cache, map[2*i],
- (uintptr_t)map2[2*i]);
+ {
+ lto_maybe_register_decl (data_in, map[2*i],
+ (uintptr_t)map2[2*i]);
+ streamer_tree_cache_replace_tree (cache, map[2*i],
+ (uintptr_t)map2[2*i]);
+ }
}
/* Free the tree nodes from the read SCC. */
@@ -1759,13 +1786,7 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
}
if (!flag_ltrans)
{
- /* Register variables and functions with the
- symbol table. */
- if (TREE_CODE (t) == VAR_DECL)
- lto_register_var_decl_in_symtab (data_in, t, from + i);
- else if (TREE_CODE (t) == FUNCTION_DECL
- && !DECL_BUILT_IN (t))
- lto_register_function_decl_in_symtab (data_in, t, from + i);
+ lto_maybe_register_decl (data_in, t, from + i);
/* Scan the tree for references to global functions or
variables and record those for later fixup. */
if (mentions_vars_p (t))
@@ -2858,13 +2879,25 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Store resolutions into the symbol table. */
- ld_plugin_symbol_resolution_t *res;
FOR_EACH_SYMBOL (snode)
- if (snode->real_symbol_p ()
- && snode->lto_file_data
- && snode->lto_file_data->resolution_map
- && (res = snode->lto_file_data->resolution_map->get (snode->decl)))
- snode->resolution = *res;
+ if (snode->externally_visible && snode->real_symbol_p ()
+ && snode->lto_file_data && snode->lto_file_data->resolution_map
+ && !is_builtin_fn (snode->decl)
+ && !(VAR_P (snode->decl) && DECL_HARD_REGISTER (snode->decl)))
+ {
+ ld_plugin_symbol_resolution_t *res;
+
+ res = snode->lto_file_data->resolution_map->get (snode->decl);
+ if (!res || *res == LDPR_UNKNOWN)
+ {
+ if (snode->output_to_lto_symbol_table_p ())
+ fatal_error (input_location, "missing resolution data for %s",
+ IDENTIFIER_POINTER
+ (DECL_ASSEMBLER_NAME (snode->decl)));
+ }
+ else
+ snode->resolution = *res;
+ }
for (i = 0; all_file_decl_data[i]; i++)
if (all_file_decl_data[i]->resolution_map)
{
diff --git a/gcc/machmode.def b/gcc/machmode.def
index afe685195ef..6c844889b7f 100644
--- a/gcc/machmode.def
+++ b/gcc/machmode.def
@@ -243,6 +243,7 @@ UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */
/* Complex modes. */
COMPLEX_MODES (INT);
+COMPLEX_MODES (PARTIAL_INT);
COMPLEX_MODES (FLOAT);
/* Decimal floating point modes. */
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 770af1d3942..62e7c9f97d8 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index 38778b4aebb..babdf8c10da 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 2d1ba3f52c3..e10f2e81d7f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -3261,6 +3261,43 @@ scan_omp (gimple_seq *body_p, omp_context *ctx)
/* Re-gimplification and code generation routines. */
+/* Remove omp_member_access_dummy_var variables from gimple_bind_vars
+ of BIND if in a method. */
+
+static void
+maybe_remove_omp_member_access_dummy_vars (gbind *bind)
+{
+ if (DECL_ARGUMENTS (current_function_decl)
+ && DECL_ARTIFICIAL (DECL_ARGUMENTS (current_function_decl))
+ && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))
+ == POINTER_TYPE))
+ {
+ tree vars = gimple_bind_vars (bind);
+ for (tree *pvar = &vars; *pvar; )
+ if (omp_member_access_dummy_var (*pvar))
+ *pvar = DECL_CHAIN (*pvar);
+ else
+ pvar = &DECL_CHAIN (*pvar);
+ gimple_bind_set_vars (bind, vars);
+ }
+}
+
+/* Remove omp_member_access_dummy_var variables from BLOCK_VARS of
+ block and its subblocks. */
+
+static void
+remove_member_access_dummy_vars (tree block)
+{
+ for (tree *pvar = &BLOCK_VARS (block); *pvar; )
+ if (omp_member_access_dummy_var (*pvar))
+ *pvar = DECL_CHAIN (*pvar);
+ else
+ pvar = &DECL_CHAIN (*pvar);
+
+ for (block = BLOCK_SUBBLOCKS (block); block; block = BLOCK_CHAIN (block))
+ remove_member_access_dummy_vars (block);
+}
+
/* If a context was created for STMT when it was scanned, return it. */
static omp_context *
@@ -7002,6 +7039,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
pop_gimplify_context (new_stmt);
gimple_bind_append_vars (new_stmt, ctx->block_vars);
+ maybe_remove_omp_member_access_dummy_vars (new_stmt);
BLOCK_VARS (block) = gimple_bind_vars (new_stmt);
if (BLOCK_VARS (block))
TREE_USED (block) = 1;
@@ -7452,6 +7490,7 @@ lower_omp_taskreg (gimple_stmt_iterator *gsi_p, omp_context *ctx)
/* Declare all the variables created by mapping and the variables
declared in the scope of the parallel body. */
record_vars_into (ctx->block_vars, child_fn);
+ maybe_remove_omp_member_access_dummy_vars (par_bind);
record_vars_into (gimple_bind_vars (par_bind), child_fn);
if (ctx->record_type)
@@ -7820,6 +7859,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
/* Declare all the variables created by mapping and the variables
declared in the scope of the target body. */
record_vars_into (ctx->block_vars, child_fn);
+ maybe_remove_omp_member_access_dummy_vars (tgt_bind);
record_vars_into (gimple_bind_vars (tgt_bind), child_fn);
}
@@ -8811,6 +8851,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
break;
case GIMPLE_BIND:
lower_omp (gimple_bind_body_ptr (as_a <gbind *> (stmt)), ctx);
+ maybe_remove_omp_member_access_dummy_vars (as_a <gbind *> (stmt));
break;
case GIMPLE_OMP_PARALLEL:
case GIMPLE_OMP_TASK:
@@ -9015,6 +9056,16 @@ execute_lower_omp (void)
all_contexts = NULL;
}
BITMAP_FREE (task_shared_vars);
+
+ /* If current function is a method, remove artificial dummy VAR_DECL created
+ for non-static data member privatization, they aren't needed for
+ debuginfo nor anything else, have been already replaced everywhere in the
+ IL and cause problems with LTO. */
+ if (DECL_ARGUMENTS (current_function_decl)
+ && DECL_ARTIFICIAL (DECL_ARGUMENTS (current_function_decl))
+ && (TREE_CODE (TREE_TYPE (DECL_ARGUMENTS (current_function_decl)))
+ == POINTER_TYPE))
+ remove_member_access_dummy_vars (DECL_INITIAL (current_function_decl));
return 0;
}
diff --git a/gcc/opts.c b/gcc/opts.c
index f03b57aa343..e5126618f35 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1014,6 +1014,26 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_flag_tm)
sorry ("transactional memory is not supported with "
"%<-fsanitize=kernel-address%>");
+
+ /* Comes from final.c -- no real reason to change it. */
+#define MAX_CODE_ALIGN 16
+#define MAX_CODE_ALIGN_VALUE (1 << MAX_CODE_ALIGN)
+
+ if (opts->x_align_loops > MAX_CODE_ALIGN_VALUE)
+ error_at (loc, "-falign-loops=%d is not between 0 and %d",
+ opts->x_align_loops, MAX_CODE_ALIGN_VALUE);
+
+ if (opts->x_align_jumps > MAX_CODE_ALIGN_VALUE)
+ error_at (loc, "-falign-jumps=%d is not between 0 and %d",
+ opts->x_align_jumps, MAX_CODE_ALIGN_VALUE);
+
+ if (opts->x_align_functions > MAX_CODE_ALIGN_VALUE)
+ error_at (loc, "-falign-functions=%d is not between 0 and %d",
+ opts->x_align_functions, MAX_CODE_ALIGN_VALUE);
+
+ if (opts->x_align_labels > MAX_CODE_ALIGN_VALUE)
+ error_at (loc, "-falign-labels=%d is not between 0 and %d",
+ opts->x_align_labels, MAX_CODE_ALIGN_VALUE);
}
#define LEFT_COLUMN 27
diff --git a/gcc/params.def b/gcc/params.def
index 6b07518a34b..9c83b0af3ef 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -344,11 +344,11 @@ DEFPARAM(PARAM_MAX_UNSWITCH_LEVEL,
"The maximum number of unswitchings in a single loop.",
3, 0, 0)
-/* The maximum number of insns in loop header duplicated by he copy loop
+/* The maximum number of insns in loop header duplicated by the copy loop
headers pass. */
DEFPARAM(PARAM_MAX_LOOP_HEADER_INSNS,
"max-loop-header-insns",
- "The maximum number of insns in loop header duplicated by he copy loop headers pass.",
+ "The maximum number of insns in loop header duplicated by the copy loop headers pass.",
20, 0, 0)
/* The maximum number of iterations of a loop the brute force algorithm
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 3f3c3a1c709..b8ed7deef96 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-22 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
2018-01-09 Joseph Myers <joseph@codesourcery.com>
* es.po: Update.
diff --git a/gcc/po/es.po b/gcc/po/es.po
index 94510a792c6..7cf0bc59c36 100644
--- a/gcc/po/es.po
+++ b/gcc/po/es.po
@@ -8,6 +8,7 @@
#
# Glosario
#
+# alignment - alineamiento > alineación
# array - TBD
# asan - asan
# bug - error
@@ -40,7 +41,7 @@ msgstr ""
"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: 2018-01-07 10:20+0100\n"
+"PO-Revision-Date: 2018-01-20 10:10+0100\n"
"Last-Translator: Antonio Ceballos <aceballos@gmail.com>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
"Language: es\n"
@@ -26348,10 +26349,9 @@ msgid "operand 2 should be an even 3-bit value (subreg 0,2,4,6)"
msgstr "el operando 2 debería ser un valor de 3 bits par (subreg 0,2,4,6)"
#: config/arc/arc.c:6127
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "symbol used as immediate operand"
+#, gcc-internal-format, gfc-internal-format
msgid "builtin requires an immediate for operand %d"
-msgstr "se usó un símbolo como un operando inmediato"
+msgstr "el interno requiere un inmediato para el operando %d"
#: config/arc/arc.c:6132
#, gcc-internal-format, gfc-internal-format
@@ -26880,10 +26880,9 @@ msgid "using %qs with unsigned type has no effect"
msgstr "usar %qs con un tipo sin signo no tiene ningún efecto"
#: config/avr/avr-c.c:105 config/avr/avr-c.c:171 config/avr/avr-c.c:228
-#, fuzzy, gcc-internal-format
-#| msgid "no matching template for %qD found"
+#, gcc-internal-format
msgid "no matching fixed-point overload found for %qs"
-msgstr "no se encontró una plantilla coincidente para %qD"
+msgstr "no se encontró una sobrecarga de coma flotante coincidente para %qs"
#: config/avr/avr-c.c:122
#, gcc-internal-format
@@ -28750,10 +28749,9 @@ msgid "the %qs architecture does not support madd or msub instructions"
msgstr "la arquitectura %qs no admite las instrucciones madd ni msub"
#: config/mips/mips.c:19848
-#, fuzzy, gcc-internal-format
-#| msgid "the %qs architecture does not support paired-single instructions"
+#, gcc-internal-format
msgid "the %qs architecture does not support odd single-precision registers"
-msgstr "la arquitectura %qs no admite las instrucciones par-sencillo"
+msgstr "la arquitectura %qs no admite los registros de precisión sencilla impar"
#: config/mips/mips.c:19861 config/mips/mips.c:19867
#, gcc-internal-format
@@ -29766,13 +29764,12 @@ msgstr "-mfloat128-hardware necesita -mfloat128-type"
#: config/rs6000/rs6000.c:4861
#, gcc-internal-format
msgid "-mfloat128-hardware requires full ISA 3.0 support"
-msgstr ""
+msgstr "-mfloat128-hardware requiere suporte pleno de ISA 3.0"
#: config/rs6000/rs6000.c:4869
-#, fuzzy, gcc-internal-format
-#| msgid "-mrecip requires -mfused-madd"
+#, gcc-internal-format
msgid "-mfloat128-hardware requires -m64"
-msgstr "-mrecip requiere -mfused-madd"
+msgstr "-mfloat128-hardware requiere -m64"
#: config/rs6000/rs6000.c:4933
#, gcc-internal-format, gfc-internal-format
@@ -29802,29 +29799,27 @@ msgstr "el atributo o pragma target cambia la coma flotante de precisión doble"
#: config/rs6000/rs6000.c:5153
#, gcc-internal-format
msgid "%qs is not a valid number in -mstack-protector-guard-offset="
-msgstr ""
+msgstr "%qs no es un número válido en -mstack-protector-guard-offset="
#: config/rs6000/rs6000.c:5158
-#, fuzzy, gcc-internal-format
-#| msgid "%qs is not a valid option to the preprocessor"
+#, gcc-internal-format
msgid "%qs is not a valid offset in -mstack-protector-guard-offset="
-msgstr "%qs no es una opción válida para el preprocesador"
+msgstr "%qs no es un desplazamiento válido en -mstack-protector-guard-offset="
#: config/rs6000/rs6000.c:5170
#, gcc-internal-format
msgid "%qs is not a valid base register in -mstack-protector-guard-reg="
-msgstr ""
+msgstr "%qs no es un registro base válido en -mstack-protector-guard-reg="
#: config/rs6000/rs6000.c:5178
#, gcc-internal-format
msgid "-mstack-protector-guard=tls needs a valid base register"
-msgstr ""
+msgstr "-mstack-protector-guard==tls necesita un registro bae válido"
#: config/rs6000/rs6000.c:8202
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "The ABI for passing parameters with %d-byte alignment has changed in GCC 4.6"
+#, gcc-internal-format, gfc-internal-format
msgid "the layout of aggregates containing vectors with %d-byte alignment has changed in GCC 5"
-msgstr "La ABI para pasar parámetros con alineación de %d-bytes cambió en GCC 4.6"
+msgstr "la disposición de los agregados que contienen vectores con alineamiento de %d bytes cambió en GCC 5"
#: config/rs6000/rs6000.c:11615
#, gcc-internal-format
@@ -29837,10 +29832,9 @@ msgid "cannot return value in vector register because altivec instructions are d
msgstr "no se puede devolver un valor en el registro vector porque las instrucciones altivec están desactivadas, use -maltivec para activarlas"
#: config/rs6000/rs6000.c:11977
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "The ABI for passing parameters with %d-byte alignment has changed in GCC 4.6"
+#, gcc-internal-format, gfc-internal-format
msgid "the ABI of passing aggregates with %d-byte alignment has changed in GCC 5"
-msgstr "La ABI para pasar parámetros con alineación de %d-bytes cambió en GCC 4.6"
+msgstr "la ABI para pasar agregados con alineación de %d bytes cambió en GCC 5"
#: config/rs6000/rs6000.c:12246
#, gcc-internal-format
@@ -29864,32 +29858,29 @@ msgid "internal error: builtin function %s already processed"
msgstr "error interno: la función interna %s ya se procesó"
#: config/rs6000/rs6000.c:14571
-#, fuzzy, gcc-internal-format
-#| msgid "argument 1 must be a 5-bit signed literal"
+#, gcc-internal-format
msgid "argument 1 must be an 8-bit field value"
-msgstr "el argumento 1 debe ser una literal con signo de 5-bit"
+msgstr "el argumento 1 debe ser un valor de un campo de 8 bits"
#: config/rs6000/rs6000.c:14617
#, gcc-internal-format
msgid "argument 1 must be a 5-bit signed literal"
-msgstr "el argumento 1 debe ser una literal con signo de 5-bit"
+msgstr "el argumento 1 debe ser un literal con signo de 5 bits"
#: config/rs6000/rs6000.c:14720 config/rs6000/rs6000.c:16593
#, gcc-internal-format
msgid "argument 2 must be a 5-bit unsigned literal"
-msgstr "el argumento 2 debe ser una literal sin signo de 5-bit"
+msgstr "el argumento 2 debe ser un literal sin signo de 5 bits"
#: config/rs6000/rs6000.c:14738
-#, fuzzy, gcc-internal-format
-#| msgid "argument 2 must be a 5-bit unsigned literal"
+#, gcc-internal-format
msgid "argument 1 must be a 6-bit unsigned literal"
-msgstr "el argumento 2 debe ser una literal sin signo de 5-bit"
+msgstr "el argumento 1 debe ser un literal sin signo de 6 bits"
#: config/rs6000/rs6000.c:14752
-#, fuzzy, gcc-internal-format
-#| msgid "argument 2 must be a 5-bit unsigned literal"
+#, gcc-internal-format
msgid "argument 2 must be a 7-bit unsigned literal"
-msgstr "el argumento 2 debe ser una literal sin signo de 5-bit"
+msgstr "el argumento 2 debe ser un literal sin signo de 7 bits"
#: config/rs6000/rs6000.c:14791
#, gcc-internal-format
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 19bb65bcfb1..c8568c77222 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1035,7 +1035,8 @@ check_annul_list_true_false (int annul_true_p,
static void
steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
- vec<rtx_insn *> *delay_list, resources *sets,
+ vec<rtx_insn *> *delay_list,
+ struct resources *sets,
struct resources *needed,
struct resources *other_needed,
int slots_to_fill, int *pslots_filled,
@@ -1048,7 +1049,7 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
int used_annul = 0;
int i;
struct resources cc_set;
- bool *redundant;
+ rtx_insn **redundant;
/* We can't do anything if there are more delay slots in SEQ than we
can handle, or if we don't know that it will be a taken branch.
@@ -1087,7 +1088,7 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
if (! targetm.can_follow_jump (insn, seq->insn (0)))
return;
- redundant = XALLOCAVEC (bool, XVECLEN (seq, 0));
+ redundant = XALLOCAVEC (rtx_insn *, XVECLEN (seq, 0));
for (i = 1; i < seq->len (); i++)
{
rtx_insn *trial = seq->insn (i);
@@ -1151,7 +1152,10 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
we therefore decided not to copy. */
for (i = 1; i < seq->len (); i++)
if (redundant[i])
- update_block (seq->insn (i), insn);
+ {
+ fix_reg_dead_note (redundant[i], insn);
+ update_block (seq->insn (i), insn);
+ }
/* Show the place to which we will be branching. */
*pnew_thread = first_active_target_insn (JUMP_LABEL (seq->insn (0)));
@@ -1198,6 +1202,7 @@ steal_delay_list_from_fallthrough (rtx_insn *insn, rtx condition,
for (i = 1; i < seq->len (); i++)
{
rtx_insn *trial = seq->insn (i);
+ rtx_insn *prior_insn;
/* If TRIAL sets CC0, stealing it will move it too far from the use
of CC0. */
@@ -1209,8 +1214,9 @@ steal_delay_list_from_fallthrough (rtx_insn *insn, rtx condition,
break;
/* If this insn was already done, we don't need it. */
- if (redundant_insn (trial, insn, *delay_list))
+ if ((prior_insn = redundant_insn (trial, insn, *delay_list)))
{
+ fix_reg_dead_note (prior_insn, insn);
update_block (trial, insn);
delete_from_delay_slot (trial);
continue;
@@ -1790,15 +1796,14 @@ fix_reg_dead_note (rtx_insn *start_insn, rtx stop_insn)
}
}
-/* Delete any REG_UNUSED notes that exist on INSN but not on REDUNDANT_INSN.
+/* Delete any REG_UNUSED notes that exist on INSN but not on OTHER_INSN.
This handles the case of udivmodXi4 instructions which optimize their
- output depending on whether any REG_UNUSED notes are present.
- we must make sure that INSN calculates as many results as REDUNDANT_INSN
- does. */
+ output depending on whether any REG_UNUSED notes are present. We must
+ make sure that INSN calculates as many results as OTHER_INSN does. */
static void
-update_reg_unused_notes (rtx_insn *insn, rtx redundant_insn)
+update_reg_unused_notes (rtx_insn *insn, rtx other_insn)
{
rtx link, next;
@@ -1810,8 +1815,7 @@ update_reg_unused_notes (rtx_insn *insn, rtx redundant_insn)
|| !REG_P (XEXP (link, 0)))
continue;
- if (! find_regno_note (redundant_insn, REG_UNUSED,
- REGNO (XEXP (link, 0))))
+ if (!find_regno_note (other_insn, REG_UNUSED, REGNO (XEXP (link, 0))))
remove_note (insn, link);
}
}
@@ -2324,9 +2328,8 @@ follow_jumps (rtx label, rtx_insn *jump, bool *crossing)
taken and THREAD_IF_TRUE is set. This is used for the branch at the
end of a loop back up to the top.
- OWN_THREAD and OWN_OPPOSITE_THREAD are true if we are the only user of the
- thread. I.e., it is the fallthrough code of our jump or the target of the
- jump when we are the only jump going there.
+ OWN_THREAD is true if we are the only user of the thread, i.e. it is
+ the target of the jump when we are the only jump going there.
If OWN_THREAD is false, it must be the "true" thread of a jump. In that
case, we can only take insns from the head of the thread for our delay
@@ -3117,7 +3120,7 @@ relax_delay_slots (rtx_insn *first)
/* Look at every JUMP_INSN and see if we can improve it. */
for (insn = first; insn; insn = next)
{
- rtx_insn *other;
+ rtx_insn *other, *prior_insn;
bool crossing;
next = next_active_insn (insn);
@@ -3223,8 +3226,9 @@ relax_delay_slots (rtx_insn *first)
/* See if the first insn in the delay slot is redundant with some
previous insn. Remove it from the delay slot if so; then set up
to reprocess this insn. */
- if (redundant_insn (pat->insn (1), delay_insn, vNULL))
+ if ((prior_insn = redundant_insn (pat->insn (1), delay_insn, vNULL)))
{
+ fix_reg_dead_note (prior_insn, insn);
update_block (pat->insn (1), insn);
delete_from_delay_slot (pat->insn (1));
next = prev_active_insn (next);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index b93d19537bb..772a6a993bb 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2050,7 +2050,7 @@ dead_or_set_regno_p (const rtx_insn *insn, unsigned int test_regno)
if (GET_CODE (pattern) == COND_EXEC)
return 0;
- if (GET_CODE (pattern) == SET)
+ if (GET_CODE (pattern) == SET || GET_CODE (pattern) == CLOBBER)
return covers_regno_p (SET_DEST (pattern), test_regno);
else if (GET_CODE (pattern) == PARALLEL)
{
@@ -4976,7 +4976,7 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode, const_rtx known_x,
if (WORD_REGISTER_OPERATIONS
&& load_extend_op (inner_mode) == SIGN_EXTEND
&& paradoxical_subreg_p (x)
- && (MEM_P (SUBREG_REG (x)) || REG_P (SUBREG_REG (x))))
+ && MEM_P (SUBREG_REG (x)))
return cached_num_sign_bit_copies (SUBREG_REG (x), mode,
known_x, known_mode, known_ret);
break;
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 4c459e6587f..457b9fe9821 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2852,12 +2852,23 @@ sched_macro_fuse_insns (rtx_insn *insn)
return;
}
}
-
- if (single_set (insn) && single_set (prev))
+ else
{
- if (targetm.sched.macro_fusion_pair_p (prev, insn))
- SCHED_GROUP_P (insn) = 1;
+ rtx insn_set = single_set (insn);
+
+ if (!insn_set)
+ return;
+
+ prev = prev_nonnote_nondebug_insn (insn);
+ if (!prev
+ || !single_set (prev))
+ return;
+
}
+
+ if (targetm.sched.macro_fusion_pair_p (prev, insn))
+ SCHED_GROUP_P (insn) = 1;
+
}
/* Get the implicit reg pending clobbers for INSN and save them in TEMP. */
@@ -2916,6 +2927,8 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx_insn *insn)
= alloc_INSN_LIST (insn, deps->sched_before_next_jump);
/* Make sure epilogue insn is scheduled after preceding jumps. */
+ add_dependence_list (insn, deps->last_pending_memory_flush, 1,
+ REG_DEP_ANTI, true);
add_dependence_list (insn, deps->pending_jump_insns, 1, REG_DEP_ANTI,
true);
}
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index 35eb85ba63c..253be9d5273 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -1374,6 +1374,8 @@ spread_components (sbitmap components)
bitmap_clear_bit (seen, bb->index);
}
+ todo.release ();
+
/* Finally, mark everything not not needed both forwards and backwards. */
FOR_EACH_BB_FN (bb, cfun)
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 7cab26a0e34..a9f6720e18e 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3299,7 +3299,8 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
if (CONST_INT_P (trueop1)
&& exact_log2 (UINTVAL (trueop1)) > 0)
return simplify_gen_binary (AND, mode, op0,
- gen_int_mode (INTVAL (op1) - 1, mode));
+ gen_int_mode (UINTVAL (trueop1) - 1,
+ mode));
break;
case MOD:
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 10e9a324940..cfe876c1dc1 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1526,6 +1526,30 @@ place_field (record_layout_info rli, tree field)
= size_binop (PLUS_EXPR, rli->offset, DECL_SIZE_UNIT (field));
rli->bitpos = bitsize_zero_node;
rli->offset_align = MIN (rli->offset_align, desired_align);
+
+ if (!multiple_of_p (bitsizetype, DECL_SIZE (field),
+ bitsize_int (rli->offset_align)))
+ {
+ tree type = strip_array_types (TREE_TYPE (field));
+ /* The above adjusts offset_align just based on the start of the
+ field. The field might not have a size that is a multiple of
+ that offset_align though. If the field is an array of fixed
+ sized elements, assume there can be any multiple of those
+ sizes. If it is a variable length aggregate or array of
+ variable length aggregates, assume worst that the end is
+ just BITS_PER_UNIT aligned. */
+ if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
+ {
+ if (TREE_INT_CST_LOW (TYPE_SIZE (type)))
+ {
+ unsigned HOST_WIDE_INT sz
+ = least_bit_hwi (TREE_INT_CST_LOW (TYPE_SIZE (type)));
+ rli->offset_align = MIN (rli->offset_align, sz);
+ }
+ }
+ else
+ rli->offset_align = MIN (rli->offset_align, BITS_PER_UNIT);
+ }
}
else if (targetm.ms_bitfield_layout_p (rli->t))
{
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 342cc36f3af..c18f1b25199 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "ipa-utils.h"
#include "calls.h"
+#include "builtins.h"
static const char *ipa_ref_use_name[] = {"read","write","addr","alias","chkp"};
@@ -2279,3 +2280,58 @@ symtab_node::binds_to_current_def_p (symtab_node *ref)
return false;
}
+
+/* Return true if symbol should be output to the symbol table. */
+
+bool
+symtab_node::output_to_lto_symbol_table_p (void)
+{
+ /* Only externally visible symbols matter. */
+ if (!TREE_PUBLIC (decl))
+ return false;
+ if (!real_symbol_p ())
+ return false;
+ /* FIXME: variables probably should not be considered as real symbols at
+ first place. */
+ if (VAR_P (decl) && DECL_HARD_REGISTER (decl))
+ return false;
+ /* FIXME: Builtins corresponding to real functions probably should have
+ symbol table entries. */
+ if (is_builtin_fn (decl))
+ return false;
+
+ /* We have real symbol that should be in symbol table. However try to trim
+ down the refernces to libraries bit more because linker will otherwise
+ bring unnecesary object files into the final link.
+ FIXME: The following checks can easily be confused i.e. by self recursive
+ function or self-referring variable. */
+
+ /* We keep external functions in symtab for sake of inlining
+ and devirtualization. We do not want to see them in symbol table as
+ references unless they are really used. */
+ cgraph_node *cnode = dyn_cast <cgraph_node *> (this);
+ if (cnode && (!definition || DECL_EXTERNAL (decl))
+ && cnode->callers)
+ return true;
+
+ /* Ignore all references from external vars initializers - they are not really
+ part of the compilation unit until they are used by folding. Some symbols,
+ like references to external construction vtables can not be referred to at
+ all. We decide this at can_refer_decl_in_current_unit_p. */
+ if (!definition || DECL_EXTERNAL (decl))
+ {
+ int i;
+ struct ipa_ref *ref;
+ for (i = 0; iterate_referring (i, ref); i++)
+ {
+ if (ref->use == IPA_REF_ALIAS)
+ continue;
+ if (is_a <cgraph_node *> (ref->referring))
+ return true;
+ if (!DECL_EXTERNAL (ref->referring->decl))
+ return true;
+ }
+ return false;
+ }
+ return true;
+}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e4ea2377fbe..aafb8e1fc43 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,1077 @@
+2018-03-06 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline
+ 2/16/18 commit 257748 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/p9-vinsert4b-1.c: Remove test file for non-ABI
+ tests.
+ * gcc.target/powerpc/p9-vinsert4b-2.c: Remove test file for non-ABI
+ tests.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-23 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR testsuite/80551
+ * c-c++-common/tsan/race_on_mutex.c: Change regexp to allow
+ __GI___pthread_mutex_init as well.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-02-20 Martin Liska <mliska@suse.cz>
+
+ PR c/84310
+ PR target/79747
+ * gcc.target/i386/pr84310.c: New test.
+ * gcc.target/i386/pr84310-2.c: Likewise.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-23 Martin Liska <mliska@suse.cz>
+
+ PR lto/81440
+ * gcc.dg/lto/pr81440.h: New test.
+ * gcc.dg/lto/pr81440_0.c: New test.
+ * gcc.dg/lto/pr81440_1.c: New test.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-04-27 Martin Liska <mliska@suse.cz>
+
+ PR testsuite/79455
+ * c-c++-common/tsan/race_on_mutex.c: Make the scanned pattern
+ more generic.
+
+2018-03-06 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-30 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/83954
+ * gcc.dg/lto/pr83954.h: New testcase.
+ * gcc.dg/lto/pr83954_0.c: New testcase.
+ * gcc.dg/lto/pr83954_1.c: New testcase.
+
+2018-03-06 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/56667
+ * gfortran.dg/implied_do_2.f90: New test.
+ * gfortran.dg/coarray_8.f90: Update for new error message.
+
+2018-03-06 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-22 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/81572
+ * gcc.target/powerpc/pr81572.c: New.
+
+2018-03-06 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-02-28 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/84607
+ * gcc.dg/pr84607.c: New testcase.
+
+2018-03-05 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ Backport from trunk.
+
+ 2018-02-16 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ PR target/84371
+ * gcc.target/powerpc/builtins-3.c: Update dg-options and dg-skip-if
+ stanzas.
+ * gcc.target/powerpc/builtins-3.p8.c: Add dg-skip-if stanza.
+ * gcc.target/powerpc/builtins-3.p9.c: Add dg-skip-if stanza.
+
+2018-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84524
+ * gcc.c-torture/execute/pr84524.c: New test.
+ * gcc.target/i386/avx512bw-pr84524.c: New test.
+
+2018-03-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83076
+ * gfortran.dg/coarray_45.f90: New test.
+
+ PR fortran/83319
+ * gfortran.dg/coarray_46.f90: New test.
+
+2018-03-03 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/71085
+ * gfortran.dg/pr71085.f90: New test.
+
+2018-03-03 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/51434
+ * gfortran.dg/pr51434.f90: New test.
+
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/80965
+ * gfortran.dg/select_type_41.f90: New test.
+
+2018-03-03 Paul Thomas <pault@gcc.gnu.org>
+
+ Backported from trunk.
+ PR fortran/78990
+ * gfortran.dg/class_67.f90: New test.
+
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/84628
+ * gcc.dg/pr84628.c: New test.
+
+ PR inline-asm/84625
+ * gcc.target/i386/pr84625.c: New test.
+
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/70875
+ * gcc.dg/ubsan/bounds-3.c: Add -fno-sanitize-recover=bounds to
+ dg-options and dg-shouldfail "ubsan" directive.
+
+ 2018-02-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84558
+ * g++.dg/cpp1y/pr84558.C: New test.
+
+ PR c++/84557
+ * g++.dg/gomp/pr84557.C: New test.
+
+ PR c++/84556
+ * g++.dg/gomp/pr84556.C: New test.
+ * g++.dg/vect/pr84556.cc: New test.
+
+ 2018-02-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/84503
+ * gcc.dg/pr84503-1.c: New test.
+ * gcc.dg/pr84503-2.c: New test.
+
+ 2017-11-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/82916
+ * gcc.dg/pr82916.c: New test.
+
+ 2018-02-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84445
+ * g++.dg/cpp1z/launder7.C: New test.
+
+ PR c++/84449
+ * g++.dg/cpp0x/constexpr-84449.C: New test.
+
+ 2018-02-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84444
+ * g++.dg/cpp1z/launder8.C: New test.
+
+ PR c++/84448
+ * g++.dg/gomp/pr84448.C: New test.
+
+ PR c++/84430
+ * g++.dg/gomp/pr84430.C: New test.
+
+ 2018-02-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/84425
+ * gcc.c-torture/compile/pr84425.c: New test.
+
+ 2018-02-16 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84192
+ * g++.dg/cpp1y/constexpr-84192.C: New test.
+
+ 2018-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/82210
+ * gcc.c-torture/execute/pr82210.c: New test.
+
+ 2018-02-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84341
+ * c-c++-common/gomp/pr84341.c: New test.
+
+ 2018-02-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * g++.dg/ubsan/pr83987-2.C: New test.
+
+ 2018-02-09 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83659
+ * g++.dg/torture/pr83659.C: New test.
+
+ 2018-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84082
+ * g++.dg/template/incomplete11.C: New test.
+ * g++.dg/parse/crash67.C: Expect an incomplete type diagnostics too.
+
+ 2018-02-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/81661
+ PR tree-optimization/84117
+ * gcc.dg/pr81661.c: New test.
+ * gfortran.dg/pr84117.f90: New test.
+
+ 2018-01-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/84116
+ * gfortran.dg/gomp/pr84116.f90: New test.
+
+ PR c++/83993
+ * g++.dg/init/pr83993-2.C: New test.
+
+ PR preprocessor/69869
+ * gcc.dg/cpp/trad/pr69869.c: New test.
+
+ 2018-01-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/83986
+ * gcc.dg/pr83986.c: New test.
+
+ 2018-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84031
+ * g++.dg/cpp1z/decomp36.C: New test.
+
+ 2018-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83977
+ * c-c++-common/gomp/pr83977-1.c: New test.
+ * c-c++-common/gomp/pr83977-2.c: New test.
+ * c-c++-common/gomp/pr83977-3.c: New test.
+ * gfortran.dg/gomp/pr83977.f90: New test.
+
+ 2018-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * g++.dg/ubsan/pr83987.C: New test.
+
+ PR c++/83958
+ * g++.dg/cpp1z/decomp35.C: New test.
+
+ 2018-01-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/83945
+ * gcc.dg/tls/pr83945.c: New test.
+
+ PR target/83930
+ * gcc.dg/pr83930.c: New test.
+
+ 2018-01-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83824
+ * g++.dg/cpp0x/pr83824.C: New test.
+
+ 2018-01-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/83817
+ * g++.dg/cpp1y/pr83817.C: New test.
+
+ 2018-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/83605
+ * gcc.dg/pr83605.c: New test.
+
+2018-03-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84039
+ * gcc.target/i386/indirect-thunk-1.c: Updated.
+ * gcc.target/i386/indirect-thunk-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
+ * gcc.target/i386/ret-thunk-9.c: Likewise.
+ * gcc.target/i386/ret-thunk-10.c: Likewise.
+ * gcc.target/i386/ret-thunk-11.c: Likewise.
+ * gcc.target/i386/ret-thunk-12.c: Likewise.
+ * gcc.target/i386/ret-thunk-13.c: Likewise.
+ * gcc.target/i386/ret-thunk-14.c: Likewise.
+ * gcc.target/i386/ret-thunk-15.c: Likewise.
+
+2018-03-01 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-02-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84530
+ * gcc.target/i386/ret-thunk-22.c: New test.
+ * gcc.target/i386/ret-thunk-23.c: Likewise.
+ * gcc.target/i386/ret-thunk-24.c: Likewise.
+ * gcc.target/i386/ret-thunk-25.c: Likewise.
+ * gcc.target/i386/ret-thunk-26.c: Likewise.
+
+2017-03-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ Backport from trunk r256891:
+ 2018-01-19 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/83790
+ * gcc.target/nvptx/indirect_call.c: New test.
+
+2017-03-01 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2017-12-05 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
+ with follow-up r255433 commit.
+
+ * gcc.c-torture/unsorted/dump-noaddr.x: Generate dump files in
+ tmpdir.
+
+2018-02-28 Alan Modra <amodra@gmail.com>
+
+ * lib/prune.exp (prune_gcc_output): Match lower case "in function"
+ GNU ld message.
+ * g++.dg/other/anon5.C: Match lower case "bad value" GNU ld message.
+
+2018-02-26 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline: commit 257747 on 2018-02-16.
+
+ * gcc.target/powerpc/builtins-7-p9-runnable.c: New runnable test file
+ for the ABI definitions for vec_extract4b and vec_insert4b.
+
+2018-02-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20180226-1.c: New test.
+
+2018-02-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ ChangeLog for r257972
+ PR fortran/83633
+ * gfortran.dg/explicit_shape_1.f90: New test.
+ * gfortran.dg/automatic_module_variable.f90: Update regex.
+ * gfortran.dg/bad_automatic_objects_1.f90: Ditto.
+
+2018-02-25 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/78238
+ Backport from trunk
+ * gfortran.dg/select_type_40.f90: New test.
+
+2018-02-24 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/30792
+ * gfortran.dg/data_substring.f90: New test.
+
+2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84346
+ * gfortran.dg/statement_function_1.f90: Update test.
+
+2018-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/84506
+ * gfortran.dg/inquire_19.f90: New test.
+
+2018-02-22 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/81116
+ PR fortran/84495
+ * gfortran.dg/realloc_on_assignment_29.f90: New test.
+
+2017-02-22 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from mainline:
+ 2017-12-14 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/81228
+ * gcc.dg/pr81228.c: New.
+
+2018-02-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-01-02 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81860
+ * g++.dg/cpp0x/inh-ctor30.C: New test.
+
+2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/84412
+ * gfortran.dg/inquire_18.f90: New test.
+
+2018-02-17 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/84270
+ * gfortran.dg/inline_matmul_22.f90: New test.
+
+2018-02-16 Jozef Lawrynowicz <jozefl.gcc@gmail.com>
+
+ PR target/79242
+ gcc.target/msp430/pr79242.c: New test.
+
+2018-02-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/84277
+ * gnat.dg/array11.adb (Array11): Tweak index and remove warning.
+ * gnat.dg/dispatch1.adb: Rename into...
+ * gnat.dg/disp1.adb: ...this.
+ * gnat.dg/dispatch1_p.ads: Rename into...
+ * gnat.dg/disp1_pkg.ads: ...this.
+ * gnat.dg/disp2.adb: Rename into...
+ * gnat.dg/dispatch2.adb: ...this.
+ * gnat.dg/dispatch2_p.ads: Rename into...
+ * gnat.dg/disp2_pkg.ads: ...this.
+ * gnat.dg/dispatch2_p.adb: Rename into...
+ * gnat.dg/disp2_pkg.adb: this.
+ * gnat.dg/generic_dispatch.adb: Rename into...
+ * gnat.dg/generic_disp.adb: this.
+ * gnat.dg/generic_dispatch_p.ads: Rename into...
+ * gnat.dg/generic_disp_pkg.ads: ...this.
+ * gnat.dg/generic_dispatch_p.adb: Rename into...
+ * gnat.dg/generic_disp_pkg.adb: ...this.
+ * gnat.dg/null_pointer_deref1.adb (Null_Pointer_Deref1): Robustify.
+ * gnat.dg/null_pointer_deref2.adb (Null_Pointer_Deref2): Likewise.
+ * gnat.dg/object_overflow1.adb: Tweak index.
+ * gnat.dg/object_overflow2.adb: Likewise.
+ * gnat.dg/object_overflow3.adb: Likewise.
+ * gnat.dg/object_overflow4.adb: Likewise.
+ * gnat.dg/object_overflow5.adb: Likewise.
+
+2018-02-16 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from trunk
+ 2018-01-12 Sudakshina Das <sudi.das@arm.com>
+
+ * gcc.c-torture/compile/pr82096.c: Add dg-skip-if
+ directive.
+
+ Backport from trunk
+ 2018-01-10 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/82096
+ * gcc.c-torture/compile/pr82096.c: New test.
+
+2018-02-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84190
+ * g++.dg/torture/pr84190.C: New testcase.
+
+2018-02-15 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2018-02-07 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/84154
+ * gcc.target/powerpc/pr84154-1.c: New tests.
+ * gcc.target/powerpc/pr84154-2.c: Likewise.
+ * gcc.target/powerpc/pr84154-3.c: Likewise.
+
+2018-02-15 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ PR target/84388
+ * gcc.target/powerpc/fold-vec-mult-int128-p8.c: Update dg-options
+ and scan-assembler stanzas.
+ * gcc.target/powerpc/fold-vec-mult-int128-p9.c: Same.
+
+2018-02-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84390
+ * gcc.target/powerpc/vsxcopy.c: Also match lxv when compiling
+ with -mcpu=power9.
+
+2018-02-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ Back port from mainline
+ 2018-02-13 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84279
+ * g++.dg/pr84279.C: New test.
+
+2018-02-12 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/68560
+ * gfortran.dg/shape_9.f90: New test.
+
+2018-02-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/35299
+ ChangeLog for r257566
+ * gfortran.dg/statement_function_3.f: New test.
+
+2018-02-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/54223
+ PR fortran/84276
+ * gfortran.dg/statement_function_1.f90: New test.
+ * gfortran.dg/statement_function_2.f90: New test.
+
+2018-02-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ PR target/PR84295
+ * gcc.target/s390/pr84295.c: New test.
+
+2018-02-08 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-08 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * gcc.target/s390/nobp-function-pointer-attr.c: New test.
+ * gcc.target/s390/nobp-function-pointer-nothunk.c: New test.
+ * gcc.target/s390/nobp-function-pointer-z10.c: New test.
+ * gcc.target/s390/nobp-function-pointer-z900.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-attr.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-inline-attr.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-inline-z10.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-inline-z900.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-nothunk.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-z10.c: New test.
+ * gcc.target/s390/nobp-indirect-jump-z900.c: New test.
+ * gcc.target/s390/nobp-return-attr-all.c: New test.
+ * gcc.target/s390/nobp-return-attr-neg.c: New test.
+ * gcc.target/s390/nobp-return-mem-attr.c: New test.
+ * gcc.target/s390/nobp-return-mem-nothunk.c: New test.
+ * gcc.target/s390/nobp-return-mem-z10.c: New test.
+ * gcc.target/s390/nobp-return-mem-z900.c: New test.
+ * gcc.target/s390/nobp-return-reg-attr.c: New test.
+ * gcc.target/s390/nobp-return-reg-mixed.c: New test.
+ * gcc.target/s390/nobp-return-reg-nothunk.c: New test.
+ * gcc.target/s390/nobp-return-reg-z10.c: New test.
+ * gcc.target/s390/nobp-return-reg-z900.c: New test.
+ * gcc.target/s390/nobp-table-jump-inline-z10.c: New test.
+ * gcc.target/s390/nobp-table-jump-inline-z900.c: New test.
+ * gcc.target/s390/nobp-table-jump-z10.c: New test.
+ * gcc.target/s390/nobp-table-jump-z900.c: New test.
+
+2018-02-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/84233
+ * g++.dg/torture/pr84233.C: New testcase.
+
+2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/82994
+ * gfortran.dg/deallocate_error_3.f90: New test.
+ * gfortran.dg/deallocate_error_4.f90: New test.
+
+2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/82049
+ * gfortran.dg/assumed_charlen_parameter.f90: New test.
+
+2018-02-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-06 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/safe-indirect-jump-1.c: Detect deprecation
+ warning for -mno-speculate-indirect-jumps.
+ * gcc.target/powerpc/safe-indirect-jump-2.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-3.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-4.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-5.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-6.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-7.c: Likewise.
+
+2018-02-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR target/79975
+ * gcc.dg/rtl/x86_64/final.c: Add -fdwarf2-cfi-asm to dg-options.
+
+2017-02-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * gfortran.dg/dec_parameter_1.f (sub1): Remove statement with no effect.
+ * gfortran.dg/dec_parameter_2.f90 (sub1): Ditto.
+
+2018-02-01 Renlin Li <renlin.li@arm.com>
+
+ Backport from mainline
+ 2018-02-01 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR target/83370
+ * gcc.target/aarch64/pr83370.c: New.
+
+2018-02-01 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/82795
+ * gcc.target/i386/pr82795.c: New testcase.
+
+2018-02-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ Backport from mainline
+ 2018-01-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/target-supports.exp (check_effective_target_avx512f): Also
+ check for __builtin_ia32_addsd_round,
+ __builtin_ia32_getmantsd_round.
+ * gcc.target/i386/i386.exp (check_effective_target_avx512f):
+ Remove.
+
+2018-01-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20180131-1.c: New test.
+
+2018-01-29 Alan Modra <amodra@gmail.com>
+
+ PR target/84033
+ * gcc.target/powerpc/swaps-p8-46.c: New.
+
+2018-01-26 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from trunk
+ 2018-01-26 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * gcc.target/powerpc/safe-indirect-jump-1.c: Build on all targets.
+ Make expected output depend on whether we expect sibcalls or not.
+ * gcc.target/powerpc/safe-indirect-jump-8.c: Delete (merged into
+ safe-indirect-jump-1.c).
+
+ Backport from trunk
+ 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/83946
+ * gcc.target/powerpc/safe-indirect-jump-8.c: Skip for AIX.
+
+2018-01-26 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/82878
+ * g++.dg/cpp0x/pr82878.C: New.
+ * g++.dg/cpp1z/inh-ctor38.C: Check moves too.
+
+2018-01-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/83985
+ * gcc.dg/pr83985.c: New test.
+
+2018-01-25 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2018-01-22 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/83862
+ * gcc.target/powerpc/pr83862.c: New test.
+
+2018-01-25 Peter Bergner <bergner@vnet.ibm.com>
+
+ Back port from mainline
+ 2018-01-10 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/83399
+ * gcc.target/powerpc/pr83399.c: New test.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+ David Edelsohn <dje.gcc@gmail.com>
+
+ PR target/83946
+ * gcc.target/powerpc/safe-indirect-jump-1.c: Change expected
+ assembly output from "crset eq" to "crset 2".
+ * gcc.target/powerpc/safe-indirect-jump-2.c: Change expected
+ assembly output from . to $.
+ * gcc.target/powerpc/safe-indirect-jump-3.c: Likewise.
+ * gcc.target/powerpc/safe-indirect-jump-1.c: Change expected
+ assembly output from "crset eq" to "crset 2".
+ * gcc.target/powerpc/safe-indirect-jump-8.c: Change expected
+ assembly output from "crset eq" to "crset 2", and from . to $.
+
+2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83900
+ * gfortran.dg/matmul_18.f90: New test.
+
+2018-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83900
+ * gfortran.dg/matmul_17.f90: New test.
+
+2018-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/80768
+ * gfortran.dg/num_images_1.f90: New test that tests fix in r250734.
+
+2018-01-18 Harald Anlauf <anlauf@gmx.de>
+
+ Backport from mainline
+ PR fortran/83864
+ * gfortran.dg/pr83864.f90: New test.
+
+2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-01-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/safe-indirect-jump-1.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-2.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-3.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-4.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-5.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-6.c: New file.
+
+ Backport from mainline
+ 2018-01-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/safe-indirect-jump-1.c: Remove endian
+ restriction, but still restrict to 64-bit.
+ * gcc.target/powerpc/safe-indirect-jump-7.c: New file.
+ * gcc.target/powerpc/safe-indirect-jump-8.c: New file.
+
+2018-01-17 Harald Anlauf <anlauf@gmx.de>
+
+ Backport from mainline
+ PR fortran/83874
+ * gfortran.dg/pr83874.f90: New test.
+
+2018-01-17 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-12-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/81877
+ * g++.dg/torture/pr81877.C: New testcase.
+ * g++.dg/vect/pr70729.cc: XFAIL.
+ * g++.dg/vect/pr70729-nest.cc: XFAIL.
+
+ 2017-12-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81782
+ * gcc.dg/uninit-pr81782.c: New testcase.
+
+2018-01-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-01-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/83687
+ * gcc.target/arm/neon-combine-sub-abs-into-vabd.c: Delete integer
+ tests.
+ * gcc.target/arm/pr83687.c: New test.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/82352
+ * g++.dg/ipa/pr82352.C (size_t): Define to __SIZE_TYPE__ instead of
+ long unsigned int.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-04 Martin Liska <mliska@suse.cz>
+
+ PR ipa/82352
+ * g++.dg/ipa/pr82352.C: New test.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-03 Martin Liska <mliska@suse.cz>
+
+ PR ipa/83549
+ * g++.dg/ipa/pr83549.C: New test.
+
+2018-01-17 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-12-27 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/83552
+ * gcc.dg/pr83552.c: New test.
+
+2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR testsuite/77734
+ * gcc.dg/plugin/must-tail-call-1.c: Pass -fdelayed-branch on SPARC.
+
+2018-01-16 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2017-12-18 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/83424
+ * gcc.dg/pr83424.c: New testsuite.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/indirect-thunk-10.c: New test.
+ * gcc.target/i386/indirect-thunk-8.c: Likewise.
+ * gcc.target/i386/indirect-thunk-9.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-10.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-11.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-9.c: Likewise.
+ * gcc.target/i386/ret-thunk-17.c: Likewise.
+ * gcc.target/i386/ret-thunk-18.c: Likewise.
+ * gcc.target/i386/ret-thunk-19.c: Likewise.
+ * gcc.target/i386/ret-thunk-20.c: Likewise.
+ * gcc.target/i386/ret-thunk-21.c: Likewise.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/indirect-thunk-register-4.c: New test.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/indirect-thunk-1.c (dg-options): Add
+ -mno-indirect-branch-register.
+ * gcc.target/i386/indirect-thunk-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
+ * gcc.target/i386/ret-thunk-10.c: Likewise.
+ * gcc.target/i386/ret-thunk-11.c: Likewise.
+ * gcc.target/i386/ret-thunk-12.c: Likewise.
+ * gcc.target/i386/ret-thunk-13.c: Likewise.
+ * gcc.target/i386/ret-thunk-14.c: Likewise.
+ * gcc.target/i386/ret-thunk-15.c: Likewise.
+ * gcc.target/i386/ret-thunk-9.c: Likewise.
+ * gcc.target/i386/indirect-thunk-register-1.c: New test.
+ * gcc.target/i386/indirect-thunk-register-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-register-3.c: Likewise.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/83839
+ * gcc.target/i386/indirect-thunk-1.c: Scan for "push" only on
+ Linux.
+ * gcc.target/i386/indirect-thunk-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-register-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-register-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-register-4.c: Likewise.
+ * gcc.target/i386/ret-thunk-10.c: Likewise.
+ * gcc.target/i386/ret-thunk-11.c: Likewise.
+ * gcc.target/i386/ret-thunk-12.c: Likewise.
+ * gcc.target/i386/ret-thunk-13.c: Likewise.
+ * gcc.target/i386/ret-thunk-14.c: Likewise.
+ * gcc.target/i386/ret-thunk-15.c: Likewise.
+ * gcc.target/i386/ret-thunk-9.c: Don't check the
+ __x86_return_thunk label.
+ Scan for "push" only for Linux.
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/indirect-thunk-1.c (dg-options): Add
+ -mfunction-return=keep.
+ * gcc.target/i386/indirect-thunk-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
+ * gcc.target/i386/ret-thunk-1.c: New test.
+ * gcc.target/i386/ret-thunk-10.c: Likewise.
+ * gcc.target/i386/ret-thunk-11.c: Likewise.
+ * gcc.target/i386/ret-thunk-12.c: Likewise.
+ * gcc.target/i386/ret-thunk-13.c: Likewise.
+ * gcc.target/i386/ret-thunk-14.c: Likewise.
+ * gcc.target/i386/ret-thunk-15.c: Likewise.
+ * gcc.target/i386/ret-thunk-16.c: Likewise.
+ * gcc.target/i386/ret-thunk-2.c: Likewise.
+ * gcc.target/i386/ret-thunk-3.c: Likewise.
+ * gcc.target/i386/ret-thunk-4.c: Likewise.
+ * gcc.target/i386/ret-thunk-5.c: Likewise.
+ * gcc.target/i386/ret-thunk-6.c: Likewise.
+ * gcc.target/i386/ret-thunk-7.c: Likewise.
+ * gcc.target/i386/ret-thunk-8.c: Likewise.
+ * gcc.target/i386/ret-thunk-9.c: Likewise.
+
+2018-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/indirect-thunk-1.c: New test.
+ * gcc.target/i386/indirect-thunk-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-attr-8.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-extern-7.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-1.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-2.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-3.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-4.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-6.c: Likewise.
+ * gcc.target/i386/indirect-thunk-inline-7.c: Likewise.
+
+2018-01-16 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2017-09-29 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR target/81481
+ * gcc.target/i386/pr81481.c: New.
+
+2018-01-15 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2018-01-10 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/83629
+ * gcc.target/powerpc/pr83629.c: New testcase.
+
+ 2018-01-12 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/83629
+ * gcc.target/powerpc/pr83629.c: Require ilp32.
+
+2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ PR target/83330
+ * gcc.target/i386/pr83330.c: New test.
+
2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
@@ -553,7 +1627,7 @@
Backported from trunk
PR fortran/80850
- * gfortran.dg/class_64_f90 : New test.
+ * gfortran.dg/class_64_f90: New test.
2017-10-30 Paolo Carlini <paolo.carlini@oracle.com>
@@ -604,7 +1678,7 @@
Backport from trunk
PR fortran/82312
- * gfortran.dg/typebound_proc_36.f90 : New test.
+ * gfortran.dg/typebound_proc_36.f90: New test.
2017-10-20 Thomas Koenig <tkoenig@gcc.gnu.org>
diff --git a/gcc/testsuite/c-c++-common/gomp/pr83977-1.c b/gcc/testsuite/c-c++-common/gomp/pr83977-1.c
new file mode 100644
index 00000000000..9941db49469
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr83977-1.c
@@ -0,0 +1,19 @@
+/* PR middle-end/83977 */
+/* { dg-do compile } */
+/* { dg-additional-options "-O2" } */
+
+struct S { int a, b, c; };
+
+#pragma omp declare simd uniform(z) linear(v:1)
+__attribute__((noinline)) static int
+foo (int x, int y, struct S z, int u, int v)
+{
+ return x + y + z.a;
+}
+
+int
+bar (int x, int y, int z)
+{
+ struct S s = { z, 1, 1 };
+ return foo (x, y, s, 0, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr83977-2.c b/gcc/testsuite/c-c++-common/gomp/pr83977-2.c
new file mode 100644
index 00000000000..c3359b9f05e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr83977-2.c
@@ -0,0 +1,18 @@
+/* PR middle-end/83977 */
+/* { dg-do compile } */
+
+void bar (void);
+
+#pragma omp declare simd uniform (b) linear(a:b)
+int
+foo (int a, int b)
+{
+ a = a + 1;
+/* This function can't be called from simd loops,
+ because it violates declare simd restrictions.
+ We shouldn't ICE on it though, nor attempt to generate
+ simd clones for the *omp_fn* functions. */
+ #pragma omp parallel
+ bar ();
+ return a;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr83977-3.c b/gcc/testsuite/c-c++-common/gomp/pr83977-3.c
new file mode 100644
index 00000000000..00e18d85b37
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr83977-3.c
@@ -0,0 +1,21 @@
+/* PR middle-end/83977 */
+/* { dg-do compile } */
+
+void bar (void);
+int foo (int, int) __attribute__((used));
+
+#pragma omp declare simd uniform (b) linear(a:b)
+int
+foo (int a, int b)
+{
+ a = a + 1;
+/* This function can't be called from simd loops,
+ because it violates declare simd restrictions.
+ We shouldn't ICE on it though, nor attempt to generate
+ simd clones for the *omp_fn* functions. */
+ #pragma omp parallel
+ bar ();
+ return a;
+}
+
+int foo (int, int) __attribute__((unused));
diff --git a/gcc/testsuite/c-c++-common/gomp/pr84341.c b/gcc/testsuite/c-c++-common/gomp/pr84341.c
new file mode 100644
index 00000000000..557f1ba21bd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr84341.c
@@ -0,0 +1,10 @@
+/* PR c++/84341 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (int i)
+{
+ #pragma omp atomic
+ i = &i + 1; /* { dg-error "invalid form of" } */
+}
diff --git a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
index ae30d053c92..2e4b7ac3cb9 100644
--- a/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
+++ b/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c
@@ -37,9 +37,10 @@ int main() {
}
/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
-/* { dg-output " Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */
+/* { dg-output " Atomic read of size \[0-9]\+ at .* by thread T2:(\n|\r\n|\r)" } */
/* { dg-output " #0 pthread_mutex_lock.*" } */
/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:22|\\?{2}:0) (.*)" } */
-/* { dg-output " Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */
-/* { dg-output " #0 pthread_mutex_init .* (.)*" } */
-/* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
+/* { dg-output " Previous write of size \[0-9]\+ at .* by thread T1:(\n|\r\n|\r)" } */
+/* { dg-output "( #0 \[^\n\r\]*(\n|\r\n|\r))?" } */
+/* { dg-output " #\[01\] ((__GI_)?__)?pthread_mutex_init \[^\n\r\]* (.)*" } */
+/* { dg-output " #\[12\] Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-84449.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-84449.C
new file mode 100644
index 00000000000..f187c425272
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-84449.C
@@ -0,0 +1,14 @@
+// PR c++/84449
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ constexpr A (int) {}
+ ~A () = delete;
+};
+
+struct B
+{
+ A a;
+ constexpr B () : a (0) {} // { dg-error "use of deleted function" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor21.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor21.C
new file mode 100644
index 00000000000..4bf57b9e897
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor21.C
@@ -0,0 +1,15 @@
+// PR c++/83835
+// { dg-do compile { target c++11 } }
+
+struct Z
+{
+ void const * p_;
+ constexpr Z( void const * p ): p_( p ) {}
+ ~Z();
+};
+
+struct Y
+{
+ Z z_;
+ constexpr Y() noexcept: z_( this ) {}
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-list2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-list2.C
new file mode 100644
index 00000000000..780a64dbbc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-list2.C
@@ -0,0 +1,20 @@
+// PR c++/82461
+// { dg-do compile { target c++11 } }
+
+class A {
+private:
+public:
+ constexpr A() {}
+ ~A() {}
+};
+
+class B {
+private:
+ A a;
+public:
+ constexpr B() : a{} {}
+// works
+// constexpr B() : a() {}
+
+ ~B() {}
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C b/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C
index fbbc6a14972..4a8f053234e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-33837.C
@@ -2,6 +2,6 @@
// PR c++/33837
void foo()
{
- __decltype (A::foo()); // { dg-error "was not declared|expected" }
- __decltype (B); // { dg-error "was not declared" }
+ __decltype (A::foo()); // { dg-error "A" }
+ __decltype (B); // { dg-error "B" }
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype43.C b/gcc/testsuite/g++.dg/cpp0x/decltype43.C
index 4df95a1047c..7a1dcbf8744 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype43.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype43.C
@@ -22,6 +22,6 @@ struct B
int main()
{
int x = B<decltype(A<int>::a(1))>::b(A<int>::a(1));
- int y = B<decltype(A ::a(2))>::b(A<int>::a(2)); // { dg-error "template argument" }
+ int y = B<decltype(A ::a(2))>::b(A<int>::a(2)); // { dg-error "template" }
return x + y;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/elision3.C b/gcc/testsuite/g++.dg/cpp0x/elision3.C
new file mode 100644
index 00000000000..7c5c8b9f0b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/elision3.C
@@ -0,0 +1,21 @@
+// PR c++/84441
+// { dg-do compile { target c++11 } }
+
+struct B {
+ int *b;
+};
+struct A {
+ B b;
+ A (A &&);
+};
+struct C {
+ A c;
+ int d;
+};
+C bar ();
+struct D : C {
+ D ()
+ : C (0 ? bar () : bar ())
+ {}
+};
+D d;
diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C
new file mode 100644
index 00000000000..636bf1afd88
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C
@@ -0,0 +1,10 @@
+// PR c++/84489
+// { dg-do compile { target c++11 } }
+
+template <class T = int, T N = T(), bool B = (N >> 1)>
+T f1() {return 0;}
+
+int main()
+{
+ f1(); // Bug here
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor30.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor30.C
new file mode 100644
index 00000000000..04c58636d8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor30.C
@@ -0,0 +1,27 @@
+// PR c++/81860
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler "_ZN1AIjEC\[12\]Ev" } }
+
+template <typename T>
+struct A
+{
+ A() {}
+};
+
+struct B
+{
+ template <typename D>
+ B(D, const A<unsigned>& a = A<unsigned>()) : a(a) {}
+
+ A<unsigned> a;
+};
+
+struct C : B
+{
+ using B::B;
+};
+
+int main()
+{
+ C c(0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist98.C b/gcc/testsuite/g++.dg/cpp0x/initlist98.C
new file mode 100644
index 00000000000..4f2fcd20219
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist98.C
@@ -0,0 +1,17 @@
+// PR c++/83227
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+template <typename d> struct f {
+ f(std::initializer_list<d>) {}
+};
+
+struct h {};
+struct i : h {
+ i();
+};
+void foo(f<h>);
+int main() {
+ foo({i{}});
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle5.C
new file mode 100644
index 00000000000..dd95894755c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mangle5.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+// { dg-final { scan-assembler "_ZZN1AIiEC4IiEET_S2_Ed_NKUlvE_clEv" } }
+
+template <class T> struct A
+{
+ template <class U>
+ A(U, U = []{ return 42; }());
+};
+
+struct B: A<int>
+{
+ using A::A;
+};
+
+B b(24);
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept32.C b/gcc/testsuite/g++.dg/cpp0x/noexcept32.C
new file mode 100644
index 00000000000..9a435049599
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept32.C
@@ -0,0 +1,14 @@
+// PR c++/84045
+// { dg-do compile { target c++11 } }
+
+template <typename T> struct K {
+ static const bool d = true;
+};
+template <typename T, typename> struct B {
+ typedef K<T> D;
+ void foo () noexcept (D::d);
+};
+template <typename T> struct P {
+ P () noexcept (K<T>::d);
+};
+P<int> p;
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-empty1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-empty1.C
new file mode 100644
index 00000000000..66d94e53824
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-empty1.C
@@ -0,0 +1,18 @@
+// PR c++/82764
+// { dg-do compile { target c++11 } }
+
+struct Empty {};
+struct Empty2 : Empty {};
+
+struct A : Empty2
+{
+ int x {1};
+ int y {2};
+};
+
+struct B
+{
+ A a {};
+};
+
+B b;
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr82878.C b/gcc/testsuite/g++.dg/cpp0x/pr82878.C
new file mode 100644
index 00000000000..c75e93b56c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr82878.C
@@ -0,0 +1,20 @@
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-O" }
+// pr 82878 erroneously unwrapped a reference parm in the lambda::_FUN
+// thunk.
+
+struct A {
+ ~A();
+ operator int ();
+};
+
+void baz ();
+
+void
+bar (A b)
+{
+ void (*lam) (A) = [](A) { baz (); };
+
+ if (auto c = b)
+ lam (c);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr83824.C b/gcc/testsuite/g++.dg/cpp0x/pr83824.C
new file mode 100644
index 00000000000..9474e1ebb25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr83824.C
@@ -0,0 +1,9 @@
+// PR c++/83824
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ if (alignas(1 alignas(1))) // { dg-error "expected" }
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual18.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual18.C
new file mode 100644
index 00000000000..aaa00b9cfc3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual18.C
@@ -0,0 +1,18 @@
+// PR c++/71784
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct A {
+ template<typename U> void f(U const&) & { }
+ template<typename U> void f(U const&) && { }
+};
+
+template void A<int>::f<int>(int const&) &;
+template void A<float>::f<int>(int const&) &&;
+
+template<typename T> struct B {
+ void f(int const&) & { }
+ void f(int const&) && { }
+};
+
+template void B<int>::f(int const&) &;
+template void B<float>::f(int const&) &&;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic171.C b/gcc/testsuite/g++.dg/cpp0x/variadic171.C
new file mode 100644
index 00000000000..1e268141d6d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic171.C
@@ -0,0 +1,12 @@
+// PR c++/81843
+// { dg-do compile { target c++11 } }
+
+template < typename > struct A;
+template < typename, typename > struct B;
+template < typename ... S > struct C
+{
+ template < typename > struct D {};
+ template < typename ... T > struct D < A < B < S, T > ... > >;
+};
+
+C <>::D < A < B < int, int > > > c;
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C
new file mode 100644
index 00000000000..ad9458d238f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C
@@ -0,0 +1,41 @@
+// PR c++/84192
+// { dg-do compile { target c++14 } }
+// { dg-options "" }
+
+bool
+f1 ()
+{
+ return ({ return true; }) && false; // { dg-error "could not convert" }
+}
+
+void
+f2 ()
+{
+ for (;;)
+ constexpr bool b = ({ break; false; }) && false; // { dg-error "statement is not a constant expression" }
+}
+
+constexpr bool
+f3 (int n)
+{
+ bool b = false;
+ for (int i = 0; i < n; i++)
+ b = ({ break; }); // { dg-error "void value not ignored as it ought to be" }
+ return b;
+}
+
+constexpr bool b = f3 (4);
+
+bool
+f4 ()
+{
+ constexpr bool b = ({ return true; }) && false; // { dg-error "could not convert" }
+ return false;
+}
+
+constexpr bool
+f5 (int x)
+{
+ constexpr bool b = ({ switch (x) case 0: true; }) && false; // { dg-error "could not convert" }
+ return false;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nsdmi1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nsdmi1.C
new file mode 100644
index 00000000000..89ce519d812
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nsdmi1.C
@@ -0,0 +1,8 @@
+// PR c++/84520
+// { dg-do compile { target c++14 } }
+
+struct A
+{
+ static void foo(int);
+ void (*f)(int) = [](auto i) { foo(i); };
+};
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr83817.C b/gcc/testsuite/g++.dg/cpp1y/pr83817.C
new file mode 100644
index 00000000000..9a69cbb201c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr83817.C
@@ -0,0 +1,17 @@
+// PR c++/83817
+// { dg-do compile { target c++14 } }
+
+struct A;
+struct B { template <typename> using C = A; };
+struct D : B { struct F { typedef C<char> E; }; };
+struct G {
+ struct I { I (D, A &); } h;
+ D::F::E &k ();
+ D j;
+ G (G &&) : h (j, k ()) {}
+};
+struct N { G l; };
+typedef N (*M)(N &);
+struct H { const char *o; M s; };
+N foo (N &);
+H r { "", [](auto &x) { return foo (x); }};
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84496.C b/gcc/testsuite/g++.dg/cpp1y/pr84496.C
new file mode 100644
index 00000000000..028d00235cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr84496.C
@@ -0,0 +1,44 @@
+// PR c++/84496
+// { dg-do compile { target c++14 } }
+
+template <typename T, T n> struct C { static constexpr T D = n; };
+struct E : C<bool, false> {};
+template <typename> struct F : C<bool, false> {};
+template <typename T> T foo ();
+template <typename> struct H { typedef int G; };
+template <typename> class I;
+struct L;
+template <typename, typename> struct J;
+template <bool, bool, typename...> struct K;
+struct R {
+ template <typename M, typename... N>
+ static J<decltype (foo<M> () (foo<N>...)), L> o;
+};
+template <typename P, typename... Q> struct K<false, false, P, Q...> : R {
+ typedef decltype (o<P, Q...>) G;
+};
+template <typename P, typename... Q>
+struct D : K<E::D, F<typename H<P>::G>::D, P, Q...> {};
+template <typename P, typename... Q> struct I<P (Q...)> : D<P, Q...> {};
+template <typename> class function;
+template <typename S, typename... Q> struct function<S (Q...)> {
+ template <typename T, typename = typename I<T (Q...)>::G> struct C;
+ template <typename, typename> using U = int;
+ template <typename P, typename = U<int, void>, typename = U<C<P>, void>>
+ function (P);
+};
+template <typename S, typename... Q>
+template <typename P, typename, typename>
+function<S (Q...)>::function (P)
+{
+}
+void bar (function<void (int)>);
+
+void
+baz ()
+{
+ auto a = [] {
+ static int counter;
+ bar ([] (auto) { counter++; });
+ };
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84558.C b/gcc/testsuite/g++.dg/cpp1y/pr84558.C
new file mode 100644
index 00000000000..40d7ef68561
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr84558.C
@@ -0,0 +1,6 @@
+// PR c++/84558
+// { dg-do compile { target c++14 } }
+
+struct A { static int i; constexpr A () { i = 0; } };
+struct B { A a[2][3][4]; };
+B b;
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ58.C b/gcc/testsuite/g++.dg/cpp1y/var-templ58.C
new file mode 100644
index 00000000000..f9095f61e67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ58.C
@@ -0,0 +1,12 @@
+// PR c++/71569
+// { dg-do compile { target c++14 } }
+
+template <class T>
+struct A {
+ template <class U>
+ static const U u;
+};
+
+template <class T>
+template <class U>
+const U A<T>::u<U> = 0; // { dg-error "does not specialize" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ58a.C b/gcc/testsuite/g++.dg/cpp1y/var-templ58a.C
new file mode 100644
index 00000000000..850a2c9689c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ58a.C
@@ -0,0 +1,14 @@
+// PR c++/71569
+// { dg-do compile { target c++14 } }
+
+template <class T>
+struct A {
+ template <class U>
+ static const U u;
+};
+
+template <class T>
+template <class U>
+const U* A<T>::u<U*> = 0;
+
+const int *p = A<char>::u<int*>;
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ59.C b/gcc/testsuite/g++.dg/cpp1y/var-templ59.C
new file mode 100644
index 00000000000..da9710e1ce4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ59.C
@@ -0,0 +1,14 @@
+// PR c++/71569
+// { dg-do compile { target c++14 } }
+
+template <class T>
+struct A {
+ template <class U>
+ static U u;
+};
+
+int main()
+{
+ decltype(A<int>::u) a; // { dg-error "missing template arguments" }
+ return a;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new8.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new8.C
new file mode 100644
index 00000000000..11dd45722b7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new8.C
@@ -0,0 +1,19 @@
+// PR c++/82760
+// { dg-options -std=c++17 }
+// { dg-do run }
+
+#include <new>
+#include <cstddef>
+
+struct alignas(2 * alignof (std::max_align_t)) aligned_foo {
+ char x[2048];
+
+ ~aligned_foo() { }
+ aligned_foo() { __builtin_memset(x, 0, sizeof(x)); }
+};
+
+int main()
+{
+ aligned_foo * gFoo = new (std::nothrow) aligned_foo[2];
+ delete[] gFoo;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C
new file mode 100644
index 00000000000..086f12ad3c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C
@@ -0,0 +1,15 @@
+// PR c++/84015
+// { dg-additional-options -std=c++17 }
+
+template <int I>
+struct A { };
+
+template <int I>
+struct B
+{
+ template<template<auto>class T>
+ B(T<I>);
+};
+
+A<42> a;
+B b (a);
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-84684.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-84684.C
new file mode 100644
index 00000000000..0e7912d4067
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-84684.C
@@ -0,0 +1,163 @@
+// PR c++/84684
+// { dg-options -std=c++17 }
+
+typedef decltype (sizeof (0)) size_t;
+
+namespace std {
+ template<class _E>
+ struct initializer_list
+ {
+ typedef _E value_type;
+ typedef const _E& reference;
+ typedef const _E& const_reference;
+ typedef size_t size_type;
+ typedef const _E* iterator;
+ typedef const _E* const_iterator;
+ iterator _M_array;
+ size_type _M_len;
+ constexpr initializer_list(const_iterator __a, size_type __l) : _M_array(__a), _M_len(__l) { }
+ constexpr initializer_list() noexcept : _M_array(0), _M_len(0) { }
+ constexpr size_type size() const noexcept { return _M_len; }
+ constexpr const_iterator begin() const noexcept { return _M_array; }
+ constexpr const_iterator end() const noexcept { return begin() + size(); }
+ };
+}
+
+template <typename E, size_t N>
+struct array
+{
+ constexpr E &operator[](size_t n) noexcept { return elems[n]; }
+ constexpr const E &operator[](size_t n) const noexcept { return elems[n]; }
+ constexpr size_t size() const { return N; }
+ E elems[N];
+};
+
+template<typename T>
+constexpr
+inline T
+max (std::initializer_list<T> i)
+{
+ const T *b = i.begin ();
+ const T *e = i.end ();
+ if (b == e) return *b;
+ const T *r = b;
+ while (++b != e)
+ if (*r < *b)
+ r = b;
+ return *r;
+}
+
+template <typename alphabet_type>
+constexpr char to_char(alphabet_type const alph)
+{
+ return alph.to_char();
+}
+
+template <typename ...alphabet_types>
+struct union_composition
+{
+ static constexpr size_t value_size = (alphabet_types::value_size + ... );
+ unsigned char _value;
+ template <size_t fixed_size, typename alphabet_t>
+ static constexpr auto value_to_char_helper(alphabet_t alphabet)
+ {
+ array<char, fixed_size> value_to_char{};
+ for (size_t i = 0u; i < alphabet_t::value_size; ++i)
+ value_to_char[i] = to_char(alphabet.assign_rank(i));
+ return value_to_char;
+ }
+
+ static constexpr auto make_value_to_char()
+ {
+ constexpr auto N = sizeof...(alphabet_types);
+ constexpr array<size_t, N> alphabet_sizes { alphabet_types::value_size... };
+ constexpr size_t fixed_size = max({alphabet_types::value_size...});
+ array value_to_char_tables = array<array<char, fixed_size>, N> {
+ value_to_char_helper<fixed_size>(alphabet_types{})...
+ };
+ array<char, value_size> value_to_char{};
+ for (size_t i = 0u, value = 0u; i < N; ++i)
+ for (size_t k = 0u; k < alphabet_sizes[i]; ++k, ++value)
+ value_to_char[value] = value_to_char_tables[i][k];
+ return value_to_char;
+ }
+};
+
+struct gap
+{
+ constexpr char to_char() const noexcept { return '-'; }
+ constexpr gap & assign_rank([[maybe_unused]] bool const i) noexcept { return *this; }
+ static constexpr size_t value_size{1};
+};
+
+struct dna4
+{
+ constexpr char to_char() const noexcept { return value_to_char[_value]; }
+ constexpr dna4 & assign_rank(unsigned char const c) { _value = c; return *this; }
+ static constexpr size_t value_size{4};
+ static constexpr char value_to_char[value_size] { 'A', 'C', 'G', 'T' };
+ unsigned char _value;
+};
+
+struct dna5
+{
+ constexpr char to_char() const noexcept { return value_to_char[_value]; }
+ constexpr dna5 & assign_rank(unsigned char const c) { _value = c; return *this; }
+ static constexpr size_t value_size{5};
+ static constexpr char value_to_char[value_size] { 'A', 'C', 'G', 'T', 'N' };
+ unsigned char _value;
+};
+
+constexpr array value_to_char1 = union_composition<dna4>::make_value_to_char();
+static_assert(value_to_char1.size() == 4u);
+static_assert(value_to_char1[0] == 'A');
+static_assert(value_to_char1[1] == 'C');
+static_assert(value_to_char1[2] == 'G');
+static_assert(value_to_char1[3] == 'T');
+
+constexpr array value_to_char2 = union_composition<dna4, gap>::make_value_to_char();
+static_assert(value_to_char2.size() == 5u);
+static_assert(value_to_char2[0] == 'A');
+static_assert(value_to_char2[1] == 'C');
+static_assert(value_to_char2[2] == 'G');
+static_assert(value_to_char2[3] == 'T');
+static_assert(value_to_char2[4] == '-');
+
+constexpr array value_to_char3 = union_composition<dna4, gap, dna5>::make_value_to_char();
+static_assert(value_to_char3.size() == 10u);
+static_assert(value_to_char3[0] == 'A');
+static_assert(value_to_char3[1] == 'C');
+static_assert(value_to_char3[2] == 'G');
+static_assert(value_to_char3[3] == 'T');
+static_assert(value_to_char3[4] == '-');
+static_assert(value_to_char3[5] == 'A');
+static_assert(value_to_char3[6] == 'C');
+static_assert(value_to_char3[7] == 'G');
+static_assert(value_to_char3[8] == 'T');
+static_assert(value_to_char3[9] == 'N');
+
+constexpr array value_to_char4 = union_composition<dna5, gap, dna4>::make_value_to_char();
+static_assert(value_to_char4.size() == 10u);
+static_assert(value_to_char4[0] == 'A');
+static_assert(value_to_char4[1] == 'C');
+static_assert(value_to_char4[2] == 'G');
+static_assert(value_to_char4[3] == 'T');
+static_assert(value_to_char4[4] == 'N');
+static_assert(value_to_char4[5] == '-');
+static_assert(value_to_char4[6] == 'A');
+static_assert(value_to_char4[7] == 'C');
+static_assert(value_to_char4[8] == 'G');
+static_assert(value_to_char4[9] == 'T');
+
+constexpr array value_to_char5 = union_composition<gap, dna4, dna5>::make_value_to_char();
+static_assert(value_to_char5.size() == 10u);
+static_assert(value_to_char5[0] == '-');
+static_assert(value_to_char5[1] == 'A');
+static_assert(value_to_char5[2] == 'C');
+static_assert(value_to_char5[3] == 'G');
+static_assert(value_to_char5[4] == 'T');
+static_assert(value_to_char5[5] == 'A');
+static_assert(value_to_char5[6] == 'C');
+static_assert(value_to_char5[7] == 'G');
+static_assert(value_to_char5[8] == 'T');
+static_assert(value_to_char5[9] == 'N');
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp-lambda1.C b/gcc/testsuite/g++.dg/cpp1z/decomp-lambda1.C
new file mode 100644
index 00000000000..fbab0259643
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp-lambda1.C
@@ -0,0 +1,10 @@
+// PR c++/84420
+// { dg-additional-options -std=c++17 }
+
+int main(){
+ int a[1]{};
+ [&a]{
+ auto [v] = a;
+ (void)v;
+ }();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp35.C b/gcc/testsuite/g++.dg/cpp1z/decomp35.C
new file mode 100644
index 00000000000..844ad43e141
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp35.C
@@ -0,0 +1,35 @@
+// PR c++/83958
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <typename = void> struct A;
+class B;
+template <typename, typename, typename = A<>> class C;
+template <typename, typename> struct D;
+template <typename T, typename U, typename V, typename, typename, typename W>
+struct E {
+ using X = W;
+ X operator* ();
+ T operator++ ();
+ template <typename P, typename R, typename S, typename Q>
+ bool operator!= (E<P, U, V, R, S, Q>);
+};
+template <typename T, typename U, typename>
+struct F {
+ class G;
+ using H = D<T, U>;
+ using I = E<G, T, U, G, H, H &>;
+ class G : public I {};
+ G begin ();
+ G end ();
+};
+template <typename T, typename U, typename V> struct C : F<T, U, V> {
+ using J = F<T, U, V>;
+ using J::begin;
+ using J::end;
+};
+using K = class L;
+struct M {
+ void foo () { for (auto & [ a ] : m) {} } // { dg-error "incomplete type" }
+ C<K, B> m; // { dg-warning "only available with" "" { target c++14_down } .-1 }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp36.C b/gcc/testsuite/g++.dg/cpp1z/decomp36.C
new file mode 100644
index 00000000000..5a66d0c7b56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp36.C
@@ -0,0 +1,19 @@
+// PR c++/84031
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { unsigned char : 1, a1 : 1, a2 : 2, : 1, a3 : 3; };
+struct B { unsigned char : 1, : 7; };
+struct C : B { constexpr C () : c1 (1), c2 (2), c3 (3) {} unsigned char : 1, c1 : 1, c2 : 2, : 1, c3 : 3; };
+struct D : C { constexpr D () {} unsigned char : 1, : 7; };
+
+int
+main ()
+{
+ static constexpr A a { 1, 2, 3 };
+ const auto &[a1, a2, a3] = a; // { dg-warning "only available with" "" { target c++14_down } }
+ static_assert (a1 == 1 && a2 == 2 && a3 == 3, "");
+ static constexpr D d;
+ const auto &[d1, d2, d3] = d; // { dg-warning "only available with" "" { target c++14_down } }
+ static_assert (d1 == 1 && d2 == 2 && d3 == 3, "");
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C b/gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C
index fbee8ca5c9e..356c36f5ff6 100644
--- a/gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C
+++ b/gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C
@@ -1,17 +1,19 @@
// { dg-do run { target c++11 } }
// PR78495 failed to propagate pass-by-value struct to base ctor.
+static int moves = 0;
+
struct Ptr {
void *ptr = 0;
Ptr() {}
Ptr(Ptr const&) = delete;
- Ptr(Ptr&& other) : ptr (other.ptr) {}
+ Ptr(Ptr&& other) : ptr (other.ptr) {moves++;}
};
struct Base {
Ptr val;
- Base(Ptr val_) : val(static_cast<Ptr&&>(val_)) {}
+ Base(Ptr val_);
};
struct Derived: Base {
@@ -27,5 +29,13 @@ void *Foo () {
}
int main () {
- return Foo () != 0;
+ if (Foo ())
+ return 1;
+
+ if (moves != 2)
+ return 2;
+
+ return 0;
}
+
+Base::Base(Ptr val_) : val(static_cast<Ptr&&>(val_)) {}
diff --git a/gcc/testsuite/g++.dg/cpp1z/launder7.C b/gcc/testsuite/g++.dg/cpp1z/launder7.C
new file mode 100644
index 00000000000..e418329f931
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/launder7.C
@@ -0,0 +1,10 @@
+// PR c++/84445
+// { dg-do compile }
+
+struct A { virtual void foo (); };
+
+void
+bar (A *p)
+{
+ __builtin_launder (p)->foo ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/launder8.C b/gcc/testsuite/g++.dg/cpp1z/launder8.C
new file mode 100644
index 00000000000..f57e91b60cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/launder8.C
@@ -0,0 +1,11 @@
+// PR c++/84444
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A {};
+
+__UINTPTR_TYPE__
+foo (A *p)
+{
+ return (__UINTPTR_TYPE__) __builtin_launder (p);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C
new file mode 100644
index 00000000000..2152cef811e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C
@@ -0,0 +1,18 @@
+// PR c++/82331
+// { dg-options -std=c++17 }
+
+template <auto>
+class X;
+
+template <typename R, typename... A, R (*F) (A...)>
+class X<F> {
+public:
+ static R call (A... args)
+ {
+ return (*F)(args...);
+ }
+};
+
+int func (int a, int b) { return a + b; }
+
+int test () { return X<&func>::call(1, 2); }
diff --git a/gcc/testsuite/g++.dg/ext/is_trivially_constructible6.C b/gcc/testsuite/g++.dg/ext/is_trivially_constructible6.C
new file mode 100644
index 00000000000..10a8dfbb8f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_trivially_constructible6.C
@@ -0,0 +1,10 @@
+// PR c++/81589
+
+template <typename k>
+struct z {
+ z() {
+ k::error;
+ }
+};
+
+int x = __is_trivially_constructible(z<int>);
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr22.C b/gcc/testsuite/g++.dg/ext/stmtexpr22.C
new file mode 100644
index 00000000000..f46523a5875
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr22.C
@@ -0,0 +1,13 @@
+// PR c++/81853
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+namespace N {
+ enum { i };
+}
+
+int g ()
+{
+ constexpr int j = ({ using namespace N; i; });
+ return j;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr84430.C b/gcc/testsuite/g++.dg/gomp/pr84430.C
new file mode 100644
index 00000000000..cf9275acaa0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr84430.C
@@ -0,0 +1,12 @@
+// PR c++/84430
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ auto a = [] {
+ #pragma omp simd
+ for (int i = 0; i < 10; ++i)
+ ;
+ };
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr84448.C b/gcc/testsuite/g++.dg/gomp/pr84448.C
new file mode 100644
index 00000000000..3fad4741d38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr84448.C
@@ -0,0 +1,17 @@
+// PR c++/84448
+// { dg-do compile }
+
+struct A
+{
+ operator int () const;
+ A& operator += (int);
+ A& operator ++ ();
+};
+
+void
+foo (A a, A b)
+{
+ #pragma omp for
+ for (A i = a; i <=; ++i) // { dg-error "expected primary-expression before" }
+ ; // { dg-error "invalid controlling predicate" "" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr84556.C b/gcc/testsuite/g++.dg/gomp/pr84556.C
new file mode 100644
index 00000000000..188d5a49b91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr84556.C
@@ -0,0 +1,14 @@
+// PR c++/84556
+// { dg-do compile }
+// { dg-options "-std=c++17 -fopenmp-simd" }
+
+void
+foo ()
+{
+ auto x = [] ()
+ {
+ #pragma omp simd
+ for (int i = 0; i < 8; ++i)
+ ;
+ };
+}
diff --git a/gcc/testsuite/g++.dg/gomp/pr84557.C b/gcc/testsuite/g++.dg/gomp/pr84557.C
new file mode 100644
index 00000000000..cd215901aef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr84557.C
@@ -0,0 +1,14 @@
+// PR c++/84557
+// { dg-do compile }
+
+template<int> struct A {};
+template<int> struct B {};
+
+void
+foo ()
+{
+ #pragma omp parallel firstprivate (A) // { dg-error "is not a variable in clause" }
+ ;
+ #pragma omp parallel firstprivate (B<0>) // { dg-error "is not a variable in clause" }
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/init/pr83993-2.C b/gcc/testsuite/g++.dg/init/pr83993-2.C
new file mode 100644
index 00000000000..19f54081130
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/pr83993-2.C
@@ -0,0 +1,14 @@
+// PR c++/83993
+// { dg-do compile }
+// { dg-options "-w" }
+
+int a[5];
+extern int b[];
+int *const c = &a[6];
+int *const d = &b[1];
+
+int
+foo ()
+{
+ return c[-4] + d[-1];
+}
diff --git a/gcc/testsuite/g++.dg/ipa/pr82352.C b/gcc/testsuite/g++.dg/ipa/pr82352.C
new file mode 100644
index 00000000000..08516da0c8a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr82352.C
@@ -0,0 +1,93 @@
+// PR ipa/82352
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __SIZE_TYPE__ size_t;
+
+class A
+{
+public :
+ typedef enum { Zero = 0, One = 1 } tA;
+ A(tA a) { m_a = a; }
+
+private :
+ tA m_a;
+};
+
+class B
+{
+public :
+ void *operator new(size_t t) { return (void*)(42); };
+};
+
+class C
+{
+public:
+ virtual void ffff () = 0;
+};
+
+class D
+{
+ public :
+ virtual void g() = 0;
+ virtual void h() = 0;
+};
+
+template<class T> class IIII: public T, public D
+{
+public:
+ void ffff()
+ {
+ if (!m_i2) throw A(A::One);
+ };
+
+ void h()
+ {
+ if (m_i2) throw A(A::Zero);
+ }
+
+protected:
+ virtual void g()
+ {
+ if (m_i1 !=0) throw A(A::Zero);
+ };
+
+private :
+ int m_i1;
+ void *m_i2;
+};
+
+class E
+{
+private:
+ size_t m_e;
+ static const size_t Max;
+
+public:
+ E& i(size_t a, size_t b, size_t c)
+ {
+ if ((a > Max) || (c > Max)) throw A(A::Zero );
+ if (a + b > m_e) throw A(A::One );
+ return (*this);
+ }
+
+ inline E& j(const E &s)
+ {
+ return i(0,0,s.m_e);
+ }
+};
+
+class F : public C { };
+class G : public C { };
+class HHHH : public B, public F, public G { };
+
+void k()
+{
+ new IIII<HHHH>();
+}
+
+void l()
+{
+ E e1, e2;
+ e1.j(e2);
+}
diff --git a/gcc/testsuite/g++.dg/ipa/pr83549.C b/gcc/testsuite/g++.dg/ipa/pr83549.C
new file mode 100644
index 00000000000..90cf8fe7e0d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr83549.C
@@ -0,0 +1,8 @@
+// PR ipa/83549
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A { virtual ~A (); };
+struct B { virtual void foo (...); };
+struct C : A, B { void foo (...) {} };
+C c;
diff --git a/gcc/testsuite/g++.dg/other/anon5.C b/gcc/testsuite/g++.dg/other/anon5.C
index 2a6f57f12bc..ee4601e270e 100644
--- a/gcc/testsuite/g++.dg/other/anon5.C
+++ b/gcc/testsuite/g++.dg/other/anon5.C
@@ -4,7 +4,7 @@
// Ignore additional message on powerpc-ibm-aix
// { dg-prune-output "obtain more information" } */
// Ignore additional messages on Linux/x86 with PIE
-// { dg-prune-output "Bad value" } */
+// { dg-prune-output "\[Bb\]ad value" } */
namespace {
struct c
diff --git a/gcc/testsuite/g++.dg/parse/crash67.C b/gcc/testsuite/g++.dg/parse/crash67.C
index 51773ccef53..dbd828e2eee 100644
--- a/gcc/testsuite/g++.dg/parse/crash67.C
+++ b/gcc/testsuite/g++.dg/parse/crash67.C
@@ -2,4 +2,4 @@
class x0;
template <x1> x2() { // { dg-error "declared|type" }
-x0 x3 = x3. // { dg-error "expected" }
+x0 x3 = x3. // { dg-error "expected|incomplete type" }
diff --git a/gcc/testsuite/g++.dg/pr84279.C b/gcc/testsuite/g++.dg/pr84279.C
new file mode 100644
index 00000000000..a88d3fb8470
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr84279.C
@@ -0,0 +1,35 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-O3 -mcpu=power8 -g -fPIC -fvisibility=hidden -fstack-protector-strong" } */
+
+template <typename, typename T> struct E { T e; };
+struct J {
+ unsigned k, l;
+ J (unsigned x, unsigned y) : k(x), l(y) {}
+};
+typedef struct A {
+ J n, p;
+ A ();
+ A (J x, J y) : n(x), p(y) {}
+} *S;
+S t;
+struct B {
+ struct C {
+ S q, r;
+ int u, v;
+ bool m1 (S, A &);
+ J m2 () const;
+ J m3 () const;
+ A m4 () const;
+ };
+ typedef E<unsigned, S> D;
+ void m5 (D *);
+ void m6 (unsigned, A);
+};
+bool B::C::m1 (S, A &x) { bool o; x = m4 (); return o; }
+J B::C::m2 () const { unsigned g (u == 0); unsigned h (v); return J (g, h); }
+J B::C::m3 () const { unsigned g (q != t); unsigned h (r != t); return J (g, h); }
+A B::C::m4 () const { return A (m2 (), m3 ()); }
+void B::m5 (D *c) { unsigned x; C ar; A am; if (ar.m1 (c->e, am)) m6 (x, am); }
diff --git a/gcc/testsuite/g++.dg/template/incomplete11.C b/gcc/testsuite/g++.dg/template/incomplete11.C
new file mode 100644
index 00000000000..38c92e3d337
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/incomplete11.C
@@ -0,0 +1,10 @@
+// PR c++/84082
+// { dg-do compile }
+// { dg-options "" }
+
+struct A;
+
+template<typename> void foo()
+{
+ static int a[A().operator=(A())]; // { dg-error "invalid use of incomplete type 'struct A'" }
+}
diff --git a/gcc/testsuite/g++.dg/template/nontype-fn1.C b/gcc/testsuite/g++.dg/template/nontype-fn1.C
new file mode 100644
index 00000000000..12d29a91a54
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nontype-fn1.C
@@ -0,0 +1,11 @@
+// PR c++/82664
+
+template < typename > struct target_disambiguator;
+template < typename R, typename A1 > struct target_disambiguator< R(A1) > {
+ typedef A1 type;
+ template < R (&)() > struct layout;
+};
+
+int main() {
+ typedef target_disambiguator< void (int) > ::type target_type ;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr81877.C b/gcc/testsuite/g++.dg/torture/pr81877.C
new file mode 100644
index 00000000000..dae23a3c0d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr81877.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+
+void __attribute__((noinline,noclone)) g(int p, int *out)
+{
+ int x = 0, y;
+#pragma GCC ivdep
+ for (int i = 0; i < 100; i++)
+ {
+ int &r = p ? x : y;
+ r = 42;
+ out[i] = x;
+ }
+}
+
+int main()
+{
+ int out[100] = { 0 };
+ g (1, out);
+ if (out[0] != 42)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr83659.C b/gcc/testsuite/g++.dg/torture/pr83659.C
new file mode 100644
index 00000000000..bdcdca230ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr83659.C
@@ -0,0 +1,18 @@
+// PR c++/83659
+// { dg-do compile }
+
+typedef int V __attribute__ ((__vector_size__ (16)));
+V a;
+V b[2];
+
+int
+foo ()
+{
+ return reinterpret_cast <int *> (&a)[-1] += 1;
+}
+
+int
+bar ()
+{
+ return reinterpret_cast <int *> (&a[1])[-1];
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr84190.C b/gcc/testsuite/g++.dg/torture/pr84190.C
new file mode 100644
index 00000000000..a7bab944365
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr84190.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// For slim LTO there's no optimized dump
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+// { dg-additional-options "-fdump-tree-optimized" }
+
+typedef double T;
+static int equalfn (volatile T* x, volatile T* y);
+T gx, gy;
+int main ()
+{
+ T x = gx, y = gy;
+ return equalfn (&x, &y);
+}
+static int equalfn (volatile T* x, volatile T* y)
+{
+ return (*x == *y);
+}
+
+// There should be exactly two volatile accesses (ignoring clobbers).
+// { dg-final { scan-tree-dump-times " ={v} \[^\{\]" 2 "optimized" } }
diff --git a/gcc/testsuite/g++.dg/torture/pr84233.C b/gcc/testsuite/g++.dg/torture/pr84233.C
new file mode 100644
index 00000000000..d45a830bf63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr84233.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-additional-options "-w" }
+
+void a(const char *, int, const char *, const char *);
+template <typename b> void c(b);
+struct d {
+ long e;
+ template <typename> union f;
+ template <typename h> union f<h *> {
+ f(h *i) : j(i) {}
+ h *j;
+ long bits;
+ };
+ static int k(volatile long &i) { return *(int *)f<volatile long *>(&i).bits; }
+ typedef long g;
+ operator g() volatile {
+ int l = k(e);
+ c(l);
+ }
+};
+struct : d {
+ } m, n;
+bool o;
+void p() { (o ? m : n) ? (void)0 : a("", 5, "", ""); }
+
diff --git a/gcc/testsuite/g++.dg/tree-ssa/volatile1.C b/gcc/testsuite/g++.dg/tree-ssa/volatile1.C
new file mode 100644
index 00000000000..00f04a07d84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/volatile1.C
@@ -0,0 +1,28 @@
+// PR c++/84151
+// { dg-additional-options "-fdump-tree-gimple" }
+// { dg-final { scan-tree-dump-not {\*this} "gimple" } }
+
+struct A {
+ static int& bar(int& a) {
+ return a;
+ }
+ static int i;
+
+ int foo() volatile {
+ int v = c;
+ return i + bar(v);
+ }
+
+ int c;
+};
+
+int A::i = 0;
+
+A a;
+
+int main() {
+ a.c = 2;
+ a.foo();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/volatile2.C b/gcc/testsuite/g++.dg/tree-ssa/volatile2.C
new file mode 100644
index 00000000000..bec60442477
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/volatile2.C
@@ -0,0 +1,20 @@
+// PR c++/84686
+// { dg-additional-options -fdump-tree-gimple }
+// { dg-final { scan-tree-dump-times "= i" 10 "gimple" } }
+
+volatile int i;
+
+int main()
+{
+ i; //evaluated (a load is performed)
+ (i); //unevaluated => the load shall be performed
+
+ (void)i; //evaluated (a load is performed)
+ (void)(i); //unevaluated => the load shall be performed
+
+ (void)i; //evaluated (a load is performed)
+ (void)(i); //unevaluated => the load shall be performed
+
+ (i,i); // the two subexpression are evaluated
+ ((i),(i)); // no evaluation, => two loads shall happen
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr83987-2.C b/gcc/testsuite/g++.dg/ubsan/pr83987-2.C
new file mode 100644
index 00000000000..a70b7b2850b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr83987-2.C
@@ -0,0 +1,24 @@
+// PR sanitizer/83987
+// { dg-do compile { target fopenmp } }
+// { dg-options "-fopenmp -fsanitize=vptr" }
+
+struct A
+{
+ int i;
+};
+
+struct B : virtual A
+{
+ void foo();
+};
+
+void B::foo()
+{
+#pragma omp parallel
+ {
+ #pragma omp sections lastprivate (i)
+ {
+ i = 0;
+ }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/ubsan/pr83987.C b/gcc/testsuite/g++.dg/ubsan/pr83987.C
new file mode 100644
index 00000000000..7ba7952b293
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr83987.C
@@ -0,0 +1,15 @@
+// PR sanitizer/83987
+// { dg-do compile { target fopenmp } }
+// { dg-options "-fopenmp -fsanitize=vptr -O0" }
+
+struct A { int i; };
+struct B : virtual A { void foo (); };
+
+void
+B::foo ()
+{
+#pragma omp sections lastprivate (i)
+ {
+ i = 0;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr70729-nest.cc b/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
index 96171e5ec94..bbe4a5e2dba 100644
--- a/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
+++ b/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
@@ -76,4 +76,4 @@ void Ss::foo (int n)
}
}
-// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }
+// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { xfail *-*-* } } }
diff --git a/gcc/testsuite/g++.dg/vect/pr70729.cc b/gcc/testsuite/g++.dg/vect/pr70729.cc
index ff868f7a41b..d5bdf49c419 100644
--- a/gcc/testsuite/g++.dg/vect/pr70729.cc
+++ b/gcc/testsuite/g++.dg/vect/pr70729.cc
@@ -70,4 +70,4 @@ void Ss::foo (float *in, float w)
}
}
-// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }
+// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { xfail *-*-* } } }
diff --git a/gcc/testsuite/g++.dg/vect/pr84556.cc b/gcc/testsuite/g++.dg/vect/pr84556.cc
new file mode 100644
index 00000000000..e0655536f7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr84556.cc
@@ -0,0 +1,21 @@
+// PR c++/84556
+// { dg-do run { target c++11 } }
+// { dg-options "-O2 -fopenmp-simd" }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+
+int
+main ()
+{
+ int y[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ auto x = [&y] ()
+ {
+ #pragma omp simd
+ for (int i = 0; i < 8; ++i)
+ y[i]++;
+ };
+ x ();
+ x ();
+ for (int i = 0; i < 8; ++i)
+ if (y[i] != i + 3)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr82096.c b/gcc/testsuite/gcc.c-torture/compile/pr82096.c
new file mode 100644
index 00000000000..d144b70585f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr82096.c
@@ -0,0 +1,11 @@
+/* { dg-require-effective-target arm_arch_v5t_ok { target arm*-*-* } } */
+/* { dg-skip-if "Do not combine float-abi values" { arm*-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+/* { dg-additional-options "-march=armv5t -mthumb -mfloat-abi=soft" { target arm*-*-* } } */
+
+static long long AL[24];
+
+int
+check_ok (void)
+{
+ return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 0x1234567890ll));
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr84425.c b/gcc/testsuite/gcc.c-torture/compile/pr84425.c
new file mode 100644
index 00000000000..5d3d325aa23
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr84425.c
@@ -0,0 +1,17 @@
+/* PR ipa/84425 */
+
+void bar (int);
+
+void
+foo (int x)
+{
+ if (x < 5)
+ bar (x);
+}
+
+__attribute__((optimize(0))) void
+bar (int x)
+{
+ if (x > 10)
+ foo (x);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20180131-1.c b/gcc/testsuite/gcc.c-torture/execute/20180131-1.c
new file mode 100644
index 00000000000..76e264bf967
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20180131-1.c
@@ -0,0 +1,28 @@
+/* PR rtl-optimization/84071 */
+/* Reported by Wilco <wilco@gcc.gnu.org> */
+
+extern void abort (void);
+
+typedef union
+{
+ signed short ss;
+ unsigned short us;
+ int x;
+} U;
+
+int f(int x, int y, int z, int a, U u) __attribute__((noclone, noinline));
+
+int f(int x, int y, int z, int a, U u)
+{
+ return (u.ss <= 0) + u.us;
+}
+
+int main (void)
+{
+ U u = { .ss = -1 };
+
+ if (f (0, 0, 0, 0, u) != (1 << sizeof (short) * 8))
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20180226-1.c b/gcc/testsuite/gcc.c-torture/execute/20180226-1.c
new file mode 100644
index 00000000000..e2b678c8fc7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20180226-1.c
@@ -0,0 +1,31 @@
+/* PR rtl-optimization/83496 */
+/* Reported by Hauke Mehrtens <gcc@hauke-m.de> */
+
+extern void abort (void);
+
+typedef unsigned long mp_digit;
+
+typedef struct { int used, alloc, sign; mp_digit *dp; } mp_int;
+
+int mytest(mp_int *a, mp_digit b) __attribute__((noclone, noinline));
+
+int mytest(mp_int *a, mp_digit b)
+{
+ if (a->sign == 1)
+ return -1;
+ if (a->used > 1)
+ return 1;
+ if (a->dp[0] > b)
+ return 1;
+ if (a->dp[0] < b)
+ return -1;
+ return 0;
+}
+
+int main (void)
+{
+ mp_int i = { 2, 0, -1 };
+ if (mytest (&i, 0) != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr82210.c b/gcc/testsuite/gcc.c-torture/execute/pr82210.c
new file mode 100644
index 00000000000..48fb715570a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr82210.c
@@ -0,0 +1,26 @@
+/* PR c/82210 */
+
+void
+foo (int size)
+{
+ int i;
+ struct S {
+ __attribute__((aligned (16))) struct T { short c; } a[size];
+ int b[size];
+ } s;
+
+ for (i = 0; i < size; i++)
+ s.a[i].c = 0x1234;
+ for (i = 0; i < size; i++)
+ s.b[i] = 0;
+ for (i = 0; i < size; i++)
+ if (s.a[i].c != 0x1234 || s.b[i] != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo (15);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr84524.c b/gcc/testsuite/gcc.c-torture/execute/pr84524.c
new file mode 100644
index 00000000000..ba20ad87a5a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr84524.c
@@ -0,0 +1,41 @@
+/* PR target/84524 */
+
+__attribute__((noinline,noclone)) void
+foo (unsigned short *x)
+{
+ unsigned short i, v;
+ unsigned char j;
+ for (i = 0; i < 256; i++)
+ {
+ v = i << 8;
+ for (j = 0; j < 8; j++)
+ if (v & 0x8000)
+ v = (v << 1) ^ 0x1021;
+ else
+ v = v << 1;
+ x[i] = v;
+ }
+}
+
+int
+main ()
+{
+ unsigned short a[256];
+
+ foo (a);
+ for (int i = 0; i < 256; i++)
+ {
+ unsigned short v = i << 8;
+ for (int j = 0; j < 8; j++)
+ {
+ asm volatile ("" : "+r" (v));
+ if (v & 0x8000)
+ v = (v << 1) ^ 0x1021;
+ else
+ v = v << 1;
+ }
+ if (a[i] != v)
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x
index d14d4945709..e86f36a1861 100644
--- a/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x
+++ b/gcc/testsuite/gcc.c-torture/unsorted/dump-noaddr.x
@@ -9,14 +9,14 @@ proc dump_compare { src options } {
# loop through all the options
foreach option $option_list {
- file delete -force dump1
- file mkdir dump1
+ file delete -force $tmpdir/dump1
+ file mkdir $tmpdir/dump1
c-torture-compile $src "$option $options -dumpbase dump1/$dumpbase -DMASK=1 -x c --param ggc-min-heapsize=1 -fdump-ipa-all -fdump-rtl-all -fdump-tree-all -fdump-noaddr"
- file delete -force dump2
- file mkdir dump2
+ file delete -force $tmpdir/dump2
+ file mkdir $tmpdir/dump2
c-torture-compile $src "$option $options -dumpbase dump2/$dumpbase -DMASK=2 -x c -fdump-ipa-all -fdump-rtl-all -fdump-tree-all -fdump-noaddr"
- foreach dump1 [lsort [glob -nocomplain dump1/*]] {
- regsub dump1/ $dump1 dump2/ dump2
+ foreach dump1 [lsort [glob -nocomplain $tmpdir/dump1/*]] {
+ set dump2 "$tmpdir/dump2/[file tail $dump1]"
set dumptail "gcc.c-torture/unsorted/[file tail $dump1]"
regsub {\.\d+((t|r|i)\.[^.]+)$} $dumptail {.*\1} dumptail
set tmp [ diff "$dump1" "$dump2" ]
@@ -29,8 +29,8 @@ proc dump_compare { src options } {
}
}
}
- file delete -force dump1
- file delete -force dump2
+ file delete -force $tmpdir/dump1
+ file delete -force $tmpdir/dump2
}
dump_compare $src $options
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/pr69869.c b/gcc/testsuite/gcc.dg/cpp/trad/pr69869.c
new file mode 100644
index 00000000000..78bc3cdce39
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/trad/pr69869.c
@@ -0,0 +1,8 @@
+/* PR preprocessor/69869 */
+/* { dg-do preprocess } */
+/* { dg-options "-traditional-cpp" } */
+
+#define C(a,b)a/**/b
+C (foo/,**/)
+C (foo/,*)
+/* { dg-error "unterminated comment" "" {target "*-*-*"} .-1 } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
index 6577eff3548..19457173eb3 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
@@ -3,9 +3,8 @@
the build not reproducible. Other skipped options could be tested here
as well. */
/* { dg-do compile } */
-/* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */
-/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */
-/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */
+/* { dg-options "-O2 -gdwarf -dA -fno-merge-debug-strings -fdebug-prefix-map=a=b" } */
+/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" } } */
/* { dg-final { scan-assembler-not "debug-prefix-map" } } */
void func (void)
diff --git a/gcc/testsuite/gcc.dg/lto/pr81440.h b/gcc/testsuite/gcc.dg/lto/pr81440.h
new file mode 100644
index 00000000000..d9e6c3da645
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr81440.h
@@ -0,0 +1,4 @@
+typedef struct {
+ int i;
+ int ints[];
+} struct_t;
diff --git a/gcc/testsuite/gcc.dg/lto/pr81440_0.c b/gcc/testsuite/gcc.dg/lto/pr81440_0.c
new file mode 100644
index 00000000000..07f2a87da21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr81440_0.c
@@ -0,0 +1,9 @@
+/* { dg-lto-do link } */
+
+#include "pr81440.h"
+
+extern struct_t my_struct;
+
+int main() {
+ return my_struct.ints[0];
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr81440_1.c b/gcc/testsuite/gcc.dg/lto/pr81440_1.c
new file mode 100644
index 00000000000..d03533029c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr81440_1.c
@@ -0,0 +1,6 @@
+#include "pr81440.h"
+
+struct_t my_struct = {
+ 20,
+ { 1, 2 }
+};
diff --git a/gcc/testsuite/gcc.dg/lto/pr83954.h b/gcc/testsuite/gcc.dg/lto/pr83954.h
new file mode 100644
index 00000000000..e0155402504
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr83954.h
@@ -0,0 +1,3 @@
+struct foo;
+extern struct foo *FOO_PTR_ARR[1];
+
diff --git a/gcc/testsuite/gcc.dg/lto/pr83954_0.c b/gcc/testsuite/gcc.dg/lto/pr83954_0.c
new file mode 100644
index 00000000000..065a31dab80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr83954_0.c
@@ -0,0 +1,8 @@
+/* { dg-lto-do link } */
+#include "pr83954.h"
+
+int main() {
+ // just to prevent symbol removal
+ FOO_PTR_ARR[1] = 0;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr83954_1.c b/gcc/testsuite/gcc.dg/lto/pr83954_1.c
new file mode 100644
index 00000000000..61b40fc7759
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr83954_1.c
@@ -0,0 +1,7 @@
+#include "pr83954.h"
+
+struct foo {
+ int x;
+};
+struct foo *FOO_PTR_ARR[1] = { 0 };
+
diff --git a/gcc/testsuite/gcc.dg/plugin/must-tail-call-1.c b/gcc/testsuite/gcc.dg/plugin/must-tail-call-1.c
index 6d74955aa80..1495a48232a 100644
--- a/gcc/testsuite/gcc.dg/plugin/must-tail-call-1.c
+++ b/gcc/testsuite/gcc.dg/plugin/must-tail-call-1.c
@@ -1,3 +1,5 @@
+/* { dg-options "-fdelayed-branch" { target sparc*-*-* } } */
+
extern void abort (void);
int __attribute__((noinline,noclone))
diff --git a/gcc/testsuite/gcc.dg/pr81228.c b/gcc/testsuite/gcc.dg/pr81228.c
new file mode 100644
index 00000000000..f7eecc510ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81228.c
@@ -0,0 +1,21 @@
+/* PR target/81228. */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-ssa" } */
+
+void *a;
+
+void b ()
+{
+ char c;
+ long d;
+ char *e = a;
+ for (; d; d++)
+ {
+ double f, g;
+ c = g < f || g > f;
+ e[d] = c;
+ }
+}
+
+/* Let's make sure we do have a LTGT. */
+/* { dg-final { scan-tree-dump "<>" "ssa" } } */
diff --git a/gcc/testsuite/gcc.dg/pr81661.c b/gcc/testsuite/gcc.dg/pr81661.c
new file mode 100644
index 00000000000..d8d27304ddb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81661.c
@@ -0,0 +1,12 @@
+/* PR tree-optimization/81661 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftrapv" } */
+
+int a, b, c;
+
+void
+foo (void)
+{
+ while (a + c > b)
+ a--;
+}
diff --git a/gcc/testsuite/gcc.dg/pr82916.c b/gcc/testsuite/gcc.dg/pr82916.c
new file mode 100644
index 00000000000..9b1610ba57b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82916.c
@@ -0,0 +1,47 @@
+/* PR bootstrap/82916 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-tree-dse" } */
+
+struct A { struct A *next; };
+struct C
+{
+ int *of;
+ struct C *parent, *prev, *next;
+ int depth;
+ int min;
+ struct C *min_occ;
+};
+
+__attribute__((noinline, noclone)) struct C *
+foo (int *node)
+{
+ struct A *p = __builtin_malloc (sizeof (struct C));
+ if (!p)
+ return 0;
+ p->next = 0;
+ /* Originally placement new. */
+ struct C *nw = (struct C *)(void *)p;
+ nw->of = node;
+ nw->parent = 0;
+ nw->prev = 0;
+ nw->next = 0;
+ nw->depth = 0;
+ nw->min_occ = nw;
+ nw->min = 0;
+ return nw;
+}
+
+int
+main ()
+{
+ int o;
+ struct C *p = foo (&o);
+ if (p)
+ {
+ if (p->of != &o || p->parent || p->prev || p->next || p->depth
+ || p->min || p->min_occ != p)
+ __builtin_abort ();
+ }
+ __builtin_free (p);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83424.c b/gcc/testsuite/gcc.dg/pr83424.c
new file mode 100644
index 00000000000..5a304f50292
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83424.c
@@ -0,0 +1,30 @@
+/* PR rtl-optimization/83424 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-coalesce-vars" } */
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+typedef unsigned __int128 u128;
+
+u32 a, c;
+u8 b;
+
+static u128 __attribute__ ((noinline, noclone))
+foo (u128 p)
+{
+ u8 x = ~b;
+ p &= c;
+ x *= -p;
+ x &= a == 0;
+ x >>= 1;
+ return p + x;
+}
+
+int
+main (void)
+{
+ u128 x = foo (0);
+ if (x != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83552.c b/gcc/testsuite/gcc.dg/pr83552.c
new file mode 100644
index 00000000000..993cdd26581
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83552.c
@@ -0,0 +1,13 @@
+/* PR tree-optimization/83364 */
+/* { dg-options "-O2" } */
+
+char *b;
+char d[100];
+void a ();
+void
+c (void)
+{
+ __builtin_strcat (d, "12345");
+ if (__builtin_strstr (b, d) == b)
+ a ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr83605.c b/gcc/testsuite/gcc.dg/pr83605.c
new file mode 100644
index 00000000000..c680f0ce91f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83605.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/83605 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftrapv -fexceptions -fnon-call-exceptions" } */
+
+int a;
+
+int
+foo (int x)
+{
+ int b = a;
+ {
+ int c;
+ int *d = (x == 0) ? &c : &b;
+
+ for (a = 0; a < 2; ++a)
+ c = (x + b) < a;
+
+ return *d;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr83930.c b/gcc/testsuite/gcc.dg/pr83930.c
new file mode 100644
index 00000000000..8a079af3fb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83930.c
@@ -0,0 +1,17 @@
+/* PR target/83930 */
+/* { dg-do compile } */
+/* { dg-options "-Og -fno-tree-ccp -w" } */
+
+unsigned __attribute__ ((__vector_size__ (16))) v;
+
+static inline void
+bar (unsigned char d)
+{
+ v /= d;
+}
+
+__attribute__ ((always_inline)) void
+foo (void)
+{
+ bar (4);
+}
diff --git a/gcc/testsuite/gcc.dg/pr83985.c b/gcc/testsuite/gcc.dg/pr83985.c
new file mode 100644
index 00000000000..51cfc49a193
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83985.c
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/83985 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mcpu=e300c3 -mtune=e300c3" { target { powerpc*-*-* && ilp32 } } } */
+
+long long int v;
+
+void
+foo (int x)
+{
+ if (x == 0)
+ return;
+
+ while (v < 2)
+ {
+ signed char *a;
+ v /= x;
+ a = v == 0 ? (signed char *) &x : (signed char *) &v;
+ ++*a;
+ ++v;
+ }
+
+ while (1)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/pr83986.c b/gcc/testsuite/gcc.dg/pr83986.c
new file mode 100644
index 00000000000..31a53d93616
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr83986.c
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/83986 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2 -fsched2-use-superblocks -funwind-tables --param max-pending-list-length=1" } */
+
+int v;
+
+int
+foo (int x)
+{
+ v &= !!v && !!x;
+ if (v != 0)
+ foo (0);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84503-1.c b/gcc/testsuite/gcc.dg/pr84503-1.c
new file mode 100644
index 00000000000..03fb2fbd9a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84503-1.c
@@ -0,0 +1,68 @@
+/* PR tree-optimization/84503 */
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+typedef __SIZE_TYPE__ size_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
+
+struct S { int a; unsigned short b; int c, d, e; long f, g, h; int i, j; };
+static struct S *k;
+static size_t l = 0;
+int m;
+
+static int
+bar (void)
+{
+ unsigned i;
+ int j;
+ if (k[0].c == 0)
+ {
+ ++m;
+ size_t n = l * 2;
+ struct S *o;
+ o = (struct S *) __builtin_realloc (k, sizeof (struct S) * n);
+ if (!o)
+ __builtin_exit (0);
+ k = o;
+ for (i = l; i < n; i++)
+ {
+ void *p = (void *) &k[i];
+ int q = 0;
+ size_t r = sizeof (struct S);
+ if ((((uintptr_t) p) % __alignof__ (long)) == 0
+ && r % sizeof (long) == 0)
+ {
+ long __attribute__ ((may_alias)) *s = (long *) p;
+ long *t = (long *) ((char *) s + r);
+ while (s < t)
+ *s++ = 0;
+ }
+ else
+ __builtin_memset (p, q, r);
+ k[i].c = i + 1;
+ k[i].a = -1;
+ }
+ k[n - 1].c = 0;
+ k[0].c = l;
+ l = n;
+ }
+ j = k[0].c;
+ k[0].c = k[j].c;
+ return j;
+}
+
+int
+main ()
+{
+ k = (struct S *) __builtin_malloc (sizeof (struct S));
+ if (!k)
+ __builtin_exit (0);
+ __builtin_memset (k, '\0', sizeof (struct S));
+ k->a = -1;
+ l = 1;
+ for (int i = 0; i < 15; ++i)
+ bar ();
+ if (m != 4)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84503-2.c b/gcc/testsuite/gcc.dg/pr84503-2.c
new file mode 100644
index 00000000000..76701f07938
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84503-2.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/84503 */
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-tree-vectorize -fno-ivopts" } */
+
+#include "pr84503-1.c"
diff --git a/gcc/testsuite/gcc.dg/pr84607.c b/gcc/testsuite/gcc.dg/pr84607.c
new file mode 100644
index 00000000000..710ee94f729
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84607.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+
+extern void exit(int);
+extern void abort(void);
+int a[10];
+int foo()
+{
+ exit (0);
+ return 0;
+}
+int main()
+{
+ if (&a[foo()])
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84628.c b/gcc/testsuite/gcc.dg/pr84628.c
new file mode 100644
index 00000000000..b8eb53c7dc0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84628.c
@@ -0,0 +1,8 @@
+/* PR ipa/84628 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int f0 (void);
+__attribute__((error ("err"))) void f1 (void) { f0 (); f0 (); }
+__attribute__((error ("err"))) void f2 (void) { f0 (); f0 (); }
+/* { dg-bogus "declared with attribute error" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/rtl/x86_64/final.c b/gcc/testsuite/gcc.dg/rtl/x86_64/final.c
index 3e37ce2cd9e..de13df47c69 100644
--- a/gcc/testsuite/gcc.dg/rtl/x86_64/final.c
+++ b/gcc/testsuite/gcc.dg/rtl/x86_64/final.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
-/* { dg-options "-fdump-rtl-final" } */
+/* { dg-options "-fdwarf2-cfi-asm -fdump-rtl-final" } */
/* Lightly-modified dump of test.c.304r.dwarf2 for x86_64 target,
with various NOTE_INSN_CFI deleted by hand for now. */
diff --git a/gcc/testsuite/gcc.dg/tls/pr83945.c b/gcc/testsuite/gcc.dg/tls/pr83945.c
new file mode 100644
index 00000000000..dade2388eea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/pr83945.c
@@ -0,0 +1,21 @@
+/* PR middle-end/83945 */
+/* { dg-do compile { target tls } } */
+/* { dg-options "-O2" } */
+
+struct S { int a[1]; };
+__thread struct T { int c; } e;
+int f;
+void bar (int);
+
+void
+foo (int f, int x)
+{
+ struct S *h = (struct S *) &e.c;
+ for (;;)
+ {
+ int *a = h->a, i;
+ for (i = x; i; i--)
+ bar (a[f]);
+ bar (a[f]);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/ubsan/bounds-3.c b/gcc/testsuite/gcc.dg/ubsan/bounds-3.c
index 50ad67389f8..c9d896d1903 100644
--- a/gcc/testsuite/gcc.dg/ubsan/bounds-3.c
+++ b/gcc/testsuite/gcc.dg/ubsan/bounds-3.c
@@ -1,6 +1,7 @@
/* PR sanitizer/70875 */
/* { dg-do run } */
-/* { dg-options "-fsanitize=bounds" } */
+/* { dg-options "-fsanitize=bounds -fno-sanitize-recover=bounds" } */
+/* { dg-shouldfail "ubsan" } */
int
foo (int n, int k)
diff --git a/gcc/testsuite/gcc.dg/uninit-pr81782.c b/gcc/testsuite/gcc.dg/uninit-pr81782.c
new file mode 100644
index 00000000000..7d1e90203f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr81782.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-Wmaybe-uninitialized" } */
+
+int
+foo (void)
+{
+ char empty_array[] = { };
+ int i, ret = 0;
+
+ for (i = 0; i < (int) (sizeof (empty_array) / sizeof (empty_array[0])); i++)
+ ret = empty_array[i]; /* { dg-bogus "uninitialized" } */
+
+ return ret;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr83370.c b/gcc/testsuite/gcc.target/aarch64/pr83370.c
new file mode 100644
index 00000000000..001373c4d39
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr83370.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+typedef void (*fun) (void);
+
+void
+f (fun x1)
+{
+ register fun x2 asm ("x16");
+ int arr[5000];
+ int *volatile ptr = arr;
+ asm ("mov %0, %1" : "=r" (x2) : "r" (x1));
+ x2 ();
+}
+
+void g (void) {}
+
+int
+main (void)
+{
+ f (g);
+}
diff --git a/gcc/testsuite/gcc.target/arm/neon-combine-sub-abs-into-vabd.c b/gcc/testsuite/gcc.target/arm/neon-combine-sub-abs-into-vabd.c
index fe3d78b308c..784714f0e87 100644
--- a/gcc/testsuite/gcc.target/arm/neon-combine-sub-abs-into-vabd.c
+++ b/gcc/testsuite/gcc.target/arm/neon-combine-sub-abs-into-vabd.c
@@ -12,31 +12,3 @@ float32x2_t f_sub_abs_to_vabd_32(float32x2_t val1, float32x2_t val2)
return res;
}
/* { dg-final { scan-assembler "vabd\.f32" } }*/
-
-#include <arm_neon.h>
-int8x8_t sub_abs_to_vabd_8(int8x8_t val1, int8x8_t val2)
-{
- int8x8_t sres = vsub_s8(val1, val2);
- int8x8_t res = vabs_s8 (sres);
-
- return res;
-}
-/* { dg-final { scan-assembler "vabd\.s8" } }*/
-
-int16x4_t sub_abs_to_vabd_16(int16x4_t val1, int16x4_t val2)
-{
- int16x4_t sres = vsub_s16(val1, val2);
- int16x4_t res = vabs_s16 (sres);
-
- return res;
-}
-/* { dg-final { scan-assembler "vabd\.s16" } }*/
-
-int32x2_t sub_abs_to_vabd_32(int32x2_t val1, int32x2_t val2)
-{
- int32x2_t sres = vsub_s32(val1, val2);
- int32x2_t res = vabs_s32 (sres);
-
- return res;
-}
-/* { dg-final { scan-assembler "vabd\.s32" } }*/
diff --git a/gcc/testsuite/gcc.target/arm/pr83687.c b/gcc/testsuite/gcc.target/arm/pr83687.c
new file mode 100644
index 00000000000..42754138660
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr83687.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_neon } */
+
+#include <arm_neon.h>
+
+__attribute__ ((noinline)) int8_t
+testFunction1 (int8_t a, int8_t b)
+{
+ volatile int8x16_t sub = vsubq_s8 (vdupq_n_s8 (a), vdupq_n_s8 (b));
+ int8x16_t abs = vabsq_s8 (sub);
+ return vgetq_lane_s8 (abs, 0);
+}
+
+__attribute__ ((noinline)) int8_t
+testFunction2 (int8_t a, int8_t b)
+{
+ int8x16_t sub = vsubq_s8 (vdupq_n_s8 (a), vdupq_n_s8 (b));
+ int8x16_t abs = vabsq_s8 (sub);
+ return vgetq_lane_s8 (abs, 0);
+}
+
+int
+main (void)
+{
+ if (testFunction1 (-100, 100) != testFunction2 (-100, 100))
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c
new file mode 100644
index 00000000000..536e81e17db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c
@@ -0,0 +1,14 @@
+/* PR target/84524 */
+/* { dg-do run { target avx512bw } } */
+/* { dg-options "-O3 -mavx512bw" } */
+
+#include "avx512bw-check.h"
+
+#define main() do_main()
+#include "../../gcc.c-torture/execute/pr84524.c"
+
+static void
+avx512bw_test (void)
+{
+ do_main ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/i386.exp b/gcc/testsuite/gcc.target/i386/i386.exp
index eae253192ad..ec13306b1ed 100644
--- a/gcc/testsuite/gcc.target/i386/i386.exp
+++ b/gcc/testsuite/gcc.target/i386/i386.exp
@@ -241,18 +241,6 @@ proc check_effective_target_rtm { } {
} "-mrtm" ]
}
-# Return 1 if avx512f instructions can be compiled.
-proc check_effective_target_avx512f { } {
- return [check_no_compiler_messages avx512f object {
- typedef long long __v8di __attribute__ ((__vector_size__ (64)));
- __v8di
- mm512_and_epi64 (__v8di __X, __v8di __Y)
- {
- return __builtin_ia32_pandq512_mask (__X, __Y, __X, -1);
- }
- } "-mavx512f" ]
-}
-
# Return 1 if avx512vl instructions can be compiled.
proc check_effective_target_avx512vl { } {
return [check_no_compiler_messages avx512vl object {
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
new file mode 100644
index 00000000000..6e94d2c4865
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
new file mode 100644
index 00000000000..a0674bd2363
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mfunction-return=keep -mcmodel=large" } */
+
+void
+bar (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
new file mode 100644
index 00000000000..3c467078964
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
new file mode 100644
index 00000000000..2c7fb52b59d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
new file mode 100644
index 00000000000..0d3f895009d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
new file mode 100644
index 00000000000..fb26c005e80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
+
+extern void bar (void);
+
+void
+foo (void)
+{
+ bar ();
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
new file mode 100644
index 00000000000..aa03fbd8446
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */
+
+extern void bar (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 { target x32 } } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
new file mode 100644
index 00000000000..3c72036dbaf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+void func0 (void);
+void func1 (void);
+void func2 (void);
+void func3 (void);
+void func4 (void);
+void func4 (void);
+void func5 (void);
+
+void
+bar (int i)
+{
+ switch (i)
+ {
+ default:
+ func0 ();
+ break;
+ case 1:
+ func1 ();
+ break;
+ case 2:
+ func2 ();
+ break;
+ case 3:
+ func3 ();
+ break;
+ case 4:
+ func4 ();
+ break;
+ case 5:
+ func5 ();
+ break;
+ }
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
new file mode 100644
index 00000000000..7a80a8986e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=thunk -mfunction-return=keep -mcmodel=large" } */
+
+void
+bar (void)
+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
new file mode 100644
index 00000000000..d4d45c5114d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mfunction-return=keep -mcmodel=large" } */
+
+void
+bar (void)
+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
new file mode 100644
index 00000000000..7106407b83d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+extern void male_indirect_jump (long)
+ __attribute__ ((indirect_branch("thunk")));
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
new file mode 100644
index 00000000000..3a2aeaddbc5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+__attribute__ ((indirect_branch("thunk-extern")))
+void
+bar (void)
+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
new file mode 100644
index 00000000000..8e52f032b6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+__attribute__ ((indirect_branch("thunk-inline")))
+void
+bar (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
new file mode 100644
index 00000000000..27c7e5b029b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+__attribute__ ((indirect_branch("thunk")))
+void
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
new file mode 100644
index 00000000000..89a2bac8403
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+extern int male_indirect_jump (long)
+ __attribute__ ((indirect_branch("thunk-inline")));
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
new file mode 100644
index 00000000000..3eb83c3779a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+__attribute__ ((indirect_branch("thunk-inline")))
+int
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
new file mode 100644
index 00000000000..0098dd1133d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+extern int male_indirect_jump (long)
+ __attribute__ ((indirect_branch("thunk-extern")));
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
new file mode 100644
index 00000000000..ece8de15a4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+__attribute__ ((indirect_branch("thunk-extern")))
+int
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
new file mode 100644
index 00000000000..d53fc887dcc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */
+
+void func0 (void);
+void func1 (void);
+void func2 (void);
+void func3 (void);
+void func4 (void);
+void func4 (void);
+void func5 (void);
+
+__attribute__ ((indirect_branch("thunk-extern")))
+void
+bar (int i)
+{
+ switch (i)
+ {
+ default:
+ func0 ();
+ break;
+ case 1:
+ func1 ();
+ break;
+ case 2:
+ func2 ();
+ break;
+ case 3:
+ func3 ();
+ break;
+ case 4:
+ func4 ();
+ break;
+ case 5:
+ func5 ();
+ break;
+ }
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
new file mode 100644
index 00000000000..d730d31bda1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+void func0 (void);
+void func1 (void);
+void func2 (void);
+void func3 (void);
+void func4 (void);
+void func4 (void);
+void func5 (void);
+
+__attribute__ ((indirect_branch("keep")))
+void
+bar (int i)
+{
+ switch (i)
+ {
+ default:
+ func0 ();
+ break;
+ case 1:
+ func1 ();
+ break;
+ case 2:
+ func2 ();
+ break;
+ case 3:
+ func3 ();
+ break;
+ case 4:
+ func4 ();
+ break;
+ case 5:
+ func5 ();
+ break;
+ }
+}
+
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
new file mode 100644
index 00000000000..bdaa4f6911b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+__attribute__ ((indirect_branch("thunk")))
+void
+bar (void)
+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
new file mode 100644
index 00000000000..73d16baddc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
+
+void (*dispatch) (char *);
+char buf[10];
+
+void
+foo (void)
+{
+ dispatch (buf);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "bnd ret" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
new file mode 100644
index 00000000000..856751ac224
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
+
+void (*dispatch) (char *);
+char buf[10];
+
+int
+foo (void)
+{
+ dispatch (buf);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "bnd ret" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
new file mode 100644
index 00000000000..42312f65588
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
+
+void bar (char *);
+char buf[10];
+
+void
+foo (void)
+{
+ bar (buf);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */
+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "bnd ret" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
new file mode 100644
index 00000000000..c8ca102c8df
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */
+
+void bar (char *);
+char buf[10];
+
+int
+foo (void)
+{
+ bar (buf);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */
+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */
+/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 1 } } */
+/* { dg-final { scan-assembler "bnd ret" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
new file mode 100644
index 00000000000..c09dd0afd2d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
new file mode 100644
index 00000000000..826425a5115
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
new file mode 100644
index 00000000000..385626850a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
new file mode 100644
index 00000000000..1ae49b137ca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
new file mode 100644
index 00000000000..53282390977
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
+
+extern void bar (void);
+
+void
+foo (void)
+{
+ bar ();
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
new file mode 100644
index 00000000000..8ae43482d0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */
+
+extern void bar (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
new file mode 100644
index 00000000000..2b9a33e93dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+void func0 (void);
+void func1 (void);
+void func2 (void);
+void func3 (void);
+void func4 (void);
+void func4 (void);
+void func5 (void);
+
+void
+bar (int i)
+{
+ switch (i)
+ {
+ default:
+ func0 ();
+ break;
+ case 1:
+ func1 ();
+ break;
+ case 2:
+ func2 ();
+ break;
+ case 3:
+ func3 ();
+ break;
+ case 4:
+ func4 ();
+ break;
+ case 5:
+ func5 ();
+ break;
+ }
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
new file mode 100644
index 00000000000..869d9040838
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
new file mode 100644
index 00000000000..c5c16ed8bd8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
new file mode 100644
index 00000000000..4a63ebed8ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
new file mode 100644
index 00000000000..a395ffca018
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch[256];
+
+int
+male_indirect_jump (long offset)
+{
+ dispatch[offset](offset);
+ return 0;
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
new file mode 100644
index 00000000000..21cbfd39582
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
+
+extern void bar (void);
+
+void
+foo (void)
+{
+ bar ();
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
new file mode 100644
index 00000000000..d1300f18dc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */
+
+extern void bar (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
new file mode 100644
index 00000000000..ea009245a58
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+void func0 (void);
+void func1 (void);
+void func2 (void);
+void func3 (void);
+void func4 (void);
+void func4 (void);
+void func5 (void);
+
+void
+bar (int i)
+{
+ switch (i)
+ {
+ default:
+ func0 ();
+ break;
+ case 1:
+ func1 ();
+ break;
+ case 2:
+ func2 ();
+ break;
+ case 3:
+ func3 ();
+ break;
+ case 4:
+ func4 ();
+ break;
+ case 5:
+ func5 ();
+ break;
+ }
+}
+
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
new file mode 100644
index 00000000000..7d396a31953
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mindirect-branch=thunk -mindirect-branch-register -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk\n" } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk_bnd\n" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
new file mode 100644
index 00000000000..e7e616bb271
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mindirect-branch-register -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
new file mode 100644
index 00000000000..5320e923be2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mindirect-branch-register -fno-pic" } */
+
+typedef void (*dispatch_t)(long offset);
+
+dispatch_t dispatch;
+
+void
+male_indirect_jump (long offset)
+{
+ dispatch(offset);
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
+/* { dg-final { scan-assembler-not {\t(pause|pause|nop)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
new file mode 100644
index 00000000000..f0cd9b75be8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mindirect-branch=keep -fno-pic" } */
+
+extern void (*func_p) (void);
+
+void
+foo (void)
+{
+ asm("call __x86_indirect_thunk_%V0" : : "a" (func_p));
+}
+
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_eax" { target ia32 } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_rax" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr81481.c b/gcc/testsuite/gcc.target/i386/pr81481.c
new file mode 100644
index 00000000000..a5b936fdacc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr81481.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ssse3 } */
+/* { dg-options "-O2 -fpic -mssse3" } */
+/* { dg-final { scan-assembler-not "pshufb\[ \t\]\\(%esp\\)" } } */
+#include <immintrin.h>
+
+extern const signed char c[31] __attribute__((visibility("hidden")));
+
+__m128i f(__m128i *x, void *v)
+{
+ int i;
+ asm("# %0" : "=r"(i));
+ __m128i t = _mm_loadu_si128((void*)&c[i]);
+ __m128i xx = *x;
+ xx = _mm_shuffle_epi8(xx, t);
+ asm("# %0 %1 %2" : "+x"(xx) : "r"(c), "r"(i));
+ return xx;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82795.c b/gcc/testsuite/gcc.target/i386/pr82795.c
new file mode 100644
index 00000000000..9e7fec74699
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82795.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2" } */
+
+void
+sj (int qh, int rn, int *by)
+{
+ for (;;)
+ if (qh != 0)
+ {
+ int dc;
+
+ for (dc = 0; dc < 17; ++dc)
+ {
+ int nn;
+
+ nn = (rn != 0) ? qh : dc;
+ if (nn != 0)
+ qh = nn;
+ else
+ qh = (qh != 0) ? *by : dc;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr83330.c b/gcc/testsuite/gcc.target/i386/pr83330.c
new file mode 100644
index 00000000000..9040168377a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr83330.c
@@ -0,0 +1,29 @@
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O2 -fno-tree-dce -mno-push-args" } */
+
+typedef unsigned long long u64;
+typedef unsigned __int128 u128;
+
+u64 v;
+u64 g;
+
+u64 __attribute__ ((noinline, noclone))
+bar (u128 d, u64 e, u64 f, u64 g, u128 h)
+{
+ (void)d, (void)e, (void)f, (void)g, (void)h;
+ return 0;
+}
+
+static u64
+foo (void)
+{
+ (void)(v - bar (0, 0, 0, 0, 0));
+ return g;
+}
+
+int
+main (void)
+{
+ (void)foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr84310-2.c b/gcc/testsuite/gcc.target/i386/pr84310-2.c
new file mode 100644
index 00000000000..dbf5db6ff87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr84310-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -malign-loops=16" } */
+/* { dg-warning "is obsolete" "" { target *-*-* } 0 } */
+
+void
+c (void)
+{
+ for (;;)
+ ;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr84310.c b/gcc/testsuite/gcc.target/i386/pr84310.c
new file mode 100644
index 00000000000..f82327e45f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr84310.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -falign-functions=100000" } */
+/* { dg-error "is not between 0 and 65536" "" { target *-*-* } 0 } */
+
+void
+test_func (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr84625.c b/gcc/testsuite/gcc.target/i386/pr84625.c
new file mode 100644
index 00000000000..600a6f15a9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr84625.c
@@ -0,0 +1,12 @@
+/* PR inline-asm/84625 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef int V __attribute__((vector_size (16)));
+
+void
+foo (void)
+{
+ asm volatile ("# %0" : : "X" ((V) { 1, 2, 3, 4 })); // { dg-error "invalid vector immediate" }
+ asm volatile ("# %0" : : "" ((V) { 2, 3, 4, 5 })); // { dg-error "invalid vector immediate" }
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-1.c b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
new file mode 100644
index 00000000000..7223f67ba5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=thunk" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
new file mode 100644
index 00000000000..af9023af613
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */
+
+extern void (*bar) (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
new file mode 100644
index 00000000000..ba467c59b36
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */
+
+extern void (*bar) (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
new file mode 100644
index 00000000000..43e57cac2c3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */
+
+extern void (*bar) (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
new file mode 100644
index 00000000000..55f156c4376
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */
+
+extern void (*bar) (void);
+extern int foo (void) __attribute__ ((function_return("thunk")));
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */
+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
new file mode 100644
index 00000000000..1c790436a53
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */
+
+extern void (*bar) (void);
+
+__attribute__ ((function_return("thunk-inline")))
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
new file mode 100644
index 00000000000..58aba319cba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */
+
+extern void (*bar) (void);
+
+__attribute__ ((function_return("thunk-extern"), indirect_branch("thunk")))
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-times {\tpause} 1 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-16.c b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
new file mode 100644
index 00000000000..a16cad16aaa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk-extern -fno-pic" } */
+
+extern void (*bar) (void);
+
+__attribute__ ((function_return("keep"), indirect_branch("keep")))
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */
+/* { dg-final { scan-assembler-not "__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-17.c b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
new file mode 100644
index 00000000000..0605e2c6542
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=keep -mcmodel=large" } */
+
+void
+bar (void)
+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-18.c b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
new file mode 100644
index 00000000000..307019dc242
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+void
+bar (void)
+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-19.c b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
new file mode 100644
index 00000000000..772617f4010
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
+
+__attribute__ ((function_return("thunk")))
+void
+bar (void)
+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-2.c b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
new file mode 100644
index 00000000000..c6659e3ad09
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-20.c b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
new file mode 100644
index 00000000000..1e9f9bd5a66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+__attribute__ ((function_return("thunk-extern")))
+void
+bar (void)
+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-21.c b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
new file mode 100644
index 00000000000..eea07f7abe1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { lp64 } } } */
+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */
+/* { dg-additional-options "-fPIC" { target fpic } } */
+
+__attribute__ ((function_return("thunk-inline")))
+void
+bar (void)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-22.c b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c
new file mode 100644
index 00000000000..89e086de97b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c
@@ -0,0 +1,15 @@
+/* PR target/r84530 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mfunction-return=thunk" } */
+
+struct s { _Complex unsigned short x; };
+struct s gs = { 100 + 200i };
+struct s __attribute__((noinline)) foo (void) { return gs; }
+
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-23.c b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c
new file mode 100644
index 00000000000..43f0ccaa854
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c
@@ -0,0 +1,15 @@
+/* PR target/r84530 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */
+
+struct s { _Complex unsigned short x; };
+struct s gs = { 100 + 200i };
+struct s __attribute__((noinline)) foo (void) { return gs; }
+
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not {\tpause} } } */
+/* { dg-final { scan-assembler-not {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-24.c b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c
new file mode 100644
index 00000000000..8729e35147e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c
@@ -0,0 +1,15 @@
+/* PR target/r84530 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
+
+struct s { _Complex unsigned short x; };
+struct s gs = { 100 + 200i };
+struct s __attribute__((noinline)) foo (void) { return gs; }
+
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk_ecx" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-25.c b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c
new file mode 100644
index 00000000000..f73553c9a9f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c
@@ -0,0 +1,15 @@
+/* PR target/r84530 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mfunction-return=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */
+
+struct s { _Complex unsigned short x; };
+struct s gs = { 100 + 200i };
+struct s __attribute__((noinline)) foo (void) { return gs; }
+
+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */
+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_bnd_ecx" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
new file mode 100644
index 00000000000..9144e988735
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c
@@ -0,0 +1,40 @@
+/* PR target/r84530 */
+/* { dg-do run } */
+/* { dg-options "-Os -mfunction-return=thunk" } */
+
+struct S { int i; };
+__attribute__((const, noinline, noclone))
+struct S foo (int x)
+{
+ struct S s;
+ s.i = x;
+ return s;
+}
+
+int a[2048], b[2048], c[2048], d[2048];
+struct S e[2048];
+
+__attribute__((noinline, noclone)) void
+bar (void)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ e[i] = foo (i);
+ a[i+2] = a[i] + a[i+1];
+ b[10] = b[10] + i;
+ c[i] = c[2047 - i];
+ d[i] = d[i + 1];
+ }
+}
+
+int
+main ()
+{
+ int i;
+ bar ();
+ for (i = 0; i < 1024; i++)
+ if (e[i].i != i)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-3.c b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
new file mode 100644
index 00000000000..0f7f388f459
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-4.c b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
new file mode 100644
index 00000000000..9ae37e835a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=keep" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-5.c b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
new file mode 100644
index 00000000000..4bd0d2a27bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=keep" } */
+
+extern void foo (void) __attribute__ ((function_return("thunk")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-6.c b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
new file mode 100644
index 00000000000..053841f6f7d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=keep" } */
+
+__attribute__ ((function_return("thunk-inline")))
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler {\tpause} } } */
+/* { dg-final { scan-assembler {\tlfence} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-7.c b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
new file mode 100644
index 00000000000..262e6780112
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=keep" } */
+
+__attribute__ ((function_return("thunk-extern")))
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-8.c b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
new file mode 100644
index 00000000000..c1658e96673
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */
+
+extern void foo (void) __attribute__ ((function_return("keep")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */
+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
new file mode 100644
index 00000000000..d2df8b874e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */
+
+extern void (*bar) (void);
+
+int
+foo (void)
+{
+ bar ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */
+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
+/* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */
+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */
+/* { dg-final { scan-assembler-times {\tpause} 2 } } */
+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */
+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */
+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */
diff --git a/gcc/testsuite/gcc.target/msp430/pr79242.c b/gcc/testsuite/gcc.target/msp430/pr79242.c
new file mode 100644
index 00000000000..d7ff8d38a3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/pr79242.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { "*-*-*" } { "-mcpu=msp430" "-msmall" } { "" } } */
+/* { dg-options "-mcpu=msp430x" } */
+
+typedef _Complex __int20 C;
+
+C
+foo (C x, C y)
+{
+ return x + y;
+}
diff --git a/gcc/testsuite/gcc.target/nvptx/indirect_call.c b/gcc/testsuite/gcc.target/nvptx/indirect_call.c
new file mode 100644
index 00000000000..39992a7137b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/indirect_call.c
@@ -0,0 +1,19 @@
+/* { dg-options "-O2 -msoft-stack" } */
+/* { dg-do run } */
+
+int
+f1 (int a)
+{
+ return a + 1;
+}
+
+int (*f2)(int) = f1;
+
+int
+main ()
+{
+ if (f2 (100) != 101)
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
index 90e573d2654..92b8f9a9154 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mcpu=power8" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
index e3db2da655c..25a94bca612 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mcpu=power9" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3.c b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
index bddd0ac91cc..01aa862aaa8 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-maltivec -mvsx" } */
+/* { dg-options "-O2 -mvsx -mcpu=power6" } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power6" } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c
new file mode 100644
index 00000000000..137b46b052a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c
@@ -0,0 +1,169 @@
+/* { dg-do run { target { powerpc*-*-* && p9vector_hw } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mcpu=power9 -O2" } */
+
+#include <altivec.h>
+#define TRUE 1
+#define FALSE 0
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#define EXTRACT 0
+
+void abort (void);
+
+int result_wrong_ull (vector unsigned long long vec_expected,
+ vector unsigned long long vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 2; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+int result_wrong_uc (vector unsigned char vec_expected,
+ vector unsigned char vec_actual)
+{
+ int i;
+
+ for (i = 0; i < 16; i++)
+ if (vec_expected[i] != vec_actual[i])
+ return TRUE;
+
+ return FALSE;
+}
+
+#ifdef DEBUG
+void print_ull (vector unsigned long long vec_expected,
+ vector unsigned long long vec_actual)
+{
+ int i;
+
+ printf("expected unsigned long long data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %lld,", vec_expected[i]);
+
+ printf("\nactual signed char data\n");
+ for (i = 0; i < 2; i++)
+ printf(" %lld,", vec_actual[i]);
+ printf("\n");
+}
+
+void print_uc (vector unsigned char vec_expected,
+ vector unsigned char vec_actual)
+{
+ int i;
+
+ printf("expected unsigned char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_expected[i]);
+
+ printf("\nactual unsigned char data\n");
+ for (i = 0; i < 16; i++)
+ printf(" %d,", vec_actual[i]);
+ printf("\n");
+}
+#endif
+
+#if EXTRACT
+vector unsigned long long
+vext (vector unsigned char *vc)
+{
+ return vextract_si_vchar (*vc, 5);
+}
+#endif
+
+int main()
+{
+ vector signed int vsi_arg;
+ vector unsigned char vec_uc_arg, vec_uc_result, vec_uc_expected;
+ vector unsigned long long vec_ull_result, vec_ull_expected;
+ unsigned long long ull_result, ull_expected;
+
+ vec_uc_arg = (vector unsigned char){1, 2, 3, 4,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16};
+
+ vsi_arg = (vector signed int){0xA, 0xB, 0xC, 0xD};
+
+ vec_uc_expected = (vector unsigned char){0xC, 0, 0, 0,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16};
+ /* Test vec_insert4b() */
+ /* Insert into char 0 location */
+ vec_uc_result = vec_insert4b (vsi_arg, vec_uc_arg, 0);
+
+ if (result_wrong_uc(vec_uc_expected, vec_uc_result))
+ {
+#ifdef DEBUG
+ printf("Error: vec_insert4b pos 0, result does not match expected result\n");
+ print_uc (vec_uc_expected, vec_uc_result);
+#else
+ abort();
+#endif
+ }
+
+ /* insert into char 4 location */
+ vec_uc_expected = (vector unsigned char){1, 2, 3, 4,
+ 0xC, 0, 0, 0,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16};
+ vec_uc_result = vec_insert4b (vsi_arg, vec_uc_arg, 4);
+
+ if (result_wrong_uc(vec_uc_expected, vec_uc_result))
+ {
+#ifdef DEBUG
+ printf("Error: vec_insert4b pos 4, result does not match expected result\n");
+ print_uc (vec_uc_expected, vec_uc_result);
+#else
+ abort();
+#endif
+ }
+
+ /* Test vec_extract4b() */
+ /* Extract 4b, from char 0 location */
+ vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
+ 20, 0, 0, 0,
+ 30, 0, 0, 0,
+ 40, 0, 0, 0};
+
+ vec_ull_expected = (vector unsigned long long){0, 10};
+ vec_ull_result = vec_extract4b(vec_uc_arg, 0);
+
+ if (result_wrong_ull(vec_ull_expected, vec_ull_result))
+ {
+#ifdef DEBUG
+ printf("Error: vec_extract4b pos 0, result does not match expected result\n");
+ print_ull (vec_ull_expected, vec_ull_result);
+#else
+ abort();
+#endif
+ }
+
+ /* Extract 4b, from char 12 location */
+ vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
+ 20, 0, 0, 0,
+ 30, 0, 0, 0,
+ 40, 0, 0, 0};
+
+ vec_ull_expected = (vector unsigned long long){0, 40};
+ vec_ull_result = vec_extract4b(vec_uc_arg, 12);
+
+ if (result_wrong_ull(vec_ull_expected, vec_ull_result))
+ {
+#ifdef DEBUG
+ printf("Error: vec_extract4b pos 12, result does not match expected result\n");
+ print_ull (vec_ull_expected, vec_ull_result);
+#else
+ abort();
+#endif
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p8.c
index a133c5d90fe..b1cf0a78628 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p8.c
@@ -4,7 +4,9 @@
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-require-effective-target int128 } */
-/* { dg-options "-maltivec -mvsx -mpower8-vector" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mpower8-vector -mcpu=power8 -O2" } */
/* { dg-additional-options "-maix64" { target powerpc-ibm-aix* } } */
#include "altivec.h"
@@ -21,5 +23,5 @@ test2 (vector unsigned __int128 x, vector unsigned __int128 y)
return vec_mul (x, y);
}
-/* { dg-final { scan-assembler-times "\[ \t\]mulld " 6 } } */
-/* { dg-final { scan-assembler-times "\[ \t\]mulhdu" 2 } } */
+/* { dg-final { scan-assembler-times {\mmulld\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mmulhdu\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p9.c
index 96c9d019682..657188435d4 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-mult-int128-p9.c
@@ -2,10 +2,10 @@
inputs produce the right results. */
/* { dg-do compile } */
-/* { dg-require-effective-target powerpc_float128_hw_ok } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-require-effective-target int128 } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
-/* { dg-options "-maltivec -mvsx -mcpu=power9 -O2" } */
+/* { dg-options "-mpower9-vector -mcpu=power9 -O2" } */
/* { dg-additional-options "-maix64" { target powerpc-ibm-aix* } } */
#include "altivec.h"
@@ -22,4 +22,5 @@ test2 (vector unsigned __int128 x, vector unsigned __int128 y)
return vec_mul (x, y);
}
-/* { dg-final { scan-assembler-times "\[ \t\]xsmulqp" 2 } } */
+/* { dg-final { scan-assembler-times {\mmulld\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mmulhdu\M} 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
index 71dd0a24ae1..6a7baf31b43 100644
--- a/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
+++ b/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c
@@ -6,7 +6,7 @@
/* { dg-options "-O0 -Wno-deprecated" } */
/* { dg-final { scan-assembler-times "lvsl" 2 } } */
/* { dg-final { scan-assembler-times "lvsr" 2 } } */
-/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 2 } } */
/* { dg-final { scan-assembler-times "vperm" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-1.c
deleted file mode 100644
index fa1ba754705..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-1.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
-/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-options "-mcpu=power9 -O2" } */
-
-#include <altivec.h>
-
-vector signed char
-vins_v4si (vector int *vi, vector signed char *vc)
-{
- return vec_vinsert4b (*vi, *vc, 1);
-}
-
-vector unsigned char
-vins_di (long di, vector unsigned char *vc)
-{
- return vec_vinsert4b (di, *vc, 2);
-}
-
-vector char
-vins_di2 (long *p_di, vector char *vc)
-{
- return vec_vinsert4b (*p_di, *vc, 3);
-}
-
-vector unsigned char
-vins_di0 (vector unsigned char *vc)
-{
- return vec_vinsert4b (0, *vc, 4);
-}
-
-long
-vext (vector signed char *vc)
-{
- return vec_vextract4b (*vc, 5);
-}
-
-/* { dg-final { scan-assembler "xxextractuw\|vextuw\[lr\]x" } } */
-/* { dg-final { scan-assembler "xxinsertw" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-2.c b/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-2.c
deleted file mode 100644
index 3b5872ebec6..00000000000
--- a/gcc/testsuite/gcc.target/powerpc/p9-vinsert4b-2.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
-/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-options "-mcpu=power9 -O2" } */
-
-#include <altivec.h>
-
-vector signed char
-ins_v4si (vector int vi, vector signed char vc)
-{
- return vec_vinsert4b (vi, vc, 13); /* { dg-error "vec_vinsert4b" } */
-}
-
-vector unsigned char
-ins_di (long di, vector unsigned char vc, long n)
-{
- return vec_vinsert4b (di, vc, n); /* { dg-error "vec_vinsert4b" } */
-}
-
-long
-vext1 (vector signed char vc)
-{
- return vec_vextract4b (vc, 13); /* { dg-error "vec_vextract4b" } */
-}
-
-long
-vextn (vector unsigned char vc, long n)
-{
- return vec_vextract4b (vc, n); /* { dg-error "vec_vextract4b" } */
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr81572.c b/gcc/testsuite/gcc.target/powerpc/pr81572.c
new file mode 100644
index 00000000000..de00c187d62
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr81572.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target powerpc64*-*-* } } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler-not "xxlor" } } */
+
+#include <altivec.h>
+
+typedef __vector unsigned char nvec_t;
+
+long testz_and(nvec_t a, nvec_t b)
+{
+ nvec_t c = vec_andc(a, b);
+ return vec_all_eq(a, c);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83399.c b/gcc/testsuite/gcc.target/powerpc/pr83399.c
new file mode 100644
index 00000000000..96d9b382184
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83399.c
@@ -0,0 +1,15 @@
+/* PR target/83399 */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O1 -mabi=elfv2 -mlittle -mvsx" } */
+
+typedef __attribute__((altivec(vector__))) int v4si_t;
+int
+foo (void)
+{
+ v4si_t a, u, v, y;
+ u = __builtin_altivec_lvx (32, ((void *) &a) - 32);
+ v = __builtin_altivec_lvx (64, ((void *) &a) - 32);
+ y = u + v;
+ return y[0];
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83629.c b/gcc/testsuite/gcc.target/powerpc/pr83629.c
new file mode 100644
index 00000000000..ae00e145952
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83629.c
@@ -0,0 +1,10 @@
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fPIC -frename-registers --param=sched-autopref-queue-depth=0 -mcpu=603" } */
+
+extern void bar (void *);
+
+void
+foo (void)
+{
+ bar ("");
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83862.c b/gcc/testsuite/gcc.target/powerpc/pr83862.c
new file mode 100644
index 00000000000..ac97e6aa5b4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83862.c
@@ -0,0 +1,34 @@
+/* PR target/83862.c */
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mpower9-vector -O2 -mfloat128" } */
+
+/* On little endian systems, optimizing signbit of IEEE 128-bit values from
+ memory could abort if the memory address was indexed (reg+reg). The
+ optimization is only on 64-bit machines with direct move.
+
+ Compile with -g -O2 -mabi=ieeelongdouble -Wno-psabi. */
+
+#ifndef TYPE
+#define TYPE __float128
+#endif
+
+int sbr (TYPE a) { return __builtin_signbit (a); }
+int sbm (TYPE *a) { return __builtin_signbit (*a); }
+int sbo (TYPE *a) { return __builtin_signbit (a[4]); }
+int sbi (TYPE *a, unsigned long n) { return __builtin_signbit (a[n]); }
+void sbs (int *p, TYPE a) { *p = __builtin_signbit (a); }
+
+/* On big endian systems, this will generate 2 LDs and 1 LDX, while on
+ little endian systems, this will generate 3 LDs and an ADD. */
+
+/* { dg-final { scan-assembler-times {\mldx?\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mmfvsrd\M} 2 } } */
+/* { dg-final { scan-assembler-times {\msrdi\M} 5 } } */
+/* { dg-final { scan-assembler-not {\mmfvsrld\M} } } */
+/* { dg-final { scan-assembler-not {\mstxvx?\M} } } */
+/* { dg-final { scan-assembler-not {\mstxvw4x\M} } } */
+/* { dg-final { scan-assembler-not {\mstxvd2x\M} } } */
+/* { dg-final { scan-assembler-not {\mstvx\M} } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84154-1.c b/gcc/testsuite/gcc.target/powerpc/pr84154-1.c
new file mode 100644
index 00000000000..c7c61be0def
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84154-1.c
@@ -0,0 +1,55 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mpower8-vector -O2" } */
+
+/* PR target/84154. Make sure conversion to char/short does not generate a
+ store and a load on ISA 2.07 and newer systems. */
+
+unsigned char
+double_to_uc (double x)
+{
+ return x;
+}
+
+signed char
+double_to_sc (double x)
+{
+ return x;
+}
+
+unsigned short
+double_to_us (double x)
+{
+ return x;
+}
+
+short
+double_to_ss (double x)
+{
+ return x;
+}
+
+unsigned int
+double_to_ui (double x)
+{
+ return x;
+}
+
+int
+double_to_si (double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\mextsb\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mextsh\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mmfvsrwz\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mrlwinm\M} 2 } } */
+/* { dg-final { scan-assembler-not {\mlbz\M} } } */
+/* { dg-final { scan-assembler-not {\mlhz\M} } } */
+/* { dg-final { scan-assembler-not {\mlha\M} } } */
+/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */
+/* { dg-final { scan-assembler-not {\mstw\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84154-2.c b/gcc/testsuite/gcc.target/powerpc/pr84154-2.c
new file mode 100644
index 00000000000..619777ce8dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84154-2.c
@@ -0,0 +1,58 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+/* PR target/84154. Make sure on ISA 2.07 (power8) that we store the result of
+ a conversion to char/short using an offsettable address does not generate
+ direct moves for storing 32-bit integers, but does do a direct move for
+ 8/16-bit integers. */
+
+void
+double_to_uc (double x, unsigned char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_sc (double x, signed char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_us (double x, unsigned short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ss (double x, short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ui (double x, unsigned int *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_si (double x, int *p)
+{
+ p[3] = x;
+}
+
+/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mmfvsrwz\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstb\M} 2 } } */
+/* { dg-final { scan-assembler-times {\msth\M} 2 } } */
+/* { dg-final { scan-assembler-not {\mlbz\M} } } */
+/* { dg-final { scan-assembler-not {\mlhz\M} } } */
+/* { dg-final { scan-assembler-not {\mlha\M} } } */
+/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */
+/* { dg-final { scan-assembler-not {\mstw\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84154-3.c b/gcc/testsuite/gcc.target/powerpc/pr84154-3.c
new file mode 100644
index 00000000000..0361e2f1b51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84154-3.c
@@ -0,0 +1,60 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-options "-mcpu=power9 -O2" } */
+
+/* PR target/84154. Make sure on ISA 3.0 we store the result of a conversion
+ to char/short using an offsettable address does not generate direct moves
+ for storing 8/16/32-bit integers. */
+
+void
+double_to_uc (double x, unsigned char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_sc (double x, signed char *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_us (double x, unsigned short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ss (double x, short *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_ui (double x, unsigned int *p)
+{
+ p[3] = x;
+}
+
+void
+double_to_si (double x, int *p)
+{
+ p[3] = x;
+}
+
+/* { dg-final { scan-assembler-times {\maddi\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstxsibx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstxsihx\M} 2 } } */
+/* { dg-final { scan-assembler-not {\mlbz\M} } } */
+/* { dg-final { scan-assembler-not {\mlhz\M} } } */
+/* { dg-final { scan-assembler-not {\mlha\M} } } */
+/* { dg-final { scan-assembler-not {\mmfvsrwz\M} } } */
+/* { dg-final { scan-assembler-not {\mmfvsrd\M} } } */
+/* { dg-final { scan-assembler-not {\mstw\M} } } */
+/* { dg-final { scan-assembler-not {\mstb\M} } } */
+/* { dg-final { scan-assembler-not {\msth\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c
new file mode 100644
index 00000000000..16ccfe471f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of indirect calls. */
+
+extern int (*f)();
+
+int bar ()
+{
+ return (*f) ();
+}
+
+/* { dg-final { scan-assembler "crset 2" } } */
+
+/* The AIX and ELFv2 ABIs don't allow a sibcall here. */
+/* { dg-final { scan-assembler "beqctrl-" { target { lp64 || { powerpc*-*-aix* } } } } } */
+
+/* The other ABIs do allow a sibcall. */
+/* { dg-final { scan-assembler "beqctr-" { target { ilp32 && !powerpc*-*-aix* } } } } */
+/* { dg-final { scan-assembler {b \$} { target { ilp32 && !powerpc*-*-aix* } } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c
new file mode 100644
index 00000000000..d3d040fbbf0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-2.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of computed goto. */
+
+int bar (int);
+int baz (int);
+int spaz (int);
+
+int foo (int x)
+{
+ static void *labptr[] = { &&lab0, &&lab1, &&lab2 };
+
+ if (x < 0 || x > 2)
+ return -1;
+
+ goto *labptr[x];
+
+ lab0:
+ return bar (x);
+
+ lab1:
+ return baz (x) + 1;
+
+ lab2:
+ return spaz (x) / 2;
+}
+
+/* The following assumes CR7 as the first chosen volatile. */
+
+/* { dg-final { scan-assembler "crset 30" } } */
+/* { dg-final { scan-assembler "beqctr- 7" } } */
+/* { dg-final { scan-assembler {b \$} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c
new file mode 100644
index 00000000000..c338e30d01a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-3.c
@@ -0,0 +1,53 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of jump tables. */
+
+void bar (void);
+
+int foo (int x)
+{
+ int a;
+
+ switch (x)
+ {
+ default:
+ a = -1;
+ break;
+ case 0:
+ a = x * x;
+ break;
+ case 1:
+ a = x + 1;
+ break;
+ case 2:
+ a = x + x;
+ break;
+ case 3:
+ a = x << 3;
+ break;
+ case 4:
+ a = x >> 1;
+ break;
+ case 5:
+ a = x;
+ break;
+ case 6:
+ a = 0;
+ break;
+ case 7:
+ a = x * x + x;
+ break;
+ }
+
+ bar();
+
+ return a;
+}
+
+/* The following assumes CR7 as the first chosen volatile. */
+
+/* { dg-final { scan-assembler "crset 30" } } */
+/* { dg-final { scan-assembler "beqctr- 7" } } */
+/* { dg-final { scan-assembler {b \$} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c
new file mode 100644
index 00000000000..b55de13af93
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of indirect calls for ELFv2. */
+
+int (*f)();
+
+int __attribute__((noinline)) bar ()
+{
+ return (*f) ();
+}
+
+int g ()
+{
+ return 26;
+}
+
+int main ()
+{
+ f = &g;
+ if (bar () != 26)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-5.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-5.c
new file mode 100644
index 00000000000..fd04ffd56c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-5.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-additional-options "-mno-speculate-indirect-jumps -Wno-pedantic" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of computed goto. */
+
+int __attribute__((noinline)) bar (int i)
+{
+ return 1960 + i;
+}
+
+int __attribute__((noinline)) baz (int i)
+{
+ return i * i;
+}
+
+int __attribute__((noinline)) spaz (int i)
+{
+ return i + 1;
+}
+
+int foo (int x)
+{
+ static void *labptr[] = { &&lab0, &&lab1, &&lab2 };
+
+ if (x < 0 || x > 2)
+ return -1;
+
+ goto *labptr[x];
+
+ lab0:
+ return bar (x);
+
+ lab1:
+ return baz (x) + 1;
+
+ lab2:
+ return spaz (x) / 2;
+}
+
+int main ()
+{
+ if (foo (0) != 1960)
+ __builtin_abort ();
+
+ if (foo (1) != 2)
+ __builtin_abort ();
+
+ if (foo (2) != 1)
+ __builtin_abort ();
+
+ if (foo (3) != -1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-6.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-6.c
new file mode 100644
index 00000000000..1468a4ee20d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-6.c
@@ -0,0 +1,81 @@
+/* { dg-do run } */
+/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of jump tables. */
+
+void __attribute__((noinline)) bar ()
+{
+}
+
+int foo (int x)
+{
+ int a;
+
+ switch (x)
+ {
+ default:
+ a = -1;
+ break;
+ case 0:
+ a = x * x + 3;
+ break;
+ case 1:
+ a = x + 1;
+ break;
+ case 2:
+ a = x + x;
+ break;
+ case 3:
+ a = x << 3;
+ break;
+ case 4:
+ a = x >> 1;
+ break;
+ case 5:
+ a = x;
+ break;
+ case 6:
+ a = 0;
+ break;
+ case 7:
+ a = x * x + x;
+ break;
+ }
+
+ bar();
+
+ return a;
+}
+
+int main ()
+{
+ if (foo (0) != 3)
+ __builtin_abort ();
+
+ if (foo (1) != 2)
+ __builtin_abort ();
+
+ if (foo (2) != 4)
+ __builtin_abort ();
+
+ if (foo (3) != 24)
+ __builtin_abort ();
+
+ if (foo (4) != 2)
+ __builtin_abort ();
+
+ if (foo (5) != 5)
+ __builtin_abort ();
+
+ if (foo (6) != 0)
+ __builtin_abort ();
+
+ if (foo (7) != 56)
+ __builtin_abort ();
+
+ if (foo (8) != -1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c
new file mode 100644
index 00000000000..e7d81d40ff0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-7.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mno-speculate-indirect-jumps" } */
+/* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */
+
+/* Test for deliberate misprediction of indirect calls. */
+
+extern int (*f)();
+
+int bar ()
+{
+ return (*f) () * 53;
+}
+
+/* { dg-final { scan-assembler "crset 2" } } */
+/* { dg-final { scan-assembler "beqctrl-" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c
new file mode 100644
index 00000000000..23494b695a5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c
@@ -0,0 +1,34 @@
+/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2 " } */
+
+typedef __attribute__ ((__aligned__ (8))) unsigned long long __m64;
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+
+/* PR84033. Extracted from xmmintrin.h but with a pointer param to
+ allow swaps to happen when not inline. */
+int __attribute__ ((__noinline__))
+_mm_movemask_ps (__m128 *__A)
+{
+ __vector __m64 result;
+ static const __vector unsigned int perm_mask =
+ {
+ 0x00204060, 0x80808080, 0x80808080, 0x80808080
+ };
+
+ result = (__vector __m64)
+ __builtin_vec_vbpermq ((__vector unsigned char) (*__A),
+ (__vector unsigned char) perm_mask);
+ return result[1];
+}
+
+int
+main (void)
+{
+ union { unsigned int i[4]; __m128 m; } x
+ = { 0x80000000, 0x80000000, 0x7fffffff, 0x7fffffff };
+ if (_mm_movemask_ps (&x.m) != 3)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsxcopy.c b/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
index fbe3c67e7e5..2060046eaf2 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
@@ -1,8 +1,8 @@
/* { dg-do compile { target { powerpc64*-*-* } } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O1 -mvsx" } */
-/* { dg-final { scan-assembler "lxvd2x" } } */
-/* { dg-final { scan-assembler "stxvd2x" } } */
+/* { dg-final { scan-assembler {\mlxvd2x\M|\mlxv\M} } } */
+/* { dg-final { scan-assembler {\mstxvd2x\M|\mstxv\M} } } */
/* { dg-final { scan-assembler-not "xxpermdi" } } */
typedef float vecf __attribute__ ((vector_size (16)));
diff --git a/gcc/testsuite/gcc.target/s390/nobp-function-pointer-attr.c b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-attr.c
new file mode 100644
index 00000000000..db9336d51dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-attr.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-table" } */
+
+int gl;
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ gl = a + 40;
+}
+
+int __attribute__((noinline,noclone))
+foo_value (int a)
+{
+ return a + 40;
+}
+
+void* __attribute__((noinline,noclone))
+get_fptr (int a)
+{
+ switch (a)
+ {
+ case 0: return &foo; break;
+ case 1: return &foo_value; break;
+ default: __builtin_abort ();
+ }
+}
+
+void (*f) (int);
+int (*g) (int);
+
+int __attribute__((indirect_branch_call("thunk")))
+main ()
+{
+ int res;
+
+ f = get_fptr(0);
+ f (2);
+ if (gl != 42)
+ __builtin_abort ();
+
+ g = get_fptr(1);
+ if (g (2) != 42)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 2 x main
+/* { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-function-pointer-nothunk.c b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-nothunk.c
new file mode 100644
index 00000000000..c02b45a2cc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-nothunk.c
@@ -0,0 +1,59 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-call=thunk-extern -mindirect-branch-table" } */
+
+int gl;
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ gl = a + 40;
+}
+
+int __attribute__((noinline,noclone))
+foo_value (int a)
+{
+ return a + 40;
+}
+
+void* __attribute__((noinline,noclone))
+get_fptr (int a)
+{
+ switch (a)
+ {
+ case 0: return &foo; break;
+ case 1: return &foo_value; break;
+ default: __builtin_abort ();
+ }
+}
+
+void (*f) (int);
+int (*g) (int);
+
+int
+main ()
+{
+ int res;
+
+ f = get_fptr(0);
+ f (2);
+ if (gl != 42)
+ __builtin_abort ();
+
+ g = get_fptr(1);
+ if (g (2) != 42)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 2 x main
+/* { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,__s390_indirect_jump" 2 } } */
+
+/* No thunks due to thunk-extern. */
+/* { dg-final { scan-assembler-not "exrl" } } */
+/* { dg-final { scan-assembler-not ".globl __s390_indirect_jump" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z10.c b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z10.c
new file mode 100644
index 00000000000..b5f13eb0793
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z10.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-call=thunk -mindirect-branch-table" } */
+
+int gl;
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ gl = a + 40;
+}
+
+int __attribute__((noinline,noclone))
+foo_value (int a)
+{
+ return a + 40;
+}
+
+void* __attribute__((noinline,noclone))
+get_fptr (int a)
+{
+ switch (a)
+ {
+ case 0: return &foo; break;
+ case 1: return &foo_value; break;
+ default: __builtin_abort ();
+ }
+}
+
+void (*f) (int);
+int (*g) (int);
+
+int
+main ()
+{
+ int res;
+
+ f = get_fptr(0);
+ f (2);
+ if (gl != 42)
+ __builtin_abort ();
+
+ g = get_fptr(1);
+ if (g (2) != 42)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 2 x main
+/* { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z900.c b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z900.c
new file mode 100644
index 00000000000..486495b97ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-function-pointer-z900.c
@@ -0,0 +1,56 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mindirect-branch-call=thunk -mindirect-branch-table" } */
+
+int gl;
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ gl = a + 40;
+}
+
+int __attribute__((noinline,noclone))
+foo_value (int a)
+{
+ return a + 40;
+}
+
+void* __attribute__((noinline,noclone))
+get_fptr (int a)
+{
+ switch (a)
+ {
+ case 0: return &foo; break;
+ case 1: return &foo_value; break;
+ default: __builtin_abort ();
+ }
+}
+
+void (*f) (int);
+int (*g) (int);
+
+int
+main ()
+{
+ int res;
+
+ f = get_fptr(0);
+ f (2);
+ if (gl != 42)
+ __builtin_abort ();
+
+ g = get_fptr(1);
+ if (g (2) != 42)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 2 x main
+/* { dg-final { scan-assembler-times "brasl\t%r\[0-9\]*,__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-attr.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-attr.c
new file mode 100644
index 00000000000..c62ddf56b8a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-attr.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void __attribute__((indirect_branch_jump("thunk")))
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int main() {
+ bar(code);
+ return 0;
+}
+
+/* 2x bar */
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-attr.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-attr.c
new file mode 100644
index 00000000000..63d64c15941
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-attr.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void __attribute__((indirect_branch_jump("thunk-inline")))
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* The two gotos in bar get merged. */
+/* { dg-final { scan-assembler-times "exrl" 1 } } */
+
+/* { dg-final { scan-assembler-not "jg\t__s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z10.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z10.c
new file mode 100644
index 00000000000..28d7837e2a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z10.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* The two gotos in bar get merged. */
+/* { dg-final { scan-assembler-times "exrl" 1 } } */
+
+/* { dg-final { scan-assembler-not "jg\t__s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z900.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z900.c
new file mode 100644
index 00000000000..3c0c0072539
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-inline-z900.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* The two gotos in bar get merged. */
+/* { dg-final { scan-assembler-times "\tex\t" 1 } } */
+
+/* { dg-final { scan-assembler-not "jg\t__s390_indirect_jump" } } */
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-nothunk.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-nothunk.c
new file mode 100644
index 00000000000..05c8bb8c12d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-nothunk.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-jump=thunk-extern -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* 2 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+
+/* No thunks due to thunk-extern. */
+/* { dg-final { scan-assembler-not "exrl" } } */
+/* { dg-final { scan-assembler-not ".globl __s390_indirect_jump" } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z10.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z10.c
new file mode 100644
index 00000000000..71c86fdfebc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z10.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-jump=thunk -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* 2x bar */
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z900.c b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z900.c
new file mode 100644
index 00000000000..89ad799c7a6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-indirect-jump-z900.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mindirect-branch-jump=thunk -mindirect-branch-table" } */
+/* { dg-require-effective-target label_values } */
+
+/* This is a copy of the gcc.c-torture/execute/20040302-1.c
+ testcase. */
+
+int code[]={0,0,0,0,1};
+
+void
+foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void
+bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int
+main() {
+ bar(code);
+ return 0;
+}
+
+/* 2 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-attr-all.c b/gcc/testsuite/gcc.target/s390/nobp-return-attr-all.c
new file mode 100644
index 00000000000..4bf88cf78c2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-attr-all.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((function_return("thunk"),noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* With -march=z10 -mzarch the shrink wrapped returns use compare and
+ swap relative to jump to the exit block instead of making use of
+ the conditional return pattern.
+ FIXME: Use compare and branch register for that!!!! */
+
+/* 2 x foo
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-attr-neg.c b/gcc/testsuite/gcc.target/s390/nobp-return-attr-neg.c
new file mode 100644
index 00000000000..8b32bfe5172
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-attr-neg.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mfunction-return-mem=thunk -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((function_return("keep"),noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int __attribute__((function_return("keep")))
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "jg\t__s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-mem-attr.c b/gcc/testsuite/gcc.target/s390/nobp-return-mem-attr.c
new file mode 100644
index 00000000000..39cab8bd89e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-mem-attr.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((function_return_mem("thunk"),noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* With -march=z10 -mzarch the shrink wrapped returns use compare and
+ swap relative to jump to the exit block instead of making use of
+ the conditional return pattern.
+ FIXME: Use compare and branch register for that!!!! */
+
+/* 2 x foo
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-mem-nothunk.c b/gcc/testsuite/gcc.target/s390/nobp-return-mem-nothunk.c
new file mode 100644
index 00000000000..f99f152305c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-mem-nothunk.c
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mfunction-return-mem=thunk-extern -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* With -march=z10 -mzarch the shrink wrapped returns use compare and
+ swap relative to jump to the exit block instead of making use of
+ the conditional return pattern.
+ FIXME: Use compare and branch register for that!!!! */
+
+/* 2 x foo, 1 x main
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 3 } } */
+
+/* No thunks due to thunk-extern. */
+/* { dg-final { scan-assembler-not "exrl" } } */
+/* { dg-final { scan-assembler-not ".globl __s390_indirect_jump" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-mem-z10.c b/gcc/testsuite/gcc.target/s390/nobp-return-mem-z10.c
new file mode 100644
index 00000000000..177fc32c24b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-mem-z10.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mfunction-return-mem=thunk -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* With -march=z10 -mzarch the shrink wrapped returns use compare and
+ swap relative to jump to the exit block instead of making use of
+ the conditional return pattern.
+ FIXME: Use compare and branch register for that!!!! */
+
+/* 2 x foo, 1 x main
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 3 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-mem-z900.c b/gcc/testsuite/gcc.target/s390/nobp-return-mem-z900.c
new file mode 100644
index 00000000000..0b318115a8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-mem-z900.c
@@ -0,0 +1,48 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-mem=thunk -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x foo, 1 x main
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+
+/* 1 x foo, conditional return, shrink wrapped
+/* { dg-final { scan-assembler "jge\t__s390_indirect_jump" } } */
+
+/* 1 x foo, conditional return, shrink wrapped
+/* { dg-final { scan-assembler "jgle\t__s390_indirect_jump" } } */
+
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-reg-attr.c b/gcc/testsuite/gcc.target/s390/nobp-return-reg-attr.c
new file mode 100644
index 00000000000..ebfc9ff0ebb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-reg-attr.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((function_return_reg("thunk"),noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-reg-mixed.c b/gcc/testsuite/gcc.target/s390/nobp-return-reg-mixed.c
new file mode 100644
index 00000000000..82833f7e0d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-reg-mixed.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */
+
+/* We have to generate different thunks for indirect branches
+ depending on whether the code is compiled for pre z10 machines or
+ later. This testcase makes sure this works within the same compile
+ unit. */
+
+int __attribute__((noinline,noclone,target("arch=z10")))
+bar (int a)
+{
+ return a + 2;
+}
+
+int __attribute__((noinline,noclone,target("arch=z9-ec")))
+foo (int a)
+{
+ return a + 3;
+}
+
+int
+main ()
+{
+ if (bar (42) != 44)
+ __builtin_abort ();
+
+ if (foo (42) != 45)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar, 1 x foo */
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 2 } } */
+/* 1 x foo */
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump_r1use" 1 } } */
+
+/* { dg-final { scan-assembler-times "ex\t" 1 } } */
+/* { dg-final { scan-assembler-times "exrl\t" 1 } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-reg-nothunk.c b/gcc/testsuite/gcc.target/s390/nobp-return-reg-nothunk.c
new file mode 100644
index 00000000000..4ea14e379f5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-reg-nothunk.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z10 --save-temps -mfunction-return-reg=thunk-extern -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+
+/* No thunks due to thunk-extern. */
+/* { dg-final { scan-assembler-not "exrl" } } */
+/* { dg-final { scan-assembler-not ".globl __s390_indirect_jump" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-reg-z10.c b/gcc/testsuite/gcc.target/s390/nobp-return-reg-z10.c
new file mode 100644
index 00000000000..42c3e7435fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-reg-z10.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "exrl" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-return-reg-z900.c b/gcc/testsuite/gcc.target/s390/nobp-return-reg-z900.c
new file mode 100644
index 00000000000..3f4efa57e71
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-return-reg-z900.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */
+
+int gl = 0;
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ return a + 2;
+}
+
+void __attribute__((noinline,noclone))
+foo (int a)
+{
+ int i;
+
+ if (a == 42)
+ return;
+
+ for (i = 0; i < a; i++)
+ gl += bar (i);
+}
+
+int
+main ()
+{
+ foo (3);
+ if (gl != 9)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z10.c b/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z10.c
new file mode 100644
index 00000000000..8dfd7e4c786
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z10.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
+
+/* case-values-threshold will be set to 20 by the back-end when jump
+ thunk are requested. */
+
+int __attribute__((noinline,noclone)) foo1 (void) { return 1; }
+int __attribute__((noinline,noclone)) foo2 (void) { return 2; }
+int __attribute__((noinline,noclone)) foo3 (void) { return 3; }
+int __attribute__((noinline,noclone)) foo4 (void) { return 4; }
+int __attribute__((noinline,noclone)) foo5 (void) { return 5; }
+int __attribute__((noinline,noclone)) foo6 (void) { return 6; }
+int __attribute__((noinline,noclone)) foo7 (void) { return 7; }
+int __attribute__((noinline,noclone)) foo8 (void) { return 8; }
+int __attribute__((noinline,noclone)) foo9 (void) { return 9; }
+int __attribute__((noinline,noclone)) foo10 (void) { return 10; }
+int __attribute__((noinline,noclone)) foo11 (void) { return 11; }
+int __attribute__((noinline,noclone)) foo12 (void) { return 12; }
+int __attribute__((noinline,noclone)) foo13 (void) { return 13; }
+int __attribute__((noinline,noclone)) foo14 (void) { return 14; }
+int __attribute__((noinline,noclone)) foo15 (void) { return 15; }
+int __attribute__((noinline,noclone)) foo16 (void) { return 16; }
+int __attribute__((noinline,noclone)) foo17 (void) { return 17; }
+int __attribute__((noinline,noclone)) foo18 (void) { return 18; }
+int __attribute__((noinline,noclone)) foo19 (void) { return 19; }
+int __attribute__((noinline,noclone)) foo20 (void) { return 20; }
+
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ int ret = 0;
+
+ switch (a)
+ {
+ case 1: ret = foo1 (); break;
+ case 2: ret = foo2 (); break;
+ case 3: ret = foo3 (); break;
+ case 4: ret = foo4 (); break;
+ case 5: ret = foo5 (); break;
+ case 6: ret = foo6 (); break;
+ case 7: ret = foo7 (); break;
+ case 8: ret = foo8 (); break;
+ case 9: ret = foo9 (); break;
+ case 10: ret = foo10 (); break;
+ case 11: ret = foo11 (); break;
+ case 12: ret = foo12 (); break;
+ case 13: ret = foo13 (); break;
+ case 14: ret = foo14 (); break;
+ case 15: ret = foo15 (); break;
+ case 16: ret = foo16 (); break;
+ case 17: ret = foo17 (); break;
+ case 18: ret = foo18 (); break;
+ case 19: ret = foo19 (); break;
+ case 20: ret = foo20 (); break;
+ default:
+ __builtin_abort ();
+ }
+
+ return ret;
+}
+
+int
+main ()
+{
+ if (bar (3) != 3)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "exrl" 1 } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_fromreg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_frommem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z900.c b/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z900.c
new file mode 100644
index 00000000000..46d2c54bcff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-table-jump-inline-z900.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 -mzarch --save-temps -mindirect-branch-jump=thunk-inline -mindirect-branch-table" } */
+
+/* case-values-threshold will be set to 20 by the back-end when jump
+ thunk are requested. */
+
+int __attribute__((noinline,noclone)) foo1 (void) { return 1; }
+int __attribute__((noinline,noclone)) foo2 (void) { return 2; }
+int __attribute__((noinline,noclone)) foo3 (void) { return 3; }
+int __attribute__((noinline,noclone)) foo4 (void) { return 4; }
+int __attribute__((noinline,noclone)) foo5 (void) { return 5; }
+int __attribute__((noinline,noclone)) foo6 (void) { return 6; }
+int __attribute__((noinline,noclone)) foo7 (void) { return 7; }
+int __attribute__((noinline,noclone)) foo8 (void) { return 8; }
+int __attribute__((noinline,noclone)) foo9 (void) { return 9; }
+int __attribute__((noinline,noclone)) foo10 (void) { return 10; }
+int __attribute__((noinline,noclone)) foo11 (void) { return 11; }
+int __attribute__((noinline,noclone)) foo12 (void) { return 12; }
+int __attribute__((noinline,noclone)) foo13 (void) { return 13; }
+int __attribute__((noinline,noclone)) foo14 (void) { return 14; }
+int __attribute__((noinline,noclone)) foo15 (void) { return 15; }
+int __attribute__((noinline,noclone)) foo16 (void) { return 16; }
+int __attribute__((noinline,noclone)) foo17 (void) { return 17; }
+int __attribute__((noinline,noclone)) foo18 (void) { return 18; }
+int __attribute__((noinline,noclone)) foo19 (void) { return 19; }
+int __attribute__((noinline,noclone)) foo20 (void) { return 20; }
+
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ int ret = 0;
+
+ switch (a)
+ {
+ case 1: ret = foo1 (); break;
+ case 2: ret = foo2 (); break;
+ case 3: ret = foo3 (); break;
+ case 4: ret = foo4 (); break;
+ case 5: ret = foo5 (); break;
+ case 6: ret = foo6 (); break;
+ case 7: ret = foo7 (); break;
+ case 8: ret = foo8 (); break;
+ case 9: ret = foo9 (); break;
+ case 10: ret = foo10 (); break;
+ case 11: ret = foo11 (); break;
+ case 12: ret = foo12 (); break;
+ case 13: ret = foo13 (); break;
+ case 14: ret = foo14 (); break;
+ case 15: ret = foo15 (); break;
+ case 16: ret = foo16 (); break;
+ case 17: ret = foo17 (); break;
+ case 18: ret = foo18 (); break;
+ case 19: ret = foo19 (); break;
+ case 20: ret = foo20 (); break;
+ default:
+ __builtin_abort ();
+ }
+
+ return ret;
+}
+
+int
+main ()
+{
+ if (bar (3) != 3)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "\tex\t" 1 } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_fromreg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_frommem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-table-jump-z10.c b/gcc/testsuite/gcc.target/s390/nobp-table-jump-z10.c
new file mode 100644
index 00000000000..9dfe391f337
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-table-jump-z10.c
@@ -0,0 +1,77 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z10 -mzarch --save-temps -mindirect-branch-jump=thunk -mindirect-branch-table" } */
+/* case-values-threshold will be set to 20 by the back-end when jump
+ thunk are requested. */
+
+int __attribute__((noinline,noclone)) foo1 (void) { return 1; }
+int __attribute__((noinline,noclone)) foo2 (void) { return 2; }
+int __attribute__((noinline,noclone)) foo3 (void) { return 3; }
+int __attribute__((noinline,noclone)) foo4 (void) { return 4; }
+int __attribute__((noinline,noclone)) foo5 (void) { return 5; }
+int __attribute__((noinline,noclone)) foo6 (void) { return 6; }
+int __attribute__((noinline,noclone)) foo7 (void) { return 7; }
+int __attribute__((noinline,noclone)) foo8 (void) { return 8; }
+int __attribute__((noinline,noclone)) foo9 (void) { return 9; }
+int __attribute__((noinline,noclone)) foo10 (void) { return 10; }
+int __attribute__((noinline,noclone)) foo11 (void) { return 11; }
+int __attribute__((noinline,noclone)) foo12 (void) { return 12; }
+int __attribute__((noinline,noclone)) foo13 (void) { return 13; }
+int __attribute__((noinline,noclone)) foo14 (void) { return 14; }
+int __attribute__((noinline,noclone)) foo15 (void) { return 15; }
+int __attribute__((noinline,noclone)) foo16 (void) { return 16; }
+int __attribute__((noinline,noclone)) foo17 (void) { return 17; }
+int __attribute__((noinline,noclone)) foo18 (void) { return 18; }
+int __attribute__((noinline,noclone)) foo19 (void) { return 19; }
+int __attribute__((noinline,noclone)) foo20 (void) { return 20; }
+
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ int ret = 0;
+
+ switch (a)
+ {
+ case 1: ret = foo1 (); break;
+ case 2: ret = foo2 (); break;
+ case 3: ret = foo3 (); break;
+ case 4: ret = foo4 (); break;
+ case 5: ret = foo5 (); break;
+ case 6: ret = foo6 (); break;
+ case 7: ret = foo7 (); break;
+ case 8: ret = foo8 (); break;
+ case 9: ret = foo9 (); break;
+ case 10: ret = foo10 (); break;
+ case 11: ret = foo11 (); break;
+ case 12: ret = foo12 (); break;
+ case 13: ret = foo13 (); break;
+ case 14: ret = foo14 (); break;
+ case 15: ret = foo15 (); break;
+ case 16: ret = foo16 (); break;
+ case 17: ret = foo17 (); break;
+ case 18: ret = foo18 (); break;
+ case 19: ret = foo19 (); break;
+ case 20: ret = foo20 (); break;
+ default:
+ __builtin_abort ();
+ }
+
+ return ret;
+}
+
+int
+main ()
+{
+ if (bar (3) != 3)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "exrl" 1 } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_fromreg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_frommem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/nobp-table-jump-z900.c b/gcc/testsuite/gcc.target/s390/nobp-table-jump-z900.c
new file mode 100644
index 00000000000..f1439a8b120
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-table-jump-z900.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 -mzarch --save-temps -mindirect-branch-jump=thunk -mindirect-branch-table" } */
+
+/* case-values-threshold will be set to 20 by the back-end when jump
+ thunk are requested. */
+
+int __attribute__((noinline,noclone)) foo1 (void) { return 1; }
+int __attribute__((noinline,noclone)) foo2 (void) { return 2; }
+int __attribute__((noinline,noclone)) foo3 (void) { return 3; }
+int __attribute__((noinline,noclone)) foo4 (void) { return 4; }
+int __attribute__((noinline,noclone)) foo5 (void) { return 5; }
+int __attribute__((noinline,noclone)) foo6 (void) { return 6; }
+int __attribute__((noinline,noclone)) foo7 (void) { return 7; }
+int __attribute__((noinline,noclone)) foo8 (void) { return 8; }
+int __attribute__((noinline,noclone)) foo9 (void) { return 9; }
+int __attribute__((noinline,noclone)) foo10 (void) { return 10; }
+int __attribute__((noinline,noclone)) foo11 (void) { return 11; }
+int __attribute__((noinline,noclone)) foo12 (void) { return 12; }
+int __attribute__((noinline,noclone)) foo13 (void) { return 13; }
+int __attribute__((noinline,noclone)) foo14 (void) { return 14; }
+int __attribute__((noinline,noclone)) foo15 (void) { return 15; }
+int __attribute__((noinline,noclone)) foo16 (void) { return 16; }
+int __attribute__((noinline,noclone)) foo17 (void) { return 17; }
+int __attribute__((noinline,noclone)) foo18 (void) { return 18; }
+int __attribute__((noinline,noclone)) foo19 (void) { return 19; }
+int __attribute__((noinline,noclone)) foo20 (void) { return 20; }
+
+
+int __attribute__((noinline,noclone))
+bar (int a)
+{
+ int ret = 0;
+
+ switch (a)
+ {
+ case 1: ret = foo1 (); break;
+ case 2: ret = foo2 (); break;
+ case 3: ret = foo3 (); break;
+ case 4: ret = foo4 (); break;
+ case 5: ret = foo5 (); break;
+ case 6: ret = foo6 (); break;
+ case 7: ret = foo7 (); break;
+ case 8: ret = foo8 (); break;
+ case 9: ret = foo9 (); break;
+ case 10: ret = foo10 (); break;
+ case 11: ret = foo11 (); break;
+ case 12: ret = foo12 (); break;
+ case 13: ret = foo13 (); break;
+ case 14: ret = foo14 (); break;
+ case 15: ret = foo15 (); break;
+ case 16: ret = foo16 (); break;
+ case 17: ret = foo17 (); break;
+ case 18: ret = foo18 (); break;
+ case 19: ret = foo19 (); break;
+ case 20: ret = foo20 (); break;
+ default:
+ __builtin_abort ();
+ }
+
+ return ret;
+}
+
+int
+main ()
+{
+ if (bar (3) != 3)
+ __builtin_abort ();
+
+ return 0;
+}
+
+/* 1 x bar
+/* { dg-final { scan-assembler-times "ex\t" 1 } } */
+
+/* { dg-final { scan-assembler "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_fromreg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_frommem" } } */
diff --git a/gcc/testsuite/gcc.target/s390/pr84295.c b/gcc/testsuite/gcc.target/s390/pr84295.c
new file mode 100644
index 00000000000..4da43c3cded
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr84295.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z900 -fgnu89-inline --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */
+
+extern void foo (void);
+extern __inline void foo (void) {}
+void foo (void) {}
+
+/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */
+/* { dg-final { scan-assembler "ex\t" } } */
+
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */
+/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */
+/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_parameter.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_parameter.f90
new file mode 100644
index 00000000000..2653f1b127a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_parameter.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/82049
+! Original code contributed by John Harper <john dot harper at vuw dot ac dot nz>
+program ice ! f2003
+ implicit none
+ character(*), parameter:: a = 'ice', b = '*'
+ character(*), parameter:: c(2) = [character(len(a)) :: a, b]
+ print "(2A4)",adjustr(c)
+end program ice
diff --git a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
index 201dcf4e1d3..ab041fcf4f5 100644
--- a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
+++ b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
@@ -1,10 +1,12 @@
! { dg-do compile }
! Tests fix for PR15976
!
+! Error message update with patch for PR fortran/83633
+!
module sd
integer, parameter :: n = 20
integer :: i(n)
- integer :: j(m) ! { dg-error "must have constant shape" }
+ integer :: j(m) ! { dg-error "array with nonconstant bounds" }
integer, pointer :: p(:)
integer, allocatable :: q(:)
contains
diff --git a/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
index 27344186194..61db2174e5b 100644
--- a/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
+++ b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
@@ -5,16 +5,18 @@
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
+! Error message update with patch for PR fortran/83633
+!
module foo
integer :: i
end module foo
module bar
use foo
- integer, dimension (i) :: j ! { dg-error "must have constant shape" }
+ integer, dimension (i) :: j ! { dg-error "array with nonconstant bounds" }
character (len = i) :: c1 ! { dg-error "must have constant character length" }
end module bar
program foobar
use foo
- integer, dimension (i) :: k ! { dg-error "must have constant shape" }
+ integer, dimension (i) :: k ! { dg-error "array with nonconstant bounds" }
character (len = i) :: c2 ! { dg-error "must have constant character length" }
end program foobar
diff --git a/gcc/testsuite/gfortran.dg/class_67.f90 b/gcc/testsuite/gfortran.dg/class_67.f90
new file mode 100644
index 00000000000..20029939d64
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_67.f90
@@ -0,0 +1,55 @@
+! { dg-do run }
+!
+! Test the fix for PR78990 in which the scalarization of the assignment
+! in the main program failed for two reasons: (i) The conversion of 'v1'
+! into a class actual was being done after the call to 'return_t1', giving
+! rise to the ICE reported in comment #1; and (ii) The 'info' descriptor,
+! required for scalarization was not set, which gave rise to the ICE noted
+! by the contributor.
+!
+! Contributed by Chris Macmackin <cmacmackin@gmail.com>
+!
+module test_type
+ implicit none
+
+ type t1
+ integer :: i
+ contains
+ procedure :: assign
+ generic :: assignment(=) => assign
+ end type t1
+
+contains
+
+ elemental subroutine assign(this,rhs)
+ class(t1), intent(inout) :: this
+ class(t1), intent(in) :: rhs
+ this%i = rhs%i
+ end subroutine assign
+
+ function return_t1(arg)
+ class(t1), dimension(:), intent(in) :: arg
+ class(t1), dimension(:), allocatable :: return_t1
+ allocate(return_t1(size(arg)), source=arg)
+ end function return_t1
+
+ function return_t1_p(arg)
+ class(t1), dimension(:), intent(in), target :: arg
+ class(t1), dimension(:), pointer :: return_t1_p
+ return_t1_p => arg
+ end function return_t1_p
+end module test_type
+
+program test
+ use test_type
+ implicit none
+
+ type(t1), dimension(3) :: v1, v2
+ v1%i = [1,2,3]
+ v2 = return_t1(v1)
+ if (any (v2%i .ne. v1%i)) call abort
+
+ v1%i = [4,5,6]
+ v2 = return_t1_p(v1)
+ if (any (v2%i .ne. v1%i)) call abort
+end program test
diff --git a/gcc/testsuite/gfortran.dg/coarray_45.f90 b/gcc/testsuite/gfortran.dg/coarray_45.f90
new file mode 100644
index 00000000000..87763563efe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_45.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single " }
+!
+! Test the fix for PR83076
+!
+module m
+ type t
+ integer, pointer :: z
+ end type
+ type(t) :: ptr
+contains
+ function g(x)
+ type(t) :: x[*]
+ if (associated (x%z, ptr%z)) deallocate (x%z) ! This used to ICE with -fcoarray=lib
+ end
+end module
+
+ use m
+contains
+ function f(x)
+ type(t) :: x[*]
+ if (associated (x%z, ptr%z)) deallocate (x%z)
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray_46.f90 b/gcc/testsuite/gfortran.dg/coarray_46.f90
new file mode 100644
index 00000000000..273c6e86840
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_46.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+!
+! Test the fix for PR83319
+!
+module foo_module
+ implicit none
+ type foo
+ integer, allocatable :: i(:)
+ end type
+end module
+
+ use foo_module
+ implicit none
+ type(foo), save :: bar[*]
+ allocate(bar%i(1)) ! Used to ICE here.
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray_8.f90 b/gcc/testsuite/gfortran.dg/coarray_8.f90
index db6eb6c2e2d..060f94118ac 100644
--- a/gcc/testsuite/gfortran.dg/coarray_8.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_8.f90
@@ -145,7 +145,7 @@ end module mmm4
subroutine tfgh()
integer :: i(2)
- DATA i/(i, i=1,2)/ ! { dg-error "Expected PARAMETER symbol" }
+ DATA i/(i, i=1,2)/ ! { dg-error "Syntax error in DATA" }
do i = 1, 5 ! { dg-error "cannot be an array" }
end do ! { dg-error "Expecting END SUBROUTINE" }
end subroutine tfgh
@@ -153,7 +153,7 @@ end subroutine tfgh
subroutine tfgh2()
integer, save :: x[*]
integer :: i(2)
- DATA i/(x, x=1,2)/ ! { dg-error "Expected PARAMETER symbol" }
+ DATA i/(x, x=1,2)/ ! { dg-error "Syntax error in DATA" }
do x = 1, 5 ! { dg-error "cannot be a coarray" }
end do ! { dg-error "Expecting END SUBROUTINE" }
end subroutine tfgh2
diff --git a/gcc/testsuite/gfortran.dg/constant_shape.f90 b/gcc/testsuite/gfortran.dg/constant_shape.f90
index c2eaf82f5ec..5ee927b20e2 100644
--- a/gcc/testsuite/gfortran.dg/constant_shape.f90
+++ b/gcc/testsuite/gfortran.dg/constant_shape.f90
@@ -3,7 +3,8 @@
! PR 78392: ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:5979
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
-
+! Error message update with patch for PR fortran/83633
+!
module mytypes
implicit none
contains
@@ -15,6 +16,6 @@ end module
program test
use mytypes
implicit none
- integer, dimension(get_i()) :: x ! { dg-error "must have constant shape" }
- print *, size (x)
+ integer, dimension(get_i()) :: x ! { dg-error "array with nonconstant bounds" }
+ print *, size (x) ! { dg-error "has no IMPLICIT type" }
end
diff --git a/gcc/testsuite/gfortran.dg/data_substring.f90 b/gcc/testsuite/gfortran.dg/data_substring.f90
new file mode 100644
index 00000000000..6d6b2c01579
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_substring.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/30792
+character string*1025
+integer i
+data (string(i:i),i=1,1025)/1025*'?'/ ! { dg-error "Invalid substring" }
+end
diff --git a/gcc/testsuite/gfortran.dg/deallocate_error_3.f90 b/gcc/testsuite/gfortran.dg/deallocate_error_3.f90
new file mode 100644
index 00000000000..149b7c8c15a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deallocate_error_3.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/82994
+! Code contributed by Gerhard Steinmetz
+program p
+ type t
+ end type
+ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
+ deallocate (x) ! { dg-error "not a nonprocedure pointer nor an allocatable" }
+end
diff --git a/gcc/testsuite/gfortran.dg/deallocate_error_4.f90 b/gcc/testsuite/gfortran.dg/deallocate_error_4.f90
new file mode 100644
index 00000000000..c12e776dd27
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deallocate_error_4.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/82994
+! Code contributed by Gerhard Steinmetz
+program p
+ type t
+ end type
+ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" }
+ allocate (x) ! { dg-error "neither a data pointer nor an allocatable" }
+ deallocate (x) ! { dg-error "not a nonprocedure pointer nor an allocatable" }
+end
diff --git a/gcc/testsuite/gfortran.dg/dec_parameter_1.f b/gcc/testsuite/gfortran.dg/dec_parameter_1.f
index 69ffa53c806..62e635f4ce8 100644
--- a/gcc/testsuite/gfortran.dg/dec_parameter_1.f
+++ b/gcc/testsuite/gfortran.dg/dec_parameter_1.f
@@ -22,7 +22,6 @@
two = 2.0d0
x = two * pi_1 * f_1 * t
y = two * pi_2 * f_2 * t
- z = two * pi_3 * f_3 * t
return
end subroutine
diff --git a/gcc/testsuite/gfortran.dg/dec_parameter_2.f90 b/gcc/testsuite/gfortran.dg/dec_parameter_2.f90
index 280f0007f93..d0c9f8b7eb0 100644
--- a/gcc/testsuite/gfortran.dg/dec_parameter_2.f90
+++ b/gcc/testsuite/gfortran.dg/dec_parameter_2.f90
@@ -21,7 +21,6 @@ subroutine sub1(t, x, y)
two = 2.0d0
x = two * pi_1 * f_1 * t
y = two * pi_2 * f_2 * t
- z = two * pi_3 * f_3 * t
return
end subroutine
diff --git a/gcc/testsuite/gfortran.dg/explicit_shape_1.f90 b/gcc/testsuite/gfortran.dg/explicit_shape_1.f90
new file mode 100644
index 00000000000..ca3cd00d855
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/explicit_shape_1.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/83633
+! Original testcase by Nathan T. Weeks <weeks at iastate dot edu>
+!
+integer :: A(command_argument_count()) = 1 ! { dg-error "nonconstant bounds" }
+write (*,*) A
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr83977.f90 b/gcc/testsuite/gfortran.dg/gomp/pr83977.f90
new file mode 100644
index 00000000000..b8ad1a7e39c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr83977.f90
@@ -0,0 +1,15 @@
+! PR middle-end/83977
+! { dg-do compile }
+
+integer function foo (a, b)
+ integer :: a, b
+!$omp declare simd uniform(b) linear(ref(a):b)
+ a = a + 1
+! This function can't be called from simd loops,
+! because it violates declare simd restrictions.
+! We shouldn't ICE on it though, nor attempt to generate
+! simd clones for the *omp_fn* functions.
+!$omp parallel
+ call sub
+!$omp end parallel
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr84116.f90 b/gcc/testsuite/gfortran.dg/gomp/pr84116.f90
new file mode 100644
index 00000000000..3a95ac5f36f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr84116.f90
@@ -0,0 +1,12 @@
+! PR fortran/84116
+! { dg-do compile }
+
+program pr84116
+ integer :: i, j
+ !$omp simd linear ((i)) ! { dg-error "Syntax error" }
+ do i = 1, 2
+ end do
+ !$omp simd linear () ! { dg-error "Syntax error" }
+ do j = 1, 2
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/implied_do_2.f90 b/gcc/testsuite/gfortran.dg/implied_do_2.f90
new file mode 100644
index 00000000000..5078ac804d3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/implied_do_2.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/56667
+program error_message
+ implicit none
+ integer :: ir
+ write(*,*) ( ir, ir = 1,10 ! { dg-error "Expected a right parenthesis" }
+end program error_message
diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_22.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_22.f90
new file mode 100644
index 00000000000..702e32e7467
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inline_matmul_22.f90
@@ -0,0 +1,44 @@
+! { dg-do compile }
+! { dg-additional-options "-ffrontend-optimize" }
+! PR 84270 - this used to be rejected.
+! Test case by Michael Weinert
+
+module fp_precision
+
+ integer, parameter :: fp = selected_real_kind(13)
+
+end module fp_precision
+
+ subroutine lhcal(nrot,orth,ngpts,vgauss,vr_0)
+
+ use fp_precision ! floating point precision
+
+ implicit none
+
+!---> rotation matrices and rotations (input)
+ integer, intent(in) :: nrot
+! real(kind=fp), intent(in) :: orth(3,3,nrot) ! fine at all -O
+ real(kind=fp), intent(in) :: orth(3,3,*)
+
+!---> gaussian integration points
+ integer, intent(in) :: ngpts
+ real(kind=fp), intent(in) :: vgauss(3,*)
+
+!---> output results
+ real(kind=fp), intent(out) :: vr_0(3)
+
+ real(kind=fp) :: v(3),vr(3)
+ integer :: n,nn
+
+ vr_0 = 0
+ do nn=1,ngpts
+ v(:) = vgauss(:,nn)
+!---> apply rotations
+ do n=2,nrot
+ vr = matmul( orth(:,:,n), v )
+ vr_0 = vr_0 + vr
+ enddo
+ enddo
+
+ return
+ end subroutine lhcal
diff --git a/gcc/testsuite/gfortran.dg/inquire_18.f90 b/gcc/testsuite/gfortran.dg/inquire_18.f90
new file mode 100644
index 00000000000..9829688225b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inquire_18.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! PR84412 Wrong "Inquire statement identifies an internal file" error
+program bug
+ implicit none
+ integer :: i
+ character(len=1) :: s
+ write (s,'(i1)') 0
+ open(newUnit=i,file='inquire_18.txt',status='unknown')
+ inquire(unit=i)
+ close(i, status="delete")
+end program bug
diff --git a/gcc/testsuite/gfortran.dg/inquire_19.f90 b/gcc/testsuite/gfortran.dg/inquire_19.f90
new file mode 100644
index 00000000000..7d01b6b56ce
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inquire_19.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR84506 INQUIRE(pos=) always sets pos=0 with -fdefault-integer-8
+program TestInquire
+ implicit none
+ integer(8) :: iUnit
+ integer(8) :: iPos
+ open(newunit=iunit, file='output.txt', access='stream', status='replace')
+ write(iUnit) 'TEXT'
+ inquire(iUnit, pos=iPos)
+ close(iUnit, status='delete')
+ !print *, iPos
+ if (iPos.ne.5) stop 1
+end program TestInquire
diff --git a/gcc/testsuite/gfortran.dg/matmul_17.f90 b/gcc/testsuite/gfortran.dg/matmul_17.f90
new file mode 100644
index 00000000000..b21f02be392
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_17.f90
@@ -0,0 +1,9 @@
+! { dg-do run }
+! PR Fortran/83900
+! Contributed by Gerhard Steinmetz <gscfq t t-online dot de>
+program p
+ integer, parameter :: a(3,2) = 1
+ real, parameter :: b(2,3) = 2
+ real, parameter :: c(3,3) = matmul(a, b)
+ if (any(c /= 4.)) call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/matmul_18.f90 b/gcc/testsuite/gfortran.dg/matmul_18.f90
new file mode 100644
index 00000000000..acfd3c304ca
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_18.f90
@@ -0,0 +1,8 @@
+! { dg-do run }
+program p
+ integer, parameter :: a(3,2) = 1
+ real, parameter :: b(2,3) = 2
+ real d(3,3)
+ d = 4
+ if (any(d /= matmul(a,b))) call abort
+end
diff --git a/gcc/testsuite/gfortran.dg/num_images_1.f90 b/gcc/testsuite/gfortran.dg/num_images_1.f90
new file mode 100644
index 00000000000..b5547f60cad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/num_images_1.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single -std=f2008" }
+! PR Fortran/80768
+!
+program foo
+ implicit none
+ integer k5
+ k5 = num_images(failed=.false.) ! { dg-error "argument to NUM_IMAGES" }
+ print *, k5
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/pr51434.f90 b/gcc/testsuite/gfortran.dg/pr51434.f90
new file mode 100644
index 00000000000..31679ec5d78
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr51434.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! PR fortran/51434
+module foo
+ implicit none
+ integer, parameter :: n = 5
+ character(len=1), parameter :: s(n) = 'a'
+ type :: a
+ integer :: m = n
+ character(len=1):: t(n) = transfer('abcde ', s)
+ end type a
+end module foo
+
+program bar
+ use foo
+ implicit none
+ type(a) c
+ if (c%m /= n) stop 1
+ if (any(c%t /= ['a', 'b', 'c', 'd', 'e'])) stop 2
+end program bar
diff --git a/gcc/testsuite/gfortran.dg/pr71085.f90 b/gcc/testsuite/gfortran.dg/pr71085.f90
new file mode 100644
index 00000000000..11d9850fb90
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr71085.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! PR 71085
+!
+! Testcase from PR by Vladimir Fuka <vladimir.fuka@gmail.com>
+!
+program pr71085
+ print *, f()
+contains
+ function f()
+ integer :: f(iargc()*10)
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr83864.f90 b/gcc/testsuite/gfortran.dg/pr83864.f90
new file mode 100644
index 00000000000..3bf568ab316
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83864.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR fortran/83864
+!
+! Derived from PR by Contributed by Gerhard Steinmetz <gscfq@t-online.de>
+!
+program p
+ implicit none
+ type t
+ character :: c(3) = transfer('abc','z',3)
+ end type t
+ type(t) :: x
+ if (any (x%c /= ["a", "b", "c"])) call abort ()
+end
diff --git a/gcc/testsuite/gfortran.dg/pr83874.f90 b/gcc/testsuite/gfortran.dg/pr83874.f90
new file mode 100644
index 00000000000..d1bdc97b783
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83874.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! PR fortran/83874
+! There was an ICE while initializing the character arrays
+!
+! Contributed by Harald Anlauf <anlauf@gmx.de>
+!
+program charinit
+ implicit none
+ type t
+ character(len=1) :: name
+ end type t
+ type(t), parameter :: z(2)= [ t ('a'), t ('b') ]
+ character(len=1), parameter :: names1(*) = z% name
+ character(len=*), parameter :: names2(2) = z% name
+ character(len=*), parameter :: names3(*) = z% name
+ if (.not. (names1(1) == "a" .and. names1(2) == "b")) call abort ()
+ if (.not. (names2(1) == "a" .and. names2(2) == "b")) call abort ()
+ if (.not. (names3(1) == "a" .and. names3(2) == "b")) call abort ()
+end program charinit
diff --git a/gcc/testsuite/gfortran.dg/pr84117.f90 b/gcc/testsuite/gfortran.dg/pr84117.f90
new file mode 100644
index 00000000000..1853d8c5f39
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr84117.f90
@@ -0,0 +1,7 @@
+! PR tree-optimization/84117
+! { dg-do compile }
+! { dg-options "-O3 -ftrapv" }
+ FUNCTION pw_integral_aa ( cc ) RESULT ( integral_value )
+ COMPLEX(KIND=8), DIMENSION(:), POINTER :: cc
+ integral_value = accurate_sum ( CONJG ( cc (:) ) * cc (:) )
+ END FUNCTION pw_integral_aa
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_29.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_29.f90
new file mode 100644
index 00000000000..a9160660280
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_29.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR fortran/81116
+! The assignment was broken due to a missing temporary.
+! Original test case by Clive Page.
+
+program test10
+ implicit none
+ character(:), allocatable :: string
+ !
+ string = '1234567890'
+ string = string(1:5) // string(7:)
+ if (string /= '123457890') STOP 1
+end program test10
diff --git a/gcc/testsuite/gfortran.dg/select_type_40.f90 b/gcc/testsuite/gfortran.dg/select_type_40.f90
new file mode 100644
index 00000000000..4bfa1c7e848
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_40.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-additional-options "-fdefault-integer-8" }
+! PR 78238 - this used to cause an ICE.
+! Original test cae by Gerhard Steinmetz
+class(*), allocatable :: q
+select type (x => q)
+type is (real)
+end select
+end
diff --git a/gcc/testsuite/gfortran.dg/select_type_41.f90 b/gcc/testsuite/gfortran.dg/select_type_41.f90
new file mode 100644
index 00000000000..eebb87922bd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_41.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+!
+! Tests the fix for PR80965 in which the use of the name 'loc'
+! for the dummy argument of 'xyz' caused an ICE. If the module
+! was used, the error "DUMMY attribute conflicts with INTRINSIC
+! attribute in ‘loc’ at (1)" was emitted. Note that although 'loc'
+! is a GNU extension and so can be over-ridden, this is not very
+! good practice.
+!
+! Contributed by David Sagan <david.sagan@gmail.com>
+!
+module mode3_mod
+contains
+ subroutine xyz (loc)
+ implicit none
+ class(*) :: loc
+ real x(6)
+ integer ix_use
+ select type (loc)
+ type is (integer)
+ x = 0
+ print *, "integer"
+ type is (real)
+ ix_use = 0
+ print *, "real"
+ end select
+ end subroutine xyz
+end module mode3_mod
+
diff --git a/gcc/testsuite/gfortran.dg/shape_9.f90 b/gcc/testsuite/gfortran.dg/shape_9.f90
new file mode 100644
index 00000000000..6d33f976cb8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/shape_9.f90
@@ -0,0 +1,16 @@
+! { dg-do run }
+! { dg-require-effective-target lto }
+! { dg-options "-flto" }
+! Check that there are no warnings with LTO for a KIND argument.
+!
+program test
+ implicit none
+ real, allocatable :: x(:,:)
+
+ allocate(x(2,5))
+ if (any(shape(x) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=1) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=2) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=4) /= [ 2, 5 ])) call abort
+ if (any(shape(x,kind=8) /= [ 2, 5 ])) call abort
+ end program test
diff --git a/gcc/testsuite/gfortran.dg/statement_function_1.f90 b/gcc/testsuite/gfortran.dg/statement_function_1.f90
new file mode 100644
index 00000000000..e717725e67e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/statement_function_1.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! PR fortran/84276
+ subroutine stepns(hh, h, s, w)
+ real, intent(inout) :: h, hh, s
+ real, intent(out) :: w
+ real :: qofs
+ integer i
+ qofs(s) = s
+ w = qofs(hh + h)
+ i = 42
+ w = qofs(i) ! { dg-error "Type mismatch in argument" }
+ end subroutine stepns
+
+ subroutine step(hh, h, s, w)
+ real, intent(inout) :: h, hh, s
+ real, intent(out) :: w
+ real :: qofs
+ integer i
+ qofs(s, i) = i * s
+ i = 42
+ w = qofs(hh, i)
+ w = qofs(i = i, s = hh) ! { dg-error "invalid in a statement function" }
+ end subroutine step
+! { dg-prune-output " Obsolescent feature" }
diff --git a/gcc/testsuite/gfortran.dg/statement_function_2.f90 b/gcc/testsuite/gfortran.dg/statement_function_2.f90
new file mode 100644
index 00000000000..703ca1716ca
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/statement_function_2.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+! PR fortran/54223
+subroutine r(d)
+ implicit none
+ integer, optional :: d
+ integer :: h, q
+ q(d) = d + 1 ! statement function statement
+ h = q(d)
+end subroutine r
+
+subroutine s(x)
+ implicit none
+ integer, optional :: x
+ integer :: g, z
+ g(x) = x + 1 ! statement function statement
+ z = g() ! { dg-error "Missing actual argument" }
+end subroutine s
+
+subroutine t(a)
+ implicit none
+ integer :: a
+ integer :: f, y
+ f(a) = a + 1 ! statement function statement
+ y = f() ! { dg-error "Missing actual argument" }
+end subroutine t
+! { dg-prune-output " Obsolescent feature" }
diff --git a/gcc/testsuite/gfortran.dg/statement_function_3.f b/gcc/testsuite/gfortran.dg/statement_function_3.f
new file mode 100644
index 00000000000..dcfb3e2b9dc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/statement_function_3.f
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! PR fortran/35299
+ subroutine phtod(e,n,i,h)
+ dimension e(n)
+ hstar(e,b)=b**.4*((1.25*fun(-e/40)+.18)) ! { dg-error "must be scalar" }
+ a = 1.
+ h = hstar(e(i-1), a)
+ end
+
+ function fun(a)
+ real a(*)
+ fun = 42
+ end
+! { dg-prune-output " Obsolescent feature" }
+
diff --git a/gcc/testsuite/gnat.dg/array11.adb b/gcc/testsuite/gnat.dg/array11.adb
index 7be61c4b631..aab73470092 100644
--- a/gcc/testsuite/gnat.dg/array11.adb
+++ b/gcc/testsuite/gnat.dg/array11.adb
@@ -1,15 +1,17 @@
-- { dg-do compile }
+with System;
+
procedure Array11 is
type Rec is null record;
- type Ptr is access all Rec;
+ type Index_T is mod System.Memory_Size;
- type Arr1 is array (1..8) of aliased Rec; -- { dg-warning "padded" }
- type Arr2 is array (Long_Integer) of aliased Rec; -- { dg-warning "padded" }
+ type Arr1 is array (1 .. 8) of aliased Rec; -- { dg-warning "padded" }
+ type Arr2 is array (Index_T) of aliased Rec; -- { dg-warning "padded" }
A1 : Arr1;
- A2 : Arr2; -- { dg-warning "Storage_Error" }
+ A2 : Arr2;
begin
null;
diff --git a/gcc/testsuite/gnat.dg/dispatch1.adb b/gcc/testsuite/gnat.dg/disp1.adb
index 28e97e6e7e7..2fcefeafb42 100644
--- a/gcc/testsuite/gnat.dg/dispatch1.adb
+++ b/gcc/testsuite/gnat.dg/disp1.adb
@@ -1,7 +1,8 @@
-- { dg-do run }
-with dispatch1_p; use dispatch1_p;
-procedure dispatch1 is
+with Disp1_Pkg; use Disp1_Pkg;
+
+procedure Disp1 is
O : DT_I1;
Ptr : access I1'Class;
begin
diff --git a/gcc/testsuite/gnat.dg/dispatch1_p.ads b/gcc/testsuite/gnat.dg/disp1_pkg.ads
index 73de627516a..4d80e7655e1 100644
--- a/gcc/testsuite/gnat.dg/dispatch1_p.ads
+++ b/gcc/testsuite/gnat.dg/disp1_pkg.ads
@@ -1,4 +1,6 @@
-package dispatch1_p is
+package Disp1_Pkg is
+
type I1 is interface;
type DT_I1 is new I1 with null record;
-end;
+
+end Disp1_Pkg;
diff --git a/gcc/testsuite/gnat.dg/dispatch2.adb b/gcc/testsuite/gnat.dg/disp2.adb
index ed57b13359e..2e1e6226080 100644
--- a/gcc/testsuite/gnat.dg/dispatch2.adb
+++ b/gcc/testsuite/gnat.dg/disp2.adb
@@ -1,7 +1,8 @@
-- { dg-do run }
-with dispatch2_p; use dispatch2_p;
-procedure dispatch2 is
+with Disp2_Pkg; use Disp2_Pkg;
+
+procedure Disp2 is
Obj : Object_Ptr := new Object;
begin
if Obj.Get_Ptr /= Obj.Impl_Of then
diff --git a/gcc/testsuite/gnat.dg/dispatch2_p.adb b/gcc/testsuite/gnat.dg/disp2_pkg.adb
index 243c3ca977a..ed460ec453f 100644
--- a/gcc/testsuite/gnat.dg/dispatch2_p.adb
+++ b/gcc/testsuite/gnat.dg/disp2_pkg.adb
@@ -1,7 +1,8 @@
---
-package body dispatch2_p is
+package body Disp2_Pkg is
+
function Impl_Of (Self : access Object) return Object_Ptr is
begin
return Object_Ptr (Self);
end Impl_Of;
-end;
+
+end Disp2_Pkg;
diff --git a/gcc/testsuite/gnat.dg/dispatch2_p.ads b/gcc/testsuite/gnat.dg/disp2_pkg.ads
index e7852b446b5..0b4903abe34 100644
--- a/gcc/testsuite/gnat.dg/dispatch2_p.ads
+++ b/gcc/testsuite/gnat.dg/disp2_pkg.ads
@@ -1,8 +1,11 @@
-package dispatch2_p is
+package Disp2_Pkg is
+
type Object is tagged null record;
type Object_Ptr is access all Object'CLASS;
---
+
function Impl_Of (Self : access Object) return Object_Ptr;
function Get_Ptr (Self : access Object) return Object_Ptr
renames Impl_Of;
-end;
+
+end Disp2_Pkg;
+
diff --git a/gcc/testsuite/gnat.dg/generic_dispatch.adb b/gcc/testsuite/gnat.dg/generic_disp.adb
index a22e495f451..2f828ff1b1b 100644
--- a/gcc/testsuite/gnat.dg/generic_dispatch.adb
+++ b/gcc/testsuite/gnat.dg/generic_disp.adb
@@ -1,9 +1,10 @@
-- { dg-do run }
-with generic_dispatch_p; use generic_dispatch_p;
-procedure generic_dispatch is
+with Generic_Disp_Pkg; use Generic_Disp_Pkg;
+
+procedure Generic_Disp is
I : aliased Integer := 0;
D : Iface'Class := Dispatching_Constructor (DT'Tag, I'access);
begin
null;
-end generic_dispatch;
+end Generic_Disp;
diff --git a/gcc/testsuite/gnat.dg/generic_dispatch_p.adb b/gcc/testsuite/gnat.dg/generic_disp_pkg.adb
index 7a4bbbd8a2b..b3aeb3ff078 100644
--- a/gcc/testsuite/gnat.dg/generic_dispatch_p.adb
+++ b/gcc/testsuite/gnat.dg/generic_disp_pkg.adb
@@ -1,7 +1,9 @@
-package body generic_dispatch_p is
+package body Generic_Disp_Pkg is
+
function Constructor (I : not null access Integer) return DT is
R : DT;
- begin
+ begin
return R;
end Constructor;
-end;
+
+end Generic_Disp_Pkg;
diff --git a/gcc/testsuite/gnat.dg/generic_dispatch_p.ads b/gcc/testsuite/gnat.dg/generic_disp_pkg.ads
index fe6115dd9c7..5be54921d83 100644
--- a/gcc/testsuite/gnat.dg/generic_dispatch_p.ads
+++ b/gcc/testsuite/gnat.dg/generic_disp_pkg.ads
@@ -1,5 +1,6 @@
with Ada.Tags.Generic_Dispatching_Constructor;
-package generic_dispatch_p is
+
+package Generic_Disp_Pkg is
type Iface is interface;
function Constructor (I : not null access Integer) return Iface is abstract;
function Dispatching_Constructor
@@ -10,4 +11,4 @@ package generic_dispatch_p is
type DT is new Iface with null record;
overriding
function Constructor (I : not null access Integer) return DT;
-end;
+end Generic_Disp_Pkg;
diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref1.adb b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
index 6e7bf14e5df..ec7f9460559 100644
--- a/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
+++ b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb
@@ -17,5 +17,5 @@ procedure Null_Pointer_Deref1 is
begin
Data.all := 1;
exception
- when Constraint_Error | Storage_Error => null;
+ when others => null;
end;
diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref2.adb b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
index 63e2dd11f39..284762216c5 100644
--- a/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
+++ b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb
@@ -20,7 +20,7 @@ procedure Null_Pointer_Deref2 is
begin
Data.all := 1;
exception
- when Constraint_Error | Storage_Error => null;
+ when others => null;
end T;
begin
diff --git a/gcc/testsuite/gnat.dg/object_overflow1.adb b/gcc/testsuite/gnat.dg/object_overflow1.adb
index ba7f657e710..d972f24a1fe 100644
--- a/gcc/testsuite/gnat.dg/object_overflow1.adb
+++ b/gcc/testsuite/gnat.dg/object_overflow1.adb
@@ -1,10 +1,12 @@
-- { dg-do compile }
+with Interfaces.C; use Interfaces.C;
+
procedure Object_Overflow1 is
procedure Proc (x : Boolean) is begin null; end;
- type Arr is array(Long_Integer) of Boolean;
+ type Arr is array(ptrdiff_t) of Boolean;
Obj : Arr; -- { dg-warning "Storage_Error" }
begin
diff --git a/gcc/testsuite/gnat.dg/object_overflow2.adb b/gcc/testsuite/gnat.dg/object_overflow2.adb
index 9601c563b2a..a429291e80a 100644
--- a/gcc/testsuite/gnat.dg/object_overflow2.adb
+++ b/gcc/testsuite/gnat.dg/object_overflow2.adb
@@ -1,10 +1,12 @@
-- { dg-do compile }
+with Interfaces.C; use Interfaces.C;
+
procedure Object_Overflow2 is
procedure Proc (x : Boolean) is begin null; end;
- type Arr is array(0 .. Long_Integer'Last) of Boolean;
+ type Arr is array(0 .. ptrdiff_t'Last) of Boolean;
Obj : Arr; -- { dg-warning "Storage_Error" }
begin
diff --git a/gcc/testsuite/gnat.dg/object_overflow3.adb b/gcc/testsuite/gnat.dg/object_overflow3.adb
index 5e27b4f0d81..d3c0c17c57d 100644
--- a/gcc/testsuite/gnat.dg/object_overflow3.adb
+++ b/gcc/testsuite/gnat.dg/object_overflow3.adb
@@ -1,10 +1,12 @@
-- { dg-do compile }
+with Interfaces.C; use Interfaces.C;
+
procedure Object_Overflow3 is
procedure Proc (x : Boolean) is begin null; end;
- type Arr is array(0 .. Long_Integer'Last) of Boolean;
+ type Arr is array(0 .. ptrdiff_t'Last) of Boolean;
type Rec is record
A : Arr;
diff --git a/gcc/testsuite/gnat.dg/object_overflow4.adb b/gcc/testsuite/gnat.dg/object_overflow4.adb
index 643989d348c..0e320e265ad 100644
--- a/gcc/testsuite/gnat.dg/object_overflow4.adb
+++ b/gcc/testsuite/gnat.dg/object_overflow4.adb
@@ -1,14 +1,16 @@
-- { dg-do compile }
+with Interfaces.C; use Interfaces.C;
+
procedure Object_Overflow4 is
procedure Proc (x : Integer) is begin null; end;
- type Index is new Long_Integer range 0 .. Long_Integer'Last;
+ type Index_T is new ptrdiff_t range 0 .. ptrdiff_t'Last;
- type Arr is array(Index range <>) of Integer;
+ type Arr is array(Index_T range <>) of Integer;
- type Rec (Size: Index := 6) is record -- { dg-warning "Storage_Error" }
+ type Rec (Size: Index_T := 6) is record -- { dg-warning "Storage_Error" }
A: Arr (0..Size);
end record;
diff --git a/gcc/testsuite/gnat.dg/object_overflow5.adb b/gcc/testsuite/gnat.dg/object_overflow5.adb
index 4a4f6cfe30e..42d00b24b95 100644
--- a/gcc/testsuite/gnat.dg/object_overflow5.adb
+++ b/gcc/testsuite/gnat.dg/object_overflow5.adb
@@ -1,14 +1,16 @@
-- { dg-do compile }
+with Interfaces.C; use Interfaces.C;
+
procedure Object_Overflow5 is
procedure Proc (c : Character) is begin null; end;
- type Index is new Long_Integer range 0 .. Long_Integer'Last;
+ type Index_T is new ptrdiff_t range 0 .. ptrdiff_t'Last;
- type Arr is array(Index range <>) of Character;
+ type Arr is array(Index_T range <>) of Character;
- type Rec (Size: Index := 6) is record -- { dg-warning "Storage_Error" }
+ type Rec (Size: Index_T := 6) is record -- { dg-warning "Storage_Error" }
A: Arr (0..Size);
end record;
diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp
index afc1a696393..844530bf4b3 100644
--- a/gcc/testsuite/lib/prune.exp
+++ b/gcc/testsuite/lib/prune.exp
@@ -28,7 +28,7 @@ proc prune_gcc_output { text } {
#send_user "Before:$text\n"
- regsub -all "(^|\n)(\[^\n\]*: )?In ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text
+ regsub -all "(^|\n)(\[^\n\]*: \[iI\]|I)n ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text
regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
regsub -all "(^|\n)\[^\n\]*: (recursively )?required \[^\n\]*" $text "" text
regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 290704dabea..25c8b603f8a 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -7430,11 +7430,22 @@ proc check_prefer_avx128 { } {
proc check_effective_target_avx512f { } {
return [check_no_compiler_messages avx512f object {
typedef double __m512d __attribute__ ((__vector_size__ (64)));
+ typedef double __m128d __attribute__ ((__vector_size__ (16)));
__m512d _mm512_add (__m512d a)
{
return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
}
+
+ __m128d _mm128_add (__m128d a)
+ {
+ return __builtin_ia32_addsd_round (a, a, 8);
+ }
+
+ __m128d _mm128_getmant (__m128d a)
+ {
+ return __builtin_ia32_getmantsd_round (a, a, 0, 8);
+ }
} "-O2 -mavx512f" ]
}
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index ad50b32220e..f9b2395fcad 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "gimple-low.h"
#include "asan.h"
+#include "gimplify.h"
/* In some instances a tree and a gimple need to be stored in a same table,
i.e. in hash tables. This is a structure to do this. */
@@ -2438,7 +2439,7 @@ operation_could_trap_helper_p (enum tree_code op,
case ROUND_MOD_EXPR:
case TRUNC_MOD_EXPR:
case RDIV_EXPR:
- if (honor_snans || honor_trapv)
+ if (honor_snans)
return true;
if (fp_operation)
return flag_trapping_math;
@@ -2722,6 +2723,91 @@ tree_could_trap_p (tree expr)
}
}
+/* Return non-NULL if there is an integer operation with trapping overflow
+ we can rewrite into non-trapping. Called via walk_tree from
+ rewrite_to_non_trapping_overflow. */
+
+static tree
+find_trapping_overflow (tree *tp, int *walk_subtrees, void *data)
+{
+ if (EXPR_P (*tp)
+ && !operation_no_trapping_overflow (TREE_TYPE (*tp), TREE_CODE (*tp)))
+ return *tp;
+ if (IS_TYPE_OR_DECL_P (*tp)
+ || (TREE_CODE (*tp) == SAVE_EXPR && data == NULL))
+ *walk_subtrees = 0;
+ return NULL_TREE;
+}
+
+/* Rewrite selected operations into unsigned arithmetics, so that they
+ don't trap on overflow. */
+
+static tree
+replace_trapping_overflow (tree *tp, int *walk_subtrees, void *data)
+{
+ if (find_trapping_overflow (tp, walk_subtrees, data))
+ {
+ tree type = TREE_TYPE (*tp);
+ tree utype = unsigned_type_for (type);
+ *walk_subtrees = 0;
+ int len = TREE_OPERAND_LENGTH (*tp);
+ for (int i = 0; i < len; ++i)
+ walk_tree (&TREE_OPERAND (*tp, i), replace_trapping_overflow,
+ data, (hash_set<tree> *) data);
+
+ if (TREE_CODE (*tp) == ABS_EXPR)
+ {
+ tree op = TREE_OPERAND (*tp, 0);
+ op = save_expr (op);
+ /* save_expr skips simple arithmetics, which is undesirable
+ here, if it might trap due to flag_trapv. We need to
+ force a SAVE_EXPR in the COND_EXPR condition, to evaluate
+ it before the comparison. */
+ if (EXPR_P (op)
+ && TREE_CODE (op) != SAVE_EXPR
+ && walk_tree (&op, find_trapping_overflow, NULL, NULL))
+ {
+ op = build1_loc (EXPR_LOCATION (op), SAVE_EXPR, type, op);
+ TREE_SIDE_EFFECTS (op) = 1;
+ }
+ /* Change abs (op) to op < 0 ? -op : op and handle the NEGATE_EXPR
+ like other signed integer trapping operations. */
+ tree cond = fold_build2 (LT_EXPR, boolean_type_node,
+ op, build_int_cst (type, 0));
+ tree neg = fold_build1 (NEGATE_EXPR, utype,
+ fold_convert (utype, op));
+ *tp = fold_build3 (COND_EXPR, type, cond,
+ fold_convert (type, neg), op);
+ }
+ else
+ {
+ TREE_TYPE (*tp) = utype;
+ len = TREE_OPERAND_LENGTH (*tp);
+ for (int i = 0; i < len; ++i)
+ TREE_OPERAND (*tp, i)
+ = fold_convert (utype, TREE_OPERAND (*tp, i));
+ *tp = fold_convert (type, *tp);
+ }
+ }
+ return NULL_TREE;
+}
+
+/* If any subexpression of EXPR can trap due to -ftrapv, rewrite it
+ using unsigned arithmetics to avoid traps in it. */
+
+tree
+rewrite_to_non_trapping_overflow (tree expr)
+{
+ if (!flag_trapv)
+ return expr;
+ hash_set<tree> pset;
+ if (!walk_tree (&expr, find_trapping_overflow, &pset, &pset))
+ return expr;
+ expr = unshare_expr (expr);
+ hash_set<tree> pset2;
+ walk_tree (&expr, replace_trapping_overflow, &pset2, &pset2);
+ return expr;
+}
/* Helper for stmt_could_throw_p. Return true if STMT (assumed to be a
an assignment or a conditional) may throw. */
diff --git a/gcc/tree-eh.h b/gcc/tree-eh.h
index 2883628ec35..f639282bee5 100644
--- a/gcc/tree-eh.h
+++ b/gcc/tree-eh.h
@@ -37,6 +37,7 @@ extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool,
bool, tree, bool *);
extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
extern bool tree_could_trap_p (tree);
+extern tree rewrite_to_non_trapping_overflow (tree);
extern bool stmt_could_throw_p (gimple *);
extern bool tree_could_throw_p (tree);
extern bool stmt_can_throw_external (gimple *);
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 951e7d3f513..883ca2465a8 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-walk.h"
#include "langhooks.h"
#include "tree-iterator.h"
+#include "gimplify.h"
/* Whenever a target does not support thread-local storage (TLS) natively,
we can emulate it with some run-time support in libgcc. This will in
@@ -430,6 +431,20 @@ gen_emutls_addr (tree decl, struct lower_emutls_data *d)
return addr;
}
+/* Callback for lower_emutls_1, return non-NULL if there is any TLS
+ VAR_DECL in the subexpressions. */
+
+static tree
+lower_emutls_2 (tree *ptr, int *walk_subtrees, void *)
+{
+ tree t = *ptr;
+ if (TREE_CODE (t) == VAR_DECL)
+ return DECL_THREAD_LOCAL_P (t) ? t : NULL_TREE;
+ else if (!EXPR_P (t))
+ *walk_subtrees = 0;
+ return NULL_TREE;
+}
+
/* Callback for walk_gimple_op. D = WI->INFO is a struct lower_emutls_data.
Given an operand *PTR within D->STMT, if the operand references a TLS
variable, then lower the reference to a call to the runtime. Insert
@@ -456,6 +471,13 @@ lower_emutls_1 (tree *ptr, int *walk_subtrees, void *cb_data)
{
bool save_changed;
+ /* Gimple invariants are shareable trees, so before changing
+ anything in them if we will need to change anything, unshare
+ them. */
+ if (is_gimple_min_invariant (t)
+ && walk_tree (&TREE_OPERAND (t, 0), lower_emutls_2, NULL, NULL))
+ *ptr = t = unshare_expr (t);
+
/* If we're allowed more than just is_gimple_val, continue. */
if (!wi->val_only)
{
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index e3f3768c013..8ec10f9173e 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2248,10 +2248,7 @@ predicate_mem_writes (loop_p loop)
TREE_OPERAND (cond, 0),
TREE_OPERAND (cond, 1));
else
- {
- gcc_assert (TREE_CODE (cond) == SSA_NAME);
- mask = cond;
- }
+ mask = cond;
if (swap)
{
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f56d09e1bdb..92c861383a2 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "builtins.h"
#include "tree-chkp.h"
+#include "attribs.h"
/* I'm not real happy about this, but we need to handle gimple and
@@ -6024,6 +6025,25 @@ tree_function_versioning (tree old_decl, tree new_decl,
= copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &id,
args_to_skip, &vars);
+ /* Remove omp declare simd attribute from the new attributes. */
+ if (tree a = lookup_attribute ("omp declare simd",
+ DECL_ATTRIBUTES (new_decl)))
+ {
+ while (tree a2 = lookup_attribute ("omp declare simd", TREE_CHAIN (a)))
+ a = a2;
+ a = TREE_CHAIN (a);
+ for (tree *p = &DECL_ATTRIBUTES (new_decl); *p != a;)
+ if (is_attribute_p ("omp declare simd", get_attribute_name (*p)))
+ *p = TREE_CHAIN (*p);
+ else
+ {
+ tree chain = TREE_CHAIN (*p);
+ *p = copy_node (*p);
+ p = &TREE_CHAIN (*p);
+ *p = chain;
+ }
+ }
+
DECL_INITIAL (new_decl) = remap_blocks (DECL_INITIAL (id.src_fn), &id);
BLOCK_SUPERCONTEXT (DECL_INITIAL (new_decl)) = new_decl;
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 0d806da2a3e..b259747481c 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -197,7 +197,7 @@ static struct
static bitmap_obstack lim_bitmap_obstack;
static obstack mem_ref_obstack;
-static bool ref_indep_loop_p (struct loop *, im_mem_ref *, struct loop *);
+static bool ref_indep_loop_p (struct loop *, im_mem_ref *);
/* Minimum cost of an expensive expression. */
#define LIM_EXPENSIVE ((unsigned) PARAM_VALUE (PARAM_LIM_EXPENSIVE))
@@ -545,10 +545,10 @@ outermost_indep_loop (struct loop *outer, struct loop *loop, im_mem_ref *ref)
aloop != loop;
aloop = superloop_at_depth (loop, loop_depth (aloop) + 1))
if ((!ref->stored || !bitmap_bit_p (ref->stored, aloop->num))
- && ref_indep_loop_p (aloop, ref, loop))
+ && ref_indep_loop_p (aloop, ref))
return aloop;
- if (ref_indep_loop_p (loop, ref, loop))
+ if (ref_indep_loop_p (loop, ref))
return loop;
else
return NULL;
@@ -2111,20 +2111,13 @@ record_dep_loop (struct loop *loop, im_mem_ref *ref, bool stored_p)
}
/* Returns true if REF is independent on all other memory
- references in LOOP. REF_LOOP is where REF is accessed, SAFELEN is the
- safelen to apply. */
+ references in LOOP. */
static bool
-ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
- bool stored_p, struct loop *ref_loop)
+ref_indep_loop_p_1 (struct loop *loop, im_mem_ref *ref, bool stored_p)
{
stored_p |= (ref->stored && bitmap_bit_p (ref->stored, loop->num));
- if (loop->safelen > safelen
- /* Check that REF is accessed inside LOOP. */
- && (loop == ref_loop || flow_loop_nested_p (loop, ref_loop)))
- safelen = loop->safelen;
-
bool indep_p = true;
bitmap refs_to_check;
@@ -2135,32 +2128,6 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
if (bitmap_bit_p (refs_to_check, UNANALYZABLE_MEM_ID))
indep_p = false;
- else if (safelen > 1)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file,"REF is independent due to safelen %d\n",
- safelen);
- print_generic_expr (dump_file, ref->mem.ref, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
-
- /* We need to recurse to properly handle UNANALYZABLE_MEM_ID. */
- struct loop *inner = loop->inner;
- while (inner)
- {
- if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop))
- {
- indep_p = false;
- break;
- }
- inner = inner->next;
- }
-
- /* Avoid caching here as safelen depends on context and refs
- are shared between different contexts. */
- return indep_p;
- }
else
{
if (bitmap_bit_p (&ref->indep_loop, LOOP_DEP_BIT (loop->num, stored_p)))
@@ -2171,7 +2138,7 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
struct loop *inner = loop->inner;
while (inner)
{
- if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop))
+ if (!ref_indep_loop_p_1 (inner, ref, stored_p))
{
indep_p = false;
break;
@@ -2225,14 +2192,14 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
}
/* Returns true if REF is independent on all other memory references in
- LOOP. REF_LOOP is the loop where REF is accessed. */
+ LOOP. */
static bool
-ref_indep_loop_p (struct loop *loop, im_mem_ref *ref, struct loop *ref_loop)
+ref_indep_loop_p (struct loop *loop, im_mem_ref *ref)
{
gcc_checking_assert (MEM_ANALYZABLE (ref));
- return ref_indep_loop_p_1 (0, loop, ref, false, ref_loop);
+ return ref_indep_loop_p_1 (loop, ref, false);
}
/* Returns true if we can perform store motion of REF from LOOP. */
@@ -2268,7 +2235,7 @@ can_sm_ref_p (struct loop *loop, im_mem_ref *ref)
/* And it must be independent on all other memory references
in LOOP. */
- if (!ref_indep_loop_p (loop, ref, loop))
+ if (!ref_indep_loop_p (loop, ref))
return false;
return true;
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 63c3c164894..97eec627d47 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -270,6 +270,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
use_operand_p arg_p, use;
ssa_op_iter i;
bool phi_inserted;
+ bool changed;
tree type = NULL_TREE;
if (!POINTER_TYPE_P (TREE_TYPE (ptr))
@@ -317,6 +318,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
/* Replace the first dereference of *ptr if there is one and if we
can move the loads to the place of the ptr phi node. */
phi_inserted = false;
+ changed = false;
FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
{
gimple *def_stmt;
@@ -403,7 +405,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
unlink_stmt_vdef (use_stmt);
gsi_remove (&gsi, true);
- phi_inserted = true;
+ changed = true;
}
/* Found a proper dereference. Insert a phi node if this
@@ -424,6 +426,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
gsi_remove (&gsi, true);
phi_inserted = true;
+ changed = true;
}
else
{
@@ -431,13 +434,14 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
load. */
gimple_assign_set_rhs1 (use_stmt, res);
update_stmt (use_stmt);
+ changed = true;
}
next:;
/* Continue searching for a proper dereference. */
}
- return phi_inserted;
+ return changed;
}
/* Main entry for phiprop pass. */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 443193dca78..b0524233669 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2787,11 +2787,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
unsigned int operand = 1;
vn_reference_op_t currop = &ref->operands[0];
tree sc = NULL_TREE;
- tree fn;
- if (TREE_CODE (currop->op0) == FUNCTION_DECL)
- fn = currop->op0;
- else
- fn = find_or_generate_expression (block, currop->op0, stmts);
+ tree fn = find_or_generate_expression (block, currop->op0, stmts);
if (!fn)
return NULL_TREE;
if (currop->op1)
@@ -2809,14 +2805,27 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
return NULL_TREE;
args.quick_push (arg);
}
- gcall *call
- = gimple_build_call_vec ((TREE_CODE (fn) == FUNCTION_DECL
- ? build_fold_addr_expr (fn) : fn), args);
+ gcall *call = gimple_build_call_vec (fn, args);
gimple_call_set_with_bounds (call, currop->with_bounds);
if (sc)
gimple_call_set_chain (call, sc);
tree forcedname = make_ssa_name (currop->type);
gimple_call_set_lhs (call, forcedname);
+ /* There's no CCP pass after PRE which would re-compute alignment
+ information so make sure we re-materialize this here. */
+ if (gimple_call_builtin_p (call, BUILT_IN_ASSUME_ALIGNED)
+ && args.length () - 2 <= 1
+ && tree_fits_uhwi_p (args[1])
+ && (args.length () != 3 || tree_fits_uhwi_p (args[2])))
+ {
+ unsigned HOST_WIDE_INT halign = tree_to_uhwi (args[1]);
+ unsigned HOST_WIDE_INT hmisalign
+ = args.length () == 3 ? tree_to_uhwi (args[2]) : 0;
+ if ((halign & (halign - 1)) == 0
+ && (hmisalign & ~(halign - 1)) == 0)
+ set_ptr_info_alignment (get_ptr_info (forcedname),
+ halign, hmisalign);
+ }
gimple_set_vuse (call, BB_LIVE_VOP_ON_EXIT (block));
gimple_seq_add_stmt_without_update (&forced_stmts, call);
folded = forcedname;
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 9c72d122bbe..f9f2fdd68f0 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -2306,6 +2306,16 @@ fold_strstr_to_strncmp (tree rhs1, tree rhs2, gimple *stmt)
{
gimple_stmt_iterator gsi = gsi_for_stmt (call_stmt);
tree strncmp_decl = builtin_decl_explicit (BUILT_IN_STRNCMP);
+
+ if (!is_gimple_val (arg1_len))
+ {
+ tree arg1_len_tmp = make_ssa_name (TREE_TYPE (arg1_len));
+ gassign *arg1_stmt = gimple_build_assign (arg1_len_tmp,
+ arg1_len);
+ gsi_insert_before (&gsi, arg1_stmt, GSI_SAME_STMT);
+ arg1_len = arg1_len_tmp;
+ }
+
gcall *strncmp_call = gimple_build_call (strncmp_decl, 3,
arg0, arg1, arg1_len);
tree strncmp_lhs = make_ssa_name (integer_type_node);
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index e019ecc9d29..90d2636b12a 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -290,8 +290,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
/* Do not warn if the access is fully outside of the
variable. */
if (ref.size != -1
- && ref.max_size == ref.size
- && (ref.offset + ref.size <= 0
+ && ((ref.max_size == ref.size
+ && ref.offset + ref.size <= 0)
|| (ref.offset >= 0
&& TREE_CODE (DECL_SIZE (base)) == INTEGER_CST
&& compare_tree_int (DECL_SIZE (base),
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 42e708ed673..66920e20fde 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1423,7 +1423,8 @@ non_rewritable_mem_ref_base (tree ref)
if (! DECL_P (decl))
return NULL_TREE;
if (! is_gimple_reg_type (TREE_TYPE (base))
- || VOID_TYPE_P (TREE_TYPE (base)))
+ || VOID_TYPE_P (TREE_TYPE (base))
+ || TREE_THIS_VOLATILE (decl) != TREE_THIS_VOLATILE (base))
return decl;
if ((TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE
|| TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE)
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index a6ec5396345..6f2245c526b 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "tree-cfg.h"
#include "tree-if-conv.h"
+#include "tree-eh.h"
/* Loop Vectorization Pass.
@@ -1055,7 +1056,8 @@ vect_get_loop_niters (struct loop *loop, tree *assumptions,
may_be_zero));
else
niter = fold_build3 (COND_EXPR, TREE_TYPE (niter), may_be_zero,
- build_int_cst (TREE_TYPE (niter), 0), niter);
+ build_int_cst (TREE_TYPE (niter), 0),
+ rewrite_to_non_trapping_overflow (niter));
may_be_zero = NULL_TREE;
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 5096d03b625..b5601727c53 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2753,7 +2753,7 @@ vectorizable_call (gimple *gs, gimple_stmt_iterator *gsi, gimple **vec_stmt,
if (cfn != CFN_LAST)
fndecl = targetm.vectorize.builtin_vectorized_function
(cfn, vectype_out, vectype_in);
- else
+ else if (callee)
fndecl = targetm.vectorize.builtin_md_vectorized_function
(callee, vectype_out, vectype_in);
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 698213c3501..0e98f53af96 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5454,9 +5454,10 @@ free_lang_data_in_decl (tree decl)
At this point, it is not needed anymore. */
DECL_SAVED_TREE (decl) = NULL_TREE;
- /* Clear the abstract origin if it refers to a method. Otherwise
- dwarf2out.c will ICE as we clear TYPE_METHODS and thus the
- origin will not be output correctly. */
+ /* Clear the abstract origin if it refers to a method.
+ Otherwise dwarf2out.c will ICE as we splice functions out of
+ TYPE_FIELDS and thus the origin will not be output
+ correctly. */
if (DECL_ABSTRACT_ORIGIN (decl)
&& DECL_CONTEXT (DECL_ABSTRACT_ORIGIN (decl))
&& RECORD_OR_UNION_TYPE_P
diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog
index 18337956bec..9139933defa 100644
--- a/gnattools/ChangeLog
+++ b/gnattools/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/gotools/ChangeLog b/gotools/ChangeLog
index 97fa81bb430..870fca90988 100644
--- a/gotools/ChangeLog
+++ b/gotools/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/include/ChangeLog b/include/ChangeLog
index 556f7069fa9..2bea3cbfe37 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/intl/ChangeLog b/intl/ChangeLog
index 0bbc04d8082..b835f641642 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libada/ChangeLog b/libada/ChangeLog
index ce567c65190..6a950729892 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 65df022ef7a..77297253a79 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index b3fc5e42c85..2d8810bd83f 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-10-10 Paolo Carlini <paolo.carlini@oracle.com>
* elf.c: Fix typo in the last commit, SFH_COMPRESSED vs SHF_COMPRESSED.
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index da3656a6927..c61190f7a7f 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 99e00663eba..ec16da84f00 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 8967b7d8a14..84167121915 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,23 @@
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-01-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR preprocessor/69869
+ * traditional.c (skip_macro_block_comment): Return bool, true if
+ the macro block comment is unterminated.
+ (copy_comment): Use return value from skip_macro_block_comment instead
+ of always false.
+
+ 2018-01-27 Jakub Jelinek <jakub@redhat.com>
+
+ * include/cpplib.h (enum cpp_builtin_type): Change BT_LAST_USER from
+ BT_FIRST_USER + 31 to BT_FIRST_USER + 63.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2018-01-05 Michael Weiser <michael.weiser@gmx.de>
Backport from trunk
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index b843992b0cd..1e15d6d71ae 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -702,7 +702,7 @@ enum cpp_builtin_type
BT_COUNTER, /* `__COUNTER__' */
BT_HAS_ATTRIBUTE, /* `__has_attribute__(x)' */
BT_FIRST_USER, /* User defined builtin macros. */
- BT_LAST_USER = BT_FIRST_USER + 31
+ BT_LAST_USER = BT_FIRST_USER + 63
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog
index 0a9319fc5f3..df61ee5fe50 100644
--- a/libcpp/po/ChangeLog
+++ b/libcpp/po/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libcpp/traditional.c b/libcpp/traditional.c
index e6004357ca3..91d33d651ca 100644
--- a/libcpp/traditional.c
+++ b/libcpp/traditional.c
@@ -119,8 +119,11 @@ check_output_buffer (cpp_reader *pfile, size_t n)
}
/* Skip a C-style block comment in a macro as a result of -CC.
- Buffer->cur points to the initial asterisk of the comment. */
-static void
+ PFILE->buffer->cur points to the initial asterisk of the comment,
+ change it to point to after the '*' and '/' characters that terminate it.
+ Return true if the macro has not been termined, in that case set
+ PFILE->buffer->cur to the end of the buffer. */
+static bool
skip_macro_block_comment (cpp_reader *pfile)
{
const uchar *cur = pfile->buffer->cur;
@@ -131,10 +134,15 @@ skip_macro_block_comment (cpp_reader *pfile)
/* People like decorating comments with '*', so check for '/'
instead for efficiency. */
- while(! (*cur++ == '/' && cur[-2] == '*') )
- ;
+ while (! (*cur++ == '/' && cur[-2] == '*'))
+ if (cur[-1] == '\n')
+ {
+ pfile->buffer->cur = cur - 1;
+ return true;
+ }
pfile->buffer->cur = cur;
+ return false;
}
/* CUR points to the asterisk introducing a comment in the current
@@ -158,7 +166,7 @@ copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
buffer->cur = cur;
if (pfile->context->prev)
- unterminated = false, skip_macro_block_comment (pfile);
+ unterminated = skip_macro_block_comment (pfile);
else
unterminated = _cpp_skip_block_comment (pfile);
diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index f51953c8f60..008d54f5652 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 420913d5cb7..ec5dc75d463 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 86fd102d320..9658cb68725 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,26 @@
+2018-02-20 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
+ 2018-02-20 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/ieee754-df.S (__adddf3_aux): Add
+ .literal_position directive.
+ * config/xtensa/ieee754-sf.S (__addsf3_aux): Likewise.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
+ 2018-01-23 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/ieee754-df.S (__addsf3, __subsf3, __mulsf3)
+ (__divsf3): Make NaN return value quiet.
+ * config/xtensa/ieee754-sf.S (__adddf3, __subdf3, __muldf3)
+ (__divdf3): Make NaN return value quiet.
+
2018-01-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
Backport from mainline
diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog
index 6303161652a..3d38f5fde4a 100644
--- a/libgcc/config/libbid/ChangeLog
+++ b/libgcc/config/libbid/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libgcc/config/xtensa/ieee754-df.S b/libgcc/config/xtensa/ieee754-df.S
index bdd27e52b10..73fa55c7b90 100644
--- a/libgcc/config/xtensa/ieee754-df.S
+++ b/libgcc/config/xtensa/ieee754-df.S
@@ -55,6 +55,7 @@ __negdf2:
#ifdef L_addsubdf3
+ .literal_position
/* Addition */
__adddf3_aux:
@@ -64,17 +65,26 @@ __adddf3_aux:
.Ladd_xnan_or_inf:
/* If y is neither Infinity nor NaN, return x. */
- bnall yh, a6, 1f
+ bnall yh, a6, .Ladd_return_nan_or_inf
/* If x is a NaN, return it. Otherwise, return y. */
slli a7, xh, 12
or a7, a7, xl
- beqz a7, .Ladd_ynan_or_inf
-1: leaf_return
+ bnez a7, .Ladd_return_nan
.Ladd_ynan_or_inf:
/* Return y. */
mov xh, yh
mov xl, yl
+
+.Ladd_return_nan_or_inf:
+ slli a7, xh, 12
+ or a7, a7, xl
+ bnez a7, .Ladd_return_nan
+ leaf_return
+
+.Ladd_return_nan:
+ movi a4, 0x80000 /* make it a quiet NaN */
+ or xh, xh, a4
leaf_return
.Ladd_opposite_signs:
@@ -319,17 +329,24 @@ __subdf3_aux:
.Lsub_xnan_or_inf:
/* If y is neither Infinity nor NaN, return x. */
- bnall yh, a6, 1f
+ bnall yh, a6, .Lsub_return_nan_or_inf
+
+.Lsub_return_nan:
/* Both x and y are either NaN or Inf, so the result is NaN. */
movi a4, 0x80000 /* make it a quiet NaN */
or xh, xh, a4
-1: leaf_return
+ leaf_return
.Lsub_ynan_or_inf:
/* Negate y and return it. */
slli a7, a6, 11
xor xh, yh, a7
mov xl, yl
+
+.Lsub_return_nan_or_inf:
+ slli a7, xh, 12
+ or a7, a7, xl
+ bnez a7, .Lsub_return_nan
leaf_return
.Lsub_opposite_signs:
@@ -692,10 +709,7 @@ __muldf3_aux:
/* If y is zero, return NaN. */
bnez yl, 1f
slli a8, yh, 1
- bnez a8, 1f
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
- j .Lmul_done
+ beqz a8, .Lmul_return_nan
1:
/* If y is NaN, return y. */
bnall yh, a6, .Lmul_returnx
@@ -708,6 +722,9 @@ __muldf3_aux:
mov xl, yl
.Lmul_returnx:
+ slli a8, xh, 12
+ or a8, a8, xl
+ bnez a8, .Lmul_return_nan
/* Set the sign bit and return. */
extui a7, a7, 31, 1
slli xh, xh, 1
@@ -720,8 +737,11 @@ __muldf3_aux:
bnez xl, .Lmul_returny
slli a8, xh, 1
bnez a8, .Lmul_returny
- movi a7, 0x80000 /* make it a quiet NaN */
- or xh, yh, a7
+ mov xh, yh
+
+.Lmul_return_nan:
+ movi a4, 0x80000 /* make it a quiet NaN */
+ or xh, xh, a4
j .Lmul_done
.align 4
@@ -1370,10 +1390,11 @@ __divdf3_aux:
slli a7, a7, 31
xor xh, xh, a7
/* If y is NaN or Inf, return NaN. */
- bnall yh, a6, 1f
- movi a4, 0x80000 /* make it a quiet NaN */
- or xh, xh, a4
-1: leaf_return
+ ball yh, a6, .Ldiv_return_nan
+ slli a8, xh, 12
+ or a8, a8, xl
+ bnez a8, .Ldiv_return_nan
+ leaf_return
.Ldiv_ynan_or_inf:
/* If y is Infinity, return zero. */
@@ -1383,6 +1404,10 @@ __divdf3_aux:
/* y is NaN; return it. */
mov xh, yh
mov xl, yl
+
+.Ldiv_return_nan:
+ movi a4, 0x80000 /* make it a quiet NaN */
+ or xh, xh, a4
leaf_return
.Ldiv_highequal1:
diff --git a/libgcc/config/xtensa/ieee754-sf.S b/libgcc/config/xtensa/ieee754-sf.S
index a61aba94b51..c3bf98fa9e1 100644
--- a/libgcc/config/xtensa/ieee754-sf.S
+++ b/libgcc/config/xtensa/ieee754-sf.S
@@ -55,6 +55,7 @@ __negsf2:
#ifdef L_addsubsf3
+ .literal_position
/* Addition */
__addsf3_aux:
@@ -64,15 +65,23 @@ __addsf3_aux:
.Ladd_xnan_or_inf:
/* If y is neither Infinity nor NaN, return x. */
- bnall a3, a6, 1f
+ bnall a3, a6, .Ladd_return_nan_or_inf
/* If x is a NaN, return it. Otherwise, return y. */
slli a7, a2, 9
- beqz a7, .Ladd_ynan_or_inf
-1: leaf_return
+ bnez a7, .Ladd_return_nan
.Ladd_ynan_or_inf:
/* Return y. */
mov a2, a3
+
+.Ladd_return_nan_or_inf:
+ slli a7, a2, 9
+ bnez a7, .Ladd_return_nan
+ leaf_return
+
+.Ladd_return_nan:
+ movi a6, 0x400000 /* make it a quiet NaN */
+ or a2, a2, a6
leaf_return
.Ladd_opposite_signs:
@@ -265,16 +274,22 @@ __subsf3_aux:
.Lsub_xnan_or_inf:
/* If y is neither Infinity nor NaN, return x. */
- bnall a3, a6, 1f
+ bnall a3, a6, .Lsub_return_nan_or_inf
/* Both x and y are either NaN or Inf, so the result is NaN. */
+
+.Lsub_return_nan:
movi a4, 0x400000 /* make it a quiet NaN */
or a2, a2, a4
-1: leaf_return
+ leaf_return
.Lsub_ynan_or_inf:
/* Negate y and return it. */
slli a7, a6, 8
xor a2, a3, a7
+
+.Lsub_return_nan_or_inf:
+ slli a7, a2, 9
+ bnez a7, .Lsub_return_nan
leaf_return
.Lsub_opposite_signs:
@@ -537,11 +552,7 @@ __mulsf3_aux:
.Lmul_xnan_or_inf:
/* If y is zero, return NaN. */
slli a8, a3, 1
- bnez a8, 1f
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
- j .Lmul_done
-1:
+ beqz a8, .Lmul_return_nan
/* If y is NaN, return y. */
bnall a3, a6, .Lmul_returnx
slli a8, a3, 9
@@ -551,6 +562,8 @@ __mulsf3_aux:
mov a2, a3
.Lmul_returnx:
+ slli a8, a2, 9
+ bnez a8, .Lmul_return_nan
/* Set the sign bit and return. */
extui a7, a7, 31, 1
slli a2, a2, 1
@@ -562,8 +575,11 @@ __mulsf3_aux:
/* If x is zero, return NaN. */
slli a8, a2, 1
bnez a8, .Lmul_returny
- movi a7, 0x400000 /* make it a quiet NaN */
- or a2, a3, a7
+ mov a2, a3
+
+.Lmul_return_nan:
+ movi a4, 0x400000 /* make it a quiet NaN */
+ or a2, a2, a4
j .Lmul_done
.align 4
@@ -995,10 +1011,10 @@ __divsf3_aux:
slli a7, a7, 31
xor a2, a2, a7
/* If y is NaN or Inf, return NaN. */
- bnall a3, a6, 1f
- movi a4, 0x400000 /* make it a quiet NaN */
- or a2, a2, a4
-1: leaf_return
+ ball a3, a6, .Ldiv_return_nan
+ slli a7, a2, 9
+ bnez a7, .Ldiv_return_nan
+ leaf_return
.Ldiv_ynan_or_inf:
/* If y is Infinity, return zero. */
@@ -1006,6 +1022,10 @@ __divsf3_aux:
beqz a8, .Ldiv_return_zero
/* y is NaN; return it. */
mov a2, a3
+
+.Ldiv_return_nan:
+ movi a4, 0x400000 /* make it a quiet NaN */
+ or a2, a2, a4
leaf_return
.align 4
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 15b8139e859..798a50ea85b 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,14 @@
+2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk
+ PR libgfortran/84412
+ * io/transfer.c (finalize_transfer): After completng an internal unit
+ I/O operation, clear internal_unit_kind.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 7d270fb8b36..5565188358b 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -3987,6 +3987,10 @@ finalize_transfer (st_parameter_dt *dtp)
if (dtp->u.p.unit_is_internal)
{
+ /* The unit structure may be reused later so clear the
+ internal unit kind. */
+ dtp->u.p.current_unit->internal_unit_kind = 0;
+
fbuf_destroy (dtp->u.p.current_unit);
if (dtp->u.p.current_unit
&& (dtp->u.p.current_unit->child_dtio == 0)
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index ae4dbc68f50..c3a640a0689 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,30 @@
+2018-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-02-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/84418
+ * libgomp.fortran/pr84418-1.f90: New test.
+ * libgomp.fortran/pr84418-2.f90: New test.
+
+ 2018-01-29 Christoph Spiel <cspiel@freenet.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/84096
+ * omp.h.in (omp_init_nest_lock_with_hint): Use omp_nest_lock_t
+ instead of omp_lock_t.
+
+2018-02-09 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2018-02-08 Martin Jambor <mjambor@suse.cz>
+
+ * testsuite/libgomp.hsa.c/staticvar.c: New test.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-12-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in
index bf400f88393..fb29b775adc 100644
--- a/libgomp/omp.h.in
+++ b/libgomp/omp.h.in
@@ -101,7 +101,7 @@ extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;
extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
-extern void omp_init_nest_lock_with_hint (omp_lock_t *, omp_lock_hint_t)
+extern void omp_init_nest_lock_with_hint (omp_nest_lock_t *, omp_lock_hint_t)
__GOMP_NOTHROW;
extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
diff --git a/libgomp/testsuite/libgomp.fortran/pr84418-1.f90 b/libgomp/testsuite/libgomp.fortran/pr84418-1.f90
new file mode 100644
index 00000000000..e56c022446c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr84418-1.f90
@@ -0,0 +1,26 @@
+! PR fortran/84418
+! { dg-do run { target vect_simd_clones } }
+! { dg-options "-fno-inline" }
+! { dg-additional-options "-msse2" { target sse2_runtime } }
+! { dg-additional-options "-mavx" { target avx_runtime } }
+
+ real :: a(1024), b(1024), c(1024)
+ integer :: i
+ do i = 1, 1024
+ a(i) = 0.5 * i
+ b(i) = 1.5 * i
+ end do
+ !$omp simd
+ do i = 1, 1024
+ c(i) = foo (a(i), b(i))
+ end do
+ do i = 1, 1024
+ if (c(i).ne.(2 * i)) call abort
+ end do
+contains
+ real function foo (x, y)
+ real :: x, y
+ !$omp declare simd linear (ref (x, y))
+ foo = x + y
+ end function
+end
diff --git a/libgomp/testsuite/libgomp.fortran/pr84418-2.f90 b/libgomp/testsuite/libgomp.fortran/pr84418-2.f90
new file mode 100644
index 00000000000..a6657d18095
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr84418-2.f90
@@ -0,0 +1,35 @@
+! PR fortran/84418
+! { dg-do run { target vect_simd_clones } }
+! { dg-options "-fno-inline" }
+! { dg-additional-options "-msse2" { target sse2_runtime } }
+! { dg-additional-options "-mavx" { target avx_runtime } }
+
+ type p
+ integer :: i, j
+ end type
+ type(p) :: a(1024)
+ integer :: b(4,1024), c(1024)
+ integer :: i
+ do i = 1, 1024
+ a(i)%i = 2 * i
+ a(i)%j = 3 * i
+ b(1,i) = 4 * i
+ b(2,i) = 5 * i
+ b(3,i) = 6 * i
+ b(4,i) = 7 * i
+ end do
+ !$omp simd
+ do i = 1, 1024
+ c(i) = foo (a(i), b(:,i))
+ end do
+ do i = 1, 1024
+ if (c(i).ne.(6 * i)) call abort
+ end do
+contains
+ function foo (x, y)
+ type (p) :: x
+ integer :: y(4), foo
+ !$omp declare simd linear (ref (x, y))
+ foo = x%i + y(1)
+ end function
+end
diff --git a/libgomp/testsuite/libgomp.hsa.c/staticvar.c b/libgomp/testsuite/libgomp.hsa.c/staticvar.c
new file mode 100644
index 00000000000..6d20c9aa328
--- /dev/null
+++ b/libgomp/testsuite/libgomp.hsa.c/staticvar.c
@@ -0,0 +1,23 @@
+extern void abort (void);
+
+#pragma omp declare target
+int
+foo (void)
+{
+ static int s;
+ return ++s;
+}
+#pragma omp end declare target
+
+int
+main ()
+{
+ int r;
+ #pragma omp target map(from:r)
+ {
+ r = foo ();
+ }
+ if (r != 1)
+ abort ();
+ return 0;
+}
diff --git a/libhsail-rt/ChangeLog b/libhsail-rt/ChangeLog
index 94bf346e626..ae7bfb6854c 100644
--- a/libhsail-rt/ChangeLog
+++ b/libhsail-rt/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 0ef171476d8..400b33b7527 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 9ab94d0393c..f66dd31b03a 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog
index 9b13ea75a3f..af0595017c9 100644
--- a/libmpx/ChangeLog
+++ b/libmpx/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 0472f3d94a1..78121927ba0 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog
index d4108616f20..42d03b2e7be 100644
--- a/liboffloadmic/ChangeLog
+++ b/liboffloadmic/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index d7dc3093f3c..4c66b338b2c 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index f59ad630423..2c213f18e0c 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-10-20 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/82595
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index 4b83a97599f..299029f8521 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index e0c46e0a9aa..bb2d01ff659 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,106 @@
+2018-03-02 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-03-02 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84671
+ * include/bits/parse_numbers.h (_Number_help): Add partial
+ specialization to handle digit separators. Adjust partial
+ specialization for recursion temrination to require _Pow == 1ULL.
+ * testsuite/20_util/duration/literals/84671.cc: New
+
+2018-02-26 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-02-23 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84532
+ * include/std/thread (thread::__make_invoker): Construct tuple
+ directly instead of using make_tuple.
+ * testsuite/30_threads/async/84532.cc: New.
+ * testsuite/30_threads/thread/84532.cc: New.
+
+2018-02-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-02-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/81797
+ * configure.ac (INCLUDE_DIR_NOTPARALLEL): Define.
+ * configure: Regenerate.
+ * include/Makefile.am (INCLUDE_DIR_NOTPARALLEL): Add .NOTPARALLEL when
+ defined.
+ * include/Makefile.in: Regenerate.
+
+2018-01-29 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83833
+ * testsuite/26_numerics/random/chi_squared_distribution/83833.cc:
+ Add -ffloat-store to options for m68k and ia32.
+
+ PR libstdc++/83658
+ * include/std/any (any::__do_emplace): Only set _M_manager after
+ constructing the contained object.
+ * testsuite/20_util/any/misc/any_cast_neg.cc: Adjust dg-error line.
+ * testsuite/20_util/any/modifiers/83658.cc: New test.
+
+ Backport from mainline
+ 2018-01-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83833
+ * include/bits/random.h (chi_squared_distribution::param): Update
+ gamma distribution parameter.
+ * testsuite/26_numerics/random/chi_squared_distribution/83833.cc: New
+ test.
+
+2018-01-25 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/81076
+ * include/c_global/cstddef (__byte_operand): Define primary template.
+ * testsuite/18_support/byte/81076.cc: New test.
+
+ Backport from mainline
+ 2018-01-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83830
+ * include/std/type_traits (has_unique_object_representations_v): Add
+ variable template.
+ * testsuite/20_util/has_unique_object_representations/value.cc: Check
+ variable template.
+
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
+2018-01-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-01-16 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/83834
+ * config/abi/pre/gnu.ver (GLIBCXX_3.4): Replace std::c[a-g]* wildcard
+ pattern with exact match for std::cerr.
+
+2018-01-18 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-10-23 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/manual/intro.xml: Include new section.
+ * doc/xml/manual/status_cxxis29124.xml: New section on IS 29124
+ status.
+ * doc/html/*: Regenerate.
+
+ Backport from mainline
+ 2017-10-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/manual/status_cxx2017.xml: Update references to C++17
+ section numbers.
+
+2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * testsuite/17_intro/names.cc: Undefine 'y' on SPARC/Linux.
+
2018-01-13 Jonathan Wakely <jwakely@redhat.com>
* python/libstdcxx/v6/printers.py (register_type_printers): Remove
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index f7d6c83bba6..f365da116f0 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -60,7 +60,7 @@ GLIBCXX_3.4 {
std::basic_[t-z]*;
std::ba[t-z]*;
std::b[b-z]*;
- std::c[a-g]*;
+ std::cerr;
# std::char_traits;
# std::c[i-z]*;
std::c[i-n]*;
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index e70fdd6421f..fdbf7bea876 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -620,6 +620,8 @@ CPU_DEFINES_SRCDIR
ATOMIC_FLAGS
ATOMIC_WORD_SRCDIR
ATOMICITY_SRCDIR
+INCLUDE_DIR_NOTPARALLEL_FALSE
+INCLUDE_DIR_NOTPARALLEL_TRUE
BUILD_PDF_FALSE
BUILD_PDF_TRUE
PDFLATEX
@@ -11601,7 +11603,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11604 "configure"
+#line 11606 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11707,7 +11709,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11710 "configure"
+#line 11712 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15393,7 +15395,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15396 "configure"
+#line 15398 "configure"
int main()
{
typedef bool atomic_type;
@@ -15428,7 +15430,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15431 "configure"
+#line 15433 "configure"
int main()
{
typedef short atomic_type;
@@ -15463,7 +15465,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15466 "configure"
+#line 15468 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15499,7 +15501,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15502 "configure"
+#line 15504 "configure"
int main()
{
typedef long long atomic_type;
@@ -15580,7 +15582,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15583 "configure"
+#line 15585 "configure"
int main()
{
_Decimal32 d1;
@@ -15622,7 +15624,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15625 "configure"
+#line 15627 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15656,7 +15658,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15659 "configure"
+#line 15661 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -81219,6 +81221,18 @@ else
fi
+case "$build" in
+ *-*-darwin* ) glibcxx_include_dir_notparallel=yes ;;
+ * ) glibcxx_include_dir_notparallel=no ;;
+esac
+ if test $glibcxx_include_dir_notparallel = "yes"; then
+ INCLUDE_DIR_NOTPARALLEL_TRUE=
+ INCLUDE_DIR_NOTPARALLEL_FALSE='#'
+else
+ INCLUDE_DIR_NOTPARALLEL_TRUE='#'
+ INCLUDE_DIR_NOTPARALLEL_FALSE=
+fi
+
# Propagate the target-specific source directories through the build chain.
ATOMICITY_SRCDIR=config/${atomicity_dir}
@@ -81913,6 +81927,10 @@ if test -z "${BUILD_PDF_TRUE}" && test -z "${BUILD_PDF_FALSE}"; then
as_fn_error "conditional \"BUILD_PDF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${INCLUDE_DIR_NOTPARALLEL_TRUE}" && test -z "${INCLUDE_DIR_NOTPARALLEL_FALSE}"; then
+ as_fn_error "conditional \"INCLUDE_DIR_NOTPARALLEL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 8e973503be0..a7dbe5678bf 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -467,6 +467,12 @@ AM_CONDITIONAL(BUILD_PDF,
test $ac_cv_prog_DBLATEX = "yes" &&
test $ac_cv_prog_PDFLATEX = "yes")
+case "$build" in
+ *-*-darwin* ) glibcxx_include_dir_notparallel=yes ;;
+ * ) glibcxx_include_dir_notparallel=no ;;
+esac
+AM_CONDITIONAL(INCLUDE_DIR_NOTPARALLEL,
+ test $glibcxx_include_dir_notparallel = "yes")
# Propagate the target-specific source directories through the build chain.
ATOMICITY_SRCDIR=config/${atomicity_dir}
diff --git a/libstdc++-v3/doc/html/index.html b/libstdc++-v3/doc/html/index.html
index 0e67010c6e2..576c088c5a0 100644
--- a/libstdc++-v3/doc/html/index.html
+++ b/libstdc++-v3/doc/html/index.html
@@ -23,7 +23,7 @@
</p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="book"><a href="manual/index.html">The GNU C++ Library Manual</a></span></dt><dd><dl><dt><span class="part"><a href="manual/intro.html">I.
Introduction
-</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="manual/status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="manual/status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="manual/license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="manual/bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="manual/setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/configure.html">Configure</a></span></dt><dt><span class="section"><a href="manual/make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="manual/using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="manual/using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="manual/debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/std_contents.html">II.
+</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="manual/status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="manual/status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="manual/status.html#status.iso.tr24733">C++ TR 24733</a></span></dt><dt><span class="section"><a href="manual/status.html#status.iso.specfun">C++ IS 29124</a></span></dt><dd><dl><dt><span class="section"><a href="manual/status.html#iso.specfun.specific">Implementation Specific Behavior</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="manual/license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="manual/bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="manual/bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="manual/setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="manual/setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/configure.html">Configure</a></span></dt><dt><span class="section"><a href="manual/make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="manual/using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="manual/using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="manual/using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="manual/using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="manual/using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="manual/using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="manual/using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="manual/using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="manual/using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="manual/debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="manual/debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="manual/debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="manual/std_contents.html">II.
Standard Contents
</a></span></dt><dd><dl><dt><span class="chapter"><a href="manual/support.html">4.
Support
diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html
index bbfd589c78f..d4538f26fa5 100644
--- a/libstdc++-v3/doc/html/manual/bugs.html
+++ b/libstdc++-v3/doc/html/manual/bugs.html
@@ -428,6 +428,9 @@
</p></dd><dt><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2332" target="_top">2332</a>:
<span class="emphasis"><em><code class="code">regex_iterator/regex_token_iterator</code> should forbid temporary regexes</em></span>
</span></dt><dd><p>Add deleted constructors.
+ </p></dd><dt><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2354" target="_top">2332</a>:
+ <span class="emphasis"><em>Unnecessary copying when inserting into maps with braced-init syntax</em></span>
+ </span></dt><dd><p>Add overloads of <code class="code">insert</code> taking <code class="code">value_type&amp;&amp;</code> rvalues.
</p></dd><dt><span class="term"><a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2399" target="_top">2399</a>:
<span class="emphasis"><em><code class="code">shared_ptr</code>'s constructor from <code class="code">unique_ptr</code> should be constrained</em></span>
</span></dt><dd><p>Constrain the constructor to require convertibility.
diff --git a/libstdc++-v3/doc/html/manual/index.html b/libstdc++-v3/doc/html/manual/index.html
index 64f088ec5cb..ec39379387d 100644
--- a/libstdc++-v3/doc/html/manual/index.html
+++ b/libstdc++-v3/doc/html/manual/index.html
@@ -4,7 +4,7 @@
</p></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="part"><a href="intro.html">I.
Introduction
-</a></span></dt><dd><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="std_contents.html">II.
+</a></span></dt><dd><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt><dt><span class="section"><a href="status.html#status.iso.specfun">C++ IS 29124</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.specfun.specific">Implementation Specific Behavior</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></dd><dt><span class="part"><a href="std_contents.html">II.
Standard Contents
</a></span></dt><dd><dl><dt><span class="chapter"><a href="support.html">4.
Support
@@ -149,7 +149,7 @@ Support for C++11 dialect.
</a></dt><dt>22.10. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.3.3.23">Non-unique Mapping Containers</a></dt><dt>22.11. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.4.3.5">Point Iterator Hierarchy</a></dt><dt>22.12. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.4.4.5">Invalidation Guarantee Tags Hierarchy</a></dt><dt>22.13. <a href="policy_data_structures_design.html#id-1.3.5.9.4.3.5.7.4">Container Tag Hierarchy</a></dt><dt>22.14. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.3">Hash functions, ranged-hash functions, and
range-hashing functions</a></dt><dt>22.15. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.3.4">Insert hash sequence diagram</a></dt><dt>22.16. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.3.6">Insert hash sequence diagram with a null policy</a></dt><dt>22.17. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.5.5.5">Hash policy class diagram</a></dt><dt>22.18. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.4.7">Balls and bins</a></dt><dt>22.19. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.6">Insert resize sequence diagram</a></dt><dt>22.20. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.9">Standard resize policy trigger sequence
diagram</a></dt><dt>22.21. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.3.5.3.10">Standard resize policy size sequence
- diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.5">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.8">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.3">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.8">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.10">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.20">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.2.10">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.3.5">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.3">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.6">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.3.3">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.4.4">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#fig.build_hacking.deps">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#table.cxx98_status">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#table.cxx11_status">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#table.cxx14_status">C++ 2014 Implementation Status</a></dt><dt>1.4. <a href="status.html#table.ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.5. <a href="status.html#table.cxx17_status">C++ 2017 Implementation Status</a></dt><dt>1.6. <a href="status.html#table.cxx17_ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.7. <a href="status.html#table.tr1_status">C++ TR1 Implementation Status</a></dt><dt>1.8. <a href="status.html#table.decfp_status">C++ TR 24733 Implementation Status</a></dt><dt>3.1. <a href="using.html#table.cmd_options">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#table.cxx98_headers">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#table.cxx98_cheaders">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#table.cxx11_headers">C++ 2011 Library Headers</a></dt><dt>3.5. <a href="using_headers.html#table.cxx11_cheaders">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#table.tr1_headers">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#table.tr1_cheaders">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#table.decfp_headers">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#table.abi_headers">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#table.ext_headers">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#table.debug_headers">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#table.profile_headers">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#table.parallel_headers">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#table.debug_mode_containers">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#table.debug_mode_containers_cxx11">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#table.parallel_algos">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#table.profile_code_loc">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#table.profile_diagnostics">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#table.bitmap_alloc">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#table.doxygen_prereq">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#table.doxygen_cmp">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#table.docbook_prereq">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#table.docbook_cmp">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#table.docbook_elem">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#table.extension_allocators">Extension Allocators</a></dt><dt>B.7. <a href="api.html#table.extension_allocators2">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.15">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.3">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.9">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.11">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.7">
+ diagram</a></dt><dt>22.22. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.5">Tree node invariants</a></dt><dt>22.23. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.8">Tree node invalidation</a></dt><dt>22.24. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.3">A tree and its update policy</a></dt><dt>22.25. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.8">Restoring node invariants</a></dt><dt>22.26. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.10">Insert update sequence</a></dt><dt>22.27. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.3.3.2.11.20">Useless update path</a></dt><dt>22.28. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.2.10">A PATRICIA trie</a></dt><dt>22.29. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.4.3.3.5">A trie and its update policy</a></dt><dt>22.30. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.3">A simple list</a></dt><dt>22.31. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.5.3.3.6">The counter algorithm</a></dt><dt>22.32. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.3.3">Underlying Priority-Queue Data-Structures.</a></dt><dt>22.33. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.6.3.4.4">Priority-Queue Data-Structure Tags.</a></dt><dt>B.1. <a href="appendix_porting.html#fig.build_hacking.deps">Configure and Build File Dependencies</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1.1. <a href="status.html#table.cxx98_status">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#table.cxx11_status">C++ 2011 Implementation Status</a></dt><dt>1.3. <a href="status.html#table.cxx14_status">C++ 2014 Implementation Status</a></dt><dt>1.4. <a href="status.html#table.ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.5. <a href="status.html#table.cxx17_status">C++ 2017 Implementation Status</a></dt><dt>1.6. <a href="status.html#table.cxx17_ts_status">C++ Technical Specifications Implementation Status</a></dt><dt>1.7. <a href="status.html#table.tr1_status">C++ TR1 Implementation Status</a></dt><dt>1.8. <a href="status.html#table.decfp_status">C++ TR 24733 Implementation Status</a></dt><dt>1.9. <a href="status.html#table.specfun_status">C++ Special Functions Implementation Status</a></dt><dt>3.1. <a href="using.html#table.cmd_options">C++ Command Options</a></dt><dt>3.2. <a href="using_headers.html#table.cxx98_headers">C++ 1998 Library Headers</a></dt><dt>3.3. <a href="using_headers.html#table.cxx98_cheaders">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.4. <a href="using_headers.html#table.cxx11_headers">C++ 2011 Library Headers</a></dt><dt>3.5. <a href="using_headers.html#table.cxx11_cheaders">C++ 2011 Library Headers for C Library Facilities</a></dt><dt>3.6. <a href="using_headers.html#table.tr1_headers">C++ TR 1 Library Headers</a></dt><dt>3.7. <a href="using_headers.html#table.tr1_cheaders">C++ TR 1 Library Headers for C Library Facilities</a></dt><dt>3.8. <a href="using_headers.html#table.decfp_headers">C++ TR 24733 Decimal Floating-Point Header</a></dt><dt>3.9. <a href="using_headers.html#table.abi_headers">C++ ABI Headers</a></dt><dt>3.10. <a href="using_headers.html#table.ext_headers">Extension Headers</a></dt><dt>3.11. <a href="using_headers.html#table.debug_headers">Extension Debug Headers</a></dt><dt>3.12. <a href="using_headers.html#table.profile_headers">Extension Profile Headers</a></dt><dt>3.13. <a href="using_headers.html#table.parallel_headers">Extension Parallel Headers</a></dt><dt>17.1. <a href="debug_mode_using.html#table.debug_mode_containers">Debugging Containers</a></dt><dt>17.2. <a href="debug_mode_using.html#table.debug_mode_containers_cxx11">Debugging Containers C++11</a></dt><dt>18.1. <a href="parallel_mode_using.html#table.parallel_algos">Parallel Algorithms</a></dt><dt>19.1. <a href="profile_mode_design.html#table.profile_code_loc">Profile Code Location</a></dt><dt>19.2. <a href="profile_mode_diagnostics.html#table.profile_diagnostics">Profile Diagnostics</a></dt><dt>21.1. <a href="bitmap_allocator_impl.html#table.bitmap_alloc">Bitmap Allocator Memory Map</a></dt><dt>B.1. <a href="documentation_hacking.html#table.doxygen_prereq">Doxygen Prerequisites</a></dt><dt>B.2. <a href="documentation_hacking.html#table.doxygen_cmp">HTML to Doxygen Markup Comparison</a></dt><dt>B.3. <a href="documentation_hacking.html#table.docbook_prereq">Docbook Prerequisites</a></dt><dt>B.4. <a href="documentation_hacking.html#table.docbook_cmp">HTML to Docbook XML Markup Comparison</a></dt><dt>B.5. <a href="documentation_hacking.html#table.docbook_elem">Docbook XML Element Use</a></dt><dt>B.6. <a href="api.html#table.extension_allocators">Extension Allocators</a></dt><dt>B.7. <a href="api.html#table.extension_allocators2">Extension Allocators Continued</a></dt></dl></div><div class="list-of-equations"><p><strong>List of Equations</strong></p><dl><dt>22.1. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.2.15">Ranged Hash Function</a></dt><dt>22.2. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.3">Range-Hashing, Division Method</a></dt><dt>22.3. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.9">Division via Prime Modulo</a></dt><dt>22.4. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.3.11">Division via Bit Mask</a></dt><dt>22.5. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.7">
A Standard String Hash Function
</a></dt><dt>22.6. <a href="policy_data_structures_design.html#id-1.3.5.9.4.4.2.3.2.4.12">
Only k String DNA Hash
diff --git a/libstdc++-v3/doc/html/manual/intro.html b/libstdc++-v3/doc/html/manual/intro.html
index 407f37200f3..8c24f521e1e 100644
--- a/libstdc++-v3/doc/html/manual/intro.html
+++ b/libstdc++-v3/doc/html/manual/intro.html
@@ -5,4 +5,4 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library Manual</th><td width="20%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr></table><hr /></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="manual.intro"></a>Part I. 
Introduction
<a id="id-1.3.3.1.1.1" class="indexterm"></a>
-</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Manual </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html> \ No newline at end of file
+</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt><dt><span class="section"><a href="status.html#status.iso.specfun">C++ IS 29124</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.specfun.specific">Implementation Specific Behavior</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="section"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="configure.html">Configure</a></span></dt><dt><span class="section"><a href="make.html">Make</a></span></dt></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="section"><a href="using.html#manual.intro.using.flags">Command Options</a></span></dt><dt><span class="section"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and <code class="code">namespace std</code></a></span></dt><dt><span class="section"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="section"><a href="using_macros.html">Macros</a></span></dt><dt><span class="section"><a href="using_dual_abi.html">Dual ABI</a></span></dt><dd><dl><dt><span class="section"><a href="using_dual_abi.html#manual.intro.using.abi.trouble">Troubleshooting</a></span></dt></dl></dd><dt><span class="section"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="section"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="section"><a href="using_dynamic_or_shared.html">Linking</a></span></dt><dd><dl><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.freestanding">Almost Nothing</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">Finding Dynamic or Shared Libraries</a></span></dt><dt><span class="section"><a href="using_dynamic_or_shared.html#manual.intro.using.linkage.experimental">Experimental Library Extensions</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dd><dl><dt><span class="section"><a href="using_concurrency.html#concurrency.io.structure">Structure</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.defaults">Defaults</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.future">Future</a></span></dt><dt><span class="section"><a href="using_concurrency.html#concurrency.io.alt">Alternatives</a></span></dt></dl></dd><dt><span class="section"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="section"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.propagating">Exception Neutrality</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.no">Doing without</a></span></dt><dt><span class="section"><a href="using_exceptions.html#intro.using.exception.compat">Compatibility</a></span></dt><dd><dl><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.c">With <code class="literal">C</code></a></span></dt><dt><span class="section"><a href="using_exceptions.html#using.exception.compat.posix">With <code class="literal">POSIX</code> thread cancellation</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="section"><a href="debug.html#debug.compiler">Using <span class="command"><strong>g++</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="section"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.races">Data Race Hunting</a></span></dt><dt><span class="section"><a href="debug.html#debug.gdb">Using <span class="command"><strong>gdb</strong></span></a></span></dt><dt><span class="section"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="section"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="section"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt><dt><span class="section"><a href="debug.html#debug.profile_mode">Profile-based Performance Analysis</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Manual </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html> \ No newline at end of file
diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html
index 788f7df1809..ad4134ed55f 100644
--- a/libstdc++-v3/doc/html/manual/status.html
+++ b/libstdc++-v3/doc/html/manual/status.html
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 1. Status</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="intro.html" title="Part I.  Introduction" /><link rel="prev" href="intro.html" title="Part I.  Introduction" /><link rel="next" href="license.html" title="License" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Status</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><th width="60%" align="center">Part I. 
Introduction
-</th><td width="20%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.status"></a>Chapter 1. Status</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.iso"></a>Implementation Status</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.1998"></a>C++ 1998/2003</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="iso.1998.status"></a>Implementation Status</h4></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="manual.intro.status"></a>Chapter 1. Status</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.1998.status">Implementation Status</a></span></dt><dt><span class="section"><a href="status.html#iso.1998.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2011">C++ 2011</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2011.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.2014">C++ 2014</a></span></dt><dt><span class="section"><a href="status.html#status.iso.2017">C++ 2017</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.2017.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.tr1.specific">Implementation Specific Behavior</a></span></dt></dl></dd><dt><span class="section"><a href="status.html#status.iso.tr24733">C++ TR 24733</a></span></dt><dt><span class="section"><a href="status.html#status.iso.specfun">C++ IS 29124</a></span></dt><dd><dl><dt><span class="section"><a href="status.html#iso.specfun.specific">Implementation Specific Behavior</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="section"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="section"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="section"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="section"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.status.iso"></a>Implementation Status</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.1998"></a>C++ 1998/2003</h3></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="iso.1998.status"></a>Implementation Status</h4></div></div></div><p>
This status table is based on the table of contents of ISO/IEC 14882:2003.
</p><p>
This page describes the C++ support in the GCC 7 series.
@@ -871,69 +871,69 @@ and test for <code class="code">__STDCPP_MATH_SPEC_FUNCS__ &gt;= 201003L</code>.
2011 Implementation Specific Behavior</a>. This section only
documents behaviour which is new in the 2017 standard.
</p><p>
- <span class="emphasis"><em>20.6.5 [optional.bad_optional_access]</em></span>
+ <span class="emphasis"><em>23.6.5 [optional.bad_optional_access]</em></span>
<code class="code">what()</code> returns <code class="literal">"bad optional access"</code>.
</p><p>
- <span class="emphasis"><em>20.7.2 [variant.variant]</em></span>
+ <span class="emphasis"><em>23.7.3 [variant.variant]</em></span>
Whether <code class="classname">variant</code> supports over-aligned types
should be documented here.
</p><p>
- <span class="emphasis"><em>20.7.10 [variant.bad.access]</em></span>
+ <span class="emphasis"><em>23.7.10 [variant.bad.access]</em></span>
<code class="code">what()</code> returns <code class="literal">"Unexpected index"</code>.
</p><p>
- <span class="emphasis"><em>20.12.5.2 [memory.resource.pool.options]</em></span>
+ <span class="emphasis"><em>23.12.5.2 [memory.resource.pool.options]</em></span>
The limits for maximum number of blocks and largest allocation size
supported by <code class="classname">pool_options</code> should be documented
here.
</p><p>
- <span class="emphasis"><em>20.12.6.1 [memory.resource.monotonic.buffer.ctor]</em></span>
+ <span class="emphasis"><em>23.12.6.1 [memory.resource.monotonic.buffer.ctor]</em></span>
The default <code class="code">next_buffer_size</code> and growth factor should
be documented here.
</p><p>
- <span class="emphasis"><em>20.15.4.3 [meta.unary.prop]</em></span>
+ <span class="emphasis"><em>23.15.4.3 [meta.unary.prop]</em></span>
The predicate condition for
<code class="code">has_unique_object_representations</code> is true for all scalar
types except floating point types.
</p><p>
- <span class="emphasis"><em>20.19.3 [execpol.type],
- 25.2.3 [algorithms.parallel.exec]</em></span>
+ <span class="emphasis"><em>23.19.3 [execpol.type],
+ 28.4.3 [algorithms.parallel.exec]</em></span>
There are no implementation-defined execution policies.
</p><p>
- <span class="emphasis"><em>22.4.2 [string.view.template]</em></span>
+ <span class="emphasis"><em>24.4.2 [string.view.template]</em></span>
<code class="classname">basic_string_view&lt;C, T&gt;::iterator</code> is
<code class="code">C*</code> and
<code class="classname">basic_string_view&lt;C, T&gt;::const_iterator</code> is
<code class="code">const C*</code>.
</p><p>
- <span class="emphasis"><em>25.2.3 [algorithms.parallel.exec]</em></span>
+ <span class="emphasis"><em>28.4.3 [algorithms.parallel.exec]</em></span>
Threads of execution created by <code class="classname">std::thread</code>
provide concurrent forward progress guarantees, so threads of execution
implicitly created by the library will provide parallel forward
progress guarantees.
</p><p>
- <span class="emphasis"><em>26.4.1 [cfenv.syn]</em></span>
+ <span class="emphasis"><em>29.4.1 [cfenv.syn]</em></span>
The effects of the <code class="filename">&lt;cfenv&gt;</code> functions
depends on whether the <code class="code">FENV_ACCESS</code> pragma is supported,
and on the C library that provides the header.
</p><p>
- <span class="emphasis"><em>26.6.9 [c.math.rand]</em></span>
+ <span class="emphasis"><em>29.6.9 [c.math.rand]</em></span>
Whether the <code class="function">rand</code> function may introduce data
races depends on the target C library that provides the function.
</p><p>
- <span class="emphasis"><em>26.9.5 [sf.cmath]</em></span>
+ <span class="emphasis"><em>29.9.5 [sf.cmath]</em></span>
The effect of calling the mathematical special functions with large
inputs should be documented here.
</p><p>
- <span class="emphasis"><em>27.10.2.1 [fs.conform.9945]</em></span>
+ <span class="emphasis"><em>30.10.2.1 [fs.conform.9945]</em></span>
The behavior of the filesystem library implementation will depend on
the target operating system. Some features will not be not supported
on some targets.
</p><p>
- <span class="emphasis"><em>27.10.6 [fs.filesystem.syn]</em></span>
+ <span class="emphasis"><em>30.10.5 [fs.filesystem.syn]</em></span>
The clock used for file times is
<code class="classname">std::chrono::system_clock</code>.
</p><p>
- <span class="emphasis"><em>27.10.8 [path.generic]</em></span>
+ <span class="emphasis"><em>30.10.7.1 [fs.path.generic]</em></span>
dot-dot in the root-directory refers to the root-directory itself.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.tr1"></a>C++ TR1</h3></div></div></div><p>
This table is based on the table of contents of ISO/IEC DTR 19768
@@ -985,7 +985,74 @@ This page describes the TR 24733 support in the GCC 7 series.
<span class="emphasis"><em>4</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Notes on C compatibility</em></span>
- </td></tr></tbody></table></div></div><br class="table-break" /></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="intro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part I. 
+ </td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="status.iso.specfun"></a>C++ IS 29124</h3></div></div></div><p>
+This table is based on the table of contents of ISO/IEC FDIS 29124
+Doc No: N3060 Date: 2010-03-06
+Extensions to the C++ Library to support mathematical special functions
+</p><p>
+Complete support for IS 29124 is in GCC 6.1 and later releases, when using
+at least C++11 (for older releases or C++98/C++03 use TR1 instead).
+For C++11 and C++14 the additions to the library are not declared by their
+respective headers unless <code class="code">__STDCPP_WANT_MATH_SPEC_FUNCS__</code>
+is defined as a macro that expands to a non-zero integer constant.
+For C++17 the special functions are always declared (since GCC 7.1).
+</p><p>
+When the special functions are declared the macro
+<code class="code">__STDCPP_MATH_SPEC_FUNCS__</code> is defined to <code class="code">201003L</code>.
+</p><p>
+In addition to the special functions defined in IS 29124, for
+non-strict modes (i.e. <code class="code">-std=gnu++NN</code> modes) the
+hypergeometric functions and confluent hypergeometric functions
+from TR1 are also provided, defined in namespace
+<code class="code">__gnu_cxx</code>.
+</p><div class="table"><a id="table.specfun_status"></a><p class="title"><strong>Table 1.9. C++ Special Functions Implementation Status</strong></p><div class="table-contents"><table class="table" summary="C++ Special Functions Implementation Status" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /><col align="left" class="c3" /><col align="left" class="c4" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr bgcolor="#B0B0B0"><td align="left">7</td><td align="left">Macro names</td><td align="left">Partial</td><td align="left">No diagnostic for inconsistent definitions of
+ <code class="code">__STDCPP_WANT_MATH_SPEC_FUNCS__</code></td></tr><tr><td align="left">8</td><td align="left">Mathematical special functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1</td><td align="left">Additions to header <code class="code">&lt;cmath&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.1</td><td align="left">associated Laguerre polynomials</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.2</td><td align="left">associated Legendre functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.3</td><td align="left">beta function</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.4</td><td align="left">(complete) elliptic integral of the first kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.5</td><td align="left">(complete) elliptic integral of the second kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.6</td><td align="left">(complete) elliptic integral of the third kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.7</td><td align="left">regular modified cylindrical Bessel functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.8</td><td align="left">cylindrical Bessel functions (of the first kind)</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.9</td><td align="left">irregular modified cylindrical Bessel functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.10</td><td align="left">cylindrical Neumann functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.11</td><td align="left">(incomplete) elliptic integral of the first kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.12</td><td align="left">(incomplete) elliptic integral of the second kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.13</td><td align="left">(incomplete) elliptic integral of the third kind</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.14</td><td align="left">exponential integral</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.15</td><td align="left">Hermite polynomials</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.16</td><td align="left">Laguerre polynomials</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.17</td><td align="left">Legendre polynomials</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.18</td><td align="left">Riemann zeta function</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.19</td><td align="left">spherical Bessel functions (of the first kind)</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.20</td><td align="left">spherical associated Legendre functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.1.21</td><td align="left">spherical Neumann functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">8.2</td><td align="left">Additions to header <code class="code">&lt;math.h&gt;</code></td><td align="left">Y</td><td align="left"> </td></tr><tr bgcolor="#B0B0B0"><td align="left">8.3</td><td align="left">The header <code class="code">&lt;ctgmath&gt;</code></td><td align="left">Partial</td><td align="left">Conflicts with C++ 2011 requirements.</td></tr><tr bgcolor="#C8B0B0"><td align="left">8.4</td><td align="left">The header <code class="code">&lt;tgmath.h&gt;</code></td><td align="left">N</td><td align="left">Conflicts with C++ 2011 requirements.</td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="iso.specfun.specific"></a>Implementation Specific Behavior</h4></div></div></div><p>For behaviour which is specified by the 2011 standard,
+ see <a class="link" href="status.html#iso.2011.specific" title="Implementation Specific Behavior">C++ 2011 Implementation
+ Specific Behavior</a>. This section documents behaviour which
+ is required by IS 29124.
+ </p><p>
+ <span class="emphasis"><em>7.2 [macro.user]/3 /4</em></span> The functions declared in
+ Clause 8 are only declared when
+ <code class="code">__STDCPP_WANT_MATH_SPEC_FUNCS__ == 1</code>
+ (or in C++17 mode, for GCC 7.1 and later).
+ </p><p>
+ <span class="emphasis"><em>8.1.1 [sf.cmath.Lnm]/1</em></span> The effect of calling
+ these functions with <code class="code">n &gt;= 128</code> or <code class="code">m &gt;= 128</code>
+ should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.2 [sf.cmath.Plm]/3</em></span> The effect of calling
+ these functions with <code class="code">l &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.3 [sf.cmath.I]/3</em></span> The effect of calling
+ these functions with <code class="code">nu &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.8 [sf.cmath.J]/3</em></span> The effect of calling
+ these functions with <code class="code">nu &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.9 [sf.cmath.K]/3</em></span> The effect of calling
+ these functions with <code class="code">nu &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.10 [sf.cmath.N]/3</em></span> The effect of calling
+ these functions with <code class="code">nu &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.15 [sf.cmath.Hn]/3</em></span> The effect of calling
+ these functions with <code class="code">n &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.16 [sf.cmath.Ln]/3</em></span> The effect of calling
+ these functions with <code class="code">n &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.17 [sf.cmath.Pl]/3</em></span> The effect of calling
+ these functions with <code class="code">l &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.19 [sf.cmath.j]/3</em></span> The effect of calling
+ these functions with <code class="code">n &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.20 [sf.cmath.Ylm]/3</em></span> The effect of calling
+ these functions with <code class="code">l &gt;= 128</code> should be described here.
+ </p><p>
+ <span class="emphasis"><em>8.1.21 [sf.cmath.n]/3</em></span> The effect of calling
+ these functions with <code class="code">n &gt;= 128</code> should be described here.
+ </p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="intro.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="intro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="license.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part I. 
Introduction
 </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> License</td></tr></table></div></body></html> \ No newline at end of file
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 157b2845463..61f948cdf39 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -50,6 +50,10 @@
<!-- Section 01.6 : Status C++ TR24733 -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="status_cxxtr24733.xml">
</xi:include>
+
+ <!-- Section 01.7 : Status C++ IS 24733 -->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="status_cxxis29124.xml">
+ </xi:include>
</section>
<!-- Section 02 : License -->
diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
index 389daefd75d..168933808eb 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
@@ -970,49 +970,49 @@ and test for <code>__STDCPP_MATH_SPEC_FUNCS__ >= 201003L</code>.
</para>
<para>
- <emphasis>20.6.5 [optional.bad_optional_access]</emphasis>
+ <emphasis>23.6.5 [optional.bad_optional_access]</emphasis>
<code>what()</code> returns <literal>"bad optional access"</literal>.
</para>
<para>
- <emphasis>20.7.2 [variant.variant]</emphasis>
+ <emphasis>23.7.3 [variant.variant]</emphasis>
Whether <classname>variant</classname> supports over-aligned types
should be documented here.
</para>
<para>
- <emphasis>20.7.10 [variant.bad.access]</emphasis>
+ <emphasis>23.7.10 [variant.bad.access]</emphasis>
<code>what()</code> returns <literal>"Unexpected index"</literal>.
</para>
<para>
- <emphasis>20.12.5.2 [memory.resource.pool.options]</emphasis>
+ <emphasis>23.12.5.2 [memory.resource.pool.options]</emphasis>
The limits for maximum number of blocks and largest allocation size
supported by <classname>pool_options</classname> should be documented
here.
</para>
<para>
- <emphasis>20.12.6.1 [memory.resource.monotonic.buffer.ctor]</emphasis>
+ <emphasis>23.12.6.1 [memory.resource.monotonic.buffer.ctor]</emphasis>
The default <code>next_buffer_size</code> and growth factor should
be documented here.
</para>
<para>
- <emphasis>20.15.4.3 [meta.unary.prop]</emphasis>
+ <emphasis>23.15.4.3 [meta.unary.prop]</emphasis>
The predicate condition for
<code>has_unique_object_representations</code> is true for all scalar
types except floating point types.
</para>
<para>
- <emphasis>20.19.3 [execpol.type],
- 25.2.3 [algorithms.parallel.exec]</emphasis>
+ <emphasis>23.19.3 [execpol.type],
+ 28.4.3 [algorithms.parallel.exec]</emphasis>
There are no implementation-defined execution policies.
</para>
<para>
- <emphasis>22.4.2 [string.view.template]</emphasis>
+ <emphasis>24.4.2 [string.view.template]</emphasis>
<classname>basic_string_view&lt;C, T&gt;::iterator</classname> is
<code>C*</code> and
<classname>basic_string_view&lt;C, T&gt;::const_iterator</classname> is
@@ -1021,7 +1021,7 @@ and test for <code>__STDCPP_MATH_SPEC_FUNCS__ >= 201003L</code>.
<para>
- <emphasis>25.2.3 [algorithms.parallel.exec]</emphasis>
+ <emphasis>28.4.3 [algorithms.parallel.exec]</emphasis>
Threads of execution created by <classname>std::thread</classname>
provide concurrent forward progress guarantees, so threads of execution
implicitly created by the library will provide parallel forward
@@ -1029,39 +1029,39 @@ and test for <code>__STDCPP_MATH_SPEC_FUNCS__ >= 201003L</code>.
</para>
<para>
- <emphasis>26.4.1 [cfenv.syn]</emphasis>
+ <emphasis>29.4.1 [cfenv.syn]</emphasis>
The effects of the <filename>&lt;cfenv&gt;</filename> functions
depends on whether the <code>FENV_ACCESS</code> pragma is supported,
and on the C library that provides the header.
</para>
<para>
- <emphasis>26.6.9 [c.math.rand]</emphasis>
+ <emphasis>29.6.9 [c.math.rand]</emphasis>
Whether the <function>rand</function> function may introduce data
races depends on the target C library that provides the function.
</para>
<para>
- <emphasis>26.9.5 [sf.cmath]</emphasis>
+ <emphasis>29.9.5 [sf.cmath]</emphasis>
The effect of calling the mathematical special functions with large
inputs should be documented here.
</para>
<para>
- <emphasis>27.10.2.1 [fs.conform.9945]</emphasis>
+ <emphasis>30.10.2.1 [fs.conform.9945]</emphasis>
The behavior of the filesystem library implementation will depend on
the target operating system. Some features will not be not supported
on some targets.
</para>
<para>
- <emphasis>27.10.6 [fs.filesystem.syn]</emphasis>
+ <emphasis>30.10.5 [fs.filesystem.syn]</emphasis>
The clock used for file times is
<classname>std::chrono::system_clock</classname>.
</para>
<para>
- <emphasis>27.10.8 [path.generic]</emphasis>
+ <emphasis>30.10.7.1 [fs.path.generic]</emphasis>
dot-dot in the root-directory refers to the root-directory itself.
</para>
diff --git a/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml b/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml
new file mode 100644
index 00000000000..40a90fc9944
--- /dev/null
+++ b/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml
@@ -0,0 +1,315 @@
+<section xmlns="http://docbook.org/ns/docbook" version="5.0"
+ xml:id="status.iso.specfun" xreflabel="Status C++ 29124">
+<?dbhtml filename="status_iso_cxxis29124.html"?>
+
+<info><title>C++ IS 29124</title>
+ <keywordset>
+ <keyword>ISO C++</keyword>
+ <keyword>Special Functions</keyword>
+ </keywordset>
+</info>
+
+<para>
+This table is based on the table of contents of ISO/IEC FDIS 29124
+Doc No: N3060 Date: 2010-03-06
+Extensions to the C++ Library to support mathematical special functions
+</para>
+
+<para>
+Complete support for IS 29124 is in GCC 6.1 and later releases, when using
+at least C++11 (for older releases or C++98/C++03 use TR1 instead).
+For C++11 and C++14 the additions to the library are not declared by their
+respective headers unless <code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code>
+is defined as a macro that expands to a non-zero integer constant.
+For C++17 the special functions are always declared (since GCC 7.1).
+</para>
+
+<para>
+When the special functions are declared the macro
+<code>__STDCPP_MATH_SPEC_FUNCS__</code> is defined to <code>201003L</code>.
+</para>
+
+<para>
+In addition to the special functions defined in IS 29124, for
+non-strict modes (i.e. <code>-std=gnu++NN</code> modes) the
+hypergeometric functions and confluent hypergeometric functions
+from TR1 are also provided, defined in namespace
+<code>__gnu_cxx</code>.
+</para>
+
+<!-- Status is Yes or No, Broken/Partial-->
+<!--
+ Yes
+
+ No
+ <?dbhtml bgcolor="#C8B0B0" ?>
+ Broken/Partial
+ <?dbhtml bgcolor="#B0B0B0" ?>
+-->
+<table frame="all" xml:id="table.specfun_status">
+<title>C++ Special Functions Implementation Status</title>
+
+<tgroup cols="4" align="left" colsep="0" rowsep="1">
+<colspec colname="c1"/>
+<colspec colname="c2"/>
+<colspec colname="c3"/>
+<colspec colname="c4"/>
+
+ <thead>
+ <row>
+ <entry>Section</entry>
+ <entry>Description</entry>
+ <entry>Status</entry>
+ <entry>Comments</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <?dbhtml bgcolor="#B0B0B0" ?>
+ <entry>7</entry>
+ <entry>Macro names</entry>
+ <entry>Partial</entry>
+ <entry>No diagnostic for inconsistent definitions of
+ <code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code></entry>
+ </row>
+ <row>
+ <entry>8</entry>
+ <entry>Mathematical special functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1</entry>
+ <entry>Additions to header <code>&lt;cmath&gt;</code> synopsis</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.1</entry>
+ <entry>associated Laguerre polynomials</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.2</entry>
+ <entry>associated Legendre functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.3</entry>
+ <entry>beta function</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.4</entry>
+ <entry>(complete) elliptic integral of the first kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.5</entry>
+ <entry>(complete) elliptic integral of the second kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.6</entry>
+ <entry>(complete) elliptic integral of the third kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.7</entry>
+ <entry>regular modified cylindrical Bessel functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.8</entry>
+ <entry>cylindrical Bessel functions (of the first kind)</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.9</entry>
+ <entry>irregular modified cylindrical Bessel functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.10</entry>
+ <entry>cylindrical Neumann functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.11</entry>
+ <entry>(incomplete) elliptic integral of the first kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.12</entry>
+ <entry>(incomplete) elliptic integral of the second kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.13</entry>
+ <entry>(incomplete) elliptic integral of the third kind</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.14</entry>
+ <entry>exponential integral</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.15</entry>
+ <entry>Hermite polynomials</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.16</entry>
+ <entry>Laguerre polynomials</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.17</entry>
+ <entry>Legendre polynomials</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.18</entry>
+ <entry>Riemann zeta function</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.19</entry>
+ <entry>spherical Bessel functions (of the first kind)</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.20</entry>
+ <entry>spherical associated Legendre functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.1.21</entry>
+ <entry>spherical Neumann functions</entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <entry>8.2</entry>
+ <entry>Additions to header <code>&lt;math.h&gt;</code></entry>
+ <entry>Y</entry>
+ <entry/>
+ </row>
+ <row>
+ <?dbhtml bgcolor="#B0B0B0" ?>
+ <entry>8.3</entry>
+ <entry>The header <code>&lt;ctgmath&gt;</code></entry>
+ <entry>Partial</entry>
+ <entry>Conflicts with C++ 2011 requirements.</entry>
+ </row>
+ <row>
+ <?dbhtml bgcolor="#C8B0B0" ?>
+ <entry>8.4</entry>
+ <entry>The header <code>&lt;tgmath.h&gt;</code></entry>
+ <entry>N</entry>
+ <entry>Conflicts with C++ 2011 requirements.</entry>
+ </row>
+ </tbody>
+</tgroup>
+</table>
+
+<section xml:id="iso.specfun.specific" xreflabel="Implementation Specific"><info><title>Implementation Specific Behavior</title></info>
+
+ <para>For behaviour which is specified by the 2011 standard,
+ see <link linkend="iso.2011.specific">C++ 2011 Implementation
+ Specific Behavior</link>. This section documents behaviour which
+ is required by IS 29124.
+ </para>
+
+ <para>
+ <emphasis>7.2 [macro.user]/3 /4</emphasis> The functions declared in
+ Clause 8 are only declared when
+ <code>__STDCPP_WANT_MATH_SPEC_FUNCS__ == 1</code>
+ (or in C++17 mode, for GCC 7.1 and later).
+ </para>
+
+ <para>
+ <emphasis>8.1.1 [sf.cmath.Lnm]/1</emphasis> The effect of calling
+ these functions with <code>n >= 128</code> or <code>m >= 128</code>
+ should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.2 [sf.cmath.Plm]/3</emphasis> The effect of calling
+ these functions with <code>l >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.3 [sf.cmath.I]/3</emphasis> The effect of calling
+ these functions with <code>nu >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.8 [sf.cmath.J]/3</emphasis> The effect of calling
+ these functions with <code>nu >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.9 [sf.cmath.K]/3</emphasis> The effect of calling
+ these functions with <code>nu >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.10 [sf.cmath.N]/3</emphasis> The effect of calling
+ these functions with <code>nu >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.15 [sf.cmath.Hn]/3</emphasis> The effect of calling
+ these functions with <code>n >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.16 [sf.cmath.Ln]/3</emphasis> The effect of calling
+ these functions with <code>n >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.17 [sf.cmath.Pl]/3</emphasis> The effect of calling
+ these functions with <code>l >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.19 [sf.cmath.j]/3</emphasis> The effect of calling
+ these functions with <code>n >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.20 [sf.cmath.Ylm]/3</emphasis> The effect of calling
+ these functions with <code>l >= 128</code> should be described here.
+ </para>
+
+ <para>
+ <emphasis>8.1.21 [sf.cmath.n]/3</emphasis> The effect of calling
+ these functions with <code>n >= 128</code> should be described here.
+ </para>
+
+</section>
+
+</section>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 6395f1e6ae0..370c1fe2682 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1474,3 +1474,8 @@ $(decimal_headers): ; @:
$(ext_headers): ; @:
$(experimental_headers): ; @:
$(experimental_bits_headers): ; @:
+
+if INCLUDE_DIR_NOTPARALLEL
+# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797
+.NOTPARALLEL:
+endif
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 745a8495da5..50ad7eccb01 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1897,6 +1897,9 @@ $(ext_headers): ; @:
$(experimental_headers): ; @:
$(experimental_bits_headers): ; @:
+# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797
+@INCLUDE_DIR_NOTPARALLEL_TRUE@.NOTPARALLEL:
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libstdc++-v3/include/bits/parse_numbers.h b/libstdc++-v3/include/bits/parse_numbers.h
index b82df755108..e1d514aa507 100644
--- a/libstdc++-v3/include/bits/parse_numbers.h
+++ b/libstdc++-v3/include/bits/parse_numbers.h
@@ -197,6 +197,13 @@ namespace __parse_int
"integer literal does not fit in unsigned long long");
};
+ // Skip past digit separators:
+ template<unsigned _Base, unsigned long long _Pow, char _Dig, char..._Digs>
+ struct _Number_help<_Base, _Pow, '\'', _Dig, _Digs...>
+ : _Number_help<_Base, _Pow, _Dig, _Digs...>
+ { };
+
+ // Terminating case for recursion:
template<unsigned _Base, unsigned long long _Pow, char _Dig>
struct _Number_help<_Base, _Pow, _Dig>
{
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index d39cc3e0666..c3fbb0fff16 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -2643,7 +2643,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
void
param(const param_type& __param)
- { _M_param = __param; }
+ {
+ _M_param = __param;
+ typedef typename std::gamma_distribution<result_type>::param_type
+ param_type;
+ _M_gd.param(param_type{__param.n() / 2});
+ }
/**
* @brief Returns the greatest lower bound value of the distribution.
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index 11d268b7f81..815d52c0778 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -65,7 +65,7 @@ namespace std
/// std::byte
enum class byte : unsigned char {};
- template<typename _IntegerType> struct __byte_operand;
+ template<typename _IntegerType> struct __byte_operand { };
template<> struct __byte_operand<bool> { using __type = byte; };
template<> struct __byte_operand<char> { using __type = byte; };
template<> struct __byte_operand<signed char> { using __type = byte; };
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index eef510535d7..50daa80fcf9 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -70,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @brief A type-safe container of any type.
- *
+ *
* An @c any object's state is either empty or it stores a contained object
* of CopyConstructible type.
*/
@@ -114,8 +114,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void __do_emplace(_Args&&... __args)
{
reset();
- _M_manager = &_Mgr::_S_manage;
_Mgr::_S_create(_M_storage, std::forward<_Args>(__args)...);
+ _M_manager = &_Mgr::_S_manage;
}
/// Emplace with an object created from @p __il and @p __args as
@@ -125,8 +125,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void __do_emplace(initializer_list<_Up> __il, _Args&&... __args)
{
reset();
- _M_manager = &_Mgr::_S_manage;
_Mgr::_S_create(_M_storage, __il, std::forward<_Args>(__args)...);
+ _M_manager = &_Mgr::_S_manage;
}
public:
@@ -272,8 +272,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Decay<_ValueType>, _Args&&...>::type
emplace(_Args&&... __args)
{
- __do_emplace<_Decay<_ValueType>>
- (std::forward<_Args>(__args)...);
+ __do_emplace<_Decay<_ValueType>>(std::forward<_Args>(__args)...);
any::_Arg __arg;
this->_M_manager(any::_Op_access, this, &__arg);
return *static_cast<_Decay<_ValueType>*>(__arg._M_obj);
@@ -288,8 +287,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Args&&...>::type
emplace(initializer_list<_Up> __il, _Args&&... __args)
{
- __do_emplace<_Decay<_ValueType>, _Up>
- (__il, std::forward<_Args>(__args)...);
+ __do_emplace<_Decay<_ValueType>, _Up>(__il,
+ std::forward<_Args>(__args)...);
any::_Arg __arg;
this->_M_manager(any::_Op_access, this, &__arg);
return *static_cast<_Decay<_ValueType>*>(__arg._M_obj);
@@ -624,7 +623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// @}
-
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 8e2cb68e295..6e850bb8d12 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -243,21 +243,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _M_invoke(_Indices()); }
};
- // Alias for _Invoker<tuple<DECAY_COPY(_Tp)...>>
template<typename... _Tp>
- using __invoker_type
- = _Invoker<decltype(std::make_tuple(std::declval<_Tp>()...))>;
+ using __decayed_tuple = tuple<typename std::decay<_Tp>::type...>;
public:
- // Returns a call wrapper that does
- // INVOKE(DECAY_COPY(__callable), DECAY_COPY(__args)).
+ // Returns a call wrapper that stores
+ // tuple{DECAY_COPY(__callable), DECAY_COPY(__args)...}.
template<typename _Callable, typename... _Args>
- static __invoker_type<_Callable, _Args...>
+ static _Invoker<__decayed_tuple<_Callable, _Args...>>
__make_invoker(_Callable&& __callable, _Args&&... __args)
{
- return { {
- std::make_tuple(std::forward<_Callable>(__callable),
- std::forward<_Args>(__args)...)
+ return { __decayed_tuple<_Callable, _Args...>{
+ std::forward<_Callable>(__callable), std::forward<_Args>(__args)...
} };
}
};
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index baacfb006dd..834bef745c4 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3069,6 +3069,10 @@ template <typename _From, typename _To>
remove_cv_t<remove_all_extents_t<_Tp>>
)>
{ };
+
+ template<typename _Tp>
+ inline constexpr bool has_unique_object_representations_v
+ = has_unique_object_representations<_Tp>::value;
#endif
#undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 1873deb6936..158895e89d2 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -112,4 +112,8 @@
#undef r
#endif
+#if defined (__linux__) && defined (__sparc__)
+#undef y
+#endif
+
#include <bits/stdc++.h>
diff --git a/libstdc++-v3/testsuite/18_support/byte/81076.cc b/libstdc++-v3/testsuite/18_support/byte/81076.cc
new file mode 100644
index 00000000000..6ca7063bd05
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/byte/81076.cc
@@ -0,0 +1,26 @@
+// 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 "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <cstddef>
+
+template<class> void to_integer(...);
+
+using T = decltype(to_integer<void* const>(std::byte{}));
+using T = void;
diff --git a/libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc b/libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc
index 2d2b3d3d14c..6d0a688aace 100644
--- a/libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc
@@ -26,5 +26,5 @@ void test01()
using std::any_cast;
const any y(1);
- any_cast<int&>(y); // { dg-error "invalid static_cast" "" { target { *-*-* } } 461 }
+ any_cast<int&>(y); // { dg-error "invalid static_cast" "" { target { *-*-* } } 460 }
}
diff --git a/libstdc++-v3/testsuite/20_util/any/modifiers/83658.cc b/libstdc++-v3/testsuite/20_util/any/modifiers/83658.cc
new file mode 100644
index 00000000000..121db6dc075
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/any/modifiers/83658.cc
@@ -0,0 +1,74 @@
+// 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 "-std=gnu++17" }
+// { dg-do run { target c++1z } }
+
+#include <any>
+#include <new>
+#include <testsuite_hooks.h>
+
+struct E : std::bad_alloc { };
+
+struct X
+{
+ X() = default;
+ X(std::initializer_list<int>) { }
+
+ // Prevents small-object optimization:
+ X(const X&) noexcept(false) { }
+
+ static void* operator new(std::size_t) { throw E{}; }
+ static void operator delete(void*, std::size_t) noexcept { }
+};
+
+void
+test01()
+{
+ std::any a;
+ try
+ {
+ a.emplace<X>();
+ VERIFY(false);
+ }
+ catch (const E&)
+ {
+ VERIFY( !a.has_value() );
+ }
+}
+
+void
+test02()
+{
+ std::any a;
+ try
+ {
+ a.emplace<X>(std::initializer_list<int>{});
+ VERIFY(false);
+ }
+ catch (const E&)
+ {
+ VERIFY( !a.has_value() );
+ }
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/84671.cc b/libstdc++-v3/testsuite/20_util/duration/literals/84671.cc
new file mode 100644
index 00000000000..4f50ec4c9cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/literals/84671.cc
@@ -0,0 +1,26 @@
+// 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-do compile { target c++14 } }
+
+#include <chrono>
+
+// PR libstdc++/84671
+using namespace std::literals::chrono_literals;
+constexpr auto ns_ok = 12113ns;
+constexpr auto ns_fail = 12'11'3ns;
+static_assert(ns_ok == ns_fail, "digit separators work in duration literals");
diff --git a/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
index 008d59062ab..60f30a294da 100644
--- a/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
+++ b/libstdc++-v3/testsuite/20_util/has_unique_object_representations/value.cc
@@ -108,3 +108,17 @@ void test01()
static_assert(test_category<has_unique_object_representations,
Aligned[][1]>(false), "");
}
+
+void
+test02()
+{
+ using std::has_unique_object_representations;
+ using std::has_unique_object_representations_v;
+
+ static_assert(has_unique_object_representations_v<int>
+ == has_unique_object_representations<int>::value);
+ static_assert(has_unique_object_representations_v<void>
+ == has_unique_object_representations<void>::value);
+ static_assert(has_unique_object_representations_v<float>
+ == has_unique_object_representations<float>::value);
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/83833.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/83833.cc
new file mode 100644
index 00000000000..821a1a40e2a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/83833.cc
@@ -0,0 +1,40 @@
+// 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-do run { target c++11 } }
+// { dg-additional-options "-ffloat-store" { target { m68*-*-* || ia32 } } }
+
+#include <random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::default_random_engine r1, r2;
+ using chi = std::chi_squared_distribution<double>;
+ chi::param_type p(5);
+ chi d1(p);
+ chi d2;
+ d2.param(p);
+ VERIFY( d1(r1) == d2(r2) ); // PR libstdc++/83833
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/30_threads/async/84532.cc b/libstdc++-v3/testsuite/30_threads/async/84532.cc
new file mode 100644
index 00000000000..480ed733ca3
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/async/84532.cc
@@ -0,0 +1,38 @@
+// { dg-do compile { target c++11 } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// 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/>.
+
+#include <future>
+
+// PR libstdc++/84532
+
+struct F
+{
+ template<typename T, typename U>
+ void operator()(T, U, int&)
+ {
+ using std::is_same;
+ using std::reference_wrapper;
+ static_assert(is_same<T, reference_wrapper<int>>::value, "");
+ static_assert(is_same<U, reference_wrapper<const int>>::value, "");
+ }
+};
+int i = 0;
+auto fut = std::async(F{}, std::ref(i), std::cref(i), std::ref(i));
diff --git a/libstdc++-v3/testsuite/30_threads/thread/84532.cc b/libstdc++-v3/testsuite/30_threads/thread/84532.cc
new file mode 100644
index 00000000000..f389b9b88e3
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/thread/84532.cc
@@ -0,0 +1,38 @@
+// { dg-do compile { target c++11 } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// 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/>.
+
+#include <thread>
+
+// PR libstdc++/84532
+
+struct F
+{
+ template<typename T, typename U>
+ void operator()(T, U, int&)
+ {
+ using std::is_same;
+ using std::reference_wrapper;
+ static_assert(is_same<T, reference_wrapper<int>>::value, "");
+ static_assert(is_same<U, reference_wrapper<const int>>::value, "");
+ }
+};
+int i = 0;
+std::thread t(F{}, std::ref(i), std::cref(i), std::ref(i));
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index e8ba66166a0..4f4d7e00de4 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 829a81352b0..954d7821cd0 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog
index fcf7afa9252..656bdfa253b 100644
--- a/maintainer-scripts/ChangeLog
+++ b/maintainer-scripts/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.
diff --git a/zlib/ChangeLog b/zlib/ChangeLog
index 0d55589eaf7..4d613481e75 100644
--- a/zlib/ChangeLog
+++ b/zlib/ChangeLog
@@ -1,3 +1,7 @@
+2018-01-25 Release Manager
+
+ * GCC 7.3.0 released.
+
2017-08-14 Release Manager
* GCC 7.2.0 released.