aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2018-04-18 13:54:33 +0000
committerThomas Preud'homme <thomas.preudhomme@arm.com>2018-04-18 13:54:33 +0000
commit701c5838e5f5999de48c3b2c9f2e10b453a78f88 (patch)
treea8276133b3527d661472cf6e4cc646a3c007c6f1
parent1b653976cf787dad1e554bcbd08613f01668d8ce (diff)
parentd2bd586cde45ee199d4629dc07d4b809aee257a8 (diff)
Merge from gcc-7-branch.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch@259470 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog668
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog26
-rw-r--r--gcc/ada/gcc-interface/Makefile.in4
-rw-r--r--gcc/ada/gcc-interface/misc.c3
-rw-r--r--gcc/ada/gcc-interface/trans.c4
-rw-r--r--gcc/builtins.c3
-rw-r--r--gcc/c-family/ChangeLog12
-rw-r--r--gcc/c-family/c-cppbuiltin.c13
-rw-r--r--gcc/cgraph.h3
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/aarch64/aarch64-simd.md97
-rw-r--r--gcc/config/aarch64/aarch64.c11
-rw-r--r--gcc/config/aarch64/aarch64.md3
-rw-r--r--gcc/config/alpha/alpha.c4
-rw-r--r--gcc/config/alpha/alpha.md10
-rw-r--r--gcc/config/arm/arm-builtins.c6
-rw-r--r--gcc/config/arm/arm.c16
-rw-r--r--gcc/config/arm/arm.h3
-rw-r--r--gcc/config/arm/arm.md9
-rw-r--r--gcc/config/arm/neon.md14
-rw-r--r--gcc/config/avr/avr.h3
-rw-r--r--gcc/config/avr/avr.md2
-rw-r--r--gcc/config/i386/avx512vlintrin.h40
-rw-r--r--gcc/config/i386/constraints.md4
-rw-r--r--gcc/config/i386/i386-protos.h4
-rw-r--r--gcc/config/i386/i386.c278
-rw-r--r--gcc/config/i386/i386.h5
-rw-r--r--gcc/config/i386/i386.md43
-rw-r--r--gcc/config/i386/predicates.md6
-rw-r--r--gcc/config/i386/sse.md6
-rw-r--r--gcc/config/nvptx/nvptx.c15
-rw-r--r--gcc/config/pa/pa.c20
-rw-r--r--gcc/config/pa/pa.h18
-rw-r--r--gcc/config/pa/pa.md82
-rw-r--r--gcc/config/pa/pa64-hpux.h14
-rw-r--r--gcc/config/rs6000/altivec.h2
-rw-r--r--gcc/config/rs6000/altivec.md132
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def21
-rw-r--r--gcc/config/rs6000/rs6000-c.c21
-rw-r--r--gcc/config/rs6000/rs6000.c70
-rw-r--r--gcc/config/rs6000/rs6000.h4
-rw-r--r--gcc/config/rs6000/rs6000.md12
-rw-r--r--gcc/config/rs6000/sysv4.opt4
-rw-r--r--gcc/config/rs6000/vector.md14
-rw-r--r--gcc/config/rs6000/vsx.md72
-rw-r--r--gcc/config/s390/s390.c2
-rw-r--r--gcc/config/sparc/sparc.c36
-rw-r--r--gcc/config/sparc/sparc.md12
-rw-r--r--gcc/cp/ChangeLog251
-rw-r--r--gcc/cp/call.c6
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/constexpr.c107
-rw-r--r--gcc/cp/cvt.c2
-rw-r--r--gcc/cp/decl.c30
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/error.c1
-rw-r--r--gcc/cp/parser.c231
-rw-r--r--gcc/cp/pt.c41
-rw-r--r--gcc/cp/search.c2
-rw-r--r--gcc/cp/semantics.c5
-rw-r--r--gcc/cp/tree.c9
-rw-r--r--gcc/cp/typeck.c12
-rw-r--r--gcc/ddg.c9
-rw-r--r--gcc/doc/extend.texi23
-rw-r--r--gcc/doc/gcov.texi4
-rw-r--r--gcc/doc/invoke.texi19
-rw-r--r--gcc/expr.c26
-rw-r--r--gcc/final.c4
-rw-r--r--gcc/fold-const.c19
-rw-r--r--gcc/fortran/ChangeLog141
-rw-r--r--gcc/fortran/arith.c10
-rw-r--r--gcc/fortran/decl.c57
-rw-r--r--gcc/fortran/expr.c5
-rw-r--r--gcc/fortran/frontend-passes.c8
-rw-r--r--gcc/fortran/gfortran.h4
-rw-r--r--gcc/fortran/interface.c2
-rw-r--r--gcc/fortran/openmp.c8
-rw-r--r--gcc/fortran/primary.c18
-rw-r--r--gcc/fortran/resolve.c43
-rw-r--r--gcc/fortran/simplify.c39
-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.c2
-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/gimple-ssa-store-merging.c10
-rw-r--r--gcc/gimple-ssa-strength-reduction.c4
-rw-r--r--gcc/ipa-cp.c18
-rw-r--r--gcc/ipa-inline.c2
-rw-r--r--gcc/ipa-prop.c13
-rw-r--r--gcc/ipa-utils.c2
-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/ChangeLog73
-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/omp-low.c51
-rw-r--r--gcc/opts.c20
-rw-r--r--gcc/params.def4
-rw-r--r--gcc/sched-deps.c6
-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/ChangeLog624
-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/concepts/auto4.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto-60626.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto51.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-84449.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype67.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-defarg2.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi14.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr83824.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for13.C44
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae60.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-nested3.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C41
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic16.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic17.C125
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-mangle-1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr10.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr9.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr60393.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr60626.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr83817.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr84558.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction50.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction51.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction54.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-84684.C163
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-if13.C11
-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/launder7.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/launder8.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type19.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type19.h4
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-noinline-4.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin12.C10
-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/new44.C238
-rw-r--r--gcc/testsuite/g++.dg/init/pr83993-2.C14
-rw-r--r--gcc/testsuite/g++.dg/opt/pr85196.C89
-rw-r--r--gcc/testsuite/g++.dg/parse/crash67.C2
-rw-r--r--gcc/testsuite/g++.dg/pr85026.C61
-rw-r--r--gcc/testsuite/g++.dg/template/dependent-base3.C26
-rw-r--r--gcc/testsuite/g++.dg/template/incomplete11.C10
-rw-r--r--gcc/testsuite/g++.dg/torture/pr83659.C18
-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/pr84556.cc21
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr84425.c17
-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/execute/pr84748.c34
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/pr69869.c8
-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/pr81661.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr82916.c47
-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/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/pr84956.c27
-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/vect/pr84485.c34
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr63304_1.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr81647.c45
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-1.c28
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-16.c18
-rw-r--r--gcc/testsuite/gcc.target/arm/fpscr.c9
-rw-r--r--gcc/testsuite/gcc.target/arm/pr82518.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/pr82989.c33
-rw-r--r--gcc/testsuite/gcc.target/arm/pr84826.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-1.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-3.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-4.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-5.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-6.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-7.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c4
-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/pr85193.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-10.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-11.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-12.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-13.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-14.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/ret-thunk-15.c7
-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-9.c15
-rw-r--r--gcc/testsuite/gcc.target/nvptx/indirect_call.c19
-rw-r--r--gcc/testsuite/gcc.target/nvptx/pr85056.c21
-rw-r--r--gcc/testsuite/gcc.target/nvptx/pr85056a.c3
-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/crypto-builtin-1-runnable.c109
-rw-r--r--gcc/testsuite/gcc.target/powerpc/extend-divide-1.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/extend-divide-2.c14
-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/ppc-sdata-2.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79799-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr81572.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84878.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c19
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_52.f9011
-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/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/interface_41.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/internal_references_1.f907
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_rank_1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr51434.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/pr64124.f905
-rw-r--r--gcc/testsuite/gfortran.dg/pr65453.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr70409.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/pr71085.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr77414.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr78741.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/pr83939.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr84117.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr84734.f904
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_41.f9030
-rw-r--r--gcc/testsuite/gnat.dg/prot3.adb8
-rw-r--r--gcc/testsuite/gnat.dg/prot3_pkg.adb17
-rw-r--r--gcc/testsuite/gnat.dg/prot3_pkg.ads16
-rw-r--r--gcc/testsuite/lib/target-supports.exp3
-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-inline.c20
-rw-r--r--gcc/tree-ssa-pre.c25
-rw-r--r--gcc/tree-ssa-tail-merge.c6
-rw-r--r--gcc/tree-vect-data-refs.c12
-rw-r--r--gcc/tree-vect-loop.c4
-rw-r--r--gcc/tree.c7
-rw-r--r--libatomic/ChangeLog8
-rw-r--r--libatomic/config/s390/exch_n.c69
-rw-r--r--libatomic/configure.tgt5
-rw-r--r--libcpp/ChangeLog16
-rw-r--r--libcpp/include/cpplib.h2
-rw-r--r--libcpp/traditional.c18
-rw-r--r--libgcc/ChangeLog26
-rw-r--r--libgcc/config/i386/cpuinfo.c114
-rw-r--r--libgcc/config/pa/fptr.c20
-rw-r--r--libgomp/ChangeLog16
-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--libstdc++-v3/ChangeLog95
-rwxr-xr-xlibstdc++-v3/configure26
-rw-r--r--libstdc++-v3/crossconfig.m42
-rw-r--r--libstdc++-v3/include/bits/parse_numbers.h7
-rw-r--r--libstdc++-v3/include/c_global/cstdlib6
-rw-r--r--libstdc++-v3/include/std/variant14
-rw-r--r--libstdc++-v3/src/c++11/Makefile.am20
-rw-r--r--libstdc++-v3/src/c++11/Makefile.in18
-rw-r--r--libstdc++-v3/src/c++11/cxx11-ios_failure.cc70
-rw-r--r--libstdc++-v3/src/c++11/ios.cc16
-rw-r--r--libstdc++-v3/src/c++98/ios_failure.cc47
-rw-r--r--libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc42
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/literals/84671.cc26
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc9
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc99
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc15
-rw-r--r--libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc1
352 files changed, 7135 insertions, 1474 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index def6171660c..220d222986c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,671 @@
+2018-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR target/85261
+ * config/arm/arm-builtins.c (arm_expand_builtin): Force input operand
+ into register.
+
+2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * config/s390/s390.c (s390_output_indirect_thunk_function): Check
+ also for flag_dwarf2_cfi_asm.
+
+2018-04-11 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.md (stack_probe_internal): Rename
+ from "probe_stack". Update all callers.
+
+2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2018-04-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR target/85203
+ * config/arm/arm-builtins.c (arm_expand_builtin): Change
+ expansion to perform a bitwise AND of the argument followed by a
+ boolean negation of the result.
+
+2018-04-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/84748
+ * config/aarch64/aarch64.md (*compare_cstore<mode>_insn): Mark pattern
+ as clobbering CC_REGNUM.
+
+2018-04-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/85196
+ * config/sparc/sparc.c (sparc_expand_move): Deal with symbolic operands
+ based on LABEL_REF. Remove useless assertion.
+ (pic_address_needs_scratch): Fix formatting.
+ (sparc_legitimize_pic_address): Minor tweaks.
+ (sparc_delegitimize_address): Adjust assertion accordingly.
+ * config/sparc/sparc.md (movsi_pic_label_ref): Change label_ref_operand
+ into symbolic_operand.
+ (movsi_high_pic_label_ref): Likewise.
+ (movsi_lo_sum_pic_label_ref): Likewise.
+ (movdi_pic_label_ref): Likewise.
+ (movdi_high_pic_label_ref): Likewise.
+ (movdi_lo_sum_pic_label_ref): Likewise.
+
+2018-04-06 Amaan Cheval <amaan.cheval@gmail.com>
+
+ * config.gcc (x86_64-*-rtems*): Add rtems.h to tm_file for
+ custom LIB_SPEC setup.
+
+2018-04-05 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/85193
+ * config/i386/i386.md (define_attr "memory"): Handle rotate1 type.
+
+2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR rtl-optimization/84878
+ * ddg.c (add_cross_iteration_register_deps): Use DF_REF_BB to determine
+ the basic block. Assert the use reference is not artificial and that
+ it has an associated insn.
+
+2018-04-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (emit_i387_cw_initialization): Always use logic
+ instructions when changing rounding bits to preserve precision bits
+ in the x87 control word.
+
+2018-04-03 Cesar Philippidis <cesar@codesourcery.com>
+
+ Backport from mainline
+ 2018-03-27 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/85056
+ * config/nvptx/nvptx.c (nvptx_assemble_decl_begin): Add '[]' to
+ extern array declarations.
+
+2018-04-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-28 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84912
+ * config/rs6000/rs6000.h: Update copyright date.
+ (RS6000_BTM_POWERPC64): New define.
+ (RS6000_BTM_COMMON): Add RS6000_BTM_POWERPC64.
+ * config/rs6000/rs6000.c: Update copyright date.
+ (rs6000_builtin_mask_calculate): Add support for RS6000_BTM_POWERPC64.
+ (rs6000_invalid_builtin): Add handling for RS6000_BTM_POWERPC64
+ (rs6000_builtin_mask_names): Add RS6000_BTM_POWERPC64.
+ * config/rs6000/rs6000-builtin.def: Update copyright date.
+ (BU_P7_POWERPC64_MISC_2): New macro definition.
+ (DIVDE): Use it.
+ (DIVDEU): Likewise.
+
+ Backport from mainline
+ 2018-03-28 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84912
+ * config/rs6000/rs6000-builtin.def (DIVWEO): Delete macro expansion.
+ (DIVWEUO): Likewise.
+ (DIVDEO): Likewise.
+ (DIVDEUO): Likewise.
+ * config/rs6000/rs6000.c (builtin_function_type): Remove support for
+ DIVWEUO and DIVDEUO.
+ * config/rs6000/rs6000.md: Update copyright date.
+ (UNSPEC_DIVEO, UNSPEC_DIVEUO): Delete unspecs.
+ (UNSPEC_DIV_EXTEND): Remove deleted unspecs.
+ (div_extend): Likewise.
+ * doc/extend.texi: Update copyright date.
+ (__builtin_divweo): Remove documentation for deleted builtin function.
+ (__builtin_divweuo): Likewise.
+ (__builtin_divdeo): Likewise.
+ (__builtin_divdeuo): Likewise.
+
+2018-04-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-30 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80546
+ * config/rs6000/vsx.md (??r): New mode attribute.
+ (*vsx_mov<mode>_64bit): Use it.
+ (*vsx_mov<mode>_32bit): Likewise.
+
+2018-03-29 Sebastian Peryt <sebastian.peryt@intel.com>
+
+ PR c++/84783
+ * config/i386/avx512vlintrin.h (_mm256_permutexvar_epi64)
+ (_mm256_permutexvar_epi32, _mm256_permutex_epi64): New intrinsics.
+
+2018-03-29 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from mainline
+ 2018-03-22 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/84826
+ * config/arm/arm.h (machine_function): Add static_chain_stack_bytes.
+ * config/arm/arm.c (arm_compute_static_chain_stack_bytes): Avoid
+ re-computing once computed.
+ (arm_expand_prologue): Compute machine->static_chain_stack_bytes.
+ (arm_init_machine_status): Initialize
+ machine->static_chain_stack_bytes.
+
+2018-03-28 Sudakshina Das <sudi.das@arm.com>
+
+ 2018-03-19 Sudakshina Das <sudi.das@arm.com>
+ PR target/81647
+
+ * config/aarch64/aarch64-simd.md (vec_cmp<mode><v_cmp_result>): Modify
+ instructions for UNLT, UNLE, UNGT, UNGE, UNEQ, UNORDERED and ORDERED.
+
+2018-03-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/85026
+ * config/arm/arm.md (unaligned_loadhis): Remove first alternative.
+ Clean up attributes.
+
+2018-03-28 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2018-03-08 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/82411
+ * config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Don't put
+ readonly data in sdata, if that is disabled.
+ * config/rs6000/sysv4.opt (mreadonly-in-sdata): New option.
+ * doc/invoke.texi (RS/6000 and PowerPC Options): Document
+ -mreadonly-in-sdata option.
+
+2018-03-27 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from mainline:
+ 2018-03-20 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/82989
+ * config/arm/neon.md (ashldi3_neon): Update ?s for constraints
+ to favor GPR over NEON registers.
+ (<shift>di3_neon): Likewise.
+
+2018-03-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82518
+ * config/arm/arm.c (arm_array_mode_supported_p): Return false for
+ BYTES_BIG_ENDIAN.
+
+2018-03-23 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-20 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/83789
+ * config/rs6000/altivec.md (altivec_lvx_<mode>_2op): Delete define_insn.
+ (altivec_lvx_<mode>_1op): Likewise.
+ (altivec_stvx_<mode>_2op): Likewise.
+ (altivec_stvx_<mode>_1op): Likewise.
+ (altivec_lvx_<VM2:mode>): New define_expand.
+ (altivec_stvx_<VM2:mode>): Likewise.
+ (altivec_lvx_<VM2:mode>_2op_<P:mptrsize>): New define_insn.
+ (altivec_lvx_<VM2:mode>_1op_<P:mptrsize>): Likewise.
+ (altivec_stvx_<VM2:mode>_2op_<P:mptrsize>): Likewise.
+ (altivec_stvx_<VM2:mode>_1op_<P:mptrsize>): Likewise.
+ * config/rs6000/rs6000.c (altivec_expand_lv_builtin): Likewise.
+ (altivec_expand_stv_builtin): Likewise.
+ (altivec_expand_builtin): Likewise.
+ * config/rs6000/vector.md: Likewise.
+
+2018-03-23 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline:
+ 2018-03-14 Carl Love <cel@us.ibm.com>
+
+ * config/rs6000/r6000.c (rtx_is_swappable_p): Add case UNSPEC_VPERMXOR.
+
+2018-03-22 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ 2018-03-22 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/84956
+ * tree-ssa-tail-merge.c (find_clusters_1): Skip bbs with
+ bb_has_abnormal_pred.
+
+2018-03-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84574
+ * config/i386/i386.c (indirect_thunk_needed): Update comments.
+ (indirect_thunk_bnd_needed): Likewise.
+ (indirect_thunks_used): Likewise.
+ (indirect_thunks_bnd_used): Likewise.
+ (indirect_return_needed): New.
+ (indirect_return_bnd_needed): Likewise.
+ (output_indirect_thunk_function): Add a bool argument for
+ function return.
+ (output_indirect_thunk_function): Don't generate alias for
+ function return thunk.
+ (ix86_code_end): Call output_indirect_thunk_function to generate
+ function return thunks.
+ (ix86_output_function_return): Set indirect_return_bnd_needed
+ and indirect_return_needed instead of indirect_thunk_bnd_needed
+ and indirect_thunk_needed.
+
+2018-03-14 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/83451
+ * config/pa/pa.c (pa_emit_move_sequence): Always emit secondary reload
+ insn for floating-point loads and stores.
+
+2018-03-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/invoke.texi (-mclflushopt): Fix spelling of option.
+
+2018-03-12 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84485
+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Return
+ true for zero dependence distances if the step might be zero,
+ and if there is no metadata that guarantees correctness.
+ (vect_analyze_data_ref_access): Check safelen as well as
+ force_vectorize.
+
+2018-03-11 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-02-14 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/83984
+ * config/pa/pa.md: Load address of PIC label using the linkage table
+ if the label is nonlocal.
+
+ Backport from mainline
+ 2018-03-06 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.h (ASM_GENERATE_INTERNAL_LABEL): Revise to use
+ sprint_ul.
+ (ASM_OUTPUT_ADDR_VEC_ELT): Revise for above change.
+ (ASM_OUTPUT_ADDR_DIFF_ELT): Likewise.
+ * config/pa/pa64-hpux.h (ASM_GENERATE_INTERNAL_LABEL): Revise as above.
+
+2018-03-09 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ Backport from mainline
+ 2017-09-13 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * config/aarch64/aarch64.c (aarch64_override_options_after_change_1):
+ Disable pc relative literal load irrespective of TARGET_FIX_ERR_A53_84341
+ for default.
+
+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.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 5f9bd102940..4a263217f2d 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180301
+20180418
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 29fea56a411..da154469753 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,29 @@
+2018-04-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline
+ 2018-03-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * gcc-interface/Makefile.in (OSCONS_CPP): Remove redundant
+ $(GNATLIBCFLAGS).
+ (OSCONS_EXTRACT): Add $(GNATLIBCFLAGS_FOR_C).
+
+2018-03-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/82813
+ * gcc-interface/misc.c (gnat_post_options): Disable string overflow
+ warnings.
+
+2018-03-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (node_has_volatile_full_access) <N_Identifier>:
+ Consider only entities for objects.
+
+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.
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 7a570196a88..439347a677b 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2756,9 +2756,9 @@ OSCONS_CC=$(subst ./xgcc,../../xgcc,$(subst -B./, -B../../,$(GCC_FOR_TARGET)))
# ada/types.h does not conflict with a same-named system header (VxWorks
# has a <types.h> header).
-OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) $(GNATLIBCFLAGS_FOR_C) -E -C \
+OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -E -C \
-DTARGET=\"$(target)\" -iquote $(fsrcpfx)ada $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
-OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
+OSCONS_EXTRACT=$(OSCONS_CC) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i
# Note: if you need to build with a non-GNU compiler, you could adapt the
# following definitions (written for VMS DEC-C)
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 1b6b3eb265a..11570f0987f 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -262,6 +262,9 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
/* No psABI change warnings for Ada. */
warn_psabi = 0;
+ /* No string overflow warnings for Ada. */
+ warn_stringop_overflow = 0;
+
/* No caret by default for Ada. */
if (!global_options_set.x_flag_diagnostics_show_caret)
global_dc->show_caret = false;
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index bef7f8121f3..eaad084959c 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4059,6 +4059,8 @@ node_has_volatile_full_access (Node_Id gnat_node)
case N_Identifier:
case N_Expanded_Name:
gnat_entity = Entity (gnat_node);
+ if (!Is_Object (gnat_entity))
+ break;
return Is_Volatile_Full_Access (gnat_entity)
|| Is_Volatile_Full_Access (Etype (gnat_entity));
@@ -9272,7 +9274,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/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 1a8dc119c31..7a83a0a9062 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,15 @@
+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.
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/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/config.gcc b/gcc/config.gcc
index 6e75bd45fb9..b54345dcda5 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1461,7 +1461,7 @@ x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;
x86_64-*-rtems*)
- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h rtems.h"
;;
i[34567]86-*-rdos*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 1e0a346e553..9ddf43eda5e 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -2462,10 +2462,10 @@
break;
}
/* Fall through. */
- case UNGE:
+ case UNLT:
std::swap (operands[2], operands[3]);
/* Fall through. */
- case UNLE:
+ case UNGT:
case GT:
comparison = gen_aarch64_cmgt<mode>;
break;
@@ -2476,10 +2476,10 @@
break;
}
/* Fall through. */
- case UNGT:
+ case UNLE:
std::swap (operands[2], operands[3]);
/* Fall through. */
- case UNLT:
+ case UNGE:
case GE:
comparison = gen_aarch64_cmge<mode>;
break;
@@ -2502,21 +2502,35 @@
case UNGT:
case UNLE:
case UNLT:
- case NE:
- /* FCM returns false for lanes which are unordered, so if we use
- the inverse of the comparison we actually want to emit, then
- invert the result, we will end up with the correct result.
- Note that a NE NaN and NaN NE b are true for all a, b.
-
- Our transformations are:
- a UNGE b -> !(b GT a)
- a UNGT b -> !(b GE a)
- a UNLE b -> !(a GT b)
- a UNLT b -> !(a GE b)
- a NE b -> !(a EQ b) */
- gcc_assert (comparison != NULL);
- emit_insn (comparison (operands[0], operands[2], operands[3]));
- emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
+ {
+ /* All of the above must not raise any FP exceptions. Thus we first
+ check each operand for NaNs and force any elements containing NaN to
+ zero before using them in the compare.
+ Example: UN<cc> (a, b) -> UNORDERED (a, b) |
+ (cm<cc> (isnan (a) ? 0.0 : a,
+ isnan (b) ? 0.0 : b))
+ We use the following transformations for doing the comparisions:
+ a UNGE b -> a GE b
+ a UNGT b -> a GT b
+ a UNLE b -> b GE a
+ a UNLT b -> b GT a. */
+
+ rtx tmp0 = gen_reg_rtx (<V_cmp_result>mode);
+ rtx tmp1 = gen_reg_rtx (<V_cmp_result>mode);
+ rtx tmp2 = gen_reg_rtx (<V_cmp_result>mode);
+ emit_insn (gen_aarch64_cmeq<mode> (tmp0, operands[2], operands[2]));
+ emit_insn (gen_aarch64_cmeq<mode> (tmp1, operands[3], operands[3]));
+ emit_insn (gen_and<v_cmp_result>3 (tmp2, tmp0, tmp1));
+ emit_insn (gen_and<v_cmp_result>3 (tmp0, tmp0,
+ lowpart_subreg (<V_cmp_result>mode, operands[2], <MODE>mode)));
+ emit_insn (gen_and<v_cmp_result>3 (tmp1, tmp1,
+ lowpart_subreg (<V_cmp_result>mode, operands[3], <MODE>mode)));
+ gcc_assert (comparison != NULL);
+ emit_insn (comparison (operands[0],
+ lowpart_subreg (<MODE>mode, tmp0, <V_cmp_result>mode),
+ lowpart_subreg (<MODE>mode, tmp1, <V_cmp_result>mode)));
+ emit_insn (gen_orn<v_cmp_result>3 (operands[0], tmp2, operands[0]));
+ }
break;
case LT:
@@ -2524,25 +2538,19 @@
case GT:
case GE:
case EQ:
+ case NE:
/* The easy case. Here we emit one of FCMGE, FCMGT or FCMEQ.
As a LT b <=> b GE a && a LE b <=> b GT a. Our transformations are:
a GE b -> a GE b
a GT b -> a GT b
a LE b -> b GE a
a LT b -> b GT a
- a EQ b -> a EQ b */
+ a EQ b -> a EQ b
+ a NE b -> ~(a EQ b) */
gcc_assert (comparison != NULL);
emit_insn (comparison (operands[0], operands[2], operands[3]));
- break;
-
- case UNEQ:
- /* We first check (a > b || b > a) which is !UNEQ, inverting
- this result will then give us (a == b || a UNORDERED b). */
- 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));
- emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
+ if (code == NE)
+ emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
break;
case LTGT:
@@ -2554,21 +2562,22 @@
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. */
- emit_insn (gen_aarch64_cmgt<mode> (tmp, operands[2], operands[3]));
- emit_insn (gen_aarch64_cmge<mode> (operands[0],
- operands[3], operands[2]));
- emit_insn (gen_ior<v_cmp_result>3 (operands[0], operands[0], tmp));
- emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
- break;
-
case ORDERED:
- emit_insn (gen_aarch64_cmgt<mode> (tmp, operands[2], operands[3]));
- emit_insn (gen_aarch64_cmge<mode> (operands[0],
- operands[3], operands[2]));
- emit_insn (gen_ior<v_cmp_result>3 (operands[0], operands[0], tmp));
+ case UNORDERED:
+ case UNEQ:
+ /* cmeq (a, a) & cmeq (b, b). */
+ emit_insn (gen_aarch64_cmeq<mode> (operands[0],
+ operands[2], operands[2]));
+ emit_insn (gen_aarch64_cmeq<mode> (tmp, operands[3], operands[3]));
+ emit_insn (gen_and<v_cmp_result>3 (operands[0], operands[0], tmp));
+
+ if (code == UNORDERED)
+ emit_insn (gen_one_cmpl<v_cmp_result>2 (operands[0], operands[0]));
+ else if (code == UNEQ)
+ {
+ emit_insn (gen_aarch64_cmeq<mode> (tmp, operands[2], operands[3]));
+ emit_insn (gen_orn<v_cmp_result>3 (operands[0], operands[0], tmp));
+ }
break;
default:
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 99f05d7d051..6c0b64e64c4 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -8608,17 +8608,6 @@ aarch64_override_options_after_change_1 (struct gcc_options *opts)
if (opts->x_pcrelative_literal_loads == 1)
aarch64_pcrelative_literal_loads = true;
- /* This is PR70113. When building the Linux kernel with
- CONFIG_ARM64_ERRATUM_843419, support for relocations
- R_AARCH64_ADR_PREL_PG_HI21 and R_AARCH64_ADR_PREL_PG_HI21_NC is
- removed from the kernel to avoid loading objects with possibly
- offending sequences. Without -mpc-relative-literal-loads we would
- generate such relocations, preventing the kernel build from
- succeeding. */
- if (opts->x_pcrelative_literal_loads == 2
- && TARGET_FIX_ERR_A53_843419)
- aarch64_pcrelative_literal_loads = true;
-
/* In the tiny memory model it makes no sense to disallow PC relative
literal pool loads. */
if (aarch64_cmodel == AARCH64_CMODEL_TINY
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 51368e29f2d..4c4e144587e 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -3093,7 +3093,8 @@
(define_insn_and_split "*compare_cstore<mode>_insn"
[(set (match_operand:GPI 0 "register_operand" "=r")
(EQL:GPI (match_operand:GPI 1 "register_operand" "r")
- (match_operand:GPI 2 "aarch64_imm24" "n")))]
+ (match_operand:GPI 2 "aarch64_imm24" "n")))
+ (clobber (reg:CC CC_REGNUM))]
"!aarch64_move_imm (INTVAL (operands[2]), <MODE>mode)
&& !aarch64_plus_operand (operands[2], <MODE>mode)
&& !reload_completed"
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 15011aabcc7..75a2af1e3de 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7750,13 +7750,13 @@ alpha_expand_prologue (void)
int probed;
for (probed = 4096; probed < probed_size; probed += 8192)
- emit_insn (gen_probe_stack (GEN_INT (-probed)));
+ emit_insn (gen_stack_probe_internal (GEN_INT (-probed)));
/* We only have to do this probe if we aren't saving registers or
if we are probing beyond the frame because of -fstack-check. */
if ((sa_size == 0 && probed_size > probed - 4096)
|| flag_stack_check)
- emit_insn (gen_probe_stack (GEN_INT (-probed_size)));
+ emit_insn (gen_stack_probe_internal (GEN_INT (-probed_size)));
}
if (frame_size != 0)
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 97838a5083a..14c18656d82 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -4915,7 +4915,7 @@
;; Subroutine of stack space allocation. Perform a stack probe.
-(define_expand "probe_stack"
+(define_expand "stack_probe_internal"
[(set (match_dup 1) (match_operand:DI 0 "const_int_operand"))]
""
{
@@ -4950,12 +4950,14 @@
int probed = 4096;
- emit_insn (gen_probe_stack (GEN_INT (- probed)));
+ emit_insn (gen_stack_probe_internal (GEN_INT (- probed)));
while (probed + 8192 < INTVAL (operands[1]))
- emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
+ emit_insn (gen_stack_probe_internal
+ (GEN_INT (- (probed += 8192))));
if (probed + 4096 < INTVAL (operands[1]))
- emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
+ emit_insn (gen_stack_probe_internal
+ (GEN_INT (- INTVAL(operands[1]))));
}
operands[1] = GEN_INT (- INTVAL (operands[1]));
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 924ecf32e28..1c9bda62f49 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -2576,7 +2576,7 @@ arm_expand_builtin (tree exp,
icode = CODE_FOR_set_fpscr;
arg0 = CALL_EXPR_ARG (exp, 0);
op0 = expand_normal (arg0);
- pat = GEN_FCN (icode) (op0);
+ pat = GEN_FCN (icode) (force_reg (SImode, op0));
}
emit_insn (pat);
return target;
@@ -2584,7 +2584,9 @@ arm_expand_builtin (tree exp,
case ARM_BUILTIN_CMSE_NONSECURE_CALLER:
target = gen_reg_rtx (SImode);
op0 = arm_return_addr (0, NULL_RTX);
- emit_insn (gen_addsi3 (target, op0, const1_rtx));
+ emit_insn (gen_andsi3 (target, op0, const1_rtx));
+ op1 = gen_rtx_EQ (SImode, target, const0_rtx);
+ emit_insn (gen_cstoresi4 (target, op1, target, const0_rtx));
return target;
case ARM_BUILTIN_TEXTRMSB:
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b37a8ae4754..74b9d07a195 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -19119,6 +19119,11 @@ arm_r3_live_at_start_p (void)
static int
arm_compute_static_chain_stack_bytes (void)
{
+ /* Once the value is updated from the init value of -1, do not
+ re-compute. */
+ if (cfun->machine->static_chain_stack_bytes != -1)
+ return cfun->machine->static_chain_stack_bytes;
+
/* See the defining assertion in arm_expand_prologue. */
if (IS_NESTED (arm_current_func_type ())
&& ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM)
@@ -21417,6 +21422,11 @@ arm_expand_prologue (void)
emit_insn (gen_movsi (stack_pointer_rtx, r1));
}
+ /* Let's compute the static_chain_stack_bytes required and store it. Right
+ now the value must the -1 as stored by arm_init_machine_status (). */
+ cfun->machine->static_chain_stack_bytes
+ = arm_compute_static_chain_stack_bytes ();
+
/* The static chain register is the same as the IP register. If it is
clobbered when creating the frame, we need to save and restore it. */
clobber_ip = IS_NESTED (func_type)
@@ -24564,6 +24574,7 @@ arm_init_machine_status (void)
#if ARM_FT_UNKNOWN != 0
machine->func_type = ARM_FT_UNKNOWN;
#endif
+ machine->static_chain_stack_bytes = -1;
return machine;
}
@@ -26877,7 +26888,10 @@ static bool
arm_array_mode_supported_p (machine_mode mode,
unsigned HOST_WIDE_INT nelems)
{
- if (TARGET_NEON
+ /* We don't want to enable interleaved loads and stores for BYTES_BIG_ENDIAN
+ for now, as the lane-swapping logic needs to be extended in the expanders.
+ See PR target/82518. */
+ if (TARGET_NEON && !BYTES_BIG_ENDIAN
&& (VALID_NEON_DREG_MODE (mode) || VALID_NEON_QREG_MODE (mode))
&& (nelems >= 2 && nelems <= 4))
return true;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 74a3e3bf6ca..b98ec1c4490 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1417,6 +1417,9 @@ typedef struct GTY(()) machine_function
machine_mode thumb1_cc_mode;
/* Set to 1 after arm_reorg has started. */
int after_arm_reorg;
+ /* The number of bytes used to store the static chain register on the
+ stack, above the stack frame. */
+ int static_chain_stack_bytes;
}
machine_function;
#endif
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 049a78edefe..05251cfd598 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -4498,16 +4498,13 @@
(set_attr "type" "load1")])
(define_insn "unaligned_loadhis"
- [(set (match_operand:SI 0 "s_register_operand" "=l,r")
+ [(set (match_operand:SI 0 "s_register_operand" "=r")
(sign_extend:SI
- (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,Uh")]
+ (unspec:HI [(match_operand:HI 1 "memory_operand" "Uh")]
UNSPEC_UNALIGNED_LOAD)))]
"unaligned_access"
"ldrsh%?\t%0, %1\t@ unaligned"
- [(set_attr "arch" "t2,any")
- (set_attr "length" "2,4")
- (set_attr "predicable" "yes")
- (set_attr "predicable_short_it" "yes,no")
+ [(set_attr "predicable" "yes")
(set_attr "type" "load_byte")])
(define_insn "unaligned_loadhiu"
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 175690e547c..b0844265839 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -1143,12 +1143,12 @@
)
(define_insn_and_split "ashldi3_neon"
- [(set (match_operand:DI 0 "s_register_operand" "= w, w,?&r,?r,?&r, ?w,w")
- (ashift:DI (match_operand:DI 1 "s_register_operand" " 0w, w, 0r, 0, r, 0w,w")
- (match_operand:SI 2 "general_operand" "rUm, i, r, i, i,rUm,i")))
- (clobber (match_scratch:SI 3 "= X, X,?&r, X, X, X,X"))
- (clobber (match_scratch:SI 4 "= X, X,?&r, X, X, X,X"))
- (clobber (match_scratch:DI 5 "=&w, X, X, X, X, &w,X"))
+ [(set (match_operand:DI 0 "s_register_operand" "= w, w, &r, r, &r, ?w,?w")
+ (ashift:DI (match_operand:DI 1 "s_register_operand" " 0w, w, 0r, 0, r, 0w, w")
+ (match_operand:SI 2 "general_operand" "rUm, i, r, i, i,rUm, i")))
+ (clobber (match_scratch:SI 3 "= X, X, &r, X, X, X, X"))
+ (clobber (match_scratch:SI 4 "= X, X, &r, X, X, X, X"))
+ (clobber (match_scratch:DI 5 "=&w, X, X, X, X, &w, X"))
(clobber (reg:CC_C CC_REGNUM))]
"TARGET_NEON"
"#"
@@ -1243,7 +1243,7 @@
;; ashrdi3_neon
;; lshrdi3_neon
(define_insn_and_split "<shift>di3_neon"
- [(set (match_operand:DI 0 "s_register_operand" "= w, w,?&r,?r,?&r,?w,?w")
+ [(set (match_operand:DI 0 "s_register_operand" "= w, w, &r, r, &r,?w,?w")
(RSHIFTS:DI (match_operand:DI 1 "s_register_operand" " 0w, w, 0r, 0, r,0w, w")
(match_operand:SI 2 "reg_or_int_operand" " r, i, r, i, i, r, i")))
(clobber (match_scratch:SI 3 "=2r, X, &r, X, X,2r, X"))
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/avx512vlintrin.h b/gcc/config/i386/avx512vlintrin.h
index f62f641188e..301713ba907 100644
--- a/gcc/config/i386/avx512vlintrin.h
+++ b/gcc/config/i386/avx512vlintrin.h
@@ -9099,6 +9099,17 @@ _mm_maskz_mul_epi32 (__mmask8 __M, __m128i __X, __m128i __Y)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_permutexvar_epi64 (__m256i __X, __m256i __Y)
+{
+ return (__m256i) __builtin_ia32_permvardi256_mask ((__v4di) __Y,
+ (__v4di) __X,
+ (__v4di)
+ _mm256_setzero_si256 (),
+ (__mmask8) -1);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_permutexvar_epi64 (__m256i __W, __mmask8 __M, __m256i __X,
__m256i __Y)
{
@@ -9163,6 +9174,17 @@ _mm_maskz_mul_epu32 (__mmask8 __M, __m128i __X, __m128i __Y)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_permutexvar_epi32 (__m256i __X, __m256i __Y)
+{
+ return (__m256i) __builtin_ia32_permvarsi256_mask ((__v8si) __Y,
+ (__v8si) __X,
+ (__v8si)
+ _mm256_setzero_si256 (),
+ (__mmask8) -1);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_permutexvar_epi32 (__m256i __W, __mmask8 __M, __m256i __X,
__m256i __Y)
{
@@ -9751,6 +9773,17 @@ _mm_cmple_epi64_mask (__m128i __X, __m128i __Y)
#ifdef __OPTIMIZE__
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_permutex_epi64 (__m256i __X, const int __I)
+{
+ return (__m256i) __builtin_ia32_permdi256_mask ((__v4di) __X,
+ __I,
+ (__v4di)
+ _mm256_setzero_si256 (),
+ (__mmask8) -1);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_permutex_epi64 (__m256i __W, __mmask8 __M,
__m256i __X, const int __I)
{
@@ -12367,6 +12400,13 @@ _mm256_permutex_pd (__m256d __X, const int __M)
_mm256_undefined_pd (), \
(__mmask8)-1))
+#define _mm256_permutex_epi64(X, I) \
+ ((__m256i) __builtin_ia32_permdi256_mask ((__v4di)(__m256i)(X), \
+ (int)(I), \
+ (__v4di)(__m256i) \
+ (_mm256_setzero_si256 ()),\
+ (__mmask8) -1))
+
#define _mm256_maskz_permutex_epi64(M, X, I) \
((__m256i) __builtin_ia32_permdi256_mask ((__v4di)(__m256i)(X), \
(int)(I), \
diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index a0a632aef8a..0cca766d3a0 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -198,7 +198,7 @@
(define_constraint "Bs"
"@internal Sibcall memory operand."
- (ior (and (not (match_test "ix86_indirect_branch_register"))
+ (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")
@@ -206,7 +206,7 @@
(define_constraint "Bw"
"@internal Call memory operand."
- (ior (and (not (match_test "ix86_indirect_branch_register"))
+ (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")
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 42eece35766..9434e8463c1 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -313,8 +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, bool ret_p);
+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 eca3ea68fb3..f398c1f6c3f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12031,19 +12031,29 @@ ix86_setup_frame_addresses (void)
labels in call and return thunks. */
static int indirectlabelno;
-/* True if call and return thunk functions are needed. */
+/* True if call thunk function is needed. */
static bool indirect_thunk_needed = false;
-/* True if call and return thunk functions with the BND prefix are
- needed. */
+/* True if call thunk function with the BND prefix is needed. */
static bool indirect_thunk_bnd_needed = false;
/* Bit masks of integer registers, which contain branch target, used
- by call and return thunks functions. */
+ by call thunk 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. */
+ by call thunk functions with the BND prefix. */
static int indirect_thunks_bnd_used;
+/* True if return thunk function is needed. */
+static bool indirect_return_needed = false;
+/* True if return thunk function with the BND prefix is needed. */
+static bool indirect_return_bnd_needed = false;
+
+/* 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
@@ -12054,12 +12064,13 @@ static void
indirect_thunk_name (char name[32], unsigned int regno,
bool need_bnd_p, bool ret_p)
{
- if (regno != INVALID_REGNUM && 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;
@@ -12067,14 +12078,11 @@ indirect_thunk_name (char name[32], unsigned int regno,
reg_prefix = TARGET_64BIT ? "r" : "e";
else
reg_prefix = "";
- sprintf (name, "__x86_indirect_thunk%s_%s%s",
- bnd, reg_prefix, reg_names[regno]);
+ sprintf (name, "__x86_%s_thunk%s_%s%s",
+ ret, bnd, reg_prefix, reg_names[regno]);
}
else
- {
- const char *ret = ret_p ? "return" : "indirect";
- sprintf (name, "__x86_%s_thunk%s", ret, bnd);
- }
+ sprintf (name, "__x86_%s_thunk%s", ret, bnd);
}
else
{
@@ -12186,16 +12194,18 @@ output_indirect_thunk (bool need_bnd_p, unsigned int regno)
/* 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. */
+ on the top of stack. Thunk is used for function return if RET_P is
+ true. */
static void
-output_indirect_thunk_function (bool need_bnd_p, unsigned int regno)
+output_indirect_thunk_function (bool need_bnd_p, unsigned int regno,
+ bool ret_p)
{
char name[32];
tree decl;
/* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */
- indirect_thunk_name (name, regno, need_bnd_p, false);
+ indirect_thunk_name (name, regno, need_bnd_p, ret_p);
decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
get_identifier (name),
build_function_type_list (void_type_node, NULL_TREE));
@@ -12238,36 +12248,6 @@ output_indirect_thunk_function (bool need_bnd_p, unsigned int regno)
ASM_OUTPUT_LABEL (asm_out_file, name);
}
- if (regno == INVALID_REGNUM)
- {
- /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */
- 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);
@@ -12314,19 +12294,29 @@ ix86_code_end (void)
rtx xops[2];
unsigned int regno;
+ if (indirect_return_needed)
+ output_indirect_thunk_function (false, INVALID_REGNUM, true);
+ if (indirect_return_bnd_needed)
+ output_indirect_thunk_function (true, INVALID_REGNUM, true);
+
+ if (indirect_return_via_cx)
+ output_indirect_thunk_function (false, CX_REG, true);
+ if (indirect_return_via_cx_bnd)
+ output_indirect_thunk_function (true, CX_REG, true);
+
if (indirect_thunk_needed)
- output_indirect_thunk_function (false, INVALID_REGNUM);
+ output_indirect_thunk_function (false, INVALID_REGNUM, false);
if (indirect_thunk_bnd_needed)
- output_indirect_thunk_function (true, INVALID_REGNUM);
+ output_indirect_thunk_function (true, INVALID_REGNUM, false);
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);
+ output_indirect_thunk_function (false, regno, false);
if ((indirect_thunks_bnd_used & (1 << i)))
- output_indirect_thunk_function (true, regno);
+ output_indirect_thunk_function (true, regno, false);
}
for (regno = AX_REG; regno <= SP_REG; regno++)
@@ -12335,10 +12325,10 @@ ix86_code_end (void)
tree decl;
if ((indirect_thunks_used & (1 << regno)))
- output_indirect_thunk_function (false, regno);
+ output_indirect_thunk_function (false, regno, false);
if ((indirect_thunks_bnd_used & (1 << regno)))
- output_indirect_thunk_function (true, regno);
+ output_indirect_thunk_function (true, regno, false);
if (!(pic_labels_used & (1 << regno)))
continue;
@@ -18842,7 +18832,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;
}
@@ -19807,72 +19798,36 @@ emit_i387_cw_initialization (int mode)
emit_insn (gen_x86_fnstcw_1 (stored_mode));
emit_move_insn (reg, copy_rtx (stored_mode));
- if (TARGET_64BIT || TARGET_PARTIAL_REG_STALL
- || optimize_insn_for_size_p ())
- {
- switch (mode)
- {
- case I387_CW_TRUNC:
- /* round toward zero (truncate) */
- emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0c00)));
- slot = SLOT_CW_TRUNC;
- break;
-
- case I387_CW_FLOOR:
- /* round down toward -oo */
- emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
- emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0400)));
- slot = SLOT_CW_FLOOR;
- break;
-
- case I387_CW_CEIL:
- /* round up toward +oo */
- emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
- emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0800)));
- slot = SLOT_CW_CEIL;
- break;
-
- case I387_CW_MASK_PM:
- /* mask precision exception for nearbyint() */
- emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020)));
- slot = SLOT_CW_MASK_PM;
- break;
-
- default:
- gcc_unreachable ();
- }
- }
- else
+ switch (mode)
{
- switch (mode)
- {
- case I387_CW_TRUNC:
- /* round toward zero (truncate) */
- emit_insn (gen_insvsi_1 (reg, GEN_INT (0xc)));
- slot = SLOT_CW_TRUNC;
- break;
+ case I387_CW_TRUNC:
+ /* round toward zero (truncate) */
+ emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0c00)));
+ slot = SLOT_CW_TRUNC;
+ break;
- case I387_CW_FLOOR:
- /* round down toward -oo */
- emit_insn (gen_insvsi_1 (reg, GEN_INT (0x4)));
- slot = SLOT_CW_FLOOR;
- break;
+ case I387_CW_FLOOR:
+ /* round down toward -oo */
+ emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
+ emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0400)));
+ slot = SLOT_CW_FLOOR;
+ break;
- case I387_CW_CEIL:
- /* round up toward +oo */
- emit_insn (gen_insvsi_1 (reg, GEN_INT (0x8)));
- slot = SLOT_CW_CEIL;
- break;
+ case I387_CW_CEIL:
+ /* round up toward +oo */
+ emit_insn (gen_andhi3 (reg, reg, GEN_INT (~0x0c00)));
+ emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0800)));
+ slot = SLOT_CW_CEIL;
+ break;
- case I387_CW_MASK_PM:
- /* mask precision exception for nearbyint() */
- emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020)));
- slot = SLOT_CW_MASK_PM;
- break;
+ case I387_CW_MASK_PM:
+ /* mask precision exception for nearbyint() */
+ emit_insn (gen_iorhi3 (reg, reg, GEN_INT (0x0020)));
+ slot = SLOT_CW_MASK_PM;
+ break;
- default:
- gcc_unreachable ();
- }
+ default:
+ gcc_unreachable ();
}
gcc_assert (slot < MAX_386_STACK_LOCALS);
@@ -29109,18 +29064,17 @@ ix86_output_indirect_branch (rtx call_op, const char *xasm,
else
ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p);
}
-/* Output indirect jump. CALL_OP is the jump target. Jump is a
- function return if RET_P is true. */
+
+/* Output indirect jump. CALL_OP is the jump target. */
const char *
-ix86_output_indirect_jmp (rtx call_op, bool ret_p)
+ix86_output_indirect_jmp (rtx call_op)
{
if (cfun->machine->indirect_branch_type != indirect_branch_keep)
{
- /* We can't have red-zone if this isn't a function return since
- "call" in the indirect thunk pushes the return address onto
- stack, destroying red-zone. */
- if (!ret_p && ix86_red_zone_size != 0)
+ /* 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);
@@ -29150,12 +29104,12 @@ ix86_output_function_return (bool long_p)
true);
if (need_bnd_p)
{
- indirect_thunk_bnd_needed |= need_thunk;
+ indirect_return_bnd_needed |= need_thunk;
fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name);
}
else
{
- indirect_thunk_needed |= need_thunk;
+ indirect_return_needed |= need_thunk;
fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name);
}
}
@@ -29171,6 +29125,86 @@ ix86_output_function_return (bool long_p)
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 *
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index e7da790f1b1..32a01d03073 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2719,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 93ebbbd87bc..ed09ee0bdc2 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -739,7 +739,7 @@
(if_then_else (match_operand 1 "constant_call_address_operand")
(const_string "none")
(const_string "load"))
- (and (eq_attr "type" "alu1,negnot,ishift1,sselog1,sseshuf1")
+ (and (eq_attr "type" "alu1,negnot,ishift1,rotate1,sselog1,sseshuf1")
(match_operand 1 "memory_operand"))
(const_string "both")
(and (match_operand 0 "memory_operand")
@@ -750,7 +750,7 @@
(match_operand 1 "memory_operand")
(const_string "load")
(and (eq_attr "type"
- "!alu1,negnot,ishift1,
+ "!alu1,negnot,ishift1,rotate1,
imov,imovx,icmp,test,bitmanip,
fmov,fcmp,fsgn,
sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,
@@ -11625,7 +11625,7 @@
[(set (pc) (match_operand 0 "indirect_branch_operand"))]
""
{
- if (TARGET_X32 || ix86_indirect_branch_register)
+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
operands[0] = convert_memory_address (word_mode, operands[0]);
cfun->machine->has_local_indirect_jump = true;
})
@@ -11633,7 +11633,7 @@
(define_insn "*indirect_jump"
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))]
""
- "* return ix86_output_indirect_jmp (operands[0], false);"
+ "* return ix86_output_indirect_jmp (operands[0]);"
[(set (attr "type")
(if_then_else (match_test "(cfun->machine->indirect_branch_type
!= indirect_branch_keep)")
@@ -11679,7 +11679,7 @@
OPTAB_DIRECT);
}
- if (TARGET_X32 || ix86_indirect_branch_register)
+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER)
operands[0] = convert_memory_address (word_mode, operands[0]);
cfun->machine->has_local_indirect_jump = true;
})
@@ -11688,7 +11688,7 @@
[(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))
(use (label_ref (match_operand 1)))]
""
- "* return ix86_output_indirect_jmp (operands[0], false);"
+ "* return ix86_output_indirect_jmp (operands[0]);"
[(set (attr "type")
(if_then_else (match_test "(cfun->machine->indirect_branch_type
!= indirect_branch_keep)")
@@ -11852,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);
@@ -11871,7 +11874,7 @@
[(call (mem:QI (match_operand:W 0 "memory_operand" "m"))
(match_operand 1))
(unspec [(const_int 0)] UNSPEC_PEEPSIB)]
- "!TARGET_X32 && !ix86_indirect_branch_register"
+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
"* return ix86_output_call_insn (insn, operands[0]);"
[(set_attr "type" "call")])
@@ -11881,7 +11884,7 @@
(call (mem:QI (match_dup 0))
(match_operand 3))]
"!TARGET_X32
- && !ix86_indirect_branch_register
+ && !TARGET_INDIRECT_BRANCH_REGISTER
&& SIBLING_CALL_P (peep2_next_insn (1))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
@@ -11896,7 +11899,7 @@
(call (mem:QI (match_dup 0))
(match_operand 3))]
"!TARGET_X32
- && !ix86_indirect_branch_register
+ && !TARGET_INDIRECT_BRANCH_REGISTER
&& SIBLING_CALL_P (peep2_next_insn (2))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
@@ -11994,7 +11997,7 @@
(match_operand:W 1 "memory_operand"))
(set (pc) (match_dup 0))]
"!TARGET_X32
- && !ix86_indirect_branch_register
+ && !TARGET_INDIRECT_BRANCH_REGISTER
&& peep2_reg_dead_p (2, operands[0])"
[(set (pc) (match_dup 1))])
@@ -12055,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);
@@ -12076,7 +12082,7 @@
(call (mem:QI (match_operand:W 1 "memory_operand" "m"))
(match_operand 2)))
(unspec [(const_int 0)] UNSPEC_PEEPSIB)]
- "!TARGET_X32 && !ix86_indirect_branch_register"
+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER"
"* return ix86_output_call_insn (insn, operands[1]);"
[(set_attr "type" "callv")])
@@ -12087,7 +12093,7 @@
(call (mem:QI (match_dup 0))
(match_operand 3)))]
"!TARGET_X32
- && !ix86_indirect_branch_register
+ && !TARGET_INDIRECT_BRANCH_REGISTER
&& SIBLING_CALL_P (peep2_next_insn (1))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))"
@@ -12104,7 +12110,7 @@
(call (mem:QI (match_dup 0))
(match_operand 3)))]
"!TARGET_X32
- && !ix86_indirect_branch_register
+ && !TARGET_INDIRECT_BRANCH_REGISTER
&& SIBLING_CALL_P (peep2_next_insn (2))
&& !reg_mentioned_p (operands[0],
CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))"
@@ -12354,11 +12360,14 @@
(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")
@@ -12369,7 +12378,7 @@
[(simple_return)
(use (match_operand:SI 0 "register_operand" "r"))]
"reload_completed"
- "* return ix86_output_indirect_jmp (operands[0], true);"
+ "* return ix86_output_indirect_function_return (operands[0]);"
[(set (attr "type")
(if_then_else (match_test "(cfun->machine->indirect_branch_type
!= indirect_branch_keep)")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index e4da3092260..77e97e17f1a 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -635,7 +635,7 @@
;; Test for a valid operand for indirect branch.
(define_predicate "indirect_branch_operand"
(ior (match_operand 0 "register_operand")
- (and (not (match_test "ix86_indirect_branch_register"))
+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
(not (match_test "TARGET_X32"))
(match_operand 0 "memory_operand"))))
@@ -679,7 +679,7 @@
(ior (match_test "constant_call_address_operand
(op, mode == VOIDmode ? mode : Pmode)")
(match_operand 0 "call_register_no_elim_operand")
- (and (not (match_test "ix86_indirect_branch_register"))
+ (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")
@@ -690,7 +690,7 @@
(ior (match_test "constant_call_address_operand
(op, mode == VOIDmode ? mode : Pmode)")
(match_operand 0 "register_no_elim_operand")
- (and (not (match_test "ix86_indirect_branch_register"))
+ (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")
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/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index e89b314f6ce..af2c4a23dfe 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)
@@ -2002,6 +2008,9 @@ static void
nvptx_assemble_decl_begin (FILE *file, const char *name, const char *section,
const_tree type, HOST_WIDE_INT size, unsigned align)
{
+ bool atype = (TREE_CODE (type) == ARRAY_TYPE)
+ && (TYPE_DOMAIN (type) == NULL_TREE);
+
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
@@ -2041,6 +2050,8 @@ nvptx_assemble_decl_begin (FILE *file, const char *name, const char *section,
/* We make everything an array, to simplify any initialization
emission. */
fprintf (file, "[" HOST_WIDE_INT_PRINT_DEC "]", init_frag.remaining);
+ else if (atype)
+ fprintf (file, "[]");
}
/* Called when the initializer for a decl has been completely output through
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index e6ac34acec9..9368d4504a8 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -1725,9 +1725,7 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg)
}
else
emit_move_insn (scratch_reg, XEXP (op1, 0));
- emit_insn (gen_rtx_SET (operand0,
- replace_equiv_address (op1, scratch_reg)));
- return 1;
+ op1 = replace_equiv_address (op1, scratch_reg);
}
}
else if ((!INT14_OK_STRICT && symbolic_memory_operand (op1, VOIDmode))
@@ -1737,10 +1735,10 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg)
/* Load memory address into SCRATCH_REG. */
scratch_reg = force_mode (word_mode, scratch_reg);
emit_move_insn (scratch_reg, XEXP (op1, 0));
- emit_insn (gen_rtx_SET (operand0,
- replace_equiv_address (op1, scratch_reg)));
- return 1;
+ op1 = replace_equiv_address (op1, scratch_reg);
}
+ emit_insn (gen_rtx_SET (operand0, op1));
+ return 1;
}
else if (scratch_reg
&& FP_REG_P (operand1)
@@ -1778,9 +1776,7 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg)
}
else
emit_move_insn (scratch_reg, XEXP (op0, 0));
- emit_insn (gen_rtx_SET (replace_equiv_address (op0, scratch_reg),
- operand1));
- return 1;
+ op0 = replace_equiv_address (op0, scratch_reg);
}
}
else if ((!INT14_OK_STRICT && symbolic_memory_operand (op0, VOIDmode))
@@ -1790,10 +1786,10 @@ pa_emit_move_sequence (rtx *operands, machine_mode mode, rtx scratch_reg)
/* Load memory address into SCRATCH_REG. */
scratch_reg = force_mode (word_mode, scratch_reg);
emit_move_insn (scratch_reg, XEXP (op0, 0));
- emit_insn (gen_rtx_SET (replace_equiv_address (op0, scratch_reg),
- operand1));
- return 1;
+ op0 = replace_equiv_address (op0, scratch_reg);
}
+ emit_insn (gen_rtx_SET (op0, operand1));
+ return 1;
}
/* Handle secondary reloads for loads of FP registers from constant
expressions by forcing the constant into memory. For the most part,
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 65df53e54b0..dd37dd3ad8d 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1153,8 +1153,18 @@ do { \
PREFIX is the class of label and NUM is the number within the class.
This is suitable for output with `assemble_name'. */
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
/* Output the definition of a compiler-generated label named NAME. */
@@ -1193,14 +1203,14 @@ do { \
/* This is how to output an element of a case-vector that is absolute. */
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L$%04d\n", VALUE)
+ fprintf (FILE, "\t.word L$%d\n", VALUE)
/* This is how to output an element of a case-vector that is relative.
Since we always place jump tables in the text section, the difference
is absolute and requires no relocation. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- fprintf (FILE, "\t.word L$%04d-L$%04d\n", VALUE, REL)
+ fprintf (FILE, "\t.word L$%d-L$%d\n", VALUE, REL)
/* This is how to output an absolute case-vector. */
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index e786d104b1f..01657fdf838 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -2536,24 +2536,40 @@
xoperands[0] = operands[0];
xoperands[1] = operands[1];
- xoperands[2] = gen_label_rtx ();
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[2]));
- output_asm_insn (\"mfia %0\", xoperands);
-
- /* If we're trying to load the address of a label that happens to be
- close, then we can use a shorter sequence. */
if (GET_CODE (operands[1]) == LABEL_REF
- && !LABEL_REF_NONLOCAL_P (operands[1])
- && INSN_ADDRESSES_SET_P ()
- && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
- - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
- output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ && !LABEL_REF_NONLOCAL_P (operands[1]))
+ {
+ xoperands[2] = gen_label_rtx ();
+ (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+ CODE_LABEL_NUMBER (xoperands[2]));
+ output_asm_insn (\"mfia %0\", xoperands);
+
+ /* If we're trying to load the address of a label that happens to be
+ close, then we can use a shorter sequence. */
+ if (INSN_ADDRESSES_SET_P ()
+ && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
+ - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
+ output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ else
+ {
+ output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
+ output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ }
+ }
else
{
- output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
- output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ /* Load using linkage table. */
+ if (TARGET_64BIT)
+ {
+ output_asm_insn (\"addil LT%%%1,%%r27\", xoperands);
+ output_asm_insn (\"ldd RT%%%1(%0),%0\", xoperands);
+ }
+ else
+ {
+ output_asm_insn (\"addil LT%%%1,%%r19\", xoperands);
+ output_asm_insn (\"ldw RT%%%1(%0),%0\", xoperands);
+ }
}
return \"\";
}"
@@ -2570,25 +2586,33 @@
xoperands[0] = operands[0];
xoperands[1] = operands[1];
- xoperands[2] = gen_label_rtx ();
- output_asm_insn (\"bl .+8,%0\", xoperands);
- output_asm_insn (\"depi 0,31,2,%0\", xoperands);
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xoperands[2]));
-
- /* If we're trying to load the address of a label that happens to be
- close, then we can use a shorter sequence. */
if (GET_CODE (operands[1]) == LABEL_REF
- && !LABEL_REF_NONLOCAL_P (operands[1])
- && INSN_ADDRESSES_SET_P ()
- && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
- - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
- output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ && !LABEL_REF_NONLOCAL_P (operands[1]))
+ {
+ xoperands[2] = gen_label_rtx ();
+ output_asm_insn (\"bl .+8,%0\", xoperands);
+ output_asm_insn (\"depi 0,31,2,%0\", xoperands);
+ (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+ CODE_LABEL_NUMBER (xoperands[2]));
+
+ /* If we're trying to load the address of a label that happens to be
+ close, then we can use a shorter sequence. */
+ if (INSN_ADDRESSES_SET_P ()
+ && abs (INSN_ADDRESSES (INSN_UID (XEXP (operands[1], 0)))
+ - INSN_ADDRESSES (INSN_UID (insn))) < 8100)
+ output_asm_insn (\"ldo %1-%2(%0),%0\", xoperands);
+ else
+ {
+ output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
+ output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ }
+ }
else
{
- output_asm_insn (\"addil L%%%1-%2,%0\", xoperands);
- output_asm_insn (\"ldo R%%%1-%2(%0),%0\", xoperands);
+ /* Load using linkage table. */
+ output_asm_insn (\"addil LT%%%1,%%r19\", xoperands);
+ output_asm_insn (\"ldw RT%%%1(%0),%0\", xoperands);
}
return \"\";
}"
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 8b7a42be3b5..5b21482602d 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -245,8 +245,18 @@ do { \
/* We need to use the HP style for internal labels. */
#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
#else /* USING_ELFOS_H */
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index 3011a87becf..e04c3a50a9e 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -398,8 +398,6 @@
#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
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 53c6eb81154..32dfa8f999a 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -2615,39 +2615,49 @@
"lvx %0,%y1"
[(set_attr "type" "vecload")])
-; The next two patterns embody what lvx should usually look like.
-(define_insn "altivec_lvx_<mode>_2op"
- [(set (match_operand:VM2 0 "register_operand" "=v")
- (mem:VM2 (and:DI (plus:DI (match_operand:DI 1 "register_operand" "b")
- (match_operand:DI 2 "register_operand" "r"))
- (const_int -16))))]
- "TARGET_ALTIVEC && TARGET_64BIT"
- "lvx %0,%1,%2"
- [(set_attr "type" "vecload")])
-
-(define_insn "altivec_lvx_<mode>_1op"
- [(set (match_operand:VM2 0 "register_operand" "=v")
- (mem:VM2 (and:DI (match_operand:DI 1 "register_operand" "r")
- (const_int -16))))]
- "TARGET_ALTIVEC && TARGET_64BIT"
- "lvx %0,0,%1"
- [(set_attr "type" "vecload")])
+; The following patterns embody what lvx should usually look like.
+(define_expand "altivec_lvx_<VM2:mode>"
+ [(set (match_operand:VM2 0 "register_operand")
+ (match_operand:VM2 1 "altivec_indexed_or_indirect_operand"))]
+ "TARGET_ALTIVEC"
+{
+ rtx addr = XEXP (operand1, 0);
+ if (GET_CODE (addr) == PLUS
+ && REG_P (XEXP (addr, 0))
+ && REG_P (XEXP (addr, 1)))
+ {
+ rtx op1 = XEXP (addr, 0);
+ rtx op2 = XEXP (addr, 1);
+ if (TARGET_64BIT)
+ emit_insn (gen_altivec_lvx_<VM2:mode>_2op_di (operand0, op1, op2));
+ else
+ emit_insn (gen_altivec_lvx_<VM2:mode>_2op_si (operand0, op1, op2));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_insn (gen_altivec_lvx_<VM2:mode>_1op_di (operand0, addr));
+ else
+ emit_insn (gen_altivec_lvx_<VM2:mode>_1op_si (operand0, addr));
+ }
+ DONE;
+})
-; 32-bit versions of the above.
-(define_insn "altivec_lvx_<mode>_2op_si"
+; The next two patterns embody what lvx should usually look like.
+(define_insn "altivec_lvx_<VM2:mode>_2op_<P:mptrsize>"
[(set (match_operand:VM2 0 "register_operand" "=v")
- (mem:VM2 (and:SI (plus:SI (match_operand:SI 1 "register_operand" "b")
- (match_operand:SI 2 "register_operand" "r"))
- (const_int -16))))]
- "TARGET_ALTIVEC && TARGET_32BIT"
+ (mem:VM2 (and:P (plus:P (match_operand:P 1 "register_operand" "b")
+ (match_operand:P 2 "register_operand" "r"))
+ (const_int -16))))]
+ "TARGET_ALTIVEC"
"lvx %0,%1,%2"
[(set_attr "type" "vecload")])
-(define_insn "altivec_lvx_<mode>_1op_si"
+(define_insn "altivec_lvx_<VM2:mode>_1op_<P:mptrsize>"
[(set (match_operand:VM2 0 "register_operand" "=v")
- (mem:VM2 (and:SI (match_operand:SI 1 "register_operand" "r")
- (const_int -16))))]
- "TARGET_ALTIVEC && TARGET_32BIT"
+ (mem:VM2 (and:P (match_operand:P 1 "register_operand" "r")
+ (const_int -16))))]
+ "TARGET_ALTIVEC"
"lvx %0,0,%1"
[(set_attr "type" "vecload")])
@@ -2663,39 +2673,49 @@
"stvx %1,%y0"
[(set_attr "type" "vecstore")])
-; The next two patterns embody what stvx should usually look like.
-(define_insn "altivec_stvx_<mode>_2op"
- [(set (mem:VM2 (and:DI (plus:DI (match_operand:DI 1 "register_operand" "b")
- (match_operand:DI 2 "register_operand" "r"))
- (const_int -16)))
- (match_operand:VM2 0 "register_operand" "v"))]
- "TARGET_ALTIVEC && TARGET_64BIT"
- "stvx %0,%1,%2"
- [(set_attr "type" "vecstore")])
-
-(define_insn "altivec_stvx_<mode>_1op"
- [(set (mem:VM2 (and:DI (match_operand:DI 1 "register_operand" "r")
- (const_int -16)))
- (match_operand:VM2 0 "register_operand" "v"))]
- "TARGET_ALTIVEC && TARGET_64BIT"
- "stvx %0,0,%1"
- [(set_attr "type" "vecstore")])
+; The following patterns embody what stvx should usually look like.
+(define_expand "altivec_stvx_<VM2:mode>"
+ [(set (match_operand:VM2 1 "altivec_indexed_or_indirect_operand")
+ (match_operand:VM2 0 "register_operand"))]
+ "TARGET_ALTIVEC"
+{
+ rtx addr = XEXP (operand1, 0);
+ if (GET_CODE (addr) == PLUS
+ && REG_P (XEXP (addr, 0))
+ && REG_P (XEXP (addr, 1)))
+ {
+ rtx op1 = XEXP (addr, 0);
+ rtx op2 = XEXP (addr, 1);
+ if (TARGET_64BIT)
+ emit_insn (gen_altivec_stvx_<VM2:mode>_2op_di (operand0, op1, op2));
+ else
+ emit_insn (gen_altivec_stvx_<VM2:mode>_2op_si (operand0, op1, op2));
+ }
+ else
+ {
+ if (TARGET_64BIT)
+ emit_insn (gen_altivec_stvx_<VM2:mode>_1op_di (operand0, addr));
+ else
+ emit_insn (gen_altivec_stvx_<VM2:mode>_1op_si (operand0, addr));
+ }
+ DONE;
+})
-; 32-bit versions of the above.
-(define_insn "altivec_stvx_<mode>_2op_si"
- [(set (mem:VM2 (and:SI (plus:SI (match_operand:SI 1 "register_operand" "b")
- (match_operand:SI 2 "register_operand" "r"))
- (const_int -16)))
- (match_operand:VM2 0 "register_operand" "v"))]
- "TARGET_ALTIVEC && TARGET_32BIT"
+; The next two patterns embody what stvx should usually look like.
+(define_insn "altivec_stvx_<VM2:mode>_2op_<P:mptrsize>"
+ [(set (mem:VM2 (and:P (plus:P (match_operand:P 1 "register_operand" "b")
+ (match_operand:P 2 "register_operand" "r"))
+ (const_int -16)))
+ (match_operand:VM2 0 "register_operand" "v"))]
+ "TARGET_ALTIVEC"
"stvx %0,%1,%2"
[(set_attr "type" "vecstore")])
-(define_insn "altivec_stvx_<mode>_1op_si"
- [(set (mem:VM2 (and:SI (match_operand:SI 1 "register_operand" "r")
- (const_int -16)))
- (match_operand:VM2 0 "register_operand" "v"))]
- "TARGET_ALTIVEC && TARGET_32BIT"
+(define_insn "altivec_stvx_<VM2:mode>_1op_<P:mptrsize>"
+ [(set (mem:VM2 (and:P (match_operand:P 1 "register_operand" "r")
+ (const_int -16)))
+ (match_operand:VM2 0 "register_operand" "v"))]
+ "TARGET_ALTIVEC"
"stvx %0,0,%1"
[(set_attr "type" "vecstore")])
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index 46ae21a6120..2cc07c6b5ae 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -1,5 +1,5 @@
/* Builtin functions for rs6000/powerpc.
- Copyright (C) 2009-2017 Free Software Foundation, Inc.
+ Copyright (C) 2009-2018 Free Software Foundation, Inc.
Contributed by Michael Meissner (meissner@linux.vnet.ibm.com)
This file is part of GCC.
@@ -659,6 +659,14 @@
| RS6000_BTC_BINARY), \
CODE_FOR_ ## ICODE) /* ICODE */
+#define BU_P7_POWERPC64_MISC_2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_" NAME, /* NAME */ \
+ RS6000_BTM_POPCNTD /* MASK */ \
+ | RS6000_BTM_POWERPC64, \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
/* Miscellaneous builtins for instructions added in ISA 2.07. These
instructions do require the ISA 2.07 vector support, but they aren't vector
@@ -2034,8 +2042,6 @@ 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)
@@ -2090,7 +2096,6 @@ 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,
@@ -2107,13 +2112,9 @@ BU_P9V_OVERLOAD_1 (VCTZLSBB, "vctzlsbb")
/* 2 argument extended divide functions added in ISA 2.06. */
BU_P7_MISC_2 (DIVWE, "divwe", CONST, dive_si)
-BU_P7_MISC_2 (DIVWEO, "divweo", CONST, diveo_si)
BU_P7_MISC_2 (DIVWEU, "divweu", CONST, diveu_si)
-BU_P7_MISC_2 (DIVWEUO, "divweuo", CONST, diveuo_si)
-BU_P7_MISC_2 (DIVDE, "divde", CONST, dive_di)
-BU_P7_MISC_2 (DIVDEO, "divdeo", CONST, diveo_di)
-BU_P7_MISC_2 (DIVDEU, "divdeu", CONST, diveu_di)
-BU_P7_MISC_2 (DIVDEUO, "divdeuo", CONST, diveuo_di)
+BU_P7_POWERPC64_MISC_2 (DIVDE, "divde", CONST, dive_di)
+BU_P7_POWERPC64_MISC_2 (DIVDEU, "divdeu", CONST, diveu_di)
/* 1 argument DFP (decimal floating point) functions added in ISA 2.05. */
BU_DFP_MISC_1 (DXEX, "dxex", CONST, dfp_dxex_dd)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index c3134fce60d..c6fd52439eb 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -5109,27 +5109,6 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ P9V_BUILTIN_VEC_INSERT4B, P9V_BUILTIN_INSERT4B,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V4SI,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
- { 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,
- 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 },
{ 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.c b/gcc/config/rs6000/rs6000.c
index 21ce2975932..edddff7aeca 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1,5 +1,5 @@
/* Subroutines used for code generation on IBM RS/6000.
- Copyright (C) 1991-2017 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
@@ -3890,6 +3890,7 @@ rs6000_builtin_mask_calculate (void)
| ((TARGET_P9_MISC) ? RS6000_BTM_P9_MISC : 0)
| ((TARGET_MODULO) ? RS6000_BTM_MODULO : 0)
| ((TARGET_64BIT) ? RS6000_BTM_64BIT : 0)
+ | ((TARGET_POWERPC64) ? RS6000_BTM_POWERPC64 : 0)
| ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0)
| ((TARGET_HTM) ? RS6000_BTM_HTM : 0)
| ((TARGET_DFP) ? RS6000_BTM_DFP : 0)
@@ -15098,12 +15099,12 @@ altivec_expand_lv_builtin (enum insn_code icode, tree exp, rtx target, bool blk)
/* For LVX, express the RTL accurately by ANDing the address with -16.
LVXL and LVE*X expand to use UNSPECs to hide their special behavior,
so the raw address is fine. */
- if (icode == CODE_FOR_altivec_lvx_v2df_2op
- || icode == CODE_FOR_altivec_lvx_v2di_2op
- || icode == CODE_FOR_altivec_lvx_v4sf_2op
- || icode == CODE_FOR_altivec_lvx_v4si_2op
- || icode == CODE_FOR_altivec_lvx_v8hi_2op
- || icode == CODE_FOR_altivec_lvx_v16qi_2op)
+ if (icode == CODE_FOR_altivec_lvx_v2df
+ || icode == CODE_FOR_altivec_lvx_v2di
+ || icode == CODE_FOR_altivec_lvx_v4sf
+ || icode == CODE_FOR_altivec_lvx_v4si
+ || icode == CODE_FOR_altivec_lvx_v8hi
+ || icode == CODE_FOR_altivec_lvx_v16qi)
{
rtx rawaddr;
if (op0 == const0_rtx)
@@ -15289,12 +15290,12 @@ altivec_expand_stv_builtin (enum insn_code icode, tree exp)
/* For STVX, express the RTL accurately by ANDing the address with -16.
STVXL and STVE*X expand to use UNSPECs to hide their special behavior,
so the raw address is fine. */
- if (icode == CODE_FOR_altivec_stvx_v2df_2op
- || icode == CODE_FOR_altivec_stvx_v2di_2op
- || icode == CODE_FOR_altivec_stvx_v4sf_2op
- || icode == CODE_FOR_altivec_stvx_v4si_2op
- || icode == CODE_FOR_altivec_stvx_v8hi_2op
- || icode == CODE_FOR_altivec_stvx_v16qi_2op)
+ if (icode == CODE_FOR_altivec_stvx_v2df
+ || icode == CODE_FOR_altivec_stvx_v2di
+ || icode == CODE_FOR_altivec_stvx_v4sf
+ || icode == CODE_FOR_altivec_stvx_v4si
+ || icode == CODE_FOR_altivec_stvx_v8hi
+ || icode == CODE_FOR_altivec_stvx_v16qi)
{
if (op1 == const0_rtx)
rawaddr = op2;
@@ -16195,18 +16196,18 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
switch (fcode)
{
case ALTIVEC_BUILTIN_STVX_V2DF:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2df_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2df, exp);
case ALTIVEC_BUILTIN_STVX_V2DI:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2di_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v2di, exp);
case ALTIVEC_BUILTIN_STVX_V4SF:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4sf_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4sf, exp);
case ALTIVEC_BUILTIN_STVX:
case ALTIVEC_BUILTIN_STVX_V4SI:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4si_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v4si, exp);
case ALTIVEC_BUILTIN_STVX_V8HI:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v8hi_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v8hi, exp);
case ALTIVEC_BUILTIN_STVX_V16QI:
- return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v16qi_2op, exp);
+ return altivec_expand_stv_builtin (CODE_FOR_altivec_stvx_v16qi, exp);
case ALTIVEC_BUILTIN_STVEBX:
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvebx, exp);
case ALTIVEC_BUILTIN_STVEHX:
@@ -16400,9 +16401,6 @@ 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);
@@ -16413,7 +16411,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;
@@ -16473,23 +16471,23 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v16qi,
exp, target, false);
case ALTIVEC_BUILTIN_LVX_V2DF:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2df_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2df,
exp, target, false);
case ALTIVEC_BUILTIN_LVX_V2DI:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2di_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v2di,
exp, target, false);
case ALTIVEC_BUILTIN_LVX_V4SF:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4sf_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4sf,
exp, target, false);
case ALTIVEC_BUILTIN_LVX:
case ALTIVEC_BUILTIN_LVX_V4SI:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4si_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v4si,
exp, target, false);
case ALTIVEC_BUILTIN_LVX_V8HI:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v8hi_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v8hi,
exp, target, false);
case ALTIVEC_BUILTIN_LVX_V16QI:
- return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v16qi_2op,
+ return altivec_expand_lv_builtin (CODE_FOR_altivec_lvx_v16qi,
exp, target, false);
case ALTIVEC_BUILTIN_LVLX:
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvlx,
@@ -17053,6 +17051,11 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
error ("Builtin function %s requires the -mhard-float option", name);
else if ((fnmask & RS6000_BTM_FLOAT128) != 0)
error ("Builtin function %s requires the -mfloat128 option", name);
+ else if ((fnmask & (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
+ == (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
+ error ("builtin function %qs requires the %qs (or newer), and "
+ "%qs or %qs options",
+ name, "-mcpu=power7", "-m64", "-mpowerpc64");
else
error ("Builtin function %s is not supported with the current options",
name);
@@ -18817,9 +18820,7 @@ builtin_function_type (machine_mode mode_ret, machine_mode mode_arg0,
case CRYPTO_BUILTIN_VPMSUM:
case MISC_BUILTIN_ADDG6S:
case MISC_BUILTIN_DIVWEU:
- case MISC_BUILTIN_DIVWEUO:
case MISC_BUILTIN_DIVDEU:
- case MISC_BUILTIN_DIVDEUO:
h.uns_p[0] = 1;
h.uns_p[1] = 1;
h.uns_p[2] = 1;
@@ -35618,6 +35619,11 @@ rs6000_elf_in_small_data_p (const_tree decl)
}
else
{
+ /* If we are told not to put readonly data in sdata, then don't. */
+ if (TREE_READONLY (decl) && rs6000_sdata != SDATA_EABI
+ && !rs6000_readonly_in_sdata)
+ return false;
+
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
if (size > 0
@@ -39138,6 +39144,7 @@ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
{ "hard-dfp", RS6000_BTM_DFP, false, false },
{ "hard-float", RS6000_BTM_HARD_FLOAT, false, false },
{ "long-double-128", RS6000_BTM_LDBL128, false, false },
+ { "powerpc64", RS6000_BTM_POWERPC64, false, false },
{ "float128", RS6000_BTM_FLOAT128, false, false },
};
@@ -41875,6 +41882,7 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
case UNSPEC_VPERM_UNS:
case UNSPEC_VPERMHI:
case UNSPEC_VPERMSI:
+ case UNSPEC_VPERMXOR:
case UNSPEC_VPKPX:
case UNSPEC_VSLDOI:
case UNSPEC_VSLO:
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 3780a49d902..76c44ef31b3 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for IBM RS/6000.
- Copyright (C) 1992-2017 Free Software Foundation, Inc.
+ Copyright (C) 1992-2018 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
@@ -2735,6 +2735,7 @@ extern int frame_pointer_needed;
#define RS6000_BTM_HARD_FLOAT MASK_SOFT_FLOAT /* Hardware floating point. */
#define RS6000_BTM_LDBL128 MASK_MULTIPLE /* 128-bit long double. */
#define RS6000_BTM_64BIT MASK_64BIT /* 64-bit addressing. */
+#define RS6000_BTM_POWERPC64 MASK_POWERPC64 /* 64-bit registers. */
#define RS6000_BTM_FLOAT128 MASK_FLOAT128_TYPE /* IEEE 128-bit float. */
#define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \
@@ -2754,6 +2755,7 @@ extern int frame_pointer_needed;
| RS6000_BTM_DFP \
| RS6000_BTM_HARD_FLOAT \
| RS6000_BTM_LDBL128 \
+ | RS6000_BTM_POWERPC64 \
| RS6000_BTM_FLOAT128)
/* Define builtin enum index. */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index e83f80b7121..40eda587137 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -1,5 +1,5 @@
;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler
-;; Copyright (C) 1990-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1990-2018 Free Software Foundation, Inc.
;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
;; This file is part of GCC.
@@ -135,9 +135,7 @@
UNSPEC_CDTBCD
UNSPEC_CBCDTD
UNSPEC_DIVE
- UNSPEC_DIVEO
UNSPEC_DIVEU
- UNSPEC_DIVEUO
UNSPEC_UNPACK_128BIT
UNSPEC_PACK_128BIT
UNSPEC_LSQ
@@ -14383,14 +14381,10 @@
(set_attr "length" "4")])
(define_int_iterator UNSPEC_DIV_EXTEND [UNSPEC_DIVE
- UNSPEC_DIVEO
- UNSPEC_DIVEU
- UNSPEC_DIVEUO])
+ UNSPEC_DIVEU])
(define_int_attr div_extend [(UNSPEC_DIVE "e")
- (UNSPEC_DIVEO "eo")
- (UNSPEC_DIVEU "eu")
- (UNSPEC_DIVEUO "euo")])
+ (UNSPEC_DIVEU "eu")])
(define_insn "div<div_extend>_<mode>"
[(set (match_operand:GPR 0 "register_operand" "=r")
diff --git a/gcc/config/rs6000/sysv4.opt b/gcc/config/rs6000/sysv4.opt
index 423300b8148..1492871da7d 100644
--- a/gcc/config/rs6000/sysv4.opt
+++ b/gcc/config/rs6000/sysv4.opt
@@ -27,6 +27,10 @@ msdata=
Target RejectNegative Joined Var(rs6000_sdata_name)
Select method for sdata handling.
+mreadonly-in-sdata
+Target Report Var(rs6000_readonly_in_sdata) Init(1) Save
+Allow readonly data in sdata.
+
mtls-size=
Target RejectNegative Joined Var(rs6000_tls_size) Enum(rs6000_tls_size)
Specify bit size of immediate TLS offsets.
diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index ea8169fabe0..a9ec9a9981a 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -180,12 +180,7 @@
operands[1] = rs6000_address_for_altivec (operands[1]);
rtx and_op = XEXP (operands[1], 0);
gcc_assert (GET_CODE (and_op) == AND);
- rtx addr = XEXP (and_op, 0);
- if (GET_CODE (addr) == PLUS)
- emit_insn (gen_altivec_lvx_<mode>_2op (operands[0], XEXP (addr, 0),
- XEXP (addr, 1)));
- else
- emit_insn (gen_altivec_lvx_<mode>_1op (operands[0], operands[1]));
+ emit_insn (gen_altivec_lvx_<mode> (operands[0], operands[1]));
DONE;
}
}")
@@ -203,12 +198,7 @@
operands[0] = rs6000_address_for_altivec (operands[0]);
rtx and_op = XEXP (operands[0], 0);
gcc_assert (GET_CODE (and_op) == AND);
- rtx addr = XEXP (and_op, 0);
- if (GET_CODE (addr) == PLUS)
- emit_insn (gen_altivec_stvx_<mode>_2op (operands[1], XEXP (addr, 0),
- XEXP (addr, 1)));
- else
- emit_insn (gen_altivec_stvx_<mode>_1op (operands[1], operands[0]));
+ emit_insn (gen_altivec_stvx_<mode> (operands[1], operands[0]));
DONE;
}
}")
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index c00238bf7a3..eef53578abb 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -157,6 +157,22 @@
(TF "wp")
(KF "wq")])
+;; A mode attribute to disparage use of GPR registers, except for scalar
+;; interger modes.
+(define_mode_attr ??r [(V16QI "??r")
+ (V8HI "??r")
+ (V4SI "??r")
+ (V4SF "??r")
+ (V2DI "??r")
+ (V2DF "??r")
+ (DI "r")
+ (DF "??r")
+ (SF "??r")
+ (V1TI "??r")
+ (TI "r")
+ (TF "??r")
+ (KF "??r")])
+
;; Same size integer type for floating point data
(define_mode_attr VSi [(V4SF "v4si")
(V2DF "v2di")
@@ -961,7 +977,7 @@
(define_insn "*vsx_mov<mode>_64bit"
[(set (match_operand:VSX_M 0 "nonimmediate_operand"
"=ZwO, <VSa>, <VSa>, r, we, ?wQ,
- ?&r, ??r, ??Y, ??r, wo, v,
+ ?&r, ??r, ??Y, <??r>, wo, v,
?<VSa>, *r, v, ??r, wZ, v")
(match_operand:VSX_M 1 "input_operand"
@@ -990,7 +1006,7 @@
;; LVX (VMX) STVX (VMX)
(define_insn "*vsx_mov<mode>_32bit"
[(set (match_operand:VSX_M 0 "nonimmediate_operand"
- "=ZwO, <VSa>, <VSa>, ??r, ??Y, ??r,
+ "=ZwO, <VSa>, <VSa>, ??r, ??Y, <??r>,
wo, v, ?<VSa>, *r, v, ??r,
wZ, v")
@@ -4084,7 +4100,7 @@
;; 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.
+;; insert4b.
(define_insn "extract4b"
[(set (match_operand:V2DI 0 "vsx_register_operand")
(unspec:V2DI [(match_operand:V16QI 1 "vsx_register_operand" "wa")
@@ -4164,56 +4180,6 @@
}
[(set_attr "type" "vecperm")])
-(define_expand "vinsert4b"
- [(set (match_operand:V16QI 0 "vsx_register_operand")
- (unspec:V16QI [(match_operand:V4SI 1 "vsx_register_operand")
- (match_operand:V16QI 2 "vsx_register_operand")
- (match_operand:QI 3 "const_0_to_12_operand")]
- UNSPEC_XXINSERTW))]
- "TARGET_P9_VECTOR"
-{
- if (!VECTOR_ELT_ORDER_BIG)
- {
- rtx op1 = operands[1];
- rtx v4si_tmp = gen_reg_rtx (V4SImode);
- emit_insn (gen_vsx_xxpermdi_v4si_be (v4si_tmp, op1, op1, const1_rtx));
- operands[1] = v4si_tmp;
- operands[3] = GEN_INT (12 - INTVAL (operands[3]));
- }
-})
-
-(define_insn "*vinsert4b_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")
- (match_operand:QI 3 "const_0_to_12_operand" "n")]
- UNSPEC_XXINSERTW))]
- "TARGET_P9_VECTOR"
- "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))]
- "TARGET_P9_VECTOR"
-{
- if (!VECTOR_ELT_ORDER_BIG)
- operands[3] = GEN_INT (12 - INTVAL (operands[3]));
-})
-
-(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))]
- "TARGET_P9_VECTOR"
- "xxinsertw %x0,%x1,%3"
- [(set_attr "type" "vecperm")])
-
;; Support for ISA 3.0 vector byte reverse
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index bc8e71a883d..603f5d6486e 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -15965,7 +15965,7 @@ s390_output_indirect_thunk_function (unsigned int regno, bool z10_p)
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)
+ if (flag_asynchronous_unwind_tables && flag_dwarf2_cfi_asm)
{
fputs ("\t.cfi_signal_frame\n", asm_out_file);
fprintf (asm_out_file, "\t.cfi_return_column %d\n", regno);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index b9c8dcc57c1..ed3bea2a9a7 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -2188,7 +2188,7 @@ sparc_expand_move (machine_mode mode, rtx *operands)
}
}
- /* Fixup TLS cases. */
+ /* Fix up TLS cases. */
if (TARGET_HAVE_TLS
&& CONSTANT_P (operands[1])
&& sparc_tls_referenced_p (operands [1]))
@@ -2197,15 +2197,20 @@ sparc_expand_move (machine_mode mode, rtx *operands)
return false;
}
- /* Fixup PIC cases. */
+ /* Fix up PIC cases. */
if (flag_pic && CONSTANT_P (operands[1]))
{
if (pic_address_needs_scratch (operands[1]))
operands[1] = sparc_legitimize_pic_address (operands[1], NULL_RTX);
/* We cannot use the mov{si,di}_pic_label_ref patterns in all cases. */
- if (GET_CODE (operands[1]) == LABEL_REF
- && can_use_mov_pic_label_ref (operands[1]))
+ if ((GET_CODE (operands[1]) == LABEL_REF
+ && can_use_mov_pic_label_ref (operands[1]))
+ || (GET_CODE (operands[1]) == CONST
+ && GET_CODE (XEXP (operands[1], 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
+ && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == CONST_INT
+ && can_use_mov_pic_label_ref (XEXP (XEXP (operands[1], 0), 0))))
{
if (mode == SImode)
{
@@ -2215,7 +2220,6 @@ sparc_expand_move (machine_mode mode, rtx *operands)
if (mode == DImode)
{
- gcc_assert (TARGET_ARCH64);
emit_insn (gen_movdi_pic_label_ref (operands[0], operands[1]));
return true;
}
@@ -4216,10 +4220,11 @@ int
pic_address_needs_scratch (rtx x)
{
/* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */
- if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
+ if (GET_CODE (x) == CONST
+ && GET_CODE (XEXP (x, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
- && ! SMALL_INT (XEXP (XEXP (x, 0), 1)))
+ && !SMALL_INT (XEXP (XEXP (x, 0), 1)))
return 1;
return 0;
@@ -4667,16 +4672,15 @@ sparc_legitimize_tls_address (rtx addr)
static rtx
sparc_legitimize_pic_address (rtx orig, rtx reg)
{
- bool gotdata_op = false;
-
if (GET_CODE (orig) == SYMBOL_REF
/* See the comment in sparc_expand_move. */
|| (GET_CODE (orig) == LABEL_REF && !can_use_mov_pic_label_ref (orig)))
{
+ bool gotdata_op = false;
rtx pic_ref, address;
rtx_insn *insn;
- if (reg == 0)
+ if (!reg)
{
gcc_assert (can_create_pseudo_p ());
reg = gen_reg_rtx (Pmode);
@@ -4687,8 +4691,7 @@ sparc_legitimize_pic_address (rtx orig, rtx reg)
/* If not during reload, allocate another temp reg here for loading
in the address, so that these instructions can be optimized
properly. */
- rtx temp_reg = (! can_create_pseudo_p ()
- ? reg : gen_reg_rtx (Pmode));
+ rtx temp_reg = can_create_pseudo_p () ? gen_reg_rtx (Pmode) : reg;
/* Must put the SYMBOL_REF inside an UNSPEC here so that cse
won't get confused into thinking that these two instructions
@@ -4704,6 +4707,7 @@ sparc_legitimize_pic_address (rtx orig, rtx reg)
emit_insn (gen_movsi_high_pic (temp_reg, orig));
emit_insn (gen_movsi_lo_sum_pic (temp_reg, temp_reg, orig));
}
+
address = temp_reg;
gotdata_op = true;
}
@@ -4744,7 +4748,7 @@ sparc_legitimize_pic_address (rtx orig, rtx reg)
&& XEXP (XEXP (orig, 0), 0) == pic_offset_table_rtx)
return orig;
- if (reg == 0)
+ if (!reg)
{
gcc_assert (can_create_pseudo_p ());
reg = gen_reg_rtx (Pmode);
@@ -4853,7 +4857,11 @@ sparc_delegitimize_address (rtx x)
&& XINT (XEXP (XEXP (x, 1), 1), 1) == UNSPEC_MOVE_PIC_LABEL)
{
x = XVECEXP (XEXP (XEXP (x, 1), 1), 0, 0);
- gcc_assert (GET_CODE (x) == LABEL_REF);
+ gcc_assert (GET_CODE (x) == LABEL_REF
+ || (GET_CODE (x) == CONST
+ && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT));
}
return x;
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 4ddbe56fbf4..55d41ef8dc7 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -1758,7 +1758,7 @@
(define_expand "movsi_pic_label_ref"
[(set (match_dup 3) (high:SI
- (unspec:SI [(match_operand:SI 1 "label_ref_operand" "")
+ (unspec:SI [(match_operand:SI 1 "symbolic_operand" "")
(match_dup 2)] UNSPEC_MOVE_PIC_LABEL)))
(set (match_dup 4) (lo_sum:SI (match_dup 3)
(unspec:SI [(match_dup 1) (match_dup 2)] UNSPEC_MOVE_PIC_LABEL)))
@@ -1784,7 +1784,7 @@
(define_insn "*movsi_high_pic_label_ref"
[(set (match_operand:SI 0 "register_operand" "=r")
(high:SI
- (unspec:SI [(match_operand:SI 1 "label_ref_operand" "")
+ (unspec:SI [(match_operand:SI 1 "symbolic_operand" "")
(match_operand:SI 2 "" "")] UNSPEC_MOVE_PIC_LABEL)))]
"flag_pic"
"sethi\t%%hi(%a2-(%a1-.)), %0")
@@ -1792,7 +1792,7 @@
(define_insn "*movsi_lo_sum_pic_label_ref"
[(set (match_operand:SI 0 "register_operand" "=r")
(lo_sum:SI (match_operand:SI 1 "register_operand" "r")
- (unspec:SI [(match_operand:SI 2 "label_ref_operand" "")
+ (unspec:SI [(match_operand:SI 2 "symbolic_operand" "")
(match_operand:SI 3 "" "")] UNSPEC_MOVE_PIC_LABEL)))]
"flag_pic"
"or\t%1, %%lo(%a3-(%a2-.)), %0")
@@ -1896,7 +1896,7 @@ visl")
(define_expand "movdi_pic_label_ref"
[(set (match_dup 3) (high:DI
- (unspec:DI [(match_operand:DI 1 "label_ref_operand" "")
+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")
(match_dup 2)] UNSPEC_MOVE_PIC_LABEL)))
(set (match_dup 4) (lo_sum:DI (match_dup 3)
(unspec:DI [(match_dup 1) (match_dup 2)] UNSPEC_MOVE_PIC_LABEL)))
@@ -1922,7 +1922,7 @@ visl")
(define_insn "*movdi_high_pic_label_ref"
[(set (match_operand:DI 0 "register_operand" "=r")
(high:DI
- (unspec:DI [(match_operand:DI 1 "label_ref_operand" "")
+ (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")
(match_operand:DI 2 "" "")] UNSPEC_MOVE_PIC_LABEL)))]
"TARGET_ARCH64 && flag_pic"
"sethi\t%%hi(%a2-(%a1-.)), %0")
@@ -1930,7 +1930,7 @@ visl")
(define_insn "*movdi_lo_sum_pic_label_ref"
[(set (match_operand:DI 0 "register_operand" "=r")
(lo_sum:DI (match_operand:DI 1 "register_operand" "r")
- (unspec:DI [(match_operand:DI 2 "label_ref_operand" "")
+ (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")
(match_operand:DI 3 "" "")] UNSPEC_MOVE_PIC_LABEL)))]
"TARGET_ARCH64 && flag_pic"
"or\t%1, %%lo(%a3-(%a2-.)), %0")
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c5c676c2bca..87633e9343c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,254 @@
+2018-04-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/85279 - dump_expr doesn't understand decltype.
+ * error.c (dump_expr): Handle DECLTYPE_TYPE.
+
+2018-04-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/82152 - ICE with class deduction and inherited ctor.
+ * pt.c (do_class_deduction): Ignore inherited ctors.
+
+ PR c++/84665 - ICE with array of empty class.
+ * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
+
+ PR c++/85006 - -fconcepts ICE with A<auto...> return type
+ * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
+
+2018-04-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/85118 - wrong error with generic lambda and std::bind.
+ * call.c (add_template_conv_candidate): Disable if there are any
+ call operators.
+
+ PR c++/85148 - ICE with 'this' in array NSDMI.
+ * tree.c (replace_placeholders_r): Use handled_component_p.
+
+2018-04-03 Jason Merrill <jason@redhat.com>
+
+ PR c++/85113 - ICE with constexpr and __builtin_constant_p.
+ * constexpr.c (cxx_eval_builtin_function_call): Only defer
+ __builtin_constant_p if ctx->quiet.
+
+ * typeck.c (merge_types): Limit matching attribute shortcut to
+ the default case.
+
+ PR c++/64095 - auto... parameter pack.
+ * parser.c (cp_parser_parameter_declaration): Handle turning autos
+ into packs here.
+ (cp_parser_parameter_declaration_list): Not here.
+
+ PR c++/85060 - wrong-code with call to base member in template.
+ * search.c (any_dependent_bases_p): Check uses_template_parms
+ rather than processing_template_decl.
+
+2018-03-29 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2018-03-23 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Implement P0962
+ * parser.c (cp_parser_perform_range_for_lookup): Change
+ the condition for deciding whether to use members.
+
+2018-03-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/78489 - Substitution in wrong order
+ PR c++/84489
+ * pt.c (type_unification_real): Revert last two changes.
+
+ PR c++/71834 - template-id with too few arguments.
+ * pt.c (coerce_template_parms): Make sure we gave an error.
+
+ PR c++/84937 - ICE with class deduction and auto.
+ * pt.c (rewrite_template_parm): Fix auto handling.
+
+ PR c++/80227 - SFINAE and negative array size.
+ * decl.c (compute_array_index_type): Convert to signed for negative
+ check.
+
+ PR c++/84839 - ICE with decltype of parameter pack.
+ * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
+ instantiating dummy parms.
+
+ PR c++/84798 - ICE with auto in abstract function declarator.
+ * parser.c (cp_parser_parameter_declaration_clause): Check
+ parser->default_arg_ok_p.
+
+ PR c++/84355 - ICE with deduction for member class template.
+ * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
+ CLASS_PLACEHOLDER_TEMPLATE.
+
+2018-03-23 Paolo Carlini <paolo.carlini@oracle.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/82336 - link error with list-init default argument.
+ * decl.c (check_default_argument): Unshare an initializer list.
+
+2018-03-22 Marek Polacek <polacek@redhat.com>
+
+ Backported from mainline
+ 2018-03-22 Marek Polacek <polacek@redhat.com>
+
+ PR c++/84854
+ * semantics.c (finish_if_stmt_cond): Check if the type of the condition
+ is boolean.
+
+ 2018-03-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/84927
+ * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
+ as we evaluate the elements.
+ (cxx_eval_constant_expression): Verify constructor's flags
+ unconditionally.
+
+ 2018-03-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/71638, ICE with NSDMI and reference.
+ * constexpr.c (cxx_eval_bare_aggregate): Update constructor's flags
+ even when we replace an element.
+
+2018-03-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/84785 - ICE with alias template and default targs.
+ * pt.c (type_unification_real): Set processing_template_decl if
+ saw_undeduced == 1.
+
+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.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 87729ac01e8..012134fd47a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3259,10 +3259,10 @@ add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
tree return_type, tree access_path,
tree conversion_path, tsubst_flags_t complain)
{
- /* Making this work broke PR 71117, so until the committee resolves core
- issue 2189, let's disable this candidate if there are any viable call
+ /* Making this work broke PR 71117 and 85118, so until the committee resolves
+ core issue 2189, let's disable this candidate if there are any call
operators. */
- if (any_strictly_viable (*candidates))
+ if (*candidates)
return NULL;
return
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 5ea96321765..5a4c9840acf 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -7598,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 0c0cd7bd07a..96f8277bdf2 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1140,7 +1140,10 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
/* Don't fold __builtin_constant_p within a constexpr function. */
bool bi_const_p = (DECL_FUNCTION_CODE (fun) == BUILT_IN_CONSTANT_P);
+ /* If we aren't requiring a constant expression, defer __builtin_constant_p
+ in a constexpr function until we have values for the parameters. */
if (bi_const_p
+ && ctx->quiet
&& current_function_decl
&& DECL_DECLARED_CONSTEXPR_P (current_function_decl))
{
@@ -1274,6 +1277,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)
@@ -2783,14 +2788,20 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
gcc_assert (is_empty_class (TREE_TYPE (TREE_TYPE (index))));
changed = true;
}
- else if (new_ctx.ctor != ctx->ctor)
+ else
{
- /* We appended this element above; update the value. */
- gcc_assert ((*p)->last().index == index);
- (*p)->last().value = elt;
+ if (new_ctx.ctor != ctx->ctor)
+ {
+ /* We appended this element above; update the value. */
+ gcc_assert ((*p)->last().index == index);
+ (*p)->last().value = elt;
+ }
+ else
+ CONSTRUCTOR_APPEND_ELT (*p, index, elt);
+ /* Adding or replacing an element might change the ctor's flags. */
+ TREE_CONSTANT (ctx->ctor) = constant_p;
+ TREE_SIDE_EFFECTS (ctx->ctor) = side_effects_p;
}
- else
- CONSTRUCTOR_APPEND_ELT (*p, index, elt);
}
if (*non_constant_p || !changed)
return t;
@@ -2895,9 +2906,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 +2920,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 +2977,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 +3034,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 +3075,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 +3156,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 +4195,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:
@@ -4414,11 +4448,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
{
/* Don't re-process a constant CONSTRUCTOR, but do fold it to
VECTOR_CST if applicable. */
- /* FIXME after GCC 6 branches, make the verify unconditional. */
- if (CHECKING_P)
- verify_constructor_flags (t);
- else
- recompute_constructor_flags (t);
+ verify_constructor_flags (t);
if (TREE_CONSTANT (t))
return fold (t);
}
@@ -4767,8 +4797,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);
@@ -5457,6 +5491,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:
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 a394ac8803d..5c519146043 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7211,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;
@@ -7250,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)
{
@@ -7261,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 "
@@ -7464,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;
@@ -7638,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++;
@@ -7653,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
{
@@ -9515,7 +9524,8 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
constant_expression_error (size);
/* An array must have a positive number of elements. */
- if (tree_int_cst_lt (size, integer_zero_node))
+ tree signed_size = fold_convert (ssizetype, size);
+ if (tree_int_cst_lt (signed_size, integer_zero_node))
{
if (!(complain & tf_error))
return error_mark_node;
@@ -12554,7 +12564,9 @@ check_default_argument (tree decl, tree arg, tsubst_flags_t complain)
A default argument expression is implicitly converted to the
parameter type. */
++cp_unevaluated_operand;
- perform_implicit_conversion_flags (decl_type, arg, complain,
+ /* Avoid digest_init clobbering the initializer. */
+ tree carg = BRACE_ENCLOSED_INITIALIZER_P (arg) ? unshare_expr (arg): arg;
+ perform_implicit_conversion_flags (decl_type, carg, complain,
LOOKUP_IMPLICIT);
--cp_unevaluated_operand;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b1c3c30521f..982f35f558f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1360,7 +1360,7 @@ cp_check_const_attributes (tree attributes)
{
tree expr = TREE_VALUE (arg);
if (EXPR_P (expr))
- TREE_VALUE (arg) = maybe_constant_value (expr);
+ TREE_VALUE (arg) = fold_non_dependent_expr (expr);
}
}
}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 38bc0b2474a..989a5e8eda1 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2695,6 +2695,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
case INTEGER_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
+ case DECLTYPE_TYPE:
pp_type_specifier_seq (pp, t);
break;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c06963b7b44..9a65d945232 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)
@@ -11798,7 +11858,7 @@ cp_parser_perform_range_for_lookup (tree range, tree *begin, tree *end)
/*protect=*/2, /*want_type=*/false,
tf_warning_or_error);
- if (member_begin != NULL_TREE || member_end != NULL_TREE)
+ if (member_begin != NULL_TREE && member_end != NULL_TREE)
{
/* Use the member functions. */
if (member_begin != 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;
@@ -18227,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;
}
@@ -19401,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);
@@ -20796,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;
}
@@ -20911,7 +20969,10 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
if (!processing_specialization
&& !processing_template_parmlist
- && !processing_explicit_instantiation)
+ && !processing_explicit_instantiation
+ /* default_arg_ok_p tracks whether this is a parameter-clause for an
+ actual function or a random abstract declarator. */
+ && parser->default_arg_ok_p)
if (!current_function_decl
|| (current_class_type && LAMBDA_TYPE_P (current_class_type)))
parser->auto_is_implicit_function_template_parm_p = true;
@@ -21020,9 +21081,6 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
cp_parameter_declarator *parameter;
tree decl = error_mark_node;
bool parenthesized_p = false;
- int template_parm_idx = (function_being_declared_is_template_p (parser)?
- TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS
- (current_template_parms)) : 0);
/* Parse the parameter. */
parameter
@@ -21036,22 +21094,6 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
if (parameter)
{
- /* If a function parameter pack was specified and an implicit template
- parameter was introduced during cp_parser_parameter_declaration,
- change any implicit parameters introduced into packs. */
- if (parser->implicit_template_parms
- && parameter->declarator
- && parameter->declarator->parameter_pack_p)
- {
- int latest_template_parm_idx = TREE_VEC_LENGTH
- (INNERMOST_TEMPLATE_PARMS (current_template_parms));
-
- if (latest_template_parm_idx != template_parm_idx)
- parameter->decl_specifiers.type = convert_generic_types_to_packs
- (parameter->decl_specifiers.type,
- template_parm_idx, latest_template_parm_idx);
- }
-
decl = grokdeclarator (parameter->declarator,
&parameter->decl_specifiers,
PARM,
@@ -21209,6 +21251,10 @@ cp_parser_parameter_declaration (cp_parser *parser,
parser->type_definition_forbidden_message
= G_("types may not be defined in parameter types");
+ int template_parm_idx = (function_being_declared_is_template_p (parser) ?
+ TREE_VEC_LENGTH (INNERMOST_TEMPLATE_PARMS
+ (current_template_parms)) : 0);
+
/* Parse the declaration-specifiers. */
cp_parser_decl_specifier_seq (parser,
CP_PARSER_FLAGS_NONE,
@@ -21277,8 +21323,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
@@ -21297,6 +21343,23 @@ cp_parser_parameter_declaration (cp_parser *parser,
parameter pack expansion expression. Otherwise, leave the ellipsis
for a C-style variadic function. */
token = cp_lexer_peek_token (parser->lexer);
+
+ /* If a function parameter pack was specified and an implicit template
+ parameter was introduced during cp_parser_parameter_declaration,
+ change any implicit parameters introduced into packs. */
+ if (parser->implicit_template_parms
+ && (token->type == CPP_ELLIPSIS
+ || (declarator && declarator->parameter_pack_p)))
+ {
+ int latest_template_parm_idx = TREE_VEC_LENGTH
+ (INNERMOST_TEMPLATE_PARMS (current_template_parms));
+
+ if (latest_template_parm_idx != template_parm_idx)
+ decl_specifiers.type = convert_generic_types_to_packs
+ (decl_specifiers.type,
+ template_parm_idx, latest_template_parm_idx);
+ }
+
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
tree type = decl_specifiers.type;
@@ -23268,7 +23331,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
@@ -23325,7 +23388,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
@@ -23439,10 +23502,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. */
@@ -24554,7 +24620,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;
@@ -29732,7 +29798,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. */
@@ -29749,10 +29815,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);
@@ -30282,8 +30351,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);
@@ -30292,10 +30361,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;
@@ -30895,7 +30967,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);
@@ -37455,7 +37530,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 3b250e28f82..9a1e632fb22 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8265,7 +8265,11 @@ coerce_template_parms (tree parms,
}
if (lost)
- return error_mark_node;
+ {
+ if ((complain & tf_error) && !seen_error())
+ error ("wrong number of template arguments");
+ return error_mark_node;
+ }
if (CHECKING_P && !NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_inner_args))
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_inner_args,
@@ -11475,7 +11479,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
{
/* This parameter pack was used in an unevaluated context. Just
make a dummy decl, since it's only used for its type. */
+ ++cp_unevaluated_operand;
arg_pack = tsubst_decl (parm_pack, args, complain);
+ --cp_unevaluated_operand;
if (arg_pack && DECL_PACK_P (arg_pack))
/* Partial instantiation of the parm_pack, we can't build
up an argument pack yet. */
@@ -11545,7 +11551,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
/* We can't substitute for this parameter pack. We use a flag as
well as the missing_level counter because function parameter
packs don't have a level. */
- gcc_assert (processing_template_decl);
+ gcc_assert (processing_template_decl || is_auto (parm_pack));
unsubstituted_packs = true;
}
}
@@ -13776,8 +13782,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
= tsubst_constraint (constr, args, complain, in_decl);
else if (tree pl = CLASS_PLACEHOLDER_TEMPLATE (t))
{
- if (DECL_TEMPLATE_TEMPLATE_PARM_P (pl))
- pl = tsubst (pl, args, complain, in_decl);
+ pl = tsubst_copy (pl, args, complain, in_decl);
CLASS_PLACEHOLDER_TEMPLATE (r) = pl;
}
}
@@ -17513,7 +17518,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);
}
@@ -24095,7 +24103,8 @@ type_dependent_expression_p (tree expression)
&& undeduced_auto_decl (expression)
&& (!DECL_CLASS_SCOPE_P (expression)
|| !dependent_type_p (DECL_CONTEXT (expression)))
- && (!DECL_FRIEND_CONTEXT (expression)
+ && (!DECL_LANG_SPECIFIC (expression)
+ || !DECL_FRIEND_CONTEXT (expression)
|| !dependent_type_p (DECL_FRIEND_CONTEXT (expression)))
&& !DECL_LOCAL_FUNCTION_P (expression))
{
@@ -25126,8 +25135,21 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level,
= TEMPLATE_TYPE_PARM_FOR_CLASS (oldtype);
}
else
- newtype = tsubst (TREE_TYPE (olddecl), tsubst_args,
- complain, NULL_TREE);
+ {
+ newtype = TREE_TYPE (olddecl);
+ if (type_uses_auto (newtype))
+ {
+ // Substitute once to fix references to other template parameters.
+ newtype = tsubst (newtype, tsubst_args,
+ complain|tf_partial, NULL_TREE);
+ // Now substitute again to reduce the level of the auto.
+ newtype = tsubst (newtype, current_template_args (),
+ complain, NULL_TREE);
+ }
+ else
+ newtype = tsubst (newtype, tsubst_args,
+ complain, NULL_TREE);
+ }
tree newdecl
= build_decl (DECL_SOURCE_LOCATION (olddecl), TREE_CODE (olddecl),
@@ -25407,6 +25429,9 @@ do_class_deduction (tree ptype, tree tmpl, tree init, int flags,
// FIXME cache artificial deduction guides
for (tree fns = CLASSTYPE_CONSTRUCTORS (type); fns; fns = OVL_NEXT (fns))
{
+ if (TREE_CODE (fns) == OVERLOAD && OVL_USED (fns))
+ continue;
+
tree fn = OVL_CURRENT (fns);
tree guide = build_deduction_guide (fn, outer_args, complain);
cands = ovl_cons (guide, cands);
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index f9d770ad8ee..e72ce5a427c 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -2879,7 +2879,7 @@ original_binfo (tree binfo, tree here)
bool
any_dependent_bases_p (tree type)
{
- if (!type || !CLASS_TYPE_P (type) || !processing_template_decl)
+ if (!type || !CLASS_TYPE_P (type) || !uses_template_parms (type))
return false;
unsigned i;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index e0663764638..481c88b0728 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -730,7 +730,10 @@ finish_if_stmt_cond (tree cond, tree if_stmt)
cond = maybe_convert_cond (cond);
if (IF_STMT_CONSTEXPR_P (if_stmt)
&& require_potential_rvalue_constant_expression (cond)
- && !value_dependent_expression_p (cond))
+ && !value_dependent_expression_p (cond)
+ /* Wait until instantiation time, since only then COND has been
+ converted to bool. */
+ && TREE_TYPE (cond) == boolean_type_node)
{
cond = instantiate_non_dependent_expr (cond);
cond = cxx_constant_value (cond, NULL_TREE);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 6501f127d7c..5fef52674f6 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)
@@ -2793,7 +2798,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
TREE_TYPE (x));
x = TREE_OPERAND (x, 0))
- gcc_assert (TREE_CODE (x) == COMPONENT_REF);
+ gcc_assert (handled_component_p (x));
*t = x;
*walk_subtrees = false;
d->seen = true;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index d79b724ecca..9d7c9aa27d0 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -905,14 +905,14 @@ merge_types (tree t1, tree t2)
return t1;
default:;
+ if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes))
+ return t1;
+ else if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes))
+ return t2;
+ break;
}
- if (attribute_list_equal (TYPE_ATTRIBUTES (t1), attributes))
- return t1;
- else if (attribute_list_equal (TYPE_ATTRIBUTES (t2), attributes))
- return t2;
- else
- return cp_build_type_attribute_variant (t1, attributes);
+ return cp_build_type_attribute_variant (t1, attributes);
}
/* Return the ARRAY_TYPE type without its domain. */
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 9ea98d6f40f..68a77f8043e 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -295,11 +295,14 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
/* Create inter-loop true dependences and anti dependences. */
for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next)
{
- rtx_insn *use_insn = DF_REF_INSN (r_use->ref);
-
- if (BLOCK_FOR_INSN (use_insn) != g->bb)
+ if (DF_REF_BB (r_use->ref) != g->bb)
continue;
+ gcc_assert (!DF_REF_IS_ARTIFICIAL (r_use->ref)
+ && DF_REF_INSN_INFO (r_use->ref) != NULL);
+
+ rtx_insn *use_insn = DF_REF_INSN (r_use->ref);
+
/* ??? Do not handle uses with DF_REF_IN_NOTE notes. */
use_node = get_node_of_insn (g, use_insn);
gcc_assert (use_node);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index d1fa318bc98..b0a1b7ffac6 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1,4 +1,4 @@
-@c Copyright (C) 1988-2017 Free Software Foundation, Inc.
+@c Copyright (C) 1988-2018 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -15165,21 +15165,16 @@ or @option{-mpopcntd}):
@smallexample
long __builtin_bpermd (long, long);
int __builtin_divwe (int, int);
-int __builtin_divweo (int, int);
unsigned int __builtin_divweu (unsigned int, unsigned int);
-unsigned int __builtin_divweuo (unsigned int, unsigned int);
long __builtin_divde (long, long);
-long __builtin_divdeo (long, long);
unsigned long __builtin_divdeu (unsigned long, unsigned long);
-unsigned long __builtin_divdeuo (unsigned long, unsigned long);
unsigned int cdtbcd (unsigned int);
unsigned int cbcdtd (unsigned int);
unsigned int addg6s (unsigned int, unsigned int);
@end smallexample
-The @code{__builtin_divde}, @code{__builtin_divdeo},
-@code{__builtin_divdeu}, @code{__builtin_divdeou} functions require a
-64-bit environment support ISA 2.06 or later.
+The @code{__builtin_divde} and @code{__builtin_divdeu} functions
+require a 64-bit environment supporting ISA 2.06 or later.
The following built-in functions are available for the PowerPC family
of processors, starting with ISA 3.0 or later (@option{-mcpu=power9}):
@@ -18124,21 +18119,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);
-vector unsigned long long vec_extract4b (vector unsigned char,
- const int);
-long long vec_extract4b (const vector signed char, const int);
-long long vec_vextract4b (const vector unsigned 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 (vector int, vector signed 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 96b7d1b96d9..9abf7783313 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1025,7 +1025,7 @@ See RS/6000 and PowerPC Options.
-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
-mprototype -mno-prototype @gol
-msim -mmvme -mads -myellowknife -memb -msdata @gol
--msdata=@var{opt} -mvxworks -G @var{num} @gol
+-msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
-mno-recip-precision @gol
-mveclibabi=@var{type} -mfriz -mno-friz @gol
@@ -8132,7 +8132,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
@@ -8690,6 +8690,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}.
@@ -8715,6 +8716,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}.
@@ -8728,6 +8730,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.
@@ -8745,6 +8748,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}.
@@ -22073,6 +22077,13 @@ On embedded PowerPC systems, put all initialized global and static data
in the @code{.data} section, and all uninitialized data in the
@code{.bss} section.
+@item -mreadonly-in-sdata
+@itemx -mreadonly-in-sdata
+@opindex mreadonly-in-sdata
+@opindex mno-readonly-in-sdata
+Put read-only objects in the @code{.sdata} section as well. This is the
+default.
+
@item -mblock-move-inline-limit=@var{num}
@opindex mblock-move-inline-limit
Inline all block moves (such as calls to @code{memcpy} or structure
@@ -25094,8 +25105,8 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@itemx -mpclmul
@opindex mpclmul
@need 200
-@itemx -mclfushopt
-@opindex mclfushopt
+@itemx -mclflushopt
+@opindex mclflushopt
@need 200
@itemx -mfsgsbase
@opindex mfsgsbase
diff --git a/gcc/expr.c b/gcc/expr.c
index bf935c39362..d87e24f0634 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10862,18 +10862,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 0397c8c377c..9554295e6d0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,144 @@
+2018-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/85084
+ Backport from trunk.
+ * frontend-passes.c (gfc_run_passes): Do not run front-end
+ optimizations if a previous error occurred.
+
+2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85001
+ * interface.c (symbol_rank): Remove bogus null pointer check that
+ crept in when translating a ternary operator into an if-else
+ constructor.
+
+2018-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84931
+ Backport from trunk
+ * simplify.c (gfc_convert_constant): Correctly handle iterators
+ for type conversion.
+
+2018-03-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/77414
+ * decl.c (get_proc_name): Check for a subroutine re-defined in
+ the contain portion of a subroutine. Change language of existing
+ error message to better describe the issue. While here fix whitespace
+ issues.
+
+2018-03-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/65453
+ * decl.c (get_proc_name): Catch clash between a procedure statement
+ and a contained subprogram
+
+2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78741
+ * decl.c (get_proc_name): Check for clash of entry name with
+ subroutine name.
+
+2018-03-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83939
+ * resolve.c (resolve_fl_procedure): Enforce F2018:C15100.
+
+2018-03-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84734
+ * arith.c (check_result, eval_intrinsic): If result overflows, pass
+ the expression up the chain instead of a NULL pointer.
+
+2018-03-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/64124
+ PR fortran/70409
+ * decl.c (gfc_match_char_spec): Try to reduce a charlen to a constant.
+
+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
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 8fa305c6aee..c594048eb51 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -555,10 +555,10 @@ check_result (arith rc, gfc_expr *x, gfc_expr *r, gfc_expr **rp)
val = ARITH_OK;
}
- if (val != ARITH_OK)
- gfc_free_expr (r);
- else
+ if (val == ARITH_OK || val == ARITH_OVERFLOW)
*rp = r;
+ else
+ gfc_free_expr (r);
return val;
}
@@ -1603,9 +1603,13 @@ eval_intrinsic (gfc_intrinsic_op op,
if (rc != ARITH_OK)
{
gfc_error (gfc_arith_error (rc), &op1->where);
+ if (rc == ARITH_OVERFLOW)
+ goto done;
return NULL;
}
+done:
+
gfc_free_expr (op1);
gfc_free_expr (op2);
return result;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 6d3d28af127..ac5e462a524 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1129,14 +1129,12 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
if (sym->attr.proc == PROC_ST_FUNCTION)
return rc;
- if (sym->attr.module_procedure
- && sym->attr.if_source == IFSRC_IFBODY)
+ if (sym->attr.module_procedure && sym->attr.if_source == IFSRC_IFBODY)
{
/* Create a partially populated interface symbol to carry the
characteristics of the procedure and the result. */
sym->tlink = gfc_new_symbol (name, sym->ns);
- gfc_add_type (sym->tlink, &(sym->ts),
- &gfc_current_locus);
+ gfc_add_type (sym->tlink, &(sym->ts), &gfc_current_locus);
gfc_copy_attr (&sym->tlink->attr, &sym->attr, NULL);
if (sym->attr.dimension)
sym->tlink->as = gfc_copy_array_spec (sym->as);
@@ -1166,11 +1164,22 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
accessible names. */
if (sym->attr.flavor != 0
&& sym->attr.proc != 0
- && (sym->attr.subroutine || sym->attr.function)
+ && (sym->attr.subroutine || sym->attr.function || sym->attr.entry)
&& sym->attr.if_source != IFSRC_UNKNOWN)
gfc_error_now ("Procedure %qs at %C is already defined at %L",
name, &sym->declared_at);
+ if (sym->attr.flavor != 0
+ && sym->attr.entry && sym->attr.if_source != IFSRC_UNKNOWN)
+ gfc_error_now ("Procedure %qs at %C is already defined at %L",
+ name, &sym->declared_at);
+
+ if (sym->attr.external && sym->attr.procedure
+ && gfc_current_state () == COMP_CONTAINS)
+ gfc_error_now ("Contained procedure %qs at %C clashes with "
+ "procedure defined at %L",
+ name, &sym->declared_at);
+
/* Trap a procedure with a name the same as interface in the
encompassing scope. */
if (sym->attr.generic != 0
@@ -1190,7 +1199,16 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
&& sym->attr.access == 0
&& !module_fcn_entry)
gfc_error_now ("Procedure %qs at %C has an explicit interface "
- "and must not have attributes declared at %L",
+ "from a previous declaration", name);
+ }
+
+ if (sym && !sym->gfc_new
+ && sym->attr.flavor != FL_UNKNOWN
+ && sym->attr.referenced == 0 && sym->attr.subroutine == 1
+ && gfc_state_stack->state == COMP_CONTAINS
+ && gfc_state_stack->previous->state == COMP_SUBROUTINE)
+ {
+ gfc_error_now ("Procedure %qs at %C is already defined at %L",
name, &sym->declared_at);
}
@@ -1215,10 +1233,10 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry)
/* See if the procedure should be a module procedure. */
if (((sym->ns->proc_name != NULL
- && sym->ns->proc_name->attr.flavor == FL_MODULE
- && sym->attr.proc != PROC_MODULE)
- || (module_fcn_entry && sym->attr.proc != PROC_MODULE))
- && !gfc_add_procedure (&sym->attr, PROC_MODULE, sym->name, NULL))
+ && sym->ns->proc_name->attr.flavor == FL_MODULE
+ && sym->attr.proc != PROC_MODULE)
+ || (module_fcn_entry && sym->attr.proc != PROC_MODULE))
+ && !gfc_add_procedure (&sym->attr, PROC_MODULE, sym->name, NULL))
rc = 2;
return rc;
@@ -2979,7 +2997,24 @@ done:
if (seen_length == 0)
cl->length = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1);
else
- cl->length = len;
+ {
+ /* If gfortran ends up here, then the len may be reducible to a
+ constant. Try to do that here. If it does not reduce, simply
+ assign len to the charlen. */
+ if (len && len->expr_type != EXPR_CONSTANT)
+ {
+ gfc_expr *e;
+ e = gfc_copy_expr (len);
+ gfc_reduce_init_expr (e);
+ if (e->expr_type == EXPR_CONSTANT)
+ gfc_replace_expr (len, e);
+ else
+ gfc_free_expr (e);
+ cl->length = len;
+ }
+ else
+ cl->length = len;
+ }
ts->u.cl = cl;
ts->kind = kind == 0 ? gfc_default_character_kind : kind;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index f347c753702..f302ef70b86 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4762,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 8a5829a3358..d7b4f23fe89 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -135,6 +135,10 @@ gfc_run_passes (gfc_namespace *ns)
check_locus (ns);
#endif
+ gfc_get_errors (&w, &e);
+ if (e > 0)
+ return;
+
if (flag_frontend_optimize)
{
optimize_namespace (ns);
@@ -145,10 +149,6 @@ gfc_run_passes (gfc_namespace *ns)
expr_array.release ();
}
- gfc_get_errors (&w, &e);
- if (e > 0)
- return;
-
if (flag_realloc_lhs)
realloc_strings (ns);
}
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index a32de3e7202..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. */
@@ -3147,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 162f7772970..bd7707efc88 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1263,7 +1263,7 @@ symbol_rank (gfc_symbol *sym)
{
gfc_array_spec *as = NULL;
- if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
+ if (sym->ts.type == BT_CLASS && CLASS_DATA (sym))
as = CLASS_DATA (sym)->as;
else
as = sym->as;
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 4bb88b4e23b..4baa0e036fc 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8498,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;
@@ -8551,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))
{
@@ -12225,6 +12228,19 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
}
+ /* F2018, C15100: "The result of an elemental function shall be scalar,
+ and shall not have the POINTER or ALLOCATABLE attribute." The scalar
+ pointer is tested and caught elsewhere. */
+ if (sym->attr.elemental && sym->result
+ && (sym->result->attr.allocatable || sym->result->attr.pointer))
+ {
+ gfc_error ("Function result variable %qs at %L of elemental "
+ "function %qs shall not have an ALLOCATABLE or POINTER "
+ "attribute", sym->result->name,
+ &sym->result->declared_at, sym->name);
+ return false;
+ }
+
if (sym->attr.is_bind_c && sym->attr.is_c_interop != 1)
{
gfc_formal_arglist *curr_arg;
@@ -13799,6 +13815,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 d12ae5f4aab..e34deada3fc 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. */
@@ -6579,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,
@@ -7172,26 +7175,32 @@ gfc_convert_constant (gfc_expr *e, bt type, int kind)
{
gfc_expr *tmp;
if (c->iterator == NULL)
- tmp = f (c->expr, kind);
+ {
+ tmp = f (c->expr, kind);
+ if (tmp == NULL)
+ {
+ gfc_free_expr (result);
+ return NULL;
+ }
+
+ gfc_constructor_append_expr (&result->value.constructor,
+ tmp, &c->where);
+ }
else
{
+ gfc_constructor *n;
g = gfc_convert_constant (c->expr, type, kind);
- if (g == &gfc_bad_expr)
+ if (g == NULL || g == &gfc_bad_expr)
{
gfc_free_expr (result);
return g;
}
- tmp = g;
+ n = gfc_constructor_get ();
+ n->expr = g;
+ n->iterator = gfc_copy_iterator (c->iterator);
+ n->where = c->where;
+ gfc_constructor_append (&result->value.constructor, n);
}
-
- if (tmp == NULL)
- {
- gfc_free_expr (result);
- return NULL;
- }
-
- gfc_constructor_append_expr (&result->value.constructor,
- tmp, &c->where);
}
break;
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 69b9d79492b..05a1a7aa346 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -6617,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. */
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/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/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-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 a1488d1e18d..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)
{
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/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 db67677bf0b..9b011fd70a5 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));
@@ -6708,7 +6714,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)
{
@@ -6747,7 +6753,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 695f99ad317..993da861cf9 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);
}
@@ -1409,7 +1409,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 251156789d3..1ebbb907ec1 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,76 @@
+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.
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/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/sched-deps.c b/gcc/sched-deps.c
index b2393bf28fb..d54c69eaa98 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2851,9 +2851,11 @@ sched_macro_fuse_insns (rtx_insn *insn)
{
rtx insn_set = single_set (insn);
+ if (!insn_set)
+ return;
+
prev = prev_nonnote_nondebug_insn (insn);
if (!prev
- || !insn_set
|| !single_set (prev))
return;
@@ -2920,6 +2922,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 02ebe389d40..5a9a38728b5 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 359cbac0765..248c5d57fdc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,623 @@
+2018-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR target/85261
+ * gcc.target/arm/fpscr.c: Add call to __builtin_arm_set_fpscr with
+ literal value. Expect 2 MCR instruction. Fix function prototype.
+ Remove volatile keyword.
+
+2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-04-12 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * gcc.target/s390/nobp-no-dwarf2-cfi.c: New test.
+
+2018-04-11 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ Backport from mainline
+ 2018-04-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ PR target/85203
+ * gcc.target/arm/cmse/cmse-1.c: Tighten cmse_nonsecure_caller RTL scan
+ to match a single insn of the baz function. Move scan directives at
+ the end of the file below the functions they are trying to test for
+ better readability.
+ * gcc.target/arm/cmse/cmse-16.c: New testcase.
+
+2018-04-10 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR target/85056
+ * gcc.target/nvptx/pr85056.c (main): Initialize "sum".
+
+2018-04-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/84748
+ * gcc.c-torture/execute/pr84748.c: New test.
+
+2018-04-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/opt/pr85196.C: New test.
+
+2018-04-05 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/85193
+ * gcc.target/i386/pr85193.c: New test.
+
+2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-04-04 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR rtl-optimization/84878
+ * gcc.target/powerpc/pr84878.c: New test.
+
+2018-04-03 Cesar Philippidis <cesar@codesourcery.com>
+
+ Backport from mainline
+ 2018-03-27 Cesar Philippidis <cesar@codesourcery.com>
+
+ PR target/85056
+ * testsuite/gcc.target/nvptx/pr85056.c: New test.
+ * testsuite/gcc.target/nvptx/pr85056a.c: New test.
+
+2018-04-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-28 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/84912
+ * gcc.target/powerpc/extend-divide-1.c (div_weo): Remove test for
+ deleted builtin function.
+ (div_weuo): Likewise.
+ * gcc.target/powerpc/extend-divide-2.c (div_deo): Likewise.
+ (div_deuo): Likewise.
+
+2018-04-02 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-02-08 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/81143
+ * gcc.target/powerpc/pr79799-2.c: Use __LITTLE_ENDIAN__.
+
+2018-03-29 Sebastian Peryt <sebastian.peryt@intel.com>
+
+ PR c++/84783
+ * gcc.target/i386/avx512vl-vpermd-1.c (_mm256_permutexvar_epi32):
+ Test new intrinsic.
+ * gcc.target/i386/avx512vl-vpermq-imm-1.c (_mm256_permutex_epi64):
+ Ditto.
+ * gcc.target/i386/avx512vl-vpermq-var-1.c (_mm256_permutexvar_epi64):
+ Ditto.
+ * gcc.target/i386/avx512f-vpermd-2.c: Do not check for AVX512F_LEN.
+ * gcc.target/i386/avx512f-vpermq-imm-2.c: Ditto.
+ * gcc.target/i386/avx512f-vpermq-var-2.c: Ditto.
+
+2018-03-29 Sudakshina Das <sudi.das@arm.com>
+
+ * gcc.target/arm/pr84826.c: Change dg-option to -fstack-check.
+
+ Backport from mainline
+ 2018-03-23 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/84826
+ * gcc.target/arm/pr84826.c: Add dg directive.
+
+ Backport from mainline
+ 2018-03-22 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/84826
+ * gcc.target/arm/pr84826.c: New test.
+
+2018-03-28 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/crypto-builtin-1-runnable: Add
+ p8vector_hw to dg-do run.
+
+2018-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/85084
+ Backport from trunk.
+ * gfortran.dg/matmul_rank_1.f90: New test.
+
+2018-03-28 Sudakshina Das <sudi.das@arm.com>
+ Christophe Lyon <christophe.lyon@linaro.org>
+
+ 2018-03-20 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/81647
+ * gcc.target/aarch64/pr81647.c: Require fenv_exceptions.
+
+ 2018-03-19 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/81647
+ * gcc.target/aarch64/pr81647.c: New.
+
+2018-03-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/85026
+ * g++.dg/pr85026.C: New test.
+
+2018-03-28 Segher Boessenkool <segher@kernel.crashing.org>
+
+ Backport from mainline
+ 2018-03-08 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/82411
+ * gcc.target/powerpc/ppc-sdata-2.c: Skip if -mno-readonly-in-sdata.
+
+2018-03-27 Sudakshina Das <sudi.das@arm.com>
+
+ Backport from mainline:
+ 2018-03-20 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/82989
+ * gcc.target/arm/pr82989.c: New test.
+
+ Backport from mainline:
+ 2018-03-21 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/82989
+ * gcc.target/arm/pr82989.c: Change dg scan-assembly directives.
+
+2018-03-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2018-03-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82518
+ * lib/target-supports.exp (check_effective_target_vect_load_lanes):
+ Disable for armeb targets.
+ * gcc.target/arm/pr82518.c: New test.
+
+2018-03-23 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/crypto-builtin-1-runnable.c: New test file.
+
+2018-03-22 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ 2018-03-22 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/84956
+ * gcc.dg/pr84956.c: New test.
+
+2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85001
+ * gfortran.dg/interface_41.f90: New test.
+
+2018-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/84931
+ Backport from trunk
+ * gfortran.dg/array_constructor_52.f90: New test.
+
+2018-03-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/77414
+ * gfortran.dg/pr77414.f90: New test.
+ * gfortran.dg/internal_references_1.f90: Adjust error message.
+
+2018-03-19 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/65453
+ * gfortran.dg/pr65453.f90: New test.
+
+2018-03-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-03-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/84574
+ * gcc.target/i386/ret-thunk-9.c: Expect __x86_return_thunk
+ label instead of __x86_indirect_thunk label.
+
+2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78741
+ * gfortran.dg/pr78741.f90: New test.
+
+2018-03-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/83939
+ * gfortran.dg/pr83939.f90
+
+2018-03-12 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/84485
+ * gcc.dg/vect/pr84485.c: New test.
+
+2018-03-10 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/84734
+ * gfortran.dg/pr84734.f90: New test.
+
+2018-03-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/prot3.adb: New test.
+ * gnat.dg/prot3_pkg.ad[sb]: New helper.
+
+2018-03-09 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ Backport from mainline
+ 2017-09-13 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gcc.target/aarch64/pr63304_1.c: Remove-mno-fix-cortex-a53-843419.
+
+2018-03-08 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/64124
+ PR fortran/70409
+ * gfortran.dg/pr64124.f90: New tests.
+ * gfortran.dg/pr70409.f90: New tests.
+
+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
@@ -1270,7 +1890,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>
@@ -1321,7 +1941,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/concepts/auto4.C b/gcc/testsuite/g++.dg/concepts/auto4.C
new file mode 100644
index 00000000000..e80341ec038
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/auto4.C
@@ -0,0 +1,11 @@
+// PR c++/85006
+// { dg-additional-options "-std=c++17 -fconcepts" }
+
+template<typename... Ts> struct A {};
+
+template<typename... Us> A<auto...> foo() { return A{}; }
+
+void bar()
+{
+ foo();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto-60626.C b/gcc/testsuite/g++.dg/cpp0x/auto-60626.C
new file mode 100644
index 00000000000..35671924ea9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto-60626.C
@@ -0,0 +1,6 @@
+// PR c++/60626
+// { dg-do compile { target c++14 } }
+
+struct A {};
+
+void (*A::p)(auto) = 0; // { dg-error "auto|static data member|template" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto51.C b/gcc/testsuite/g++.dg/cpp0x/auto51.C
new file mode 100644
index 00000000000..dfb08336b53
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto51.C
@@ -0,0 +1,9 @@
+// PR c++/84798
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct S {
+ static constexpr T value = 0;
+};
+
+constexpr auto x = S<void(*)(auto)>::value; // { dg-error "auto" }
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/decltype67.C b/gcc/testsuite/g++.dg/cpp0x/decltype67.C
new file mode 100644
index 00000000000..e8042ac59e7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype67.C
@@ -0,0 +1,7 @@
+// PR c++/85279
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct A
+{
+ void foo(decltype(T())::Y); // { dg-error {decltype\(T\(\)\)::Y} }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C
new file mode 100644
index 00000000000..8d9b2d26f01
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C
@@ -0,0 +1,10 @@
+// PR c++/80227
+// { dg-do compile { target c++11 } }
+
+template <class T>
+int foo (T);
+
+template <class T, class U = T [sizeof (T) - 5]>
+int foo (T, U* = 0);
+
+int i = foo (123);
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/initlist-defarg2.C
new file mode 100644
index 00000000000..65240355fc3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-defarg2.C
@@ -0,0 +1,8 @@
+// PR c++/82336
+// { dg-do link { target c++11 } }
+
+struct foo { int x = 5; };
+struct bar : foo { bar() = default; };
+struct baz { bar x; };
+void qux(baz = {}){}
+int main() { qux(); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi14.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi14.C
new file mode 100644
index 00000000000..aac6fa1c81b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi14.C
@@ -0,0 +1,19 @@
+// PR c++/71638
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
+
+struct A {
+ struct {
+ int i;
+ int &j = i;
+ } b;
+ int a = b.j;
+};
+
+void bar (A);
+
+void
+foo ()
+{
+ bar (A{});
+}
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/range-for13.C b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
index 100f531f760..7babd713cfb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
@@ -3,16 +3,6 @@
// { dg-do compile { target c++11 } }
-//These should not be used
-template<typename T> int *begin(T &t)
-{
- T::fail;
-}
-template<typename T> int *end(T &t)
-{
- T::fail;
-}
-
struct container1
{
int *begin();
@@ -87,10 +77,37 @@ struct container10
static function end;
};
+namespace N
+{
+template<typename T> int *begin(T &t)
+{
+ return 0;
+}
+template<typename T> int *end(T &t)
+{
+ return 0;
+}
+struct container11
+{
+ int *begin();
+ //no end
+};
+
+struct container12
+{
+ int *end();
+ //no begin
+};
+
+struct container13
+{
+};
+}
+
void test1()
{
- for (int x : container1()); // { dg-error "member but not" }
- for (int x : container2()); // { dg-error "member but not" }
+ for (int x : container1()); // { dg-error "'begin' was not declared|'end' was not declared" }
+ for (int x : container2()); // { dg-error "'begin' was not declared|'end' was not declared" }
for (int x : container3()); // { dg-error "within this context" }
for (int x : container4()); // { dg-error "cannot be used as a function" }
for (int x : container5()); // { dg-error "invalid use of" }
@@ -99,4 +116,7 @@ void test1()
for (int x : container8());
for (int x : container9()); // { dg-error "within this context" }
for (int x : container10());
+ for (int x : N::container11());
+ for (int x : N::container12());
+ for (int x : N::container13());
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae60.C b/gcc/testsuite/g++.dg/cpp0x/sfinae60.C
new file mode 100644
index 00000000000..cfb4dc0b9a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae60.C
@@ -0,0 +1,25 @@
+// PR c++/78489
+// { dg-do compile { target c++11 } }
+
+template <bool P, class T = void> struct enable_if { using type = T; };
+template <class T> struct enable_if<false, T> {};
+
+template <class Dummy> struct use_type { using type = int; };
+
+template <bool Pred>
+struct get_type {
+ static_assert(Pred, "");
+ using type = int;
+};
+
+template <bool Val,
+ class = typename enable_if<Val>::type, // Evaluation/Substitution should end here
+ class ValT = typename get_type<Val>::type, // This should not be instantiated
+ typename use_type<ValT>::type = 0 // This NTTP causes ValT to be required
+ >
+constexpr bool test(int) { return false; }
+
+template <bool>
+constexpr bool test(long) { return true; }
+
+static_assert(test<false>(0), ""); // should call test(long)
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C
new file mode 100644
index 00000000000..ce18f99ea50
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-nested2.C
@@ -0,0 +1,9 @@
+// PR c++/84839
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct S {
+ using fptr = void(*)(T... x, decltype(x)... y);
+};
+
+using F = S<int>::fptr;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-nested3.C b/gcc/testsuite/g++.dg/cpp0x/variadic-nested3.C
new file mode 100644
index 00000000000..381ff731c09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-nested3.C
@@ -0,0 +1,10 @@
+// PR c++/71834
+// { dg-do compile { target c++11 } }
+
+template < typename ... Ts > struct A
+{
+ template < Ts ..., typename U > struct B {};
+};
+
+// should be, e.g.: A < int >::B < 0, int > e;
+A < int >::B < 0 > e; // { dg-error "wrong number of template arguments" }
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-variadic16.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic16.C
new file mode 100644
index 00000000000..a9292253453
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic16.C
@@ -0,0 +1,8 @@
+// PR c++/64095
+// { dg-do compile { target c++14 } }
+
+void f()
+{
+ [](auto...){}();
+ [](auto&&...){}();
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic17.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic17.C
new file mode 100644
index 00000000000..4a7392f93bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic17.C
@@ -0,0 +1,125 @@
+// PR c++/85118
+// { dg-do compile { target c++14 } }
+
+namespace std
+{
+ template<typename _Tp>
+ struct remove_const
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_const<_Tp const>
+ { typedef _Tp type; };
+
+
+ template<typename _Tp>
+ struct remove_volatile
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_volatile<_Tp volatile>
+ { typedef _Tp type; };
+
+
+ template<typename _Tp>
+ struct remove_cv
+ {
+ typedef typename
+ remove_const<typename remove_volatile<_Tp>::type>::type type;
+ };
+
+ template<typename _Tp>
+ struct remove_reference
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct remove_reference<_Tp&&>
+ { typedef _Tp type; };
+
+ template<typename _Tp>
+ struct decay
+ {
+ using type = typename remove_reference<typename remove_const<_Tp>::type>::type;
+ };
+
+ template<typename _Tp>
+ _Tp&&
+ declval() noexcept;
+
+ template<typename _Tp>
+ constexpr _Tp&&
+ forward(typename std::remove_reference<_Tp>::type& __t) noexcept
+ { return static_cast<_Tp&&>(__t); }
+
+
+ template<typename _Arg>
+ struct _Mu
+ {
+ template<typename _CVArg, typename _Tuple>
+ _CVArg&&
+ operator()(_CVArg&& __arg, _Tuple&) const volatile
+ { return std::forward<_CVArg>(__arg); }
+ };
+
+ template<typename _Functor, typename _Bound_args>
+ struct _Bind
+ {
+ _Functor _M_f;
+ _Bound_args _M_bound_args;
+
+ template<typename _Args, typename _Result
+ = decltype( std::declval<_Functor&>()(
+ _Mu<_Bound_args>()( std::declval<_Bound_args&>(),
+ std::declval<_Args&>() ) ) )>
+ _Result
+ operator()(_Args&& __args) { return {}; }
+
+ template<typename _Args, typename _Result
+ = decltype( std::declval<volatile _Functor&>()(
+ _Mu<_Bound_args>()( std::declval<volatile _Bound_args&>(),
+ std::declval<_Args&>() ) ) )>
+ _Result
+ operator()(_Args&& __args) volatile;
+
+ };
+
+ template<typename _Func, typename _BoundArgs>
+ _Bind<typename decay<_Func>::type, typename decay<_BoundArgs>::type>
+ bind(_Func&& __f, _BoundArgs&& __args)
+ {
+ return {
+ std::forward<_Func>(__f),
+ std::forward<_BoundArgs>(__args)
+ };
+ }
+
+} // namespace std
+
+
+template <typename T>
+bool isOneOf(const T& )
+{
+ return false;
+}
+
+template <typename T, typename FirstType, typename... Tail>
+bool isOneOf(const T& t, const FirstType& firstValue, const Tail&... tail)
+{
+ return t == firstValue || isOneOf(t, tail...);
+}
+
+int main()
+{
+ const auto isOneOfHelper = [](auto&&... params)
+ {
+ return isOneOf(std::forward<decltype(params)>(params)...);
+ };
+
+ auto isO = std::bind(isOneOfHelper, 'o');
+
+ isO('o');
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-mangle-1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-mangle-1.C
index ca0910be503..8f135358465 100644
--- a/gcc/testsuite/g++.dg/cpp1y/lambda-mangle-1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-mangle-1.C
@@ -85,4 +85,4 @@ void Baz ()
// { dg-final { scan-assembler "_Z3eatIZ3FoovEUlPT_PT0_E4_Z3FoovEUlS1_S3_E5_EvRS0_RS2_:" } }
// { dg-final { scan-assembler "_Z3eatIPiZ3BarIsEvvEUlPsPfS3_E_EvRT_RT0_:" } }
// { dg-final { scan-assembler "_Z3eatIPiZ3BarIsEvvEUlPsPT_PT0_E0_EvRS3_RS5_:" } }
-// { dg-final { scan-assembler "_Z3eatIPiZ3BarIsEvvEUlPsPT_zE1_EvRS3_RT0_:" } }
+// { dg-final { scan-assembler "_Z3eatIPiZ3BarIsEvvEUlPsDpPT_E1_EvRT_RT0_:" } }
diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr10.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr10.C
new file mode 100644
index 00000000000..1dc396d9ca5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr10.C
@@ -0,0 +1,7 @@
+// PR c++/71638
+// { dg-do compile { target c++14 } }
+
+struct {
+ int &&a;
+ int b{a};
+} c[] { { 2 } };
diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C
new file mode 100644
index 00000000000..09591df3807
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C
@@ -0,0 +1,12 @@
+// PR c++/85148
+// { dg-do compile { target c++14 } }
+
+template<typename T> struct A
+{
+ T x[1]{(__PTRDIFF_TYPE__)this};
+};
+
+void foo()
+{
+ A<A<__PTRDIFF_TYPE__>> a{};
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr9.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr9.C
new file mode 100644
index 00000000000..4e13fc5c9d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr9.C
@@ -0,0 +1,14 @@
+// PR c++/84927 - ICE with NSDMI and reference
+// { dg-do compile { target c++14 } }
+
+struct A
+{
+ int& r;
+ int i = r;
+};
+
+void foo()
+{
+ int j;
+ A a = A{j};
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60393.C b/gcc/testsuite/g++.dg/cpp1y/pr60393.C
index 27fe2b72296..2ae21ed1147 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr60393.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr60393.C
@@ -1,8 +1,7 @@
// PR c++/60393
// { dg-do compile { target c++14 } }
-// { dg-options "" }
-void (*f)(auto) + 0; // { dg-error "expected" }
+void (*f)(auto) + 0; // { dg-error "auto|expected" }
struct A
{
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60626.C b/gcc/testsuite/g++.dg/cpp1y/pr60626.C
deleted file mode 100644
index 311464472da..00000000000
--- a/gcc/testsuite/g++.dg/cpp1y/pr60626.C
+++ /dev/null
@@ -1,7 +0,0 @@
-// PR c++/60626
-// { dg-do compile { target c++14 } }
-// { dg-options "" }
-
-struct A {};
-
-void (*A::p)(auto) = 0; // { dg-error "static data member|template" }
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/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/cpp1z/class-deduction50.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction50.C
new file mode 100644
index 00000000000..e8cdd8c710f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction50.C
@@ -0,0 +1,22 @@
+// PR c++/84355
+// { dg-additional-options -std=c++17 }
+
+template <class, class> struct same;
+template <class T> struct same<T,T> {};
+
+template<typename T> struct A
+{
+ template<class U> struct B
+ {
+ B(U);
+ };
+
+ A() {
+ B b(0);
+ same<decltype(b),B<int>>{};
+ }
+};
+
+struct C {};
+
+A<C> a;
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction51.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction51.C
new file mode 100644
index 00000000000..eba7972c3c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction51.C
@@ -0,0 +1,11 @@
+// PR c++/84937
+// { dg-additional-options -std=c++17 }
+
+template<int, int> struct A {};
+
+template<int I> struct B
+{
+ template<auto J> B(A<I,J>);
+};
+
+B b(A<0,0>{});
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C
new file mode 100644
index 00000000000..e51398bbbb0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction54.C
@@ -0,0 +1,15 @@
+// PR c++/82152
+// { dg-additional-options -std=c++17 }
+
+struct Base {};
+
+template<typename T>
+struct Derived : public Base {
+ using Base::Base;
+};
+
+Derived() -> Derived< void >;
+
+int main() {
+ Derived x;
+}
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/constexpr-if13.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if13.C
new file mode 100644
index 00000000000..9a9053c3305
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if13.C
@@ -0,0 +1,11 @@
+// PR c++/84854
+// { dg-options -std=c++17 }
+
+constexpr int foo () { return 1; }
+constexpr int foo (int) { return 2; }
+
+template <typename>
+void a()
+{
+ if constexpr(foo) { };
+}
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/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/noexcept-type19.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type19.C
new file mode 100644
index 00000000000..2fc2b033ba6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type19.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++11 } }
+
+#include "noexcept-type19.h"
+
+extern "C" void *malloc (size_t);
+
+template<class T> void f(T*);
+
+int main()
+{
+ f<decltype(malloc)>(operator new);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type19.h b/gcc/testsuite/g++.dg/cpp1z/noexcept-type19.h
new file mode 100644
index 00000000000..33a29357e7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type19.h
@@ -0,0 +1,4 @@
+#pragma GCC system_header
+
+typedef decltype(sizeof(0)) size_t;
+extern "C" void *malloc (size_t) throw();
diff --git a/gcc/testsuite/g++.dg/ext/attr-noinline-4.C b/gcc/testsuite/g++.dg/ext/attr-noinline-4.C
new file mode 100644
index 00000000000..27c7ae80fec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-noinline-4.C
@@ -0,0 +1,10 @@
+// PR c++/84665
+
+struct S {} a[1];
+
+template <int N>
+void
+foo ()
+{
+ __attribute__ ((noinline (a[0]))) int c = 0; // { dg-error "wrong number of arguments" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/builtin12.C b/gcc/testsuite/g++.dg/ext/builtin12.C
new file mode 100644
index 00000000000..1d6bb75cd77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/builtin12.C
@@ -0,0 +1,10 @@
+// PR c++/85113
+// { dg-do compile { target c++14 } }
+
+template<bool> struct A {};
+
+constexpr int foo()
+{
+ A<__builtin_constant_p(0)> a{};
+ return 0;
+}
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/new44.C b/gcc/testsuite/g++.dg/init/new44.C
index ab6e3484cc8..4ab73209e22 100644
--- a/gcc/testsuite/g++.dg/init/new44.C
+++ b/gcc/testsuite/g++.dg/init/new44.C
@@ -87,10 +87,10 @@ test_one_dim_short_array ()
static void __attribute__ ((used))
test_two_dim_char_array ()
{
- p = new char [1][MAX]; // { dg-error "size of unnamed array" }
- p = new char [1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new char [1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new char [1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new char [1][MAX / 2]; // { dg-error "size of array" }
p = new char [1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new char [1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -104,18 +104,18 @@ test_two_dim_char_array ()
p = new char [1][MAX / 2 - 7]; // okay
p = new char [1][MAX / 2 - 8]; // okay
- p = new char [2][MAX]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX - 2]; // { dg-error "size of unnamed array" }
+ p = new char [2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
p = new char [2][MAX / 2]; // { dg-error "size of array" }
p = new char [2][MAX / 2 - 1]; // { dg-error "size of array" }
p = new char [2][MAX / 2 - 2]; // { dg-error "size of array" }
p = new char [2][MAX / 2 - 7]; // { dg-error "size of array" }
p = new char [2][MAX / 2 - 8]; // { dg-error "size of array" }
- p = new char [MAX][MAX]; // { dg-error "size of unnamed array" }
- p = new char [MAX][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [MAX][MAX - 2]; // { dg-error "size of unnamed array" }
+ p = new char [MAX][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX][MAX - 2]; // { dg-error "size of (unnamed )?array" }
p = new char [MAX][MAX / 2]; // { dg-error "size of array" }
p = new char [MAX][MAX / 2 - 1]; // { dg-error "size of array" }
p = new char [MAX][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -142,10 +142,10 @@ test_two_dim_char_array ()
static __attribute__ ((used)) void
test_three_dim_char_array ()
{
- p = new char [1][1][MAX]; // { dg-error "size of unnamed array" }
- p = new char [1][1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [1][1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new char [1][1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new char [1][1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new char [1][1][MAX / 2]; // { dg-error "size of array" }
p = new char [1][1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new char [1][1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -159,19 +159,19 @@ test_three_dim_char_array ()
p = new char [1][1][MAX / 2 - 7]; // okay
p = new char [1][1][MAX / 2 - 8]; // okay
- p = new char [1][2][MAX]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX - 99]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
- p = new char [1][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
+ p = new char [1][2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
+ p = new char [1][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
p = new char [1][2][MAX / 4]; // { dg-error "size of array" }
// Avoid exercising data model-dependent expressions.
@@ -181,10 +181,10 @@ test_three_dim_char_array ()
p = new char [1][2][MAX / 4 - 3]; // okay
p = new char [1][2][MAX / 4 - 4]; // okay
- p = new char [2][1][MAX]; // { dg-error "size of unnamed array" }
- p = new char [2][1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [2][1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new char [2][1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new char [2][1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new char [2][1][MAX / 2]; // { dg-error "size of array" }
p = new char [2][1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new char [2][1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -203,19 +203,19 @@ test_three_dim_char_array ()
p = new char [2][1][MAX / 4 - 3]; // okay
p = new char [2][1][MAX / 4 - 4]; // okay
- p = new char [2][2][MAX]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX - 99]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
- p = new char [2][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
+ p = new char [2][2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
p = new char [2][2][MAX / 4]; // { dg-error "size of array" }
p = new char [2][2][MAX / 4 - 1]; // { dg-error "size of array" }
p = new char [2][2][MAX / 4 - 2]; // { dg-error "size of array" }
@@ -227,19 +227,19 @@ test_three_dim_char_array ()
p = new char [2][2][MAX / 8 - 2];
p = new char [2][2][MAX / 8 - 3];
- p = new char [2][MAX][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX - 1][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX - 2][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX - 99][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 1][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 2][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 3][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 4][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 5][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 6][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 7][2]; // { dg-error "size of unnamed array" }
- p = new char [2][MAX / 2 - 8][2]; // { dg-error "size of unnamed array" }
+ p = new char [2][MAX][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX - 1][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX - 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX - 99][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 1][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 3][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 4][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 5][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 6][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 7][2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [2][MAX / 2 - 8][2]; // { dg-error "size of (unnamed )?array" }
p = new char [2][MAX / 4][2]; // { dg-error "size of array" }
p = new char [2][MAX / 4 - 1][2]; // { dg-error "size of array" }
p = new char [2][MAX / 4 - 2][2]; // { dg-error "size of array" }
@@ -275,11 +275,11 @@ test_three_dim_char_array ()
p = new char [MAX / 8 - 2][2][2];
p = new char [MAX / 8 - 3][2][2];
- p = new char [MAX][MAX][MAX]; // { dg-error "size of unnamed array" }
- p = new char [MAX][MAX][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new char [MAX][MAX / 2][MAX]; // { dg-error "size of unnamed array" }
- p = new char [MAX][MAX / 2][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new char [MAX / 2][MAX / 2][MAX / 2]; // { dg-error "size of unnamed array" }
+ p = new char [MAX][MAX][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX][MAX][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX][MAX / 2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX][MAX / 2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new char [MAX / 2][MAX / 2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
}
// Exercise new expression with N-dimensional arrays where N is
@@ -342,10 +342,10 @@ test_one_dim_byte_array (void *p)
static void __attribute__ ((used))
test_placement_two_dim_byte_struct_array (void *p)
{
- p = new (p) B [1][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new (p) B [1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [1][MAX / 2]; // { dg-error "size of array" }
p = new (p) B [1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new (p) B [1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -359,18 +359,18 @@ test_placement_two_dim_byte_struct_array (void *p)
p = new (p) B [1][MAX / 2 - 7]; // okay
p = new (p) B [1][MAX / 2 - 8]; // okay
- p = new (p) B [2][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX - 2]; // { dg-error "size of unnamed array" }
+ p = new (p) B [2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [2][MAX / 2]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 2 - 1]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 2 - 2]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 2 - 7]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 2 - 8]; // { dg-error "size of array" }
- p = new (p) B [MAX][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [MAX][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [MAX][MAX - 2]; // { dg-error "size of unnamed array" }
+ p = new (p) B [MAX][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [MAX][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [MAX][MAX - 2]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [MAX][MAX / 2]; // { dg-error "size of array" }
p = new (p) B [MAX][MAX / 2 - 1]; // { dg-error "size of array" }
p = new (p) B [MAX][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -397,10 +397,10 @@ test_placement_two_dim_byte_struct_array (void *p)
static __attribute__ ((used)) void
test_placement_three_dim_byte_struct_array (void *p)
{
- p = new (p) B [1][1][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new (p) B [1][1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [1][1][MAX / 2]; // { dg-error "size of array" }
p = new (p) B [1][1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new (p) B [1][1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -414,19 +414,19 @@ test_placement_three_dim_byte_struct_array (void *p)
p = new (p) B [1][1][MAX / 2 - 7]; // okay
p = new (p) B [1][1][MAX / 2 - 8]; // okay
- p = new (p) B [1][2][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX - 99]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
- p = new (p) B [1][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
+ p = new (p) B [1][2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [1][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [1][2][MAX / 4]; // { dg-error "size of array" }
// Avoid exercising data model-dependent expressions.
@@ -436,10 +436,10 @@ test_placement_three_dim_byte_struct_array (void *p)
p = new (p) B [1][2][MAX / 4 - 3]; // okay
p = new (p) B [1][2][MAX / 4 - 4]; // okay
- p = new (p) B [2][1][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][1][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][1][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][1][MAX - 99]; // { dg-error "size of unnamed array" }
+ p = new (p) B [2][1][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [2][1][MAX / 2]; // { dg-error "size of array" }
p = new (p) B [2][1][MAX / 2 - 1]; // { dg-error "size of array" }
p = new (p) B [2][1][MAX / 2 - 2]; // { dg-error "size of array" }
@@ -458,19 +458,19 @@ test_placement_three_dim_byte_struct_array (void *p)
p = new (p) B [2][1][MAX / 4 - 3]; // okay
p = new (p) B [2][1][MAX / 4 - 4]; // okay
- p = new (p) B [2][2][MAX]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX - 99]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
+ p = new (p) B [2][2][MAX]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [2][2][MAX / 4]; // { dg-error "size of array" }
p = new (p) B [2][2][MAX / 4 - 1]; // { dg-error "size of array" }
p = new (p) B [2][2][MAX / 4 - 2]; // { dg-error "size of array" }
@@ -482,19 +482,19 @@ test_placement_three_dim_byte_struct_array (void *p)
p = new (p) B [2][2][MAX / 8 - 2];
p = new (p) B [2][2][MAX / 8 - 3];
- p = new (p) B [2][MAX][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX - 1][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX - 2][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX - 99][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 1][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 2][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 3][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 4][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 5][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 6][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 7][2]; // { dg-error "size of unnamed array" }
- p = new (p) B [2][MAX / 2 - 8][2]; // { dg-error "size of unnamed array" }
+ p = new (p) B [2][MAX][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX - 1][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX - 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX - 99][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 1][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 2][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 3][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 4][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 5][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 6][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 7][2]; // { dg-error "size of (unnamed )?array" }
+ p = new (p) B [2][MAX / 2 - 8][2]; // { dg-error "size of (unnamed )?array" }
p = new (p) B [2][MAX / 4][2]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 4 - 1][2]; // { dg-error "size of array" }
p = new (p) B [2][MAX / 4 - 2][2]; // { dg-error "size of array" }
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/opt/pr85196.C b/gcc/testsuite/g++.dg/opt/pr85196.C
new file mode 100644
index 00000000000..04d7abde4fa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr85196.C
@@ -0,0 +1,89 @@
+// PR target/85196
+// Testcase by Rainer Orth <ro@gcc.gnu.org>
+
+// { dg-do compile }
+// { dg-options "-O -fpermissive -w" }
+// { dg-additional-options "-fPIC" { target fpic } }
+
+class a;
+template <typename> class b;
+template <typename k> class d : public b<k> {};
+class e {};
+void f(int);
+template <class> class g {
+public:
+ h();
+ a i();
+};
+template <> class b<e> : public g<e> {};
+typedef (*j)(d<e>);
+template <class k> class l {
+public:
+ k operator->() { return 0; }
+};
+enum m { n, aa, o, ab, q, p };
+inline s(m ac) {
+ switch (ac) {
+ case n:
+ case aa:
+ case p:
+ return 1;
+ case o:
+ case ab:
+ return 2;
+ }
+}
+class D {
+ int ad;
+
+public:
+ *ae() { return &ad; }
+};
+class a {
+ l<D *> af;
+
+public:
+ *r() { return af->ae(); }
+ t(int *c) {
+ int *w = af->ae();
+ return w == c;
+ }
+};
+class F : a {
+public:
+ static int ah[];
+ static e v(F *);
+ unsigned long ai() const;
+};
+inline unsigned long F::ai() const {
+ m aj = r() - &ah[0];
+ return s(aj);
+}
+inline e F::v(F *ak) {
+ long al = ak->ai();
+ f(al);
+}
+template <typename> am() { return q; }
+class an : F {
+public:
+ static ao(d<e> u) {
+ int *ap;
+ m aq = am<unsigned>();
+ ap = &ah[aq];
+ return u.h() && u.i().t(ap);
+ }
+ template <e ar(F *)> static as() {
+ F at;
+ ar(&at);
+ }
+ template <e ar(F *)> static au(int *, unsigned, e *) {
+ j av = ao;
+ d<e> aw;
+ if (av(aw))
+ as<ar>();
+ }
+};
+int *ax;
+int ay;
+e az;
+ba() { an::au<an::v>(ax, ay, &az); }
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/pr85026.C b/gcc/testsuite/g++.dg/pr85026.C
new file mode 100644
index 00000000000..e1e3ccd2e35
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr85026.C
@@ -0,0 +1,61 @@
+/* PR target/85026. */
+/* { dg-do assemble } */
+/* { dg-options "-O2 -std=gnu++11" } */
+
+template <class> class a;
+class b;
+struct c {
+ typedef a<b> &g;
+};
+template <typename d> struct e { typedef typename d::f iter; };
+class h {
+public:
+ void __attribute__((noreturn)) i();
+} ab;
+template <class> class a {
+public:
+ typedef b *f;
+ b &operator[](unsigned m) {
+ if (ac)
+ ab.i();
+ return ad[m];
+ }
+ f n() { return ad; }
+ f m_fn3();
+ b *ad;
+ unsigned ac;
+};
+class b {
+public:
+ short j;
+ short k;
+ signed l;
+} __attribute__((__packed__));
+void o(a<b> &m, b &p2, b &p) {
+ p2 = p = m[0];
+ if (bool at = false)
+ ;
+ else
+ for (c::g au(m);; at = true)
+ if (bool av = false)
+ ;
+ else
+ for (e<a<int>>::iter aw = au.n(), ax = au.m_fn3(); ax;
+ av ? (void)0 : (void)0)
+ if (bool ay = 0)
+ ;
+ else
+ for (b az = *aw; !ay; ay = true) {
+ if (p2.j)
+ p2.j = az.j;
+ else if (p.j)
+ p.j = az.j;
+ if (p2.k)
+ p2.k = az.k;
+ else if (az.k > p.k)
+ p.k = az.k;
+ if (az.l < p2.l)
+ if (az.l > p.l)
+ p.l = az.l;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/template/dependent-base3.C b/gcc/testsuite/g++.dg/template/dependent-base3.C
new file mode 100644
index 00000000000..e38b968e774
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/dependent-base3.C
@@ -0,0 +1,26 @@
+// PR c++/85060
+// { dg-do compile { target c++14 } }
+
+struct CA {
+ constexpr int foo() const { return 42; }
+};
+
+template <class T>
+struct CB : CA { };
+
+template <class T>
+struct CC : CB<T> {
+ constexpr int bar() const {
+ const int m = CA::foo();
+ return m;
+ }
+
+ constexpr int baz() const {
+ const T m = CA::foo();
+ return m;
+ }
+};
+
+constexpr CC<double> c;
+
+static_assert( c.bar() == 42, "" );
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/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/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/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/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/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/execute/pr84748.c b/gcc/testsuite/gcc.c-torture/execute/pr84748.c
new file mode 100644
index 00000000000..9572ab285c6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr84748.c
@@ -0,0 +1,34 @@
+/* { dg-require-effective-target int128 } */
+
+typedef unsigned __int128 u128;
+
+int a, c, d;
+u128 b;
+
+unsigned long long g0, g1;
+
+void
+store (unsigned long long a0, unsigned long long a1)
+{
+ g0 = a0;
+ g1 = a1;
+}
+
+void
+foo (void)
+{
+ b += a;
+ c = d != 84347;
+ b /= c;
+ u128 x = b;
+ store (x >> 0, x >> 64);
+}
+
+int
+main (void)
+{
+ foo ();
+ if (g0 != 0 || g1 != 0)
+ __builtin_abort ();
+ return 0;
+}
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/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/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/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/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/pr84956.c b/gcc/testsuite/gcc.dg/pr84956.c
new file mode 100644
index 00000000000..055a749d635
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84956.c
@@ -0,0 +1,27 @@
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+char a;
+int c;
+unsigned b ();
+
+unsigned
+setjmp ()
+{
+}
+
+static void
+d ()
+{
+ if (b ())
+ c = 3;
+}
+
+void
+e ()
+{
+ d ();
+ a && ({ setjmp (); });
+ a && ({ setjmp (); });
+ a && ({ setjmp (); });
+}
+
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/vect/pr84485.c b/gcc/testsuite/gcc.dg/vect/pr84485.c
new file mode 100644
index 00000000000..ad25d3642c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr84485.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+#define N 256
+
+void __attribute__ ((noinline, noclone))
+f (unsigned long incx, unsigned long incy,
+ float *restrict dx, float *restrict dy)
+{
+ unsigned long ix = 0, iy = 0;
+ for (unsigned long i = 0; i < N; ++i)
+ {
+ dy[iy] += dx[ix];
+ ix += incx;
+ iy += incy;
+ }
+}
+
+float a = 0.0;
+float b[N];
+
+int
+main (void)
+{
+ check_vect ();
+
+ for (int i = 0; i < N; ++i)
+ b[i] = i;
+ f (1, 0, b, &a);
+ if (a != N * (N - 1) / 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
index c917f81c022..fa0fb56d9e1 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c
@@ -1,5 +1,5 @@
/* { dg-do assemble } */
-/* { dg-options "-O1 --save-temps -mno-fix-cortex-a53-843419" } */
+/* { dg-options "-O1 --save-temps" } */
#pragma GCC push_options
#pragma GCC target ("+nothing+simd, cmodel=small")
diff --git a/gcc/testsuite/gcc.target/aarch64/pr81647.c b/gcc/testsuite/gcc.target/aarch64/pr81647.c
new file mode 100644
index 00000000000..2d764030dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr81647.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-tree-ssa" } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include <fenv.h>
+
+double x[28], y[28];
+int res[28];
+
+int
+main (void)
+{
+ int i;
+ for (i = 0; i < 28; ++i)
+ {
+ x[i] = __builtin_nan ("");
+ y[i] = i;
+ }
+ __asm__ volatile ("" ::: "memory");
+ feclearexcept (FE_ALL_EXCEPT);
+ for (i = 0; i < 4; ++i)
+ res[i] = __builtin_isgreater (x[i], y[i]);
+ for (i = 4; i < 8; ++i)
+ res[i] = __builtin_isgreaterequal (x[i], y[i]);
+ for (i = 8; i < 12; ++i)
+ res[i] = __builtin_isless (x[i], y[i]);
+ for (i = 12; i < 16; ++i)
+ res[i] = __builtin_islessequal (x[i], y[i]);
+ for (i = 16; i < 20; ++i)
+ res[i] = __builtin_islessgreater (x[i], y[i]);
+ for (i = 20; i < 24; ++i)
+ res[i] = __builtin_isunordered (x[i], y[i]);
+ for (i = 24; i < 28; ++i)
+ res[i] = !(__builtin_isunordered (x[i], y[i]));
+ __asm__ volatile ("" ::: "memory");
+ return fetestexcept (FE_ALL_EXCEPT) != 0;
+}
+
+/* { dg-final { scan-tree-dump " u> " "ssa" } } */
+/* { dg-final { scan-tree-dump " u>= " "ssa" } } */
+/* { dg-final { scan-tree-dump " u< " "ssa" } } */
+/* { dg-final { scan-tree-dump " u<= " "ssa" } } */
+/* { dg-final { scan-tree-dump " u== " "ssa" } } */
+/* { dg-final { scan-tree-dump " unord " "ssa" } } */
+/* { dg-final { scan-tree-dump " ord " "ssa" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-1.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-1.c
index c13272eed68..f764153cb17 100644
--- a/gcc/testsuite/gcc.target/arm/cmse/cmse-1.c
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-1.c
@@ -71,6 +71,20 @@ baz (void)
{
return cmse_nonsecure_caller ();
}
+/* { dg-final { scan-assembler "baz:" } } */
+/* { dg-final { scan-assembler "__acle_se_baz:" } } */
+/* { dg-final { scan-assembler-not "\tcmse_nonsecure_caller" } } */
+/* Look for an andsi of 1 with a register in function baz, ie.
+
+;; Function baz<anything>
+<any line without '('>
+(insn <anything but '('> (set (reg<any register modifier>:SI <anything but ')'>)
+ (and:SI (reg<any register modifier>:SI <anything but ')'>)
+ (const_int 1 <anything but ')'>)<anything but '('>
+ <optional: (nil)<anything but '('>>
+(insn
+*/
+/* { dg-final { scan-rtl-dump "\n;; Function baz\[^\n\]*\[^(\]+\[^;\]*\n\\(insn \[^(\]+ \\(set \\(reg\[^:\]*:SI \[^)\]+\\)\[^(\]*\\(and:SI \\(reg\[^:\]*:SI \[^)\]+\\)\[^(\]*\\((const_int 1|reg\[^:\]*:SI) \[^)\]+\\)\[^(\]+(\\(nil\\)\[^(\]+)?\\(insn" expand } } */
typedef int __attribute__ ((cmse_nonsecure_call)) (int_nsfunc_t) (void);
@@ -86,6 +100,11 @@ qux (int_nsfunc_t * callback)
{
fp = cmse_nsfptr_create (callback);
}
+/* { dg-final { scan-assembler "qux:" } } */
+/* { dg-final { scan-assembler "__acle_se_qux:" } } */
+/* { dg-final { scan-assembler "bic" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6" } } */
+/* { dg-final { scan-assembler "msr\tAPSR_nzcvq" } } */
int call_callback (void)
{
@@ -94,13 +113,4 @@ int call_callback (void)
else
return default_callback ();
}
-/* { dg-final { scan-assembler "baz:" } } */
-/* { dg-final { scan-assembler "__acle_se_baz:" } } */
-/* { dg-final { scan-assembler "qux:" } } */
-/* { dg-final { scan-assembler "__acle_se_qux:" } } */
-/* { dg-final { scan-assembler-not "\tcmse_nonsecure_caller" } } */
-/* { dg-final { scan-rtl-dump "and.*reg.*const_int 1" expand } } */
-/* { dg-final { scan-assembler "bic" } } */
-/* { dg-final { scan-assembler "push\t\{r4, r5, r6" } } */
-/* { dg-final { scan-assembler "msr\tAPSR_nzcvq" } } */
/* { dg-final { scan-assembler-times "bl\\s+__gnu_cmse_nonsecure_call" 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c
new file mode 100644
index 00000000000..3fb0380afaa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-16.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-Os -mcmse" } */
+
+#include <arm_cmse.h>
+
+int
+foo (void)
+{
+ return cmse_nonsecure_caller ();
+}
+
+int
+main (void)
+{
+ /* Return success (0) if main is secure, ie if cmse_nonsecure_caller/foo
+ returns false (0). */
+ return foo ();
+}
diff --git a/gcc/testsuite/gcc.target/arm/fpscr.c b/gcc/testsuite/gcc.target/arm/fpscr.c
index 7b4d71d72d8..4c3eaf7fcf7 100644
--- a/gcc/testsuite/gcc.target/arm/fpscr.c
+++ b/gcc/testsuite/gcc.target/arm/fpscr.c
@@ -6,11 +6,14 @@
/* { dg-add-options arm_fp } */
void
-test_fpscr ()
+test_fpscr (void)
{
- volatile unsigned int status = __builtin_arm_get_fpscr ();
+ unsigned status;
+
+ __builtin_arm_set_fpscr (0);
+ status = __builtin_arm_get_fpscr ();
__builtin_arm_set_fpscr (status);
}
/* { dg-final { scan-assembler "mrc\tp10, 7, r\[0-9\]+, cr1, cr0, 0" } } */
-/* { dg-final { scan-assembler "mcr\tp10, 7, r\[0-9\]+, cr1, cr0, 0" } } */
+/* { dg-final { scan-assembler-times "mcr\tp10, 7, r\[0-9\]+, cr1, cr0, 0" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/pr82518.c b/gcc/testsuite/gcc.target/arm/pr82518.c
new file mode 100644
index 00000000000..ce820b78a8d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr82518.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_neon_hw } */
+/* { dg-additional-options "-O3 -fno-inline -std=gnu99" } */
+/* { dg-add-options arm_neon } */
+
+typedef struct { int x, y; } X;
+
+void f4(X *p, int n)
+{
+ for (int i = 0; i < n; i++)
+ { p[i].x = i;
+ p[i].y = i + 1;
+ }
+}
+
+__attribute ((aligned (16))) X arr[100];
+
+int main(void)
+{
+ volatile int fail = 0;
+ f4 (arr, 100);
+ for (int i = 0; i < 100; i++)
+ if (arr[i].y != i+1 || arr[i].x != i)
+ fail = 1;
+ if (fail)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pr82989.c b/gcc/testsuite/gcc.target/arm/pr82989.c
new file mode 100644
index 00000000000..8519c3fdc82
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr82989.c
@@ -0,0 +1,33 @@
+/* PR target/82989. */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mcpu=*" } { "-mcpu=cortex-a8" } } */
+/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mfpu=*" } { "-mfpu=neon" } } */
+/* { dg-skip-if "avoid conflicts with multilib options" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" } } */
+/* { dg-options "-O2 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard" } */
+/* { dg-add-options arm_neon } */
+
+typedef unsigned long long uint64_t;
+
+void f_shr_imm (uint64_t *a)
+{
+ *a += *a >> 32;
+}
+
+void f_shr_reg (uint64_t *a, uint64_t b)
+{
+ *a += *a >> b;
+}
+
+void f_shl_imm (uint64_t *a)
+{
+ *a += *a << 32;
+}
+
+void f_shl_reg (uint64_t *a, uint64_t b)
+{
+ *a += *a << b;
+}
+/* { dg-final { scan-assembler-not "vshl*" } } */
+/* { dg-final { scan-assembler-not "vshr*" } } */
+/* { dg-final { scan-assembler-not "vmov*" } } */
diff --git a/gcc/testsuite/gcc.target/arm/pr84826.c b/gcc/testsuite/gcc.target/arm/pr84826.c
new file mode 100644
index 00000000000..563ce51b76f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr84826.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-Ofast -fstack-check" } */
+
+void d (void *);
+
+void a ()
+{
+ int b;
+ void bar (int c)
+ {
+ if (__builtin_expect (c, 0))
+ ++b;
+ }
+ d (bar);
+}
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/avx512f-vpermd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c
index dbd4544c39e..b36a9c2da0a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c
@@ -41,18 +41,14 @@ TEST (void)
res3.a[i] = DEFAULT_VALUE;
}
-#if AVX512F_LEN == 512
res1.x = INTRINSIC (_permutexvar_epi32) (src1.x, src2.x);
-#endif
res2.x = INTRINSIC (_maskz_permutexvar_epi32) (mask, src1.x, src2.x);
res3.x = INTRINSIC (_mask_permutexvar_epi32) (res3.x, mask, src1.x, src2.x);
CALC (src1.a, src2.a, res_ref);
-#if AVX512F_LEN == 512
if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
abort ();
-#endif
MASK_ZERO (i_d) (res_ref, mask, SIZE);
if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c
index 770d5623f5f..dd88cd46c0b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c
@@ -40,18 +40,14 @@ TEST (void)
res3.a[i] = DEFAULT_VALUE;
}
-#if AVX512F_LEN == 512
res1.x = INTRINSIC (_permutex_epi64) (src1.x, IMM_MASK);
-#endif
res2.x = INTRINSIC (_maskz_permutex_epi64) (mask, src1.x, IMM_MASK);
res3.x = INTRINSIC (_mask_permutex_epi64) (res3.x, mask, src1.x, IMM_MASK);
CALC (src1.a, IMM_MASK, res_ref);
-#if AVX512F_LEN == 512
if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
abort ();
-#endif
MASK_ZERO (i_q) (res_ref, mask, SIZE);
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c
index c596b1d9c40..6c222888e88 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c
@@ -41,18 +41,14 @@ TEST (void)
res3.a[i] = DEFAULT_VALUE;
}
-#if AVX512F_LEN == 512
res1.x = INTRINSIC (_permutexvar_epi64) (src1.x, src2.x);
-#endif
res2.x = INTRINSIC (_maskz_permutexvar_epi64) (mask, src1.x, src2.x);
res3.x = INTRINSIC (_mask_permutexvar_epi64) (res3.x, mask, src1.x, src2.x);
CALC (src1.a, src2.a, res_ref);
-#if AVX512F_LEN == 512
if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
abort ();
-#endif
MASK_ZERO (i_q) (res_ref, mask, SIZE);
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c
index fa1aaa390ab..069bb5d6c63 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
@@ -11,6 +12,7 @@ volatile __mmask8 m;
void extern
avx512vl_test (void)
{
+ x = _mm256_permutexvar_epi32 (x, x);
x = _mm256_maskz_permutexvar_epi32 (m, x, x);
x = _mm256_mask_permutexvar_epi32 (x, m, x, x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c
index c74c8ce96c7..2340a6d9993 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
@@ -11,6 +12,7 @@ volatile __mmask8 m;
void extern
avx512vl_test (void)
{
+ x = _mm256_permutex_epi64 (x, 13);
x = _mm256_mask_permutex_epi64 (x, m, x, 13);
x = _mm256_maskz_permutex_epi64 (m, x, 13);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c
index 43ccad3d6c1..69185e50f76 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
@@ -11,6 +12,7 @@ volatile __mmask8 m;
void extern
avx512vl_test (void)
{
+ x = _mm256_permutexvar_epi64 (x, x);
x = _mm256_maskz_permutexvar_epi64 (m, x, x);
x = _mm256_mask_permutexvar_epi64 (x, m, x, x);
}
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
index 60d09881a99..6e94d2c4865 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
dispatch(offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
index aac75163794..3c467078964 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
dispatch[offset](offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
index 9e24a385387..2c7fb52b59d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { 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 "jmp\[ \t\]*\.LIND" } } */
/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
/* { dg-final { scan-assembler {\tpause} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
index 127b5d94523..0d3f895009d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { 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 "jmp\[ \t\]*\.LIND" } } */
/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
/* { dg-final { scan-assembler {\tpause} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
index fcaa18d10b7..fb26c005e80 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
@@ -9,8 +9,10 @@ foo (void)
bar ();
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
index e4649283d10..aa03fbd8446 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
@@ -10,9 +10,13 @@ foo (void)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
-/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */
-/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */
+/* { 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
index 17c2d0faf88..3c72036dbaf 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
@@ -35,9 +35,8 @@ bar (int i)
}
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
index 9194ccf3cbc..7106407b83d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
@@ -14,9 +14,8 @@ male_indirect_jump (long offset)
dispatch(offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
index e51f261a612..27c7e5b029b 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
dispatch[offset](offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
index 4aeec1833cd..89a2bac8403 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
@@ -14,10 +14,9 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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" } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
index ac0e5999f63..3eb83c3779a 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
@@ -13,10 +13,9 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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" } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
index 573cf1ef09e..0098dd1133d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
@@ -14,9 +14,8 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { 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 "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { 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)} } } */
+/* { 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
index b2b37fc6e2e..ece8de15a4b 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
@@ -13,9 +13,8 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { 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 "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { 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)} } } */
+/* { 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
index 4a43e199931..d53fc887dcc 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
@@ -36,9 +36,8 @@ bar (int i)
}
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
+/* { 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-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
index ac84ab623fa..73d16baddc7 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
@@ -10,9 +10,9 @@ foo (void)
dispatch (buf);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
+/* { 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" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
index ce655e8be1c..856751ac224 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
@@ -11,10 +11,8 @@ foo (void)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
index d34485a0010..42312f65588 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
@@ -10,8 +10,9 @@ foo (void)
bar (buf);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */
+/* { 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" } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
index 0e19830de4d..c8ca102c8df 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
@@ -11,10 +11,9 @@ foo (void)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk" } } */
-/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */
-/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 2 } } */
+/* { 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
index 579441f250e..c09dd0afd2d 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
dispatch(offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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
index c92e6f2b02d..826425a5115 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
@@ -11,9 +11,8 @@ male_indirect_jump (long offset)
dispatch[offset](offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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
index d9964c25bbd..385626850a2 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
@@ -12,9 +12,8 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { 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 "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)} } } */
+/* { 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
index d4dca4dc5fe..1ae49b137ca 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
@@ -12,9 +12,7 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { 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 "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
index 5c07e02df6a..53282390977 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
@@ -9,8 +9,10 @@ foo (void)
bar ();
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
+/* { 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
index 3eb440693a0..8ae43482d0c 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
@@ -10,8 +10,8 @@ foo (void)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
-/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 } } */
-/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */
+/* { 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
index aece9383697..2b9a33e93dc 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
@@ -35,9 +35,8 @@ bar (int i)
}
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
+/* { 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
index 3aba5e8c81f..869d9040838 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
dispatch(offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
index 0f0181d6672..c5c16ed8bd8 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
@@ -11,7 +11,7 @@ male_indirect_jump (long offset)
dispatch[offset](offset);
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
index 2eef6f35a75..4a63ebed8ab 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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 } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
index e825a10f14c..a395ffca018 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
@@ -12,7 +12,7 @@ male_indirect_jump (long offset)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */
+/* { 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 } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
index c6d77e10352..21cbfd39582 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
@@ -9,7 +9,8 @@ foo (void)
bar ();
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
+/* { 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} } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
index 6454827b780..d1300f18dc7 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
@@ -10,7 +10,8 @@ foo (void)
return 0;
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */
+/* { 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 } } */
diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
index c67066cf197..ea009245a58 100644
--- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
@@ -35,8 +35,8 @@ bar (int i)
}
}
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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} } } */
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/pr85193.c b/gcc/testsuite/gcc.target/i386/pr85193.c
new file mode 100644
index 00000000000..98e3dafc7ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85193.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-psabi -O2 -fno-tree-ccp -fno-tree-fre -mno-sse" } */
+
+typedef unsigned char U __attribute__((vector_size(16)));
+typedef unsigned int V __attribute__((vector_size(16)));
+typedef unsigned long long W __attribute__((vector_size(16)));
+
+extern void bar(U, U);
+
+V v;
+
+void
+foo(U f)
+{
+ f[0] = f[0] << (unsigned char)~v[0] | f[~((W)(U){0, 0, 0, 0, 0, 0, 0, 0, 5})[1] & 5] >> (-(unsigned char)~v[0] & 7);
+ bar(f, (U){});
+}
diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
index e6fea84a4d9..af9023af613 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
@@ -15,9 +15,6 @@ foo (void)
/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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
index e239ec4542f..ba467c59b36 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
@@ -15,9 +15,6 @@ foo (void)
/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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
index fa3181303c9..43e57cac2c3 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
@@ -15,8 +15,6 @@ foo (void)
/* { 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 "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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
index fd5b41fdd3f..55f156c4376 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
@@ -14,9 +14,8 @@ foo (void)
/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
/* { 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" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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
index d606373ead1..1c790436a53 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
@@ -16,7 +16,6 @@ foo (void)
/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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
index 75e45e226b8..58aba319cba 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
@@ -16,7 +16,6 @@ foo (void)
/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { 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-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-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
index d1db41cc128..eee230ca2f6 100644
--- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
@@ -13,12 +13,9 @@ 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 "__x86_indirect_thunk:" } } */
-/* { dg-final { scan-assembler-times {\tpause} 1 { target { ! x32 } } } } */
-/* { dg-final { scan-assembler-times {\tlfence} 1 { target { ! x32 } } } } */
-/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */
-/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-/* { dg-final { scan-assembler-times {\tpause} 2 { target { x32 } } } } */
-/* { dg-final { scan-assembler-times {\tlfence} 2 { target { x32 } } } } */
-/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */
-/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */
+/* { dg-final { scan-assembler "__x86_return_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/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/nvptx/pr85056.c b/gcc/testsuite/gcc.target/nvptx/pr85056.c
new file mode 100644
index 00000000000..2471cb83b9e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/pr85056.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr85056a.c" } */
+
+extern void abort ();
+
+extern int a[];
+
+int
+main ()
+{
+ int i, sum;
+
+ sum = 0;
+ for (i = 0; i < 10; i++)
+ sum += a[i];
+
+ if (sum != 55)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/nvptx/pr85056a.c b/gcc/testsuite/gcc.target/nvptx/pr85056a.c
new file mode 100644
index 00000000000..a45a5f2b07f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/pr85056a.c
@@ -0,0 +1,3 @@
+/* { dg-skip-if "" { *-*-* } } */
+
+int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
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/crypto-builtin-1-runnable.c b/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1-runnable.c
new file mode 100644
index 00000000000..25c27bf9a37
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1-runnable.c
@@ -0,0 +1,109 @@
+/* { dg-do run { target { powerpc*-*-* && p8vector_hw } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2 " } */
+
+/* Make sure the test case compiled with -O2 generates the same expected
+ results. The expected results were generated with -O0. */
+
+#include <altivec.h>
+#define TRUE 1
+#define FALSE 0
+
+#define DEBUG 1
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+void abort (void);
+
+typedef vector unsigned long long crypto_t;
+typedef vector unsigned long long v2di_t;
+typedef vector unsigned int v4si_t;
+typedef vector unsigned short v8hi_t;
+typedef vector unsigned char v16qi_t;
+
+v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c)
+{
+ return __builtin_crypto_vpermxor (a, b, c);
+}
+
+v8hi_t crypto6b (v8hi_t a, v8hi_t b, v8hi_t c)
+{
+ return __builtin_crypto_vpermxor (a, b, c);
+}
+
+v4si_t crypto6c (v4si_t a, v4si_t b, v4si_t c)
+{
+ return __builtin_crypto_vpermxor (a, b, c);
+}
+
+v2di_t crypto6d (v2di_t a, v2di_t b, v2di_t c)
+{
+ return __builtin_crypto_vpermxor (a, b, c);
+}
+
+int main()
+{
+ int i;
+ v16qi_t expected_v16qi, result_v16qi;
+ v8hi_t expected_v8hi, result_v8hi;
+ v4si_t expected_v4si, result_v4si;
+ v2di_t expected_v2di, result_v2di;
+ v16qi_t v16qi_arg_a, v16qi_arg_b, v16qi_arg_c;
+ v8hi_t v8hi_arg_a, v8hi_arg_b, v8hi_arg_c;
+ v4si_t v4si_arg_a, v4si_arg_b, v4si_arg_c;
+ v2di_t v2di_arg_a, v2di_arg_b, v2di_arg_c;
+
+ v16qi_arg_a = (vector unsigned char){ 7, 6, 5, 4, 3, 2, 1, 0,
+ 1, 2, 3, 4, 5, 6, 7, 8 };
+ v16qi_arg_b = (vector unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
+ 7, 6, 5, 4, 3, 2, 1, 0 };
+ v16qi_arg_c = (vector unsigned char){ 7, 2, 5, 4, 3, 6, 1, 8,
+ 1, 6, 3, 4, 5, 2, 7, 0 };
+ expected_v16qi = (vector unsigned char){ 15, 10, 13, 12, 11, 14, 9, 0,
+ 9, 14, 11, 12, 13, 10, 15, 8 };
+
+ result_v16qi = crypto6a (v16qi_arg_a, v16qi_arg_b, v16qi_arg_c);
+
+ for (i = 0; i < 16; i++)
+ if (expected_v16qi[i] != result_v16qi[i])
+ printf("crypto6a: result_v16qi[%d] = %d, expected = %d\n",
+ i, result_v16qi[i], expected_v16qi[i]);
+
+ v8hi_arg_a = (vector unsigned short int){ 7, 6, 5, 4, 3, 2, 1, 0};
+ v8hi_arg_b = (vector unsigned short int){ 1, 2, 3, 4, 5, 6, 7, 8};
+ v8hi_arg_c = (vector unsigned short int){ 7, 2, 5, 4, 3, 6, 1, 8};
+ expected_v8hi = (vector unsigned short int){ 5, 0, 6, 0, 7, 0, 8};
+
+ result_v8hi = crypto6b (v8hi_arg_a, v8hi_arg_b, v8hi_arg_c);
+
+ for (i = 0; i < 8; i++)
+ if (expected_v8hi[i] != result_v8hi[i])
+ printf("crypto6a: result_v8hi[%d] = %d, expected = %d\n",
+ i, result_v8hi[i], expected_v8hi[i]);
+
+ v4si_arg_a = (vector unsigned int){ 7, 6, 5, 4};
+ v4si_arg_b = (vector unsigned int){ 15, 6, 7, 8};
+ v4si_arg_c = (vector unsigned int){ 7, 14, 3, 6};
+ expected_v4si = (vector unsigned int){ 7, 0, 8, 0};
+
+ result_v4si = crypto6c (v4si_arg_a, v4si_arg_b, v4si_arg_c);
+
+ for (i = 0; i < 4; i++)
+ if (expected_v4si[i] != result_v4si[i])
+ printf("crypto6a: result_v4si[%d] = %d, expected = %d\n",
+ i, result_v4si[i], expected_v4si[i]);
+
+ v2di_arg_a = (vector unsigned long long int){ 7, 6, };
+ v2di_arg_b = (vector unsigned long long int){ 15, 6, };
+ v2di_arg_c = (vector unsigned long long int){ 7, 14};
+ expected_v2di = (vector unsigned long long int){ 6, 0};
+
+ result_v2di = crypto6d (v2di_arg_a, v2di_arg_b, v2di_arg_c);
+
+ for (i = 0; i < 2; i++)
+ if (expected_v2di[i] != result_v2di[i])
+ printf("crypto6a: result_v2di[%d] = %d, expected = %d\n",
+ i, result_v2di[i], expected_v2di[i]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/extend-divide-1.c b/gcc/testsuite/gcc.target/powerpc/extend-divide-1.c
index 365dead9fac..aaf9b40fc24 100644
--- a/gcc/testsuite/gcc.target/powerpc/extend-divide-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/extend-divide-1.c
@@ -5,9 +5,7 @@
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */
/* { dg-final { scan-assembler-times "divwe " 1 } } */
-/* { dg-final { scan-assembler-times "divweo " 1 } } */
/* { dg-final { scan-assembler-times "divweu " 1 } } */
-/* { dg-final { scan-assembler-times "divweuo " 1 } } */
/* { dg-final { scan-assembler-not "bl __builtin" } } */
int
@@ -16,20 +14,8 @@ div_we (int a, int b)
return __builtin_divwe (a, b);
}
-int
-div_weo (int a, int b)
-{
- return __builtin_divweo (a, b);
-}
-
unsigned int
div_weu (unsigned int a, unsigned int b)
{
return __builtin_divweu (a, b);
}
-
-unsigned int
-div_weuo (unsigned int a, unsigned int b)
-{
- return __builtin_divweuo (a, b);
-}
diff --git a/gcc/testsuite/gcc.target/powerpc/extend-divide-2.c b/gcc/testsuite/gcc.target/powerpc/extend-divide-2.c
index 829cd40cae8..92e494aa136 100644
--- a/gcc/testsuite/gcc.target/powerpc/extend-divide-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/extend-divide-2.c
@@ -5,9 +5,7 @@
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */
/* { dg-final { scan-assembler-times "divde " 1 } } */
-/* { dg-final { scan-assembler-times "divdeo " 1 } } */
/* { dg-final { scan-assembler-times "divdeu " 1 } } */
-/* { dg-final { scan-assembler-times "divdeuo " 1 } } */
/* { dg-final { scan-assembler-not "bl __builtin" } } */
long
@@ -16,20 +14,8 @@ div_de (long a, long b)
return __builtin_divde (a, b);
}
-long
-div_deo (long a, long b)
-{
- return __builtin_divdeo (a, b);
-}
-
unsigned long
div_deu (unsigned long a, unsigned long b)
{
return __builtin_divdeu (a, b);
}
-
-unsigned long
-div_deuo (unsigned long a, unsigned long b)
-{
- return __builtin_divdeuo (a, b);
-}
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/ppc-sdata-2.c b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
index 570c81f7e33..ee77456ca4f 100644
--- a/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-sdata-2.c
@@ -5,6 +5,7 @@
/* { dg-final { scan-assembler-not "\\.section\[ \t\]\\.sdata2," } } */
/* { dg-final { scan-assembler "sdat@sdarel\\(13\\)" } } */
/* { dg-final { scan-assembler "sdat2@sdarel\\(13\\)" } } */
+/* { dg-skip-if "" { *-*-* } { "-mno-readonly-in-sdata" } { "" } } */
int sdat = 2;
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79799-2.c b/gcc/testsuite/gcc.target/powerpc/pr79799-2.c
index 793e3b9b66c..b1a0b09cbf7 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79799-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79799-2.c
@@ -8,7 +8,7 @@
/* Optimize x = vec_insert (vec_extract (v2, N), v1, M) for SFmode if N is the default
scalar position. */
-#if __ORDER_LITTLE_ENDIAN__
+#if __LITTLE_ENDIAN__
#define ELE 2
#else
#define ELE 1
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/pr84878.c b/gcc/testsuite/gcc.target/powerpc/pr84878.c
new file mode 100644
index 00000000000..f96d3803d06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84878.c
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/84878 */
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O2 -maltivec -mno-vsx -fmodulo-sched -ftree-vectorize -funroll-loops -fassociative-math -fno-signed-zeros -fno-trapping-math" } */
+
+int ek;
+float zu;
+
+int
+k5 (int ks)
+{
+ while (ek < 1)
+ {
+ ks += (int)(0x1000000 + zu + !ek);
+ ++ek;
+ }
+ return ks;
+}
diff --git a/gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c b/gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c
new file mode 100644
index 00000000000..75e32a1c7c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/nobp-no-dwarf2-cfi.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z900 --save-temps -mfunction-return-reg=thunk -mindirect-branch-table -fno-dwarf2-cfi-asm" } */
+
+/* Make sure that we do not emit .cfi directives when -fno-dwarf2-cfi-asm is being used. */
+
+int
+main ()
+{
+ return 0;
+}
+
+/* 1 x main
+/* { 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/array_constructor_52.f90 b/gcc/testsuite/gfortran.dg/array_constructor_52.f90
new file mode 100644
index 00000000000..63581acf989
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_constructor_52.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! PR 84931 - long array constructors with type conversion were not
+! handled correctly.
+program test
+ implicit none
+ integer, parameter :: n = 2**16
+ real, dimension(n) :: y
+ integer :: i
+ y = (/ (1, i=1, n) /)
+ if (y(2) /= 1) stop 1
+end program test
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/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/interface_41.f90 b/gcc/testsuite/gfortran.dg/interface_41.f90
new file mode 100644
index 00000000000..b5ea8af189d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_41.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! PR fortran/85001
+! Contributed by Gerhard Steinmetz.
+program p
+ type t
+ end type
+ call s
+contains
+ real function f(x)
+ class(t) :: x
+ dimension :: x(:)
+ f = 1.0
+ end
+ subroutine s
+ type(t) :: x(2)
+ real :: z
+ z = f(x) ! { dg-error "Rank mismatch in argument" }
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/internal_references_1.f90 b/gcc/testsuite/gfortran.dg/internal_references_1.f90
index 12041df9d70..2434e28d5e3 100644
--- a/gcc/testsuite/gfortran.dg/internal_references_1.f90
+++ b/gcc/testsuite/gfortran.dg/internal_references_1.f90
@@ -11,7 +11,7 @@ module m
implicit none
contains
- subroutine p (i) ! { dg-error "is already defined" }
+ subroutine p (i) ! { dg-error "(1)" }
integer :: i
end subroutine
@@ -22,14 +22,15 @@ end module
!
! PR25124 - would happily ignore the declaration of foo in the main program.
program test
-real :: foo, x ! { dg-error "explicit interface and must not have attributes declared" }
+real :: foo, x
x = bar () ! This is OK because it is a regular reference.
x = foo ()
contains
- function foo () ! { dg-error "explicit interface and must not have attributes declared" }
+ function foo () ! { dg-error "explicit interface from a previous" }
foo = 1.0
end function foo
function bar ()
bar = 1.0
end function bar
end program test
+
diff --git a/gcc/testsuite/gfortran.dg/matmul_rank_1.f90 b/gcc/testsuite/gfortran.dg/matmul_rank_1.f90
new file mode 100644
index 00000000000..f111b26018f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_rank_1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-additional-options "-ffrontend-optimize" }
+! PR 85044 - used to die on allocating a negative amount of memory.
+! Test case by Gerhard Steinmetz.
+program p
+ real :: a(3,3) = 1.0
+ real :: b(33)
+ b = matmul(a, a) ! { dg-error "Incompatible ranks" }
+end
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/pr64124.f90 b/gcc/testsuite/gfortran.dg/pr64124.f90
new file mode 100644
index 00000000000..349c20de204
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr64124.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! PR fortran/64124.f90
+ character(len=kind(1)) x
+ integer(len(x)) y
+ end
diff --git a/gcc/testsuite/gfortran.dg/pr65453.f90 b/gcc/testsuite/gfortran.dg/pr65453.f90
new file mode 100644
index 00000000000..8d30116b79d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr65453.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/65453
+! Contributed by Tobias Burnus <burnus at gcc.gnu.org>
+procedure() :: foo ! { dg-error "(1)" }
+ contains
+ subroutine foo() ! { dg-error "clashes with procedure" }
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr70409.f90 b/gcc/testsuite/gfortran.dg/pr70409.f90
new file mode 100644
index 00000000000..0372f6e9632
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr70409.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! PR fortran/70409
+! Contriubted by Harald Anlauf <anlauf at gmx dot de>
+program foo
+ integer, parameter :: huge_1 = huge(0_1)
+ character( huge_1 ), parameter :: x = 'abc'
+ character( huge(0_1) ), parameter :: y = 'abc'
+ character( huge(0_1)+0 ), parameter :: z = 'abcdef'
+ character( huge(0_1) ) :: a = 'abc'
+ integer, parameter :: huge_2 = huge(0_2)
+ character( huge_2 ), parameter :: u = 'abc'
+ character( huge(0_2) ), parameter :: v = 'abc'
+ character(int(huge(0_2),4)), parameter :: w = 'abcdef'
+ character( huge(0_2) ) :: b = 'abc'
+ if (len(x) /= huge_1) stop 1
+ if (len(y) /= huge_1) stop 2
+ if (len(z) /= huge_1) stop 3
+ if (len(a) /= huge_1) stop 4
+ if (len(u) /= huge_2) stop 5
+ if (len(v) /= huge_2) stop 6
+ if (len(w) /= huge_2) stop 7
+ if (len(b) /= huge_2) stop 8
+end program foo
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/pr77414.f90 b/gcc/testsuite/gfortran.dg/pr77414.f90
new file mode 100644
index 00000000000..222c1a31542
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr77414.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/77414
+subroutine a(x) ! { dg-error "(1)" }
+ character(*) :: x
+ contains
+ subroutine a(x) ! { dg-error " is already defined at" }
+ character(*) :: x
+ end subroutine a
+end subroutine a
diff --git a/gcc/testsuite/gfortran.dg/pr78741.f90 b/gcc/testsuite/gfortran.dg/pr78741.f90
new file mode 100644
index 00000000000..6eb85789f94
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr78741.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! PR fortran/78741
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran at t-online.de>
+subroutine s(n, x)
+ integer :: n
+ character(n) :: x
+ character, pointer :: z(:)
+ x = 'a'
+ return
+entry g(n, x) ! { dg-error "is already defined" }
+ x = 'b'
+contains
+ subroutine g ! { dg-error "(1)" }
+ z(1) = x(1:1)
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr83939.f90 b/gcc/testsuite/gfortran.dg/pr83939.f90
new file mode 100644
index 00000000000..dfeaac71630
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83939.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+elemental function f() result(s) ! { dg-error "shall not have an ALLOCATABLE or POINTER" }
+ allocatable s
+ allocate(s)
+ s = 3.5
+end function
+
+elemental function g() result(s) ! { dg-error "shall not have an ALLOCATABLE or POINTER" }
+ pointer s
+ allocate(s)
+ s = 3.5
+end function
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/pr84734.f90 b/gcc/testsuite/gfortran.dg/pr84734.f90
new file mode 100644
index 00000000000..4b117ae43e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr84734.f90
@@ -0,0 +1,4 @@
+! { dg-do compile }
+! PR fortran/84734
+ integer :: b(huge(1_8)+1_8) = 0 ! { dg-error "Arithmetic overflow" }
+ 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/gnat.dg/prot3.adb b/gcc/testsuite/gnat.dg/prot3.adb
new file mode 100644
index 00000000000..25390659238
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3.adb
@@ -0,0 +1,8 @@
+-- { dg-do run }
+
+with Prot3_Pkg; use Prot3_Pkg;
+
+procedure Prot3 is
+begin
+ P.Foo (4);
+end;
diff --git a/gcc/testsuite/gnat.dg/prot3_pkg.adb b/gcc/testsuite/gnat.dg/prot3_pkg.adb
new file mode 100644
index 00000000000..07ae1829f60
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3_pkg.adb
@@ -0,0 +1,17 @@
+package body Prot3_Pkg is
+
+ protected body Prot is
+ function Fn (J : Short_Integer) return Rec
+ is
+ begin
+ return (V1 => J * J,
+ V2 => J);
+ end;
+
+ procedure Foo (J : Short_Integer) is
+ begin
+ Val := Fn (J);
+ end;
+ end Prot;
+
+end Prot3_Pkg;
diff --git a/gcc/testsuite/gnat.dg/prot3_pkg.ads b/gcc/testsuite/gnat.dg/prot3_pkg.ads
new file mode 100644
index 00000000000..b4cce90a543
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot3_pkg.ads
@@ -0,0 +1,16 @@
+package Prot3_Pkg is
+
+ type Rec is record
+ V1 : Short_Integer;
+ V2 : Short_Integer;
+ end record with Volatile_Full_Access;
+
+ protected type Prot is
+ procedure Foo (J : Short_Integer);
+ private
+ Val : Rec;
+ end Prot;
+
+ P : Prot;
+
+end Prot3_Pkg;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 5d8bd67fcab..5aa05b877a9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5941,7 +5941,8 @@ proc check_effective_target_vect_load_lanes { } {
verbose "check_effective_target_vect_load_lanes: using cached result" 2
} else {
set et_vect_load_lanes 0
- if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])
+ # We don't support load_lanes correctly on big-endian arm.
+ if { ([istarget arm-*-*] && [check_effective_target_arm_neon_ok])
|| [istarget aarch64*-*-*] } {
set et_vect_load_lanes 1
}
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-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-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-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index 01c25d43e0d..1a0ac316c53 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -1454,7 +1454,8 @@ find_clusters_1 (same_succ *same_succ)
/* TODO: handle blocks with phi-nodes. We'll have to find corresponding
phi-nodes in bb1 and bb2, with the same alternatives for the same
preds. */
- if (bb_has_non_vop_phi (bb1) || bb_has_eh_pred (bb1))
+ if (bb_has_non_vop_phi (bb1) || bb_has_eh_pred (bb1)
+ || bb_has_abnormal_pred (bb1))
continue;
nr_comparisons = 0;
@@ -1462,7 +1463,8 @@ find_clusters_1 (same_succ *same_succ)
{
bb2 = BASIC_BLOCK_FOR_FN (cfun, j);
- if (bb_has_non_vop_phi (bb2) || bb_has_eh_pred (bb2))
+ if (bb_has_non_vop_phi (bb2) || bb_has_eh_pred (bb2)
+ || bb_has_abnormal_pred (bb2))
continue;
if (BB_CLUSTER (bb1) != NULL && BB_CLUSTER (bb1) == BB_CLUSTER (bb2))
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index ccaa945bffb..f0e97060d7b 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -394,6 +394,16 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
}
}
+ unsigned int step_prec = TYPE_PRECISION (TREE_TYPE (DR_STEP (dra)));
+ if (loop->safelen < 2
+ && !expr_not_equal_to (DR_STEP (dra), wi::zero (step_prec)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "step could be zero.\n");
+ return true;
+ }
+
continue;
}
@@ -2515,7 +2525,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
/* Allow references with zero step for outer loops marked
with pragma omp simd only - it guarantees absence of
loop-carried dependencies between inner loop iterations. */
- if (!loop->force_vectorize)
+ if (!loop->force_vectorize || loop->safelen < 2)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
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.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/libatomic/ChangeLog b/libatomic/ChangeLog
index 77297253a79..629048c3e64 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,11 @@
+2018-03-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * config/s390/exch_n.c: New file.
+ * configure.tgt: Add the config directory for s390.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libatomic/config/s390/exch_n.c b/libatomic/config/s390/exch_n.c
new file mode 100644
index 00000000000..b2340b4aa6a
--- /dev/null
+++ b/libatomic/config/s390/exch_n.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2018 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ This file is part of the GNU Atomic Library (libatomic).
+
+ Libatomic is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Libatomic 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.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libatomic_i.h>
+
+
+/* The compiler builtin will use the hardware instruction cdsg if the
+ memory operand is properly aligned and will fall back to the
+ library call otherwise.
+
+ In case the compiler for one part is able to detect that the
+ location is aligned and fails to do so for another usage of the hw
+ instruction and the sw fall back would be mixed on the same memory
+ location. To avoid this the library fall back also has to use the
+ hardware instruction if possible. */
+
+#if !DONE && N == 16
+UTYPE
+SIZE(libat_exchange) (UTYPE *mptr, UTYPE newval, int smodel UNUSED)
+{
+ if (!((uintptr_t)mptr & 0xf))
+ {
+ /* Use the builtin only if the memory operand is 16 byte
+ aligned. */
+ return __atomic_exchange_n ((UTYPE *)__builtin_assume_aligned (mptr, 16),
+ newval, __ATOMIC_SEQ_CST);
+ }
+ else
+ {
+ UTYPE oldval;
+ UWORD magic;
+
+ pre_seq_barrier (smodel);
+ magic = protect_start (mptr);
+
+ oldval = *mptr;
+ *mptr = newval;
+
+ protect_end (mptr, magic);
+ post_seq_barrier (smodel);
+
+ return oldval;
+ }
+}
+#define DONE 1
+#endif /* N == 16 */
+
+#include "../../exch_n.c"
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index b8af3ab2546..30ae29248cd 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -114,6 +114,11 @@ case "${target}" in
config_path="${config_path} linux/arm posix"
;;
+ s390*-*-linux*)
+ # OS support for atomic primitives.
+ config_path="${config_path} s390 posix"
+ ;;
+
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \
| *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly* \
| *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 0ff9b69f61a..84167121915 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,19 @@
+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.
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/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/libgcc/ChangeLog b/libgcc/ChangeLog
index 9658cb68725..70e5bc3baa2 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,29 @@
+2018-04-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2018-03-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/85100
+ * config/i386/cpuinfo.c (XCR_XFEATURE_ENABLED_MASK): New.
+ (XSTATE_FP): Likewise.
+ (XSTATE_SSE): Likewise.
+ (XSTATE_YMM): Likewise.
+ (XSTATE_OPMASK): Likewise.
+ (XSTATE_ZMM): Likewise.
+ (XSTATE_HI_ZMM): Likewise.
+ (XCR_AVX_ENABLED_MASK): Likewise.
+ (XCR_AVX512F_ENABLED_MASK): Likewise.
+ (get_available_features): Enable AVX and AVX512 features only
+ if their states are supported by OSXSAVE.
+
+2018-03-11 John David Anglin <danglin@gcc.gnu.org>
+
+ Backport from mainline
+ 2018-03-06 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/fptr.c (_dl_read_access_allowed): New.
+ (__canonicalize_funcptr_for_compare): Use it.
+
2018-02-20 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index a1dc011525f..29a1f80b1ad 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -220,6 +220,40 @@ get_available_features (unsigned int ecx, unsigned int edx,
unsigned int features = 0;
+ /* Get XCR_XFEATURE_ENABLED_MASK register with xgetbv. */
+#define XCR_XFEATURE_ENABLED_MASK 0x0
+#define XSTATE_FP 0x1
+#define XSTATE_SSE 0x2
+#define XSTATE_YMM 0x4
+#define XSTATE_OPMASK 0x20
+#define XSTATE_ZMM 0x40
+#define XSTATE_HI_ZMM 0x80
+
+#define XCR_AVX_ENABLED_MASK \
+ (XSTATE_SSE | XSTATE_YMM)
+#define XCR_AVX512F_ENABLED_MASK \
+ (XSTATE_SSE | XSTATE_YMM | XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM)
+
+ /* Check if AVX and AVX512 are usable. */
+ int avx_usable = 0;
+ int avx512_usable = 0;
+ if ((ecx & bit_OSXSAVE))
+ {
+ /* Check if XMM, YMM, OPMASK, upper 256 bits of ZMM0-ZMM15 and
+ ZMM16-ZMM31 states are supported by OSXSAVE. */
+ unsigned int xcrlow;
+ unsigned int xcrhigh;
+ asm (".byte 0x0f, 0x01, 0xd0"
+ : "=a" (xcrlow), "=d" (xcrhigh)
+ : "c" (XCR_XFEATURE_ENABLED_MASK));
+ if ((xcrlow & XCR_AVX_ENABLED_MASK) == XCR_AVX_ENABLED_MASK)
+ {
+ avx_usable = 1;
+ avx512_usable = ((xcrlow & XCR_AVX512F_ENABLED_MASK)
+ == XCR_AVX512F_ENABLED_MASK);
+ }
+ }
+
if (edx & bit_CMOV)
features |= (1 << FEATURE_CMOV);
if (edx & bit_MMX)
@@ -242,10 +276,13 @@ get_available_features (unsigned int ecx, unsigned int edx,
features |= (1 << FEATURE_SSE4_1);
if (ecx & bit_SSE4_2)
features |= (1 << FEATURE_SSE4_2);
- if (ecx & bit_AVX)
- features |= (1 << FEATURE_AVX);
- if (ecx & bit_FMA)
- features |= (1 << FEATURE_FMA);
+ if (avx_usable)
+ {
+ if (ecx & bit_AVX)
+ features |= (1 << FEATURE_AVX);
+ if (ecx & bit_FMA)
+ features |= (1 << FEATURE_FMA);
+ }
/* Get Advanced Features at level 7 (eax = 7, ecx = 0). */
if (max_cpuid_level >= 7)
@@ -253,34 +290,40 @@ get_available_features (unsigned int ecx, unsigned int edx,
__cpuid_count (7, 0, eax, ebx, ecx, edx);
if (ebx & bit_BMI)
features |= (1 << FEATURE_BMI);
- if (ebx & bit_AVX2)
- features |= (1 << FEATURE_AVX2);
+ if (avx_usable)
+ {
+ if (ebx & bit_AVX2)
+ features |= (1 << FEATURE_AVX2);
+ }
if (ebx & bit_BMI2)
features |= (1 << FEATURE_BMI2);
- if (ebx & bit_AVX512F)
- features |= (1 << FEATURE_AVX512F);
- if (ebx & bit_AVX512VL)
- features |= (1 << FEATURE_AVX512VL);
- if (ebx & bit_AVX512BW)
- features |= (1 << FEATURE_AVX512BW);
- if (ebx & bit_AVX512DQ)
- features |= (1 << FEATURE_AVX512DQ);
- if (ebx & bit_AVX512CD)
- features |= (1 << FEATURE_AVX512CD);
- if (ebx & bit_AVX512PF)
- features |= (1 << FEATURE_AVX512PF);
- if (ebx & bit_AVX512ER)
- features |= (1 << FEATURE_AVX512ER);
- if (ebx & bit_AVX512IFMA)
- features |= (1 << FEATURE_AVX512IFMA);
- if (ecx & bit_AVX512VBMI)
- features |= (1 << FEATURE_AVX512VBMI);
- if (ecx & bit_AVX512VPOPCNTDQ)
- features |= (1 << FEATURE_AVX512VPOPCNTDQ);
- if (edx & bit_AVX5124VNNIW)
- features |= (1 << FEATURE_AVX5124VNNIW);
- if (edx & bit_AVX5124FMAPS)
- features |= (1 << FEATURE_AVX5124FMAPS);
+ if (avx512_usable)
+ {
+ if (ebx & bit_AVX512F)
+ features |= (1 << FEATURE_AVX512F);
+ if (ebx & bit_AVX512VL)
+ features |= (1 << FEATURE_AVX512VL);
+ if (ebx & bit_AVX512BW)
+ features |= (1 << FEATURE_AVX512BW);
+ if (ebx & bit_AVX512DQ)
+ features |= (1 << FEATURE_AVX512DQ);
+ if (ebx & bit_AVX512CD)
+ features |= (1 << FEATURE_AVX512CD);
+ if (ebx & bit_AVX512PF)
+ features |= (1 << FEATURE_AVX512PF);
+ if (ebx & bit_AVX512ER)
+ features |= (1 << FEATURE_AVX512ER);
+ if (ebx & bit_AVX512IFMA)
+ features |= (1 << FEATURE_AVX512IFMA);
+ if (ecx & bit_AVX512VBMI)
+ features |= (1 << FEATURE_AVX512VBMI);
+ if (ecx & bit_AVX512VPOPCNTDQ)
+ features |= (1 << FEATURE_AVX512VPOPCNTDQ);
+ if (edx & bit_AVX5124VNNIW)
+ features |= (1 << FEATURE_AVX5124VNNIW);
+ if (edx & bit_AVX5124FMAPS)
+ features |= (1 << FEATURE_AVX5124FMAPS);
+ }
}
/* Check cpuid level of extended features. */
@@ -292,10 +335,13 @@ get_available_features (unsigned int ecx, unsigned int edx,
if (ecx & bit_SSE4a)
features |= (1 << FEATURE_SSE4_A);
- if (ecx & bit_FMA4)
- features |= (1 << FEATURE_FMA4);
- if (ecx & bit_XOP)
- features |= (1 << FEATURE_XOP);
+ if (avx_usable)
+ {
+ if (ecx & bit_FMA4)
+ features |= (1 << FEATURE_FMA4);
+ if (ecx & bit_XOP)
+ features |= (1 << FEATURE_XOP);
+ }
}
__cpu_model.__cpu_features[0] = features;
diff --git a/libgcc/config/pa/fptr.c b/libgcc/config/pa/fptr.c
index 645fa5d833a..e145026df3e 100644
--- a/libgcc/config/pa/fptr.c
+++ b/libgcc/config/pa/fptr.c
@@ -52,6 +52,16 @@ typedef int (*fptr_t) (void);
typedef int (*fixup_t) (struct link_map *, unsigned int);
extern unsigned int _GLOBAL_OFFSET_TABLE_;
+static inline int
+_dl_read_access_allowed (unsigned int *addr)
+{
+ int result;
+
+ asm ("proberi (%1),3,%0" : "=r" (result) : "r" (addr) : );
+
+ return result;
+}
+
/* __canonicalize_funcptr_for_compare must be hidden so that it is not
placed in the dynamic symbol table. Like millicode functions, it
must be linked into all binaries in order access the got table of
@@ -82,6 +92,16 @@ __canonicalize_funcptr_for_compare (fptr_t fptr)
The second word in the plabel contains the relocation offset for the
function. */
plabel = (unsigned int *) ((unsigned int) fptr & ~3);
+ if (!_dl_read_access_allowed (plabel))
+ return (unsigned int) fptr;
+
+ /* Load first word of candidate descriptor. It should be a pointer
+ with word alignment and point to memory that can be read. */
+ got = (unsigned int *) plabel[0];
+ if (((unsigned int) got & 3) != 0
+ || !_dl_read_access_allowed (got))
+ return (unsigned int) fptr;
+
got = (unsigned int *) (plabel[0] + GOT_FROM_PLT_STUB);
/* Return the address of the function if the plabel has been resolved. */
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index a74dea71aa6..c3a640a0689 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,19 @@
+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
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/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a3970c37767..5f76ed34181 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,98 @@
+2018-04-18 Jonathan Wakely <jwakely@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR libstdc++/85442
+ * src/c++11/Makefile.am: Don't generate debuginfo again for
+ cxx11-ios_failure-lt.s and cxx11-ios_failure.s files.
+ * src/c++11/Makefile.in: Regenerate.
+
+2018-04-13 Jonathan Wakely <jwakely@redhat.com>
+
+ * src/c++11/Makefile.am: Fix sed command.
+ * src/c++11/Makefile.in: Regenerate.
+
+ * src/c++11/Makefile.am: Rewrite sed rule to be less fragile and to
+ handle mangled names starting with double underscores on darwin.
+ * src/c++11/Makefile.in: Regenerate.
+
+2018-04-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * src/c++11/Makefile.am: Fix comment.
+ * src/c++11/Makefile.in: Regenerate.
+ * src/c++11/cxx11-ios_failure.cc: Fix comment.
+ * src/c++98/ios_failure.cc: Likewise.
+
+ Backport from mainline
+ 2018-04-10 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/85222
+ * src/c++11/Makefile.am [ENABLE_DUAL_ABI]: Add special rules for
+ cxx11-ios_failure.cc to rewrite type info for __ios_failure.
+ * src/c++11/Makefile.in: Regenerate.
+ * src/c++11/cxx11-ios_failure.cc (__ios_failure, __iosfail_type_info):
+ New types.
+ [_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
+ * src/c++11/ios.cc (__throw_ios_failure): Remove definition.
+ (_GLIBCXX_USE_CXX11_ABI): Don't define here.
+ * src/c++98/ios_failure.cc (__construct_ios_failure)
+ (__destroy_ios_failure, is_ios_failure_handler): New functions.
+ [!_GLIBCXX_USE_DUAL_ABI] (__throw_ios_failure): Define here.
+ * testsuite/27_io/ios_base/failure/dual_abi.cc: New.
+ * testsuite/27_io/basic_ios/copyfmt/char/1.cc: Revert changes to
+ handler types, to always catch std::ios_base::failure.
+ * testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/char/
+ exceptions_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
+ exceptions_failbit.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
+ * testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/char/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ exceptions_null.cc: Likewise.
+ * testsuite/27_io/ios_base/storage/2.cc: Likewise.
+
+2018-03-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR libstdc++/77691
+ * testsuite/experimental/memory_resource/resource_adaptor.cc:
+ xfail execution on 32-bit Solaris/x86.
+
+2018-03-13 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-03-09 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84769
+ * include/std/variant (get<_Tp, _Types...>, get_if<_Tp, _Types...>):
+ Qualify calls to get<_Np, Types...> and get_if<_Np, _Types...>.
+
+2018-03-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/84773
+ PR libstdc++/83662
+ * crossconfig.m4: Check for aligned_alloc etc. on freebsd and mingw32.
+ * configure: Regenerate.
+ * include/c_global/cstdlib [_GLIBCXX_HAVE_ALIGNED_ALLOC]
+ (aligned_alloc): Add using-declaration.
+ * testsuite/18_support/aligned_alloc/aligned_alloc.cc: New test.
+
+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
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fdbf7bea876..9e56113b872 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -53329,6 +53329,19 @@ _ACEOF
fi
done
+ for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
;;
*-fuchsia*)
@@ -66079,6 +66092,19 @@ done
CXXFLAGS="$ac_save_CXXFLAGS"
+ for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
;;
*-netbsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index 77c9828fe91..292f9963c2a 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -133,6 +133,7 @@ case "${host}" in
AC_DEFINE(HAVE_ISNANL)
fi
AC_CHECK_FUNCS(__cxa_thread_atexit)
+ AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
;;
*-fuchsia*)
@@ -197,6 +198,7 @@ case "${host}" in
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
+ AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
;;
*-netbsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
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/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 006ac689763..52d5255592f 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -78,6 +78,9 @@ namespace std
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
#undef abort
+#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# undef aligned_alloc
+#endif
#undef atexit
#if __cplusplus >= 201103L
# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
@@ -125,6 +128,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using ::ldiv_t;
using ::abort;
+#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+ using ::aligned_alloc;
+#endif
using ::atexit;
#if __cplusplus >= 201103L
# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 1f1a8492323..0180eefd169 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -741,7 +741,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
}
template<typename _Tp, typename... _Types>
@@ -750,7 +750,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
std::move(__v));
}
@@ -760,7 +760,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(__v);
}
template<typename _Tp, typename... _Types>
@@ -769,7 +769,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ return std::get<__detail::__variant::__index_of_v<_Tp, _Types...>>(
std::move(__v));
}
@@ -808,7 +808,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(__ptr);
+ return std::get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ __ptr);
}
template<typename _Tp, typename... _Types>
@@ -819,7 +820,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__detail::__variant::__exactly_once<_Tp, _Types...>,
"T should occur for exactly once in alternatives");
static_assert(!is_void_v<_Tp>, "_Tp should not be void");
- return get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(__ptr);
+ return std::get_if<__detail::__variant::__index_of_v<_Tp, _Types...>>(
+ __ptr);
}
struct monostate { };
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am
index cf73d4d5c4c..776a4ba36e3 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -126,6 +126,26 @@ hashtable_c++0x.lo: hashtable_c++0x.cc
hashtable_c++0x.o: hashtable_c++0x.cc
$(CXXCOMPILE) -fimplicit-templates -c $<
+if ENABLE_DUAL_ABI
+# Rewrite the type info for __ios_failure.
+rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/'
+
+cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
+ $(LTCXXCOMPILE) -S $< -o tmp-cxx11-ios_failure-lt.s
+ -test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s
+ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
+ -rm -f tmp-$@
+cxx11-ios_failure.s: cxx11-ios_failure.cc
+ $(CXXCOMPILE) -S $< -o tmp-$@
+ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
+ -rm -f tmp-$@
+
+cxx11-ios_failure.lo: cxx11-ios_failure-lt.s
+ $(LTCXXCOMPILE) -g0 -c $< -o $@
+cxx11-ios_failure.o: cxx11-ios_failure.s
+ $(CXXCOMPILE) -g0 -c $<
+endif
+
# AM_CXXFLAGS needs to be in each subdirectory so that it can be
# modified in a per-library or per-sub-library way. Need to manually
# set this option because CONFIG_CXXFLAGS has to be after
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index 295d915b436..6d78fd81f50 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -433,6 +433,9 @@ sources = \
libc__11convenience_la_SOURCES = $(sources) $(inst_sources)
+# Rewrite the type info for __ios_failure.
+@ENABLE_DUAL_ABI_TRUE@rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/'
+
# AM_CXXFLAGS needs to be in each subdirectory so that it can be
# modified in a per-library or per-sub-library way. Need to manually
# set this option because CONFIG_CXXFLAGS has to be after
@@ -748,6 +751,21 @@ hashtable_c++0x.lo: hashtable_c++0x.cc
hashtable_c++0x.o: hashtable_c++0x.cc
$(CXXCOMPILE) -fimplicit-templates -c $<
+@ENABLE_DUAL_ABI_TRUE@cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
+@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) -S $< -o tmp-cxx11-ios_failure-lt.s
+@ENABLE_DUAL_ABI_TRUE@ -test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s
+@ENABLE_DUAL_ABI_TRUE@ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
+@ENABLE_DUAL_ABI_TRUE@ -rm -f tmp-$@
+@ENABLE_DUAL_ABI_TRUE@cxx11-ios_failure.s: cxx11-ios_failure.cc
+@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) -S $< -o tmp-$@
+@ENABLE_DUAL_ABI_TRUE@ $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
+@ENABLE_DUAL_ABI_TRUE@ -rm -f tmp-$@
+
+@ENABLE_DUAL_ABI_TRUE@cxx11-ios_failure.lo: cxx11-ios_failure-lt.s
+@ENABLE_DUAL_ABI_TRUE@ $(LTCXXCOMPILE) -g0 -c $< -o $@
+@ENABLE_DUAL_ABI_TRUE@cxx11-ios_failure.o: cxx11-ios_failure.s
+@ENABLE_DUAL_ABI_TRUE@ $(CXXCOMPILE) -g0 -c $<
+
# 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/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
index 2f60408782e..8833ba8c91a 100644
--- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
+++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
@@ -28,6 +28,15 @@
#define _GLIBCXX_USE_CXX11_ABI 1
#include <ios>
+#include <bits/functexcept.h>
+#include <cxxabi.h>
+
+#ifdef _GLIBCXX_USE_NLS
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+#else
+# define _(msgid) (msgid)
+#endif
#if ! _GLIBCXX_USE_DUAL_ABI
# error This file should not be compiled for this configuration.
@@ -91,5 +100,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ios_base::failure::what() const throw()
{ return runtime_error::what(); }
+#if __cpp_rtti
+ // These functions are defined in src/c++98/ios_failure.cc
+ extern void __construct_ios_failure(void*, const char*);
+ extern void __destroy_ios_failure(void*);
+ extern bool __is_ios_failure_handler(const __cxxabiv1::__class_type_info*);
+
+ // The type thrown to report errors during stream buffer operations.
+ // In addition to the ios::failure[abi:cxx11] base class it also has a
+ // member of the gcc4-compatible ios::failure type (in an opaque buffer).
+ struct __ios_failure : std::ios::failure
+ {
+ __ios_failure(const char* s) : failure(s)
+ { __construct_ios_failure(buf, runtime_error::what()); }
+
+ ~__ios_failure()
+ { __destroy_ios_failure(buf); }
+
+ // Use std::runtime_error as a proxy for the gcc4-compatible ios::failure
+ // (which can't be declared here because _GLIBCXX_USE_CXX11_ABI == 1).
+ // There are assertions in src/c++98/ios_failure.cc to ensure the size
+ // and alignment assumptions are valid.
+ alignas(runtime_error) unsigned char buf[sizeof(runtime_error)];
+ };
+
+ // Custom type info for __ios_failure.
+ class __iosfail_type_info : __cxxabiv1::__si_class_type_info
+ {
+ ~__iosfail_type_info();
+
+ bool
+ __do_upcast (const __class_type_info *dst_type,
+ void **obj_ptr) const override;
+ };
+
+ __iosfail_type_info::~__iosfail_type_info() = default;
+
+ // This function gets called to see if an exception of type
+ // __ios_failure can be upcast to the type in a catch handler.
+ bool
+ __iosfail_type_info::__do_upcast(const __class_type_info *dst_type,
+ void **obj_ptr) const
+ {
+ // If the handler is for the gcc4-compatible ios::failure type then
+ // catch the object stored in __ios_failure::buf instead of
+ // the __ios_failure exception object itself.
+ if (__is_ios_failure_handler(dst_type))
+ {
+ *obj_ptr = static_cast<__ios_failure*>(*obj_ptr)->buf;
+ return true;
+ }
+ // Otherwise proceed as normal to see if the handler matches.
+ return __class_type_info::__do_upcast(dst_type, obj_ptr);
+ }
+#else // ! __cpp_rtti
+ using __ios_failure = ios::failure;
+#endif
+
+ void
+ __throw_ios_failure(const char* __s __attribute__((unused)))
+ { _GLIBCXX_THROW_OR_ABORT(__ios_failure(_(__s))); }
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
index 9061989f806..ef0da960007 100644
--- a/libstdc++-v3/src/c++11/ios.cc
+++ b/libstdc++-v3/src/c++11/ios.cc
@@ -26,29 +26,13 @@
// ISO C++ 14882: 27.4 Iostreams base classes
//
-// Determines the version of ios_base::failure thrown by __throw_ios_failure.
-// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically.
-#define _GLIBCXX_USE_CXX11_ABI 1
-
#include <ios>
#include <limits>
-#include <bits/functexcept.h>
-
-#ifdef _GLIBCXX_USE_NLS
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) (msgid)
-#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- void
- __throw_ios_failure(const char* __s __attribute__((unused)))
- { _GLIBCXX_THROW_OR_ABORT(ios_base::failure(_(__s))); }
-
// Definitions for static const members of ios_base.
const ios_base::fmtflags ios_base::boolalpha;
const ios_base::fmtflags ios_base::dec;
diff --git a/libstdc++-v3/src/c++98/ios_failure.cc b/libstdc++-v3/src/c++98/ios_failure.cc
index 3ba25f81279..e7f35e21e2c 100644
--- a/libstdc++-v3/src/c++98/ios_failure.cc
+++ b/libstdc++-v3/src/c++98/ios_failure.cc
@@ -29,6 +29,18 @@
#define _GLIBCXX_USE_CXX11_ABI 0
#include <ios>
+#if _GLIBCXX_USE_DUAL_ABI && __cpp_rtti
+#include <cxxabi.h>
+#include <typeinfo>
+#endif
+
+#ifdef _GLIBCXX_USE_NLS
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+#else
+# define _(msgid) (msgid)
+#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -43,5 +55,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ios_base::failure::what() const throw()
{ return _M_msg.c_str(); }
+#if _GLIBCXX_USE_DUAL_ABI
+ // When the dual ABI is enabled __throw_ios_failure() is defined in
+ // src/c++11/cxx11-ios_failure.cc
+#if __cpp_rtti
+ // If RTTI is enabled the exception type thrown will use these functions to
+ // construct/destroy a gcc4-compatible ios::failure object in a buffer,
+ // and to catch that object via a handler of the gcc4-compatible type.
+ void
+ __construct_ios_failure(void* buf, const char* msg)
+ { ::new(buf) ios_base::failure(msg); }
+
+ void
+ __destroy_ios_failure(void* buf)
+ { static_cast<ios_base::failure*>(buf)->~failure(); }
+
+ bool
+ __is_ios_failure_handler(const __cxxabiv1::__class_type_info* type)
+ { return *type == typeid(ios::failure); }
+
+ namespace {
+ // C++98-style static assertions to ensure ios::failure fits in a buffer
+ // with the same size and alignment as runtime_error:
+ typedef char S[1 / (sizeof(ios::failure) <= sizeof(runtime_error))];
+ typedef char A[1 / (__alignof(ios::failure) <= __alignof(runtime_error))];
+ }
+#endif // __cpp_rtti
+
+#else // ! _GLIBCXX_USE_DUAL_ABI
+
+ void
+ __throw_ios_failure(const char* __s __attribute__((unused)))
+ { _GLIBCXX_THROW_OR_ABORT(ios::failure(_(__s))); }
+
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc b/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc
new file mode 100644
index 00000000000..1700df8fdda
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/aligned_alloc/aligned_alloc.cc
@@ -0,0 +1,42 @@
+// 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 <cstdlib>
+#include <cstdint>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_HAVE_ALIGNED_ALLOC
+ void* p = std::aligned_alloc(256, 1);
+ if (p)
+ {
+ VERIFY( (reinterpret_cast<std::uintptr_t>(p) % 256) == 0 );
+ std::free(p);
+ }
+#endif
+}
+
+int
+main()
+{
+ test01();
+}
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/27_io/basic_ios/copyfmt/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
index 840017e4e85..aa05679ddbe 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/1.cc
@@ -46,13 +46,6 @@ void test02()
}
{
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
std::ios ios_01(0);
std::ios ios_02(0);
ios_01.clear(std::ios_base::eofbit);
@@ -62,7 +55,7 @@ void test02()
ios_01.copyfmt(ios_02);
VERIFY( false );
}
- catch(exception_type&) {
+ catch(std::ios_base::failure&) {
VERIFY( true );
}
catch(...) {
diff --git a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
index 152e783640a..89342d9ffe3 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ios/exceptions/char/1.cc
@@ -50,20 +50,13 @@ void test01()
}
{
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
std::ios ios_01(0);
ios_01.clear(std::ios_base::eofbit);
try {
ios_01.exceptions(std::ios_base::eofbit);
VERIFY( false );
}
- catch(exception_type&) {
+ catch(std::ios_base::failure&) {
iostate02 = ios_01.exceptions();
VERIFY( static_cast<bool>(iostate02 & std::ios_base::eofbit) );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
index 5fa3f1f34a0..b4dde2047f6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/char/exceptions_failbit.cc
@@ -27,20 +27,13 @@ void test_failbit()
istringstream stream("jaylib - champion sound");
stream.exceptions(ios_base::failbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
T i;
stream >> i;
VERIFY( false );
}
- catch (const exception_type&)
+ catch (const std::ios_base::failure&)
{
// stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
index 4ff48f73712..41d2f1fc24a 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/exceptions_failbit.cc
@@ -27,20 +27,13 @@ void test_failbit()
wistringstream stream(L"jaylib - champion sound");
stream.exceptions(ios_base::failbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
T i;
stream >> i;
VERIFY( false );
}
- catch (const exception_type&)
+ catch (const std::ios_base::failure&)
{
// stream should set failbit and throw ios_base::failure.
VERIFY( stream.fail() );
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
index 088aaa42808..1d146ddd5dd 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/exceptions_null.cc
@@ -35,19 +35,12 @@ void test4()
istringstream stream;
stream.exceptions(ios_base::failbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
stream >> static_cast<streambuf*>(0);
VERIFY(false);
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
index fd6322b4cdb..d51bcd5e469 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/exceptions_null.cc
@@ -35,19 +35,12 @@ void test4()
wistringstream stream;
stream.exceptions(ios_base::failbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
stream >> static_cast<wstreambuf*>(0);
VERIFY( false );
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
index 0900a70d148..708f343dd37 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/char/12297.cc
@@ -26,19 +26,12 @@ int main()
istringstream stream;
stream.exceptions(ios_base::eofbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
istream::sentry sentry(stream, false);
VERIFY( false );
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
index e72fe1a03a0..6e572cc653d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc
@@ -26,19 +26,12 @@ int main()
wistringstream stream;
stream.exceptions(ios_base::eofbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
wistream::sentry sentry(stream, false);
VERIFY( false );
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
VERIFY( stream.rdstate() == (ios_base::eofbit | ios_base::failbit) );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
index 9a7bd06f21a..481f04e588c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/exceptions_null.cc
@@ -37,19 +37,12 @@ void test3()
ostringstream stream;
stream.exceptions(ios_base::badbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
stream << static_cast<streambuf*>(0);
VERIFY( false );
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
index fcfb37d2dac..177cecb2edf 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/exceptions_null.cc
@@ -37,19 +37,12 @@ void test3()
wostringstream stream;
stream.exceptions(ios_base::badbit);
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
stream << static_cast<wstreambuf*>(0);
VERIFY( false );
}
- catch (exception_type&)
+ catch (std::ios_base::failure&)
{
}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc
new file mode 100644
index 00000000000..9bd72a1baf9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/dual_abi.cc
@@ -0,0 +1,99 @@
+// 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 "-D_GLIBCXX_USE_CXX11_ABI=0" }
+// { dg-do run { target c++11 } }
+
+#include <fstream>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using std::ios;
+ bool caught_ios_failure = false;
+ bool rethrown = false;
+ bool caught_system_error = false;
+ try {
+ std::ifstream f;
+ f.exceptions(ios::failbit | ios::badbit | ios::eofbit);
+ try {
+ f.get();
+ }
+ catch (const ios::failure&) // catch as old ABI type
+ {
+ caught_ios_failure = true;
+#if _GLIBCXX_USE_DUAL_ABI || _GLIBCXX_USE_CXX11_ABI == 1
+ rethrown = true;
+ throw; // re-throw, to catch as new ABI type
+#endif
+ }
+ }
+ catch (const std::system_error& e)
+ {
+ caught_system_error = true;
+ }
+
+ VERIFY( caught_ios_failure );
+ if (rethrown)
+ VERIFY( caught_system_error );
+}
+
+void
+test02()
+{
+ using std::ios;
+ const std::exception* p = nullptr;
+ bool caught_ios_failure = false;
+ bool caught_exception = false;
+ try {
+ std::ifstream f;
+ f.exceptions(ios::failbit | ios::badbit | ios::eofbit);
+ try {
+ f.get();
+ }
+ catch (const std::exception& e1)
+ {
+ caught_exception = true;
+ p = &e1;
+ throw;
+ }
+ }
+ catch (const ios::failure& e2)
+ {
+ caught_ios_failure = true;
+#if _GLIBCXX_USE_DUAL_ABI
+ // If the Dual ABI is active the library throws the new type,
+ // so e1 was an object of that new type and so &e1 != &e2.
+ VERIFY( p != &e2 );
+#else
+ // Otherwise there's only one type of ios::failure, so &e1 == &e2.
+ VERIFY( p == &e2 );
+#endif
+ }
+
+ VERIFY( caught_exception );
+ VERIFY( caught_ios_failure );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
index 8fa306f61a2..2ec234a1bfb 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/2.cc
@@ -50,18 +50,11 @@ void test02()
ios.pword(1) = v;
VERIFY( ios.pword(1) == v );
- // The library throws the new definition of std::ios::failure
-#if _GLIBCXX_USE_CXX11_ABI
- typedef std::ios_base::failure exception_type;
-#else
- typedef std::exception exception_type;
-#endif
-
try
{
v = ios.pword(max);
}
- catch(exception_type&)
+ catch(std::ios_base::failure&)
{
// Ok.
VERIFY( ios.bad() );
@@ -80,7 +73,7 @@ void test02()
{
v = ios.pword(std::numeric_limits<int>::max());
}
- catch(exception_type&)
+ catch(std::ios_base::failure&)
{
// Ok.
VERIFY( ios.bad() );
@@ -99,7 +92,7 @@ void test02()
{
l = ios.iword(max);
}
- catch(exception_type&)
+ catch(std::ios_base::failure&)
{
// Ok.
VERIFY( ios.bad() );
@@ -118,7 +111,7 @@ void test02()
{
l = ios.iword(std::numeric_limits<int>::max());
}
- catch(exception_type&)
+ catch(std::ios_base::failure&)
{
// Ok.
VERIFY( ios.bad() );
diff --git a/libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc b/libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc
index 8e639f22380..b85c5c8be45 100644
--- a/libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc
+++ b/libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++14 } }
+// { dg-xfail-run-if "PR libstdc++/77691" { { i?86-*-solaris2.* x86_64-*-solaris2.* } && ilp32 } }
// Copyright (C) 2016-2017 Free Software Foundation, Inc.
//