aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-06-27 12:33:24 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2018-10-02 11:07:15 +0000
commit18700cbbfa7b2c0a8a21947b01fae1748bbdcae2 (patch)
treebbbecedfb4235fe5a474728df7442a1c3fd7e1e1
parent0378e2ec3fc15a72e543b336d1ea4d3677c569ef (diff)
Merge branches/gcc-7-branch rev 262169.
Change-Id: Ia4e0d5dab9b29367e5f61b6ebd65fa0c318dda86
-rw-r--r--ChangeLog8
-rw-r--r--config/ChangeLog8
-rw-r--r--config/acx.m42
-rwxr-xr-xconfigure2
-rw-r--r--fixincludes/ChangeLog8
-rwxr-xr-xfixincludes/configure2
-rw-r--r--gcc/ChangeLog422
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog57
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h25
-rw-r--r--gcc/ada/gcc-interface/decl.c150
-rw-r--r--gcc/ada/gcc-interface/gigi.h15
-rw-r--r--gcc/ada/gcc-interface/trans.c16
-rw-r--r--gcc/ada/gcc-interface/utils.c15
-rw-r--r--gcc/alias.c3
-rw-r--r--gcc/builtins.c2
-rw-r--r--gcc/c-family/ChangeLog27
-rw-r--r--gcc/c-family/c-common.c30
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c-family/c-omp.c8
-rw-r--r--gcc/c/ChangeLog32
-rw-r--r--gcc/c/c-fold.c2
-rw-r--r--gcc/c/c-typeck.c39
-rw-r--r--gcc/calls.c133
-rw-r--r--gcc/cfgexpand.c8
-rw-r--r--gcc/combine.c18
-rw-r--r--gcc/config.gcc20
-rw-r--r--gcc/config/arm/arm_cmse.h7
-rw-r--r--gcc/config/i386/i386.md68
-rw-r--r--gcc/config/i386/sse.md22
-rw-r--r--gcc/config/riscv/t-rtems25
-rw-r--r--gcc/config/rs6000/rs6000-c.c2
-rw-r--r--gcc/config/rs6000/rs6000.c8
-rw-r--r--gcc/config/rs6000/rs6000.h6
-rw-r--r--gcc/config/rs6000/rs6000.md16
-rw-r--r--gcc/config/rtems.h4
-rw-r--r--gcc/config/s390/s390-builtin-types.def1
-rw-r--r--gcc/config/s390/s390-builtins.def2
-rw-r--r--gcc/config/s390/s390.h2
-rw-r--r--gcc/config/xtensa/xtensa.md46
-rwxr-xr-xgcc/configure8
-rw-r--r--gcc/configure.ac4
-rw-r--r--gcc/cp/ChangeLog150
-rw-r--r--gcc/cp/call.c16
-rw-r--r--gcc/cp/class.c17
-rw-r--r--gcc/cp/constexpr.c10
-rw-r--r--gcc/cp/cp-gimplify.c51
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl.c37
-rw-r--r--gcc/cp/init.c1
-rw-r--r--gcc/cp/name-lookup.c3
-rw-r--r--gcc/cp/parser.c15
-rw-r--r--gcc/cp/pt.c16
-rw-r--r--gcc/cp/semantics.c43
-rw-r--r--gcc/cp/tree.c16
-rw-r--r--gcc/cp/typeck.c56
-rw-r--r--gcc/cp/typeck2.c2
-rw-r--r--gcc/dce.c27
-rwxr-xr-xgcc/doc/install.texi2html5
-rw-r--r--gcc/doc/invoke.texi3
-rw-r--r--gcc/dse.c3
-rw-r--r--gcc/dwarf2asm.c18
-rw-r--r--gcc/dwarf2out.c2
-rw-r--r--gcc/emit-rtl.c2
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/fold-const.c16
-rw-r--r--gcc/fortran/ChangeLog122
-rw-r--r--gcc/fortran/array.c11
-rw-r--r--gcc/fortran/data.c31
-rw-r--r--gcc/fortran/decl.c30
-rw-r--r--gcc/fortran/expr.c37
-rw-r--r--gcc/fortran/frontend-passes.c5
-rw-r--r--gcc/fortran/openmp.c8
-rw-r--r--gcc/fortran/resolve.c30
-rw-r--r--gcc/fortran/simplify.c41
-rw-r--r--gcc/fortran/symbol.c14
-rw-r--r--gcc/fortran/trans-array.c29
-rw-r--r--gcc/fortran/trans-expr.c4
-rw-r--r--gcc/function.c5
-rw-r--r--gcc/gimple-ssa-backprop.c21
-rw-r--r--gcc/gimple-ssa-strength-reduction.c81
-rw-r--r--gcc/gimplify.c11
-rw-r--r--gcc/lower-subreg.c11
-rw-r--r--gcc/match.pd36
-rw-r--r--gcc/optabs.c3
-rw-r--r--gcc/postreload.c12
-rw-r--r--gcc/shrink-wrap.c9
-rw-r--r--gcc/testsuite/ChangeLog469
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr85696.c20
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr86025.c20
-rw-r--r--gcc/testsuite/c-c++-common/pr43690.c4
-rw-r--r--gcc/testsuite/c-c++-common/pr84999.c12
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr85022.c9
-rw-r--r--gcc/testsuite/g++.dg/asan/pr78651.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-dependent1.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr85147.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for35.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for9.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr84662.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr85076.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp41.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp42.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/desig7.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/desig8.C18
-rw-r--r--gcc/testsuite/g++.dg/ext/asm14.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/asm15.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/asm16.C10
-rw-r--r--gcc/testsuite/g++.dg/ext/atomic-4.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin13.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/offsetof2.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/offsetof3.C5
-rw-r--r--gcc/testsuite/g++.dg/ext/vla18.C19
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr84791.C15
-rw-r--r--gcc/testsuite/g++.dg/inherit/covariant22.C19
-rw-r--r--gcc/testsuite/g++.dg/init/struct2.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/pr79085.C24
-rw-r--r--gcc/testsuite/g++.dg/parse/array-size2.C2
-rw-r--r--gcc/testsuite/g++.dg/torture/pr84961-1.C24
-rw-r--r--gcc/testsuite/g++.dg/torture/pr84961-2.C24
-rw-r--r--gcc/testsuite/g++.dg/warn/Wformat-2.C17
-rw-r--r--gcc/testsuite/g++.dg/warn/Wnonnull4.C21
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-function4.C21
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-33.C37
-rw-r--r--gcc/testsuite/g++.dg/warn/deprecated-13.C44
-rw-r--r--gcc/testsuite/g++.dg/warn/deprecated-6.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/deprecated.C4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr84860.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr85945.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr85095.c52
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr85529-1.c28
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr85529-2.c25
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr86231.c30
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-10.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-12.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-13.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-14.c30
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-15.c30
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-16.c32
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-3.c19
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c19
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c25
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c25
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c25
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-8.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than-9.c27
-rw-r--r--gcc/testsuite/gcc.dg/Walloc-size-larger-than.c13
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr85252.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr84739.c26
-rw-r--r--gcc/testsuite/gcc.dg/pr84772.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr84834.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr84841.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr84853.c19
-rw-r--r--gcc/testsuite/gcc.dg/pr84875.c28
-rw-r--r--gcc/testsuite/gcc.dg/pr84899.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr84941.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr84953.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr85167.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr85257.c20
-rw-r--r--gcc/testsuite/gcc.dg/pr85300.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr85430.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr85529.c27
-rw-r--r--gcc/testsuite/gcc.dg/pr86314.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57656.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85567.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85588.c4
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85989.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp119.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr85597.c26
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-pr84786-3.c50
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2sd64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2ss64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84827.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85034.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85095-1.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85095-2.c54
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84700.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr85755.c22
-rw-r--r--gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c10
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_alloc_opt_14.f908
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_stat_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/associate_30.f905
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/data_bounds_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/data_char_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr85313.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/init_flag_17.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/pr38351.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/pr44491.f905
-rw-r--r--gcc/testsuite/gfortran.dg/pr63514.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/pr67803.f901
-rw-r--r--gcc/testsuite/gfortran.dg/pr67805.f901
-rw-r--r--gcc/testsuite/gfortran.dg/pr78278.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/pr85138_1.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/pr85138_2.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/pr85543.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr85779_1.f906
-rw-r--r--gcc/testsuite/gfortran.dg/pr85779_2.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr85779_3.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr85780.f905
-rw-r--r--gcc/testsuite/gfortran.dg/pr85895.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/pr85996.f9069
-rw-r--r--gcc/testsuite/gfortran.dg/pr86045.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr86059.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr86110.f907
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_30.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_operator_4.f032
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_30.f0338
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f908
-rw-r--r--gcc/testsuite/gnat.dg/aggr24.adb13
-rw-r--r--gcc/testsuite/gnat.dg/aggr24_pkg.adb15
-rw-r--r--gcc/testsuite/gnat.dg/aggr24_pkg.ads16
-rw-r--r--gcc/testsuite/gnat.dg/discr53.adb19
-rw-r--r--gcc/testsuite/gnat.dg/discr53.ads16
-rw-r--r--gcc/testsuite/gnat.dg/discr53_pkg.ads5
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt3.ads13
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt3_pkg.ads7
-rw-r--r--gcc/tree-inline.c1
-rw-r--r--gcc/tree-ssa-reassoc.c82
-rw-r--r--gcc/tree-ssa-sccvn.c10
-rw-r--r--gcc/tree-tailcall.c2
-rw-r--r--gcc/tree-vect-stmts.c27
-rw-r--r--gcc/tree-vrp.c2
-rw-r--r--gcc/tree.c3
-rw-r--r--gcc/varasm.c7
-rw-r--r--libada/ChangeLog8
-rwxr-xr-xlibada/configure2
-rw-r--r--libatomic/ChangeLog8
-rwxr-xr-xlibatomic/configure7
-rw-r--r--libcc1/ChangeLog8
-rwxr-xr-xlibcc1/configure2
-rw-r--r--libcilkrts/ChangeLog8
-rw-r--r--libcilkrts/configure2
-rw-r--r--libffi/ChangeLog8
-rwxr-xr-xlibffi/configure2
-rw-r--r--libgcc/ChangeLog16
-rw-r--r--libgcc/config/arm/cmse.c5
-rw-r--r--libgcc/configure2
-rw-r--r--libgfortran/ChangeLog22
-rwxr-xr-xlibgfortran/configure2
-rw-r--r--libgfortran/io/write.c32
-rw-r--r--libgfortran/io/write_float.def1
-rw-r--r--libgo/config.h.in3
-rwxr-xr-xlibgo/configure33
-rw-r--r--libgo/configure.ac18
-rw-r--r--libgo/go/syscall/libcall_linux_ustat.go12
-rwxr-xr-xlibgo/mksysinfo.sh14
-rw-r--r--libgo/sysinfo.c3
-rw-r--r--libgomp/ChangeLog13
-rwxr-xr-xlibgomp/configure2
-rw-r--r--libgomp/testsuite/libgomp.c++/pr86291.C51
-rw-r--r--libhsail-rt/ChangeLog8
-rwxr-xr-xlibhsail-rt/configure2
-rw-r--r--libitm/ChangeLog8
-rw-r--r--libitm/configure2
-rw-r--r--libmpx/ChangeLog8
-rw-r--r--libmpx/configure2
-rw-r--r--libobjc/ChangeLog8
-rwxr-xr-xlibobjc/configure2
-rw-r--r--liboffloadmic/ChangeLog9
-rw-r--r--liboffloadmic/configure2
-rw-r--r--liboffloadmic/plugin/configure2
-rw-r--r--libquadmath/ChangeLog8
-rwxr-xr-xlibquadmath/configure2
-rw-r--r--libsanitizer/ChangeLog36
-rwxr-xr-xlibsanitizer/configure2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc43
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc15
-rw-r--r--libssp/ChangeLog8
-rwxr-xr-xlibssp/configure2
-rw-r--r--libstdc++-v3/ChangeLog45
-rw-r--r--libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt1
-rwxr-xr-xlibstdc++-v3/configure2
-rw-r--r--libstdc++-v3/include/bits/basic_string.h5
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc25
-rw-r--r--libstdc++-v3/include/bits/char_traits.h4
-rw-r--r--libstdc++-v3/include/std/utility4
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc30
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc30
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc37
-rw-r--r--libvtv/ChangeLog8
-rwxr-xr-xlibvtv/configure2
294 files changed, 5254 insertions, 657 deletions
diff --git a/ChangeLog b/ChangeLog
index 670d2bb20fd..f5199ea8db6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/config/ChangeLog b/config/ChangeLog
index abce453d1f7..57c8ff87fcf 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/config/acx.m4 b/config/acx.m4
index aa1d34b2b49..87c1b5e2932 100644
--- a/config/acx.m4
+++ b/config/acx.m4
@@ -246,7 +246,7 @@ AC_DEFUN([GCC_BASE_VER],
[AS_HELP_STRING([--with-gcc-major-version-only], [use only GCC major number in filesystem paths])],
[if test x$with_gcc_major_version_only = xyes ; then
changequote(,)dnl
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
changequote([,])dnl
fi
])
diff --git a/configure b/configure
index 32a38633ad8..32ee91f949e 100755
--- a/configure
+++ b/configure
@@ -6620,7 +6620,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 1472c9fe265..96107ab5015 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/fixincludes/configure b/fixincludes/configure
index ab97983f327..e4b03fd588c 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -5401,7 +5401,7 @@ _ACEOF
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 70bc127f78d..5143f5a563b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,422 @@
+2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ Backported from mainline
+ 2018-06-20 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Change
+ behavior of vec_packsu (vector unsigned long long, vector unsigned
+ long long) to match behavior of vec_packs with same signature.
+
+2018-06-26 Robin Dapp <rdapp@linux.vnet.ibm.com>
+
+ * config/s390/s390.h (enum processor_flags): Do not use
+ default tune parameter when -march was specified.
+
+2018-06-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/86314
+ * config/i386/i386.md (setcc + movzbl to xor + setcc peephole2s):
+ Check reg_overlap_mentioned_p in addition to reg_set_p with the same
+ operands.
+
+2018-06-25 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2018-04-17 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/85424
+ * config/rs6000/rs6000.md (pack<mode>): Do not try handle a pack
+ where the inputs overlap with the output.
+
+2018-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84786
+ * config/i386/sse.md (vshift_count): New mode attr.
+ (<shift_insn><mode>3<mask_name>): Use <vshift_count>N instead of vN
+ as last operand's constraint for VI2_AVX2_AVX512BW shifts. Use YvN
+ instead of vN as last operand's constraint for VI48_AVX2 shifts.
+
+2018-06-23 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/85989
+ * gimple-ssa-backprop.c (backprop::m_visited_phis): New member
+ variable.
+ (backprop::intersect_uses): Check it when deciding whether this
+ is a backedge reference.
+ (backprop::process_block): Add each phi to m_visited_phis
+ after visiting it, then clear it at the end.
+
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/86231
+ * tree-vrp.c (union_ranges): For ( [ ) ] or ( )[ ] range and
+ anti-range don't overwrite *vr0min before using it to compute *vr0max.
+
+ 2018-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/85878
+ * expr.c (expand_assignment): Only call store_expr for halves if the
+ mode is the same.
+
+ 2018-06-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85945
+ * lower-subreg.c (find_decomposable_subregs): Don't decompose float
+ subregs of multi-word pseudos unless the float mode has word size.
+
+ 2018-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86025
+ * tree.c (inchash::add_expr): Handle IDENTIFIER_NODE.
+
+ 2018-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85659
+ * cfgexpand.c (expand_asm_stmt): Don't create a temporary if
+ the type is addressable. Don't force op into register if it has
+ BLKmode.
+
+ 2018-05-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR web/85578
+ * doc/install.texi2html: Replace _002d with - and _002a with * in
+ generated html files using sed.
+
+ 2018-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85529
+ * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Add FIRST_BB
+ argument. Don't call get_nonzero_bits if opcode is ERROR_MARK_NODE,
+ rhs2 def stmt's bb is dominated by first_bb and it isn't an obvious
+ zero extension or masking of the MSB bit.
+ (optimize_range_tests): Add FIRST_BB argument, pass it through
+ to optimize_range_tests_var_bound.
+ (maybe_optimize_range_tests, reassociate_bb): Adjust
+ optimize_range_tests callers.
+
+ 2018-04-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85446
+ * match.pd ((intptr_t) x eq/ne CST to x eq/ne (typeof x) cst): Require
+ the integral and pointer types to have the same precision.
+
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure.ac (gcc-driver-name.h): Honor --with-gcc-major-version
+ by using gcc_base_ver to generate a gcc_driver_version, and use
+ it when generating GCC_DRIVER_NAME.
+ * configure: Regenerate.
+
+ 2018-04-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85431
+ * dse.c (record_store): Ignore zero width stores.
+
+ PR target/85430
+ * config/i386/i386.md (*ashlqi3_1_slp): Use alu1 type instead of alu.
+
+ 2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85300
+ * combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
+ into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
+ simplify_unary_operation fails.
+
+ 2018-04-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85257
+ * fold-const.c (native_encode_vector): If not all elts could fit
+ and off is -1, return 0 rather than offset.
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Pass
+ (offset - offset2) / BITS_PER_UNIT as 4th argument to
+ native_encode_expr. Verify len * BITS_PER_UNIT >= maxsizei. Don't
+ adjust buffer in native_interpret_expr call.
+
+ 2018-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/85252
+ * dwarf2out.c (rtl_for_decl_init): For STRING_CST initializer only
+ build CONST_STRING if TYPE_MAX_VALUE is non-NULL and is INTEGER_CST.
+
+ 2018-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85167
+ * shrink-wrap.c (move_insn_for_shrink_wrap): Don't set bb_uses and
+ bb_defs if *split_p, instead preinitialize it to NULL.
+
+ 2018-03-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85095
+ * config/i386/i386.md (*add<mode>3_carry_0, *addsi3_carry_zext_0,
+ *sub<mode>3_carry_0, *subsi3_carry_zext_0): New patterns.
+
+ 2018-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/85022
+ * emit-rtl.c (init_emit_regs): Indicate that VOIDmode MEMs don't have
+ known size by default.
+
+ PR inline-asm/85034
+ * function.c (match_asm_constraints_1): Don't optimize if input
+ doesn't satisfy general_operand predicate for output's mode.
+
+ PR inline-asm/85022
+ * alias.c (write_dependence_p): Don't require for x_canonicalized
+ non-VOIDmode if x has VOIDmode.
+
+ 2018-03-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/84941
+ * function.c (match_asm_constraints_1): Don't do the optimization
+ if input isn't a REG, SUBREG, MEM or constant.
+
+ PR sanitizer/85018
+ * dwarf2asm.c (dw2_output_indirect_constant_1): Set
+ DECL_INITIAL (decl) to decl at the end.
+ * varasm.c (use_blocks_for_decl_p): Revert the 2018-03-20 change,
+ adjust the comment.
+
+ 2018-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/84875
+ * dce.c (delete_unmarked_insns): Don't remove frame related noop moves
+ holding REG_CFA_RESTORE notes, instead turn them into a USE.
+
+ PR c/84953
+ * builtins.c (fold_builtin_strpbrk): For strpbrk(x, "") use type
+ instead of TREE_TYPE (s1) for the return value.
+
+ PR target/84990
+ * dwarf2asm.c (dw2_output_indirect_constant_1): Temporarily turn off
+ flag_section_anchors.
+ * varasm.c (use_blocks_for_decl_p): Remove hack for
+ dw2_force_const_mem.
+
+ 2018-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/78651
+ * dwarf2asm.c: Include fold-const.c.
+ (dw2_output_indirect_constant_1): Set DECL_INITIAL (decl) to ADDR_EXPR
+ of decl rather than decl itself.
+
+ 2018-03-19 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR sanitizer/78651
+ * dwarf2asm.c (dw2_output_indirect_constant_1): Disable ASan before
+ calling assemble_variable.
+
+ 2018-03-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84899
+ * postreload.c (reload_combine_recognize_pattern): Perform
+ INTVAL addition in unsigned HOST_WIDE_INT type to avoid UB and
+ truncate_int_for_mode the result for the destination's mode.
+
+ PR tree-optimization/84841
+ * tree-ssa-reassoc.c (INTEGER_CONST_TYPE): Change to 1 << 4 from
+ 1 << 3.
+ (FLOAT_ONE_CONST_TYPE): Define.
+ (constant_type): Return FLOAT_ONE_CONST_TYPE for -1.0 and 1.0.
+ (sort_by_operand_rank): Put entries with higher constant_type last
+ rather than first to match comments.
+
+ 2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/79085
+ * calls.c (expand_call): For TREE_ADDRESSABLE rettype ignore alignment
+ check and use address of target always.
+
+ PR target/84860
+ * optabs.c (emit_conditional_move): Pass address of cmode's copy
+ rather than address of cmode as last argument to prepare_cmp_insn.
+
+ 2018-03-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/84834
+ * match.pd ((A & C) != 0 ? D : 0): Use INTEGER_CST@2 instead of
+ integer_pow2p@2 and test integer_pow2p in condition.
+ (A < 0 ? C : 0): Similarly for @1.
+
+ PR target/84827
+ * config/i386/i386.md (round<mode>2): For 387 fancy math, disable
+ pattern if -ftrapping-math -fno-fp-int-builtin-inexact.
+
+ PR target/84786
+ * config/i386/sse.md (sse2_loadhpd): Use Yv constraint rather than v
+ on the last operand.
+
+ 2018-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84772
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Mark va_arg_tmp
+ temporary TREE_ADDRESSABLE before gimplification of BUILT_IN_MEMCPY.
+
+ PR c++/84767
+ * tree-inline.c (copy_tree_body_r): For INDIRECT_REF of a remapped
+ decl, use remap_type if we want to use the type.
+
+ 2018-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/84739
+ * tree-tailcall.c (find_tail_calls): Check call arguments against
+ DECL_ARGUMENTS (current_function_decl) rather than
+ DECL_ARGUMENTS (func) when checking for tail recursion.
+
+ 2018-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84700
+ * combine.c (combine_simplify_rtx): Don't try to simplify if
+ if_then_else_cond returned non-NULL, but either true_rtx or false_rtx
+ are equal to x.
+
+2018-06-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ Backport from mainline
+ 2018-06-05 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * config/arm/arm_cmse.h (cmse_nsfptr_create): Change typeof to
+ __typeof__.
+ (cmse_check_pointed_object): Likewise.
+
+2018-06-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ Backport from mainline
+ 2018-05-17 Jerome Lambourg <lambourg@adacore.com>
+
+ * config/arm/arm_cmse.h (cmse_nsfptr_create, cmse_is_nsfptr): Remove
+ #include <stdint.h>. Replace intptr_t with __INTPTR_TYPE__.
+
+2018-06-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline
+ 2018-06-15 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.gcc (riscv*-*-elf* | riscv*-*-rtems*): Use custom
+ multilibs for *-*-rtems*.
+ * config/riscv/t-rtems: New file.
+
+2018-06-19 Max Filippov <jcmvbkbc@gmail.com>
+
+ Backport from mainline
+ 2018-06-19 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/xtensa.md (UNSPEC_FRAME_BLOCKAGE): New unspec
+ constant.
+ (allocate_stack, frame_blockage, *frame_blockage): New patterns.
+
+2018-06-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimplify.c (gimplify_init_constructor): Really never clear for an
+ incomplete constructor if CONSTRUCTOR_NO_CLEARING is set.
+
+2018-06-18 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/82063
+ * calls.c (alloc_max_size): Correct a logic error/typo.
+ Treat excessive arguments as infinite. Warn for invalid arguments.
+ * doc/invoke.texi (-Walloc-size-larger-than): Update.
+
+2018-06-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ Backport from mainline
+ 2018-06-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rtems.h (STDINT_LONG32): Define.
+
+2018-06-11 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-06-08 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/85755
+ * config/rs6000/rs6000.c (mem_operand_gpr): Enable PRE_INC and PRE_DEC
+ addresses.
+
+2018-06-07 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-06-06 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/63177
+ * /config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mpower9.
+ Don't handle -mcpu=power8 if -mpower9-vector is also used.
+
+2018-06-07 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-05-04 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85588
+ * fold-const.c (negate_expr_p): Restrict negation of operand
+ zero of a division to when we know that can happen without
+ overflow.
+ (fold_negate_expr_1): Likewise.
+
+ 2018-05-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85567
+ * gimplify.c (gimplify_save_expr): When in SSA form allow
+ SAVE_EXPRs to compute to SSA vars.
+
+ 2018-05-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85597
+ * tree-vect-stmts.c (vectorizable_operation): For ternary SLP
+ do not use split vect_get_vec_defs call but call vect_get_slp_defs
+ directly.
+
+2018-06-05 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ Backport from mainline
+ 2018-06-05 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * config/s390/s390-builtin-types.def: Add void function type.
+ * config/s390/s390-builtins.def: Use the function type for the
+ tbeginc builtin.
+
+2018-06-01 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR tree-optimization/85712
+ Backport from mainline:
+ 2018-05-23 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR tree-optimization/85712
+ * gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add
+ first_interp field.
+ (alloc_cand_and_find_basis): Initialize first_interp field.
+ (slsr_process_mul): Modify first_interp field.
+ (slsr_process_add): Likewise.
+ (slsr_process_cast): Modify first_interp field for each new
+ interpretation.
+ (slsr_process_copy): Likewise.
+ (dump_candidate): Dump first_interp field.
+ (replace_mult_candidate): Process all interpretations, not just
+ subsequent ones.
+ (replace_rhs_if_not_dup): Likewise.
+ (replace_one_candidate): Likewise.
+
+ Backport from mainline:
+ 2018-05-25 Bill Schmidt <wschmidt@linux.ibm.com>
+
+ PR tree-optimization/85712
+ * gimple-ssa-strength-reduction.c (replace_one_candidate): Skip if
+ this candidate has already been replaced in-situ by a copy.
+
+2018-05-24 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sse.md (cvtusi2<ssescalarmodesuffix>64<round_name>):
+ Add {q} suffix to insn mnemonic.
+
+2018-05-24 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/85903
+ * config/i386/sse.md (movdi_to_sse): Do not generate pseudo
+ when memory input operand is handled.
+
2018-05-21 Pat Haugen <pthaugen@us.ibm.com>
Backport from mainline
@@ -5,7 +424,8 @@
Segher Boessenkool <segher@kernel.crashing.org>
PR target/85698
- * config/rs6000/rs6000.c (rs6000_output_move_128bit): Check dest operand.
+ * config/rs6000/rs6000.c (rs6000_output_move_128bit): Check
+ dest operand.
2018-05-17 Martin Jambor <mjambor@suse.cz>
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a65005539b4..cc9cd77611b 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180522
+20180627
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index da154469753..cda6b623efb 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,60 @@
+2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/ada-tree.h (TYPE_RETURN_BY_DIRECT_REF_P): Change from
+ using TYPE_LANG_FLAG_4 to using TYPE_LANG_FLAG_0.
+ (TYPE_ALIGN_OK): Move around.
+ (TYPE_PADDING_FOR_COMPONENT): Remove superfluous parentheses.
+ * gcc-interface/decl.c (change_qualified_type): Move to...
+ (gnat_to_gnu_entity): Adjust comment.
+ * gcc-interface/gigi.h (change_qualified_type): ...here; make inline.
+ (ceil_pow2): Use ceil_log2.
+ * gcc-interface/utils.c (finish_subprog_decl): Add couple of comments
+ and do not set TREE_SIDE_EFFECTS.
+ (handle_noreturn_attribute): Use change_qualified_type.
+
+2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Do not get
+ the expression of a dispatch table that is not being defined.
+ <E_Record_Subtype>: Remove obsolete kludge.
+
+2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ Backpor from mainline
+ 2018-06-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is
+ not a definition, retrieve the expression only if it's a compile-time
+ known value if we are just annotating types.
+
+ * gcc-interface/utils.c (convert): Do not try to upcast properly for a
+ conversion between tagged types in type_annotate_only mode.
+
+2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ Backport from mainline
+ 2018-06-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Reuse the
+ existing fields of a dummy fat pointer type, if any. Clear the
+ TYPE_DECL_SUPPRESS_DEBUG on the fat pointer type after completing it.
+
+2018-06-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/ada-tree.h (TYPE_PADDING_FOR_COMPONENT): New macro.
+ * gcc-interface/decl.c (gnat_to_gnu_component_type): Cache the padding
+ type built for an aliased component with variable size.
+
+2018-06-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ Backport from mainline
+ 2018-05-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Call_to_gnu): If this is a function call and
+ there is no target, also create a temporary for the return value for
+ an allocator if the type is an unconstrained record type with default
+ discriminant.
+
2018-04-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
Backport from mainline
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index a3d38b1b22e..852e2a5138b 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -83,6 +83,12 @@ do { \
((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \
&& TYPE_PACKED_ARRAY_TYPE_P (NODE))
+/* For FUNCTION_TYPEs, nonzero if the function returns by direct reference,
+ i.e. the callee returns a pointer to a memory location it has allocated
+ and the caller only needs to dereference the pointer. */
+#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
+ TYPE_LANG_FLAG_0 (FUNCTION_TYPE_CHECK (NODE))
+
/* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that
is not equal to two to the power of its mode's size. */
#define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE))
@@ -152,12 +158,6 @@ do { \
#define TYPE_CONVENTION_FORTRAN_P(NODE) \
TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE))
-/* For FUNCTION_TYPEs, nonzero if the function returns by direct reference,
- i.e. the callee returns a pointer to a memory location it has allocated
- and the caller only needs to dereference the pointer. */
-#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
- TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE))
-
/* For RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE, nonzero if this is a dummy
type, made to correspond to a private or incomplete type. */
#define TYPE_DUMMY_P(NODE) \
@@ -186,6 +186,9 @@ do { \
/* True for a dummy type if TYPE appears in a profile. */
#define TYPE_DUMMY_IN_PROFILE_P(NODE) TYPE_LANG_FLAG_6 (NODE)
+/* True if objects of this type are guaranteed to be properly aligned. */
+#define TYPE_ALIGN_OK(NODE) TYPE_LANG_FLAG_7 (NODE)
+
/* True for types that implement a packed array and for original packed array
types. */
#define TYPE_IMPL_PACKED_ARRAY_P(NODE) \
@@ -199,9 +202,6 @@ do { \
alignment value the type ought to have. */
#define TYPE_MAX_ALIGN(NODE) (TYPE_PRECISION (RECORD_OR_UNION_CHECK (NODE)))
-/* True if objects of tagged types are guaranteed to be properly aligned. */
-#define TYPE_ALIGN_OK(NODE) TYPE_LANG_FLAG_7 (NODE)
-
/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
template and the object.
@@ -232,6 +232,11 @@ do { \
refer to the routine gnat_to_gnu_entity. */
#define TYPE_CI_CO_LIST(NODE) TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
+/* For an ARRAY_TYPE with variable size, this is the padding type built for
+ the array type when it is itself the component type of another array. */
+#define TYPE_PADDING_FOR_COMPONENT(NODE) \
+ TYPE_LANG_SLOT_1 (ARRAY_TYPE_CHECK (NODE))
+
/* For a VECTOR_TYPE, this is the representative array type. */
#define TYPE_REPRESENTATIVE_ARRAY(NODE) \
TYPE_LANG_SLOT_1 (VECTOR_TYPE_CHECK (NODE))
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index e226f256b47..d2316afc8f1 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -206,7 +206,6 @@ static tree gnat_to_gnu_component_type (Entity_Id, bool, bool);
static tree gnat_to_gnu_subprog_type (Entity_Id, bool, bool, tree *);
static tree gnat_to_gnu_field (Entity_Id, tree, int, bool, bool);
static tree gnu_ext_name_for_subprog (Entity_Id, tree);
-static tree change_qualified_type (tree, int);
static void set_nonaliased_component_on_array_type (tree);
static void set_reverse_storage_order_on_array_type (tree);
static bool same_discriminant_p (Entity_Id, Entity_Id);
@@ -592,17 +591,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* If we have a constant that we are not defining, get the expression it
was defined to represent. This is necessary to avoid generating dumb
elaboration code in simple cases, but we may throw it away later if it
- is not a constant. But do not retrieve it if it is an allocator since
- the designated type might still be dummy at this point. */
+ is not a constant. But do not do it for dispatch tables because they
+ are only referenced indirectly and we need to have a consistent view
+ of the exported and of the imported declarations of the tables from
+ external units for them to be properly merged in LTO mode. Moreover
+ simply do not retrieve the expression it if it is an allocator since
+ the designated type might still be dummy at this point. Note that we
+ invoke gnat_to_gnu_external and not gnat_to_gnu because the expression
+ may contain N_Expression_With_Actions nodes and thus declarations of
+ objects from other units that we need to discard. */
if (!definition
&& !No_Initialization (Declaration_Node (gnat_entity))
- && Present (Expression (Declaration_Node (gnat_entity)))
- && Nkind (Expression (Declaration_Node (gnat_entity)))
- != N_Allocator)
- /* The expression may contain N_Expression_With_Actions nodes and
- thus object declarations from other units. Discard them. */
- gnu_expr
- = gnat_to_gnu_external (Expression (Declaration_Node (gnat_entity)));
+ && !Is_Dispatch_Table_Entity (gnat_entity)
+ && Present (gnat_temp = Expression (Declaration_Node (gnat_entity)))
+ && Nkind (gnat_temp) != N_Allocator
+ && (!type_annotate_only || Compile_Time_Known_Value (gnat_temp)))
+ gnu_expr = gnat_to_gnu_external (gnat_temp);
/* ... fall through ... */
@@ -2063,11 +2067,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
{
gnu_fat_type = TYPE_MAIN_VARIANT (TYPE_POINTER_TO (gnu_type));
TYPE_NAME (gnu_fat_type) = NULL_TREE;
- /* Save the contents of the dummy type for update_pointer_to. */
- TYPE_POINTER_TO (gnu_type) = copy_type (gnu_fat_type);
gnu_ptr_template =
- TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_fat_type)));
+ TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_fat_type)));
gnu_template_type = TREE_TYPE (gnu_ptr_template);
+
+ /* Save the contents of the dummy type for update_pointer_to. */
+ TYPE_POINTER_TO (gnu_type) = copy_type (gnu_fat_type);
+ TYPE_FIELDS (TYPE_POINTER_TO (gnu_type))
+ = copy_node (TYPE_FIELDS (gnu_fat_type));
+ DECL_CHAIN (TYPE_FIELDS (TYPE_POINTER_TO (gnu_type)))
+ = copy_node (DECL_CHAIN (TYPE_FIELDS (gnu_fat_type)));
}
else
{
@@ -2088,29 +2097,39 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* Build the fat pointer type. Use a "void *" object instead of
a pointer to the array type since we don't have the array type
- yet (it will reference the fat pointer via the bounds). */
- tem
- = create_field_decl (get_identifier ("P_ARRAY"), ptr_type_node,
- gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
- DECL_CHAIN (tem)
- = create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template,
- gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
-
+ yet (it will reference the fat pointer via the bounds). Note
+ that we reuse the existing fields of a dummy type because for:
+
+ type Arr is array (Positive range <>) of Element_Type;
+ type Array_Ref is access Arr;
+ Var : Array_Ref := Null;
+
+ in a declarative part, Arr will be frozen only after Var, which
+ means that the fields used in the CONSTRUCTOR built for Null are
+ those of the dummy type, which in turn means that COMPONENT_REFs
+ of Var may be built with these fields. Now if COMPONENT_REFs of
+ Var are also built later with the fields of the final type, the
+ aliasing machinery may consider that the accesses are distinct
+ if the FIELD_DECLs are distinct as objects. */
if (COMPLETE_TYPE_P (gnu_fat_type))
{
- /* We are going to lay it out again so reset the alias set. */
- alias_set_type alias_set = TYPE_ALIAS_SET (gnu_fat_type);
- TYPE_ALIAS_SET (gnu_fat_type) = -1;
- finish_fat_pointer_type (gnu_fat_type, tem);
- TYPE_ALIAS_SET (gnu_fat_type) = alias_set;
+ tem = TYPE_FIELDS (gnu_fat_type);
+ TREE_TYPE (tem) = ptr_type_node;
+ TREE_TYPE (DECL_CHAIN (tem)) = gnu_ptr_template;
+ TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (gnu_fat_type)) = 0;
for (t = gnu_fat_type; t; t = TYPE_NEXT_VARIANT (t))
- {
- TYPE_FIELDS (t) = tem;
- SET_TYPE_UNCONSTRAINED_ARRAY (t, gnu_type);
- }
+ SET_TYPE_UNCONSTRAINED_ARRAY (t, gnu_type);
}
else
{
+ tem
+ = create_field_decl (get_identifier ("P_ARRAY"),
+ ptr_type_node, gnu_fat_type,
+ NULL_TREE, NULL_TREE, 0, 0);
+ DECL_CHAIN (tem)
+ = create_field_decl (get_identifier ("P_BOUNDS"),
+ gnu_ptr_template, gnu_fat_type,
+ NULL_TREE, NULL_TREE, 0, 0);
finish_fat_pointer_type (gnu_fat_type, tem);
SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_type);
}
@@ -3389,20 +3408,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
break;
}
- /* If this is a record subtype associated with a dispatch table,
- strip the suffix. This is necessary to make sure 2 different
- subtypes associated with the imported and exported views of a
- dispatch table are properly merged in LTO mode. */
- if (Is_Dispatch_Table_Entity (gnat_entity))
- {
- char *p;
- Get_Encoded_Name (gnat_entity);
- p = strchr (Name_Buffer, '_');
- gcc_assert (p);
- strcpy (p+2, "dtS");
- gnu_entity_name = get_identifier (Name_Buffer);
- }
-
/* When the subtype has discriminants and these discriminants affect
the initial shape it has inherited, factor them in. But for an
Unchecked_Union (it must be an Itype), just return the type.
@@ -4681,7 +4686,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* If this is not an unconstrained array type, set some flags. */
if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE)
{
- /* Tell the middle-end that objects of tagged types are guaranteed to
+ /* Record the property that objects of tagged types are guaranteed to
be properly aligned. This is necessary because conversions to the
class-wide type are translated into conversions to the root type,
which can be less aligned than some of its derived types. */
@@ -5272,17 +5277,6 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
Is_Bit_Packed_Array (gnat_array) ? TYPE_DECL : VAR_DECL,
true, Has_Component_Size_Clause (gnat_array));
- /* If the array has aliased components and the component size can be zero,
- force at least unit size to ensure that the components have distinct
- addresses. */
- if (!gnu_comp_size
- && Has_Aliased_Components (gnat_array)
- && (integer_zerop (TYPE_SIZE (gnu_type))
- || (TREE_CODE (gnu_type) == ARRAY_TYPE
- && !TREE_CONSTANT (TYPE_SIZE (gnu_type)))))
- gnu_comp_size
- = size_binop (MAX_EXPR, TYPE_SIZE (gnu_type), bitsize_unit_node);
-
/* If the component type is a RECORD_TYPE that has a self-referential size,
then use the maximum size for the component size. */
if (!gnu_comp_size
@@ -5290,6 +5284,13 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
&& CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)))
gnu_comp_size = max_size (TYPE_SIZE (gnu_type), true);
+ /* If the array has aliased components and the component size is zero, force
+ the unit size to ensure that the components have distinct addresses. */
+ if (!gnu_comp_size
+ && Has_Aliased_Components (gnat_array)
+ && integer_zerop (TYPE_SIZE (gnu_type)))
+ gnu_comp_size = bitsize_unit_node;
+
/* Honor the component size. This is not needed for bit-packed arrays. */
if (gnu_comp_size && !Is_Bit_Packed_Array (gnat_array))
{
@@ -5312,6 +5313,30 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
gnat_array);
}
+ /* This is a very special case where the array has aliased components and the
+ component size might be zero at run time. As explained above, we force at
+ least the unit size but we don't want to build a distinct padding type for
+ each invocation (they are not canonicalized if they have variable size) so
+ we cache this special padding type as TYPE_PADDING_FOR_COMPONENT. */
+ else if (Has_Aliased_Components (gnat_array)
+ && TREE_CODE (gnu_type) == ARRAY_TYPE
+ && !TREE_CONSTANT (TYPE_SIZE (gnu_type)))
+ {
+ if (TYPE_PADDING_FOR_COMPONENT (gnu_type))
+ gnu_type = TYPE_PADDING_FOR_COMPONENT (gnu_type);
+ else
+ {
+ gnu_comp_size
+ = size_binop (MAX_EXPR, TYPE_SIZE (gnu_type), bitsize_unit_node);
+ TYPE_PADDING_FOR_COMPONENT (gnu_type)
+ = maybe_pad_type (gnu_type, gnu_comp_size, 0, gnat_array,
+ true, false, definition, true);
+ gnu_type = TYPE_PADDING_FOR_COMPONENT (gnu_type);
+ create_type_decl (TYPE_NAME (gnu_type), gnu_type, true, debug_info_p,
+ gnat_array);
+ }
+ }
+
/* If the component type is a padded type made for a non-bit-packed array
of scalars with reverse storage order, we need to propagate the reverse
storage order to the padding type since it is the innermost enclosing
@@ -6276,19 +6301,6 @@ gnu_ext_name_for_subprog (Entity_Id gnat_subprog, tree gnu_entity_name)
return gnu_ext_name;
}
-/* Like build_qualified_type, but TYPE_QUALS is added to the existing
- qualifiers on TYPE. */
-
-static tree
-change_qualified_type (tree type, int type_quals)
-{
- /* Qualifiers must be put on the associated array type. */
- if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
- return type;
-
- return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
-}
-
/* Set TYPE_NONALIASED_COMPONENT on an array type built by means of
build_nonshared_array_type. */
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 1d87b5be44e..2b33c13302c 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -1074,7 +1074,7 @@ maybe_vector_array (tree exp)
static inline unsigned HOST_WIDE_INT
ceil_pow2 (unsigned HOST_WIDE_INT x)
{
- return (unsigned HOST_WIDE_INT) 1 << (floor_log2 (x - 1) + 1);
+ return (unsigned HOST_WIDE_INT) 1 << ceil_log2 (x);
}
/* Return true if EXP, a CALL_EXPR, is an atomic load. */
@@ -1171,3 +1171,16 @@ maybe_debug_type (tree type)
return type;
}
+
+/* Like build_qualified_type, but TYPE_QUALS is added to the existing
+ qualifiers on TYPE. */
+
+static inline tree
+change_qualified_type (tree type, int type_quals)
+{
+ /* Qualifiers must be put on the associated array type. */
+ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
+ return type;
+
+ return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
+}
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index eaad084959c..47c8a286220 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -4326,12 +4326,15 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
because we need to preserve the return value before copying back the
parameters.
- 2. There is no target and the call is made for neither an object nor a
+ 2. There is no target and the call is made for neither an object, nor a
renaming declaration, nor a return statement, nor an allocator, and
the return type has variable size because in this case the gimplifier
- cannot create the temporary, or more generally is simply an aggregate
- type, because the gimplifier would then create the temporary in the
- outermost scope instead of locally.
+ cannot create the temporary, or more generally is an aggregate type,
+ because the gimplifier would create the temporary in the outermost
+ scope instead of locally. But there is an exception for an allocator
+ of an unconstrained record type with default discriminant because we
+ allocate the actual size in this case, unlike the other 3 cases, so
+ we need a temporary to fetch the discriminant and we create it here.
3. There is a target and it is a slice or an array with fixed size,
and the return type has variable size, because the gimplifier
@@ -4350,8 +4353,9 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
&& Nkind (Parent (gnat_node)) != N_Object_Declaration
&& Nkind (Parent (gnat_node)) != N_Object_Renaming_Declaration
&& Nkind (Parent (gnat_node)) != N_Simple_Return_Statement
- && !(Nkind (Parent (gnat_node)) == N_Qualified_Expression
- && Nkind (Parent (Parent (gnat_node))) == N_Allocator)
+ && (!(Nkind (Parent (gnat_node)) == N_Qualified_Expression
+ && Nkind (Parent (Parent (gnat_node))) == N_Allocator)
+ || type_is_padding_self_referential (gnu_result_type))
&& AGGREGATE_TYPE_P (gnu_result_type)
&& !TYPE_IS_FAT_POINTER_P (gnu_result_type))
|| (gnu_target
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index f362946e63a..cb2c4d22a41 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -3255,8 +3255,11 @@ finish_subprog_decl (tree decl, tree asm_name, tree type)
DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type);
DECL_RESULT (decl) = result_decl;
+ /* Propagate the "const" property. */
TREE_READONLY (decl) = TYPE_READONLY (type);
- TREE_SIDE_EFFECTS (decl) = TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (type);
+
+ /* Propagate the "noreturn" property. */
+ TREE_THIS_VOLATILE (decl) = TYPE_VOLATILE (type);
if (asm_name)
{
@@ -4543,9 +4546,12 @@ convert (tree type, tree expr)
etype)))
return build1 (VIEW_CONVERT_EXPR, type, expr);
- /* If we are converting between tagged types, try to upcast properly. */
+ /* If we are converting between tagged types, try to upcast properly.
+ But don't do it if we are just annotating types since tagged types
+ aren't fully laid out in this mode. */
else if (ecode == RECORD_TYPE && code == RECORD_TYPE
- && TYPE_ALIGN_OK (etype) && TYPE_ALIGN_OK (type))
+ && TYPE_ALIGN_OK (etype) && TYPE_ALIGN_OK (type)
+ && !type_annotate_only)
{
tree child_etype = etype;
do {
@@ -6113,8 +6119,7 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node)
= build_pointer_type
- (build_type_variant (TREE_TYPE (type),
- TYPE_READONLY (TREE_TYPE (type)), 1));
+ (change_qualified_type (TREE_TYPE (type), TYPE_QUAL_VOLATILE));
else
{
warning (OPT_Wattributes, "%qs attribute ignored",
diff --git a/gcc/alias.c b/gcc/alias.c
index e16e3501522..e6d67b1200c 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2997,7 +2997,8 @@ write_dependence_p (const_rtx mem,
int ret;
gcc_checking_assert (x_canonicalized
- ? (x_addr != NULL_RTX && x_mode != VOIDmode)
+ ? (x_addr != NULL_RTX
+ && (x_mode != VOIDmode || GET_MODE (x) == VOIDmode))
: (x_addr == NULL_RTX && x_mode == VOIDmode));
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 75342b786de..767093f539f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -9270,7 +9270,7 @@ fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type)
if (p2[0] == '\0')
/* strpbrk(x, "") == NULL.
Evaluate and ignore s1 in case it had side-effects. */
- return omit_one_operand_loc (loc, TREE_TYPE (s1), integer_zero_node, s1);
+ return omit_one_operand_loc (loc, type, integer_zero_node, s1);
if (p2[1] != '\0')
return NULL_TREE; /* Really call strpbrk. */
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 962f62844a3..a3e153a13db 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,30 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86210
+ * c-common.c (check_nonnull_arg): Use fold_for_warn. Adjust obsolete
+ comment.
+
+ 2018-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85696
+ * c-omp.c (c_omp_predetermined_sharing): Return
+ OMP_CLAUSE_DEFAULT_SHARED for artificial vars with integral type.
+
+ 2018-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85662
+ * c-common.h (fold_offsetof_1): Removed.
+ (fold_offsetof): Add TYPE argument defaulted to size_type_node and
+ CTX argument defaulted to ERROR_MARK.
+ * c-common.c (fold_offsetof_1): Renamed to ...
+ (fold_offsetof): ... this. Remove wrapper function. Add TYPE
+ argument, convert the pointer constant to TYPE and use size_binop
+ with PLUS_EXPR instead of fold_build_pointer_plus if type is not
+ a pointer type. Adjust recursive calls.
+
2018-04-26 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e272488b39b..45be4bd1cbe 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5434,10 +5434,8 @@ check_nonnull_arg (void *ctx, tree param, unsigned HOST_WIDE_INT param_num)
if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE)
return;
- /* When not optimizing diagnose the simple cases of null arguments.
- When optimization is enabled defer the checking until expansion
- when more cases can be detected. */
- if (integer_zerop (param))
+ /* Diagnose the simple cases of null arguments. */
+ if (integer_zerop (fold_for_warn (param)))
{
warning_at (pctx->loc, OPT_Wnonnull, "null argument where non-null "
"required (argument %lu)", (unsigned long) param_num);
@@ -6253,10 +6251,11 @@ c_common_to_target_charset (HOST_WIDE_INT c)
/* Fold an offsetof-like expression. EXPR is a nested sequence of component
references with an INDIRECT_REF of a constant at the bottom; much like the
- traditional rendering of offsetof as a macro. Return the folded result. */
+ traditional rendering of offsetof as a macro. TYPE is the desired type of
+ the whole expression. Return the folded result. */
tree
-fold_offsetof_1 (tree expr, enum tree_code ctx)
+fold_offsetof (tree expr, tree type, enum tree_code ctx)
{
tree base, off, t;
tree_code code = TREE_CODE (expr);
@@ -6281,10 +6280,10 @@ fold_offsetof_1 (tree expr, enum tree_code ctx)
error ("cannot apply %<offsetof%> to a non constant address");
return error_mark_node;
}
- return TREE_OPERAND (expr, 0);
+ return convert (type, TREE_OPERAND (expr, 0));
case COMPONENT_REF:
- base = fold_offsetof_1 (TREE_OPERAND (expr, 0), code);
+ base = fold_offsetof (TREE_OPERAND (expr, 0), type, code);
if (base == error_mark_node)
return base;
@@ -6301,7 +6300,7 @@ fold_offsetof_1 (tree expr, enum tree_code ctx)
break;
case ARRAY_REF:
- base = fold_offsetof_1 (TREE_OPERAND (expr, 0), code);
+ base = fold_offsetof (TREE_OPERAND (expr, 0), type, code);
if (base == error_mark_node)
return base;
@@ -6358,23 +6357,16 @@ fold_offsetof_1 (tree expr, enum tree_code ctx)
/* Handle static members of volatile structs. */
t = TREE_OPERAND (expr, 1);
gcc_assert (VAR_P (t));
- return fold_offsetof_1 (t);
+ return fold_offsetof (t, type);
default:
gcc_unreachable ();
}
+ if (!POINTER_TYPE_P (type))
+ return size_binop (PLUS_EXPR, base, convert (type, off));
return fold_build_pointer_plus (base, off);
}
-
-/* Likewise, but convert it to the return type of offsetof. */
-
-tree
-fold_offsetof (tree expr)
-{
- return convert (size_type_node, fold_offsetof_1 (expr));
-}
-
/* *PTYPE is an incomplete array. Complete it with a domain based on
INITIAL_VALUE. If INITIAL_VALUE is not present, use 1 if DO_DEFAULT
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index b9333420434..0cff4414294 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1053,8 +1053,8 @@ extern bool c_dump_tree (void *, tree);
extern void verify_sequence_points (tree);
-extern tree fold_offsetof_1 (tree, tree_code ctx = ERROR_MARK);
-extern tree fold_offsetof (tree);
+extern tree fold_offsetof (tree, tree = size_type_node,
+ tree_code ctx = ERROR_MARK);
extern int complete_array_type (tree *, tree, bool);
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 977cb0ea153..eee718ddce1 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -1540,5 +1540,13 @@ c_omp_predetermined_sharing (tree decl)
if (TREE_READONLY (decl))
return OMP_CLAUSE_DEFAULT_SHARED;
+ /* Predetermine artificial variables holding integral values, those
+ are usually result of gimplify_one_sizepos or SAVE_EXPR
+ gimplification. */
+ if (VAR_P (decl)
+ && DECL_ARTIFICIAL (decl)
+ && INTEGRAL_TYPE_P (TREE_TYPE (decl)))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index b48e7cb422e..35f93f6ef3e 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,35 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85696
+ * c-typeck.c (c_finish_omp_clauses): Don't use
+ c_omp_predetermined_sharing, instead just check TREE_READONLY.
+
+ 2018-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85662
+ * c-fold.c (c_fully_fold_internal): Use fold_offsetof rather than
+ fold_offsetof_1, pass TREE_TYPE (expr) as TYPE to it and drop the
+ fold_convert_loc.
+ * c-typeck.c (build_unary_op): Use fold_offsetof rather than
+ fold_offsetof_1, pass argtype as TYPE to it and drop the
+ fold_convert_loc.
+
+ 2018-03-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/84999
+ * c-typeck.c (build_binary_op): If c_common_type_for_size fails when
+ building vector comparison, diagnose it and return error_mark_node.
+
+ 2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/84853
+ * c-typeck.c (build_binary_op) <case RSHIFT_EXPR, case LSHIFT_EXPR>:
+ If code1 is INTEGER_TYPE, only allow code0 VECTOR_TYPE if it has
+ INTEGER_TYPE element type.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c
index b060d76da43..96c041e265d 100644
--- a/gcc/c/c-fold.c
+++ b/gcc/c/c-fold.c
@@ -403,7 +403,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
&& (op1 = get_base_address (op0)) != NULL_TREE
&& INDIRECT_REF_P (op1)
&& TREE_CONSTANT (TREE_OPERAND (op1, 0)))
- ret = fold_convert_loc (loc, TREE_TYPE (expr), fold_offsetof_1 (op0));
+ ret = fold_offsetof (op0, TREE_TYPE (expr));
else if (op0 != orig_op0 || in_init)
ret = in_init
? fold_build1_initializer_loc (loc, code, TREE_TYPE (expr), op0)
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index ee365313c81..66a58a81e71 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -4638,7 +4638,7 @@ build_unary_op (location_t location, enum tree_code code, tree xarg,
if (val && INDIRECT_REF_P (val)
&& TREE_CONSTANT (TREE_OPERAND (val, 0)))
{
- ret = fold_convert_loc (location, argtype, fold_offsetof_1 (arg));
+ ret = fold_offsetof (arg, argtype);
goto return_build_unary_op;
}
@@ -11150,7 +11150,8 @@ build_binary_op (location_t location, enum tree_code code,
converted = 1;
}
else if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE
- || code0 == VECTOR_TYPE)
+ || (code0 == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE))
&& code1 == INTEGER_TYPE)
{
doing_shift = true;
@@ -11207,7 +11208,8 @@ build_binary_op (location_t location, enum tree_code code,
converted = 1;
}
else if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE
- || code0 == VECTOR_TYPE)
+ || (code0 == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE))
&& code1 == INTEGER_TYPE)
{
doing_shift = true;
@@ -11299,6 +11301,13 @@ build_binary_op (location_t location, enum tree_code code,
/* Always construct signed integer vector type. */
intt = c_common_type_for_size (GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (type0))), 0);
+ if (!intt)
+ {
+ error_at (location, "could not find an integer type "
+ "of the same size as %qT",
+ TREE_TYPE (type0));
+ return error_mark_node;
+ }
result_type = build_opaque_vector_type (intt,
TYPE_VECTOR_SUBPARTS (type0));
converted = 1;
@@ -11458,6 +11467,13 @@ build_binary_op (location_t location, enum tree_code code,
/* Always construct signed integer vector type. */
intt = c_common_type_for_size (GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (type0))), 0);
+ if (!intt)
+ {
+ error_at (location, "could not find an integer type "
+ "of the same size as %qT",
+ TREE_TYPE (type0));
+ return error_mark_node;
+ }
result_type = build_opaque_vector_type (intt,
TYPE_VECTOR_SUBPARTS (type0));
converted = 1;
@@ -13744,22 +13760,11 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (VAR_P (t) && DECL_THREAD_LOCAL_P (t))
share_name = "threadprivate";
- else switch (c_omp_predetermined_sharing (t))
+ else if (TREE_READONLY (t))
{
- case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
- break;
- case OMP_CLAUSE_DEFAULT_SHARED:
/* const vars may be specified in firstprivate clause. */
- if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
- && TREE_READONLY (t))
- break;
- share_name = "shared";
- break;
- case OMP_CLAUSE_DEFAULT_PRIVATE:
- share_name = "private";
- break;
- default:
- gcc_unreachable ();
+ if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_FIRSTPRIVATE)
+ share_name = "shared";
}
if (share_name)
{
diff --git a/gcc/calls.c b/gcc/calls.c
index b183be63dd4..8eec155cf7d 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1196,65 +1196,79 @@ static GTY(()) tree alloc_object_size_limit;
static tree
alloc_max_size (void)
{
- if (!alloc_object_size_limit)
- {
- alloc_object_size_limit = TYPE_MAX_VALUE (ssizetype);
+ if (alloc_object_size_limit)
+ return alloc_object_size_limit;
- if (warn_alloc_size_limit)
- {
- char *end = NULL;
- errno = 0;
- unsigned HOST_WIDE_INT unit = 1;
- unsigned HOST_WIDE_INT limit
- = strtoull (warn_alloc_size_limit, &end, 10);
+ alloc_object_size_limit = TYPE_MAX_VALUE (ssizetype);
- if (!errno)
- {
- if (end && *end)
- {
- /* Numeric option arguments are at most INT_MAX. Make it
- possible to specify a larger value by accepting common
- suffixes. */
- if (!strcmp (end, "kB"))
- unit = 1000;
- else if (!strcasecmp (end, "KiB") || strcmp (end, "KB"))
- unit = 1024;
- else if (!strcmp (end, "MB"))
- unit = HOST_WIDE_INT_UC (1000) * 1000;
- else if (!strcasecmp (end, "MiB"))
- unit = HOST_WIDE_INT_UC (1024) * 1024;
- else if (!strcasecmp (end, "GB"))
- unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000;
- else if (!strcasecmp (end, "GiB"))
- unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024;
- else if (!strcasecmp (end, "TB"))
- unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000;
- else if (!strcasecmp (end, "TiB"))
- unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024;
- else if (!strcasecmp (end, "PB"))
- unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000;
- else if (!strcasecmp (end, "PiB"))
- unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024;
- else if (!strcasecmp (end, "EB"))
- unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000
- * 1000;
- else if (!strcasecmp (end, "EiB"))
- unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024
- * 1024;
- else
- unit = 0;
- }
+ if (!warn_alloc_size_limit)
+ return alloc_object_size_limit;
- if (unit)
- {
- wide_int w = wi::uhwi (limit, HOST_BITS_PER_WIDE_INT + 64);
- w *= unit;
- if (wi::ltu_p (w, alloc_object_size_limit))
- alloc_object_size_limit = wide_int_to_tree (ssizetype, w);
- }
- }
+ const char *optname = "-Walloc-size-larger-than=";
+
+ char *end = NULL;
+ errno = 0;
+ unsigned HOST_WIDE_INT unit = 1;
+ unsigned HOST_WIDE_INT limit
+ = strtoull (warn_alloc_size_limit, &end, 10);
+
+ /* If the value is too large to be represented use the maximum
+ representable value that strtoull sets limit to (setting
+ errno to ERANGE). */
+
+ if (end && *end)
+ {
+ /* Numeric option arguments are at most INT_MAX. Make it
+ possible to specify a larger value by accepting common
+ suffixes. */
+ if (!strcmp (end, "kB"))
+ unit = 1000;
+ else if (!strcasecmp (end, "KiB") || !strcmp (end, "KB"))
+ unit = 1024;
+ else if (!strcmp (end, "MB"))
+ unit = HOST_WIDE_INT_UC (1000) * 1000;
+ else if (!strcasecmp (end, "MiB"))
+ unit = HOST_WIDE_INT_UC (1024) * 1024;
+ else if (!strcasecmp (end, "GB"))
+ unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000;
+ else if (!strcasecmp (end, "GiB"))
+ unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024;
+ else if (!strcasecmp (end, "TB"))
+ unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000;
+ else if (!strcasecmp (end, "TiB"))
+ unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024;
+ else if (!strcasecmp (end, "PB"))
+ unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000;
+ else if (!strcasecmp (end, "PiB"))
+ unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024;
+ else if (!strcasecmp (end, "EB"))
+ unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000
+ * 1000;
+ else if (!strcasecmp (end, "EiB"))
+ unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024
+ * 1024;
+ else
+ {
+ /* This could mean an unknown suffix or a bad prefix, like
+ "+-1". */
+ warning_at (UNKNOWN_LOCATION, 0,
+ "invalid argument %qs to %qs",
+ warn_alloc_size_limit, optname);
+ /* Ignore the limit extracted by strtoull. */
+ unit = 0;
}
}
+
+ if (unit)
+ {
+ widest_int w = wi::mul (limit, unit);
+ if (w < wi::to_widest (alloc_object_size_limit))
+ alloc_object_size_limit
+ = wide_int_to_tree (ptrdiff_type_node, w);
+ else
+ alloc_object_size_limit = build_all_ones_cst (size_type_node);
+ }
+
return alloc_object_size_limit;
}
@@ -3133,9 +3147,14 @@ expand_call (tree exp, rtx target, int ignore)
if (CALL_EXPR_RETURN_SLOT_OPT (exp)
&& target
&& MEM_P (target)
- && !(MEM_ALIGN (target) < TYPE_ALIGN (rettype)
- && SLOW_UNALIGNED_ACCESS (TYPE_MODE (rettype),
- MEM_ALIGN (target))))
+ /* If rettype is addressable, we may not create a temporary.
+ If target is properly aligned at runtime and the compiler
+ just doesn't know about it, it will work fine, otherwise it
+ will be UB. */
+ && (TREE_ADDRESSABLE (rettype)
+ || !(MEM_ALIGN (target) < TYPE_ALIGN (rettype)
+ && SLOW_UNALIGNED_ACCESS (TYPE_MODE (rettype),
+ MEM_ALIGN (target)))))
structure_value_addr = XEXP (target, 0);
else
{
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 66af69973c6..e15013b1149 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2997,14 +2997,14 @@ expand_asm_stmt (gasm *stmt)
generating_concat_p = 0;
- if ((TREE_CODE (val) == INDIRECT_REF
- && allows_mem)
+ if ((TREE_CODE (val) == INDIRECT_REF && allows_mem)
|| (DECL_P (val)
&& (allows_mem || REG_P (DECL_RTL (val)))
&& ! (REG_P (DECL_RTL (val))
&& GET_MODE (DECL_RTL (val)) != TYPE_MODE (type)))
|| ! allows_reg
- || is_inout)
+ || is_inout
+ || TREE_ADDRESSABLE (type))
{
op = expand_expr (val, NULL_RTX, VOIDmode,
!allows_reg ? EXPAND_MEMORY : EXPAND_WRITE);
@@ -3013,7 +3013,7 @@ expand_asm_stmt (gasm *stmt)
if (! allows_reg && !MEM_P (op))
error ("output number %d not directly addressable", i);
- if ((! allows_mem && MEM_P (op))
+ if ((! allows_mem && MEM_P (op) && GET_MODE (op) != BLKmode)
|| GET_CODE (op) == CONCAT)
{
rtx old_op = op;
diff --git a/gcc/combine.c b/gcc/combine.c
index 064e4f97d01..81c40d84fa9 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5482,11 +5482,15 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
x = gen_rtx_CLOBBER (mode, const0_rtx);
}
else if (CONST_SCALAR_INT_P (new_rtx)
- && GET_CODE (x) == ZERO_EXTEND)
+ && (GET_CODE (x) == ZERO_EXTEND
+ || GET_CODE (x) == FLOAT
+ || GET_CODE (x) == UNSIGNED_FLOAT))
{
- x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
- new_rtx, GET_MODE (XEXP (x, 0)));
- gcc_assert (x);
+ x = simplify_unary_operation (GET_CODE (x), GET_MODE (x),
+ new_rtx,
+ GET_MODE (XEXP (x, 0)));
+ if (!x)
+ return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
}
else
SUBST (XEXP (x, i), new_rtx);
@@ -5637,7 +5641,11 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
/* If everything is a comparison, what we have is highly unlikely
to be simpler, so don't use it. */
&& ! (COMPARISON_P (x)
- && (COMPARISON_P (true_rtx) || COMPARISON_P (false_rtx))))
+ && (COMPARISON_P (true_rtx) || COMPARISON_P (false_rtx)))
+ /* Similarly, if we end up with one of the expressions the same
+ as the original, it is certainly not simpler. */
+ && ! rtx_equal_p (x, true_rtx)
+ && ! rtx_equal_p (x, false_rtx))
{
rtx cop1 = const0_rtx;
enum rtx_code cond_code = simplify_comparison (NE, &cond, &cop1);
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 64b944a5d2c..5cabc9c9149 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2046,10 +2046,17 @@ riscv*-*-linux*)
;;
riscv*-*-elf* | riscv*-*-rtems*)
tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
- case "x${enable_multilib}" in
- xno) ;;
- xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;;
- *) echo "Unknown value for enable_multilib"; exit 1
+ case ${target} in
+ *-*-rtems*)
+ tm_file="${tm_file} rtems.h riscv/rtems.h"
+ tmake_file="${tmake_file} riscv/t-rtems"
+ ;;
+ *)
+ case "x${enable_multilib}" in
+ xno) ;;
+ xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;;
+ *) echo "Unknown value for enable_multilib"; exit 1
+ esac
esac
tmake_file="${tmake_file} riscv/t-riscv"
gnu_ld=yes
@@ -2057,11 +2064,6 @@ riscv*-*-elf* | riscv*-*-rtems*)
# Force .init_array support. The configure script cannot always
# automatically detect that GAS supports it, yet we require it.
gcc_cv_initfini_array=yes
- case ${target} in
- riscv*-*-rtems*)
- tm_file="${tm_file} rtems.h riscv/rtems.h"
- ;;
- esac
;;
mips*-*-netbsd*) # NetBSD/mips, either endian.
target_cpu_default="MASK_ABICALLS"
diff --git a/gcc/config/arm/arm_cmse.h b/gcc/config/arm/arm_cmse.h
index 8fde2736a2a..427647fb981 100644
--- a/gcc/config/arm/arm_cmse.h
+++ b/gcc/config/arm/arm_cmse.h
@@ -35,7 +35,6 @@ extern "C" {
#if __ARM_FEATURE_CMSE & 1
#include <stddef.h>
-#include <stdint.h>
#ifdef __ARM_BIG_ENDIAN
@@ -174,9 +173,9 @@ cmse_nonsecure_caller (void)
#define CMSE_MPU_NONSECURE 16
#define CMSE_NONSECURE 18
-#define cmse_nsfptr_create(p) ((typeof ((p))) ((intptr_t) (p) & ~1))
+#define cmse_nsfptr_create(p) ((__typeof__ ((p))) ((__INTPTR_TYPE__) (p) & ~1))
-#define cmse_is_nsfptr(p) (!((intptr_t) (p) & 1))
+#define cmse_is_nsfptr(p) (!((__INTPTR_TYPE__) (p) & 1))
#endif /* __ARM_FEATURE_CMSE & 2 */
@@ -188,7 +187,7 @@ __extension__ void *
cmse_check_address_range (void *, size_t, int);
#define cmse_check_pointed_object(p, f) \
- ((typeof ((p))) cmse_check_address_range ((p), sizeof (*(p)), (f)))
+ ((__typeof__ ((p))) cmse_check_address_range ((p), sizeof (*(p)), (f)))
#endif /* __ARM_FEATURE_CMSE & 1 */
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index ed09ee0bdc2..c5dae5ffe7d 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -6685,6 +6685,20 @@
(set_attr "pent_pair" "pu")
(set_attr "mode" "<MODE>")])
+(define_insn "*add<mode>3_carry_0"
+ [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m")
+ (plus:SWI
+ (match_operator:SWI 3 "ix86_carry_flag_operator"
+ [(match_operand 2 "flags_reg_operand") (const_int 0)])
+ (match_operand:SWI 1 "nonimmediate_operand" "0")))
+ (clobber (reg:CC FLAGS_REG))]
+ "ix86_unary_operator_ok (PLUS, <MODE>mode, operands)"
+ "adc{<imodesuffix>}\t{$0, %0|%0, 0}"
+ [(set_attr "type" "alu")
+ (set_attr "use_carry" "1")
+ (set_attr "pent_pair" "pu")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "*addsi3_carry_zext"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
@@ -6701,6 +6715,20 @@
(set_attr "pent_pair" "pu")
(set_attr "mode" "SI")])
+(define_insn "*addsi3_carry_zext_0"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (zero_extend:DI
+ (plus:SI (match_operator:SI 2 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
+ (match_operand:SI 1 "register_operand" "0"))))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_64BIT"
+ "adc{l}\t{$0, %k0|%k0, 0}"
+ [(set_attr "type" "alu")
+ (set_attr "use_carry" "1")
+ (set_attr "pent_pair" "pu")
+ (set_attr "mode" "SI")])
+
;; There is no point to generate ADCX instruction. ADC is shorter and faster.
(define_insn "addcarry<mode>"
@@ -6741,6 +6769,20 @@
(set_attr "pent_pair" "pu")
(set_attr "mode" "<MODE>")])
+(define_insn "*sub<mode>3_carry_0"
+ [(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m")
+ (minus:SWI
+ (match_operand:SWI 1 "nonimmediate_operand" "0")
+ (match_operator:SWI 3 "ix86_carry_flag_operator"
+ [(match_operand 2 "flags_reg_operand") (const_int 0)])))
+ (clobber (reg:CC FLAGS_REG))]
+ "ix86_unary_operator_ok (MINUS, <MODE>mode, operands)"
+ "sbb{<imodesuffix>}\t{$0, %0|%0, 0}"
+ [(set_attr "type" "alu")
+ (set_attr "use_carry" "1")
+ (set_attr "pent_pair" "pu")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "*subsi3_carry_zext"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
@@ -6758,6 +6800,21 @@
(set_attr "pent_pair" "pu")
(set_attr "mode" "SI")])
+(define_insn "*subsi3_carry_zext_0"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (zero_extend:DI
+ (minus:SI
+ (match_operand:SI 1 "register_operand" "0")
+ (match_operator:SI 2 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)]))))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_64BIT"
+ "sbb{l}\t{$0, %k0|%k0, 0}"
+ [(set_attr "type" "alu")
+ (set_attr "use_carry" "1")
+ (set_attr "pent_pair" "pu")
+ (set_attr "mode" "SI")])
+
(define_insn "subborrow<mode>"
[(set (reg:CCC FLAGS_REG)
(compare:CCC
@@ -9916,7 +9973,7 @@
{
switch (get_attr_type (insn))
{
- case TYPE_ALU:
+ case TYPE_ALU1:
gcc_assert (operands[1] == const1_rtx);
return "add{b}\t%0, %0";
@@ -9932,12 +9989,12 @@
(cond [(and (and (match_test "TARGET_DOUBLE_WITH_ADD")
(match_operand 0 "register_operand"))
(match_operand 1 "const1_operand"))
- (const_string "alu")
+ (const_string "alu1")
]
(const_string "ishift1")))
(set (attr "length_immediate")
(if_then_else
- (ior (eq_attr "type" "alu")
+ (ior (eq_attr "type" "alu1")
(and (eq_attr "type" "ishift1")
(and (match_operand 1 "const1_operand")
(ior (match_test "TARGET_SHIFT1")
@@ -11730,6 +11787,7 @@
"(peep2_reg_dead_p (3, operands[1])
|| operands_match_p (operands[1], operands[3]))
&& ! reg_overlap_mentioned_p (operands[3], operands[0])
+ && ! reg_overlap_mentioned_p (operands[3], operands[4])
&& ! reg_set_p (operands[3], operands[4])
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 5) (match_dup 0))
@@ -11776,6 +11834,7 @@
"(peep2_reg_dead_p (3, operands[1])
|| operands_match_p (operands[1], operands[3]))
&& ! reg_overlap_mentioned_p (operands[3], operands[0])
+ && ! reg_overlap_mentioned_p (operands[3], operands[4])
&& ! reg_set_p (operands[3], operands[4])
&& peep2_regno_dead_p (0, FLAGS_REG)"
[(parallel [(set (match_dup 5) (match_dup 0))
@@ -15536,7 +15595,8 @@
"(TARGET_USE_FANCY_MATH_387
&& (!(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
|| TARGET_MIX_SSE_I387)
- && flag_unsafe_math_optimizations)
+ && flag_unsafe_math_optimizations
+ && (flag_fp_int_builtin_inexact || !flag_trapping_math))
|| (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH
&& !flag_trapping_math && !flag_rounding_math)"
{
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 1cd6efb300e..c8c3a5045b7 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -1134,11 +1134,8 @@
operands[2]));
}
else if (memory_operand (operands[1], DImode))
- {
- rtx tmp = gen_reg_rtx (V2DImode);
- emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
- emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
- }
+ emit_insn (gen_vec_concatv2di (gen_lowpart (V2DImode, operands[0]),
+ operands[1], const0_rtx));
else
gcc_unreachable ();
DONE;
@@ -4398,7 +4395,7 @@
(match_operand:VF_128 1 "register_operand" "v")
(const_int 1)))]
"TARGET_AVX512F && TARGET_64BIT"
- "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
+ "vcvtusi2<ssescalarmodesuffix>{q}\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
[(set_attr "type" "sseicvt")
(set_attr "prefix" "evex")
(set_attr "mode" "<ssescalarmode>")])
@@ -8883,14 +8880,14 @@
;; see comment above inline_secondary_memory_needed function in i386.c
(define_insn "sse2_loadhpd"
[(set (match_operand:V2DF 0 "nonimmediate_operand"
- "=x,v,x,v,o,o ,o")
+ "=x,v,x,v ,o,o ,o")
(vec_concat:V2DF
(vec_select:DF
(match_operand:V2DF 1 "nonimmediate_operand"
- " 0,v,0,v,0,0 ,0")
+ " 0,v,0,v ,0,0 ,0")
(parallel [(const_int 0)]))
(match_operand:DF 2 "nonimmediate_operand"
- " m,m,x,v,x,*f,r")))]
+ " m,m,x,Yv,x,*f,r")))]
"TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
"@
movhpd\t{%2, %0|%0, %2}
@@ -10683,11 +10680,14 @@
(const_string "0")))
(set_attr "mode" "<sseinsnmode>")])
+(define_mode_attr vshift_count
+ [(V32HI "v") (V16HI "Yv") (V8HI "Yv")])
+
(define_insn "<shift_insn><mode>3<mask_name>"
[(set (match_operand:VI2_AVX2_AVX512BW 0 "register_operand" "=x,v")
(any_lshift:VI2_AVX2_AVX512BW
(match_operand:VI2_AVX2_AVX512BW 1 "register_operand" "0,v")
- (match_operand:DI 2 "nonmemory_operand" "xN,vN")))]
+ (match_operand:DI 2 "nonmemory_operand" "xN,<vshift_count>N")))]
"TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
"@
p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
@@ -10706,7 +10706,7 @@
[(set (match_operand:VI48_AVX2 0 "register_operand" "=x,x,v")
(any_lshift:VI48_AVX2
(match_operand:VI48_AVX2 1 "register_operand" "0,x,v")
- (match_operand:DI 2 "nonmemory_operand" "xN,xN,vN")))]
+ (match_operand:DI 2 "nonmemory_operand" "xN,xN,YvN")))]
"TARGET_SSE2 && <mask_mode512bit_condition>"
"@
p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
diff --git a/gcc/config/riscv/t-rtems b/gcc/config/riscv/t-rtems
new file mode 100644
index 00000000000..41f5927fc87
--- /dev/null
+++ b/gcc/config/riscv/t-rtems
@@ -0,0 +1,25 @@
+MULTILIB_OPTIONS =
+MULTILIB_DIRNAMES =
+
+MULTILIB_OPTIONS += march=rv32i/march=rv32im/march=rv32imafd/march=rv32iac/march=rv32imac/march=rv32imafc/march=rv64imafd/march=rv64imac/march=rv64imafdc
+MULTILIB_DIRNAMES += rv32i rv32im rv32imafd rv32iac rv32imac rv32imafc rv64imafd rv64imac rv64imafdc
+
+MULTILIB_OPTIONS += mabi=ilp32/mabi=ilp32f/mabi=ilp32d/mabi=lp64/mabi=lp64d
+MULTILIB_DIRNAMES += ilp32 ilp32f ilp32d lp64 lp64d
+
+MULTILIB_OPTIONS += mcmodel=medany
+MULTILIB_DIRNAMES += medany
+
+MULTILIB_REQUIRED =
+MULTILIB_REQUIRED += march=rv32i/mabi=ilp32
+MULTILIB_REQUIRED += march=rv32im/mabi=ilp32
+MULTILIB_REQUIRED += march=rv32imafd/mabi=ilp32d
+MULTILIB_REQUIRED += march=rv32iac/mabi=ilp32
+MULTILIB_REQUIRED += march=rv32imac/mabi=ilp32
+MULTILIB_REQUIRED += march=rv32imafc/mabi=ilp32f
+MULTILIB_REQUIRED += march=rv64imafd/mabi=lp64d
+MULTILIB_REQUIRED += march=rv64imafd/mabi=lp64d/mcmodel=medany
+MULTILIB_REQUIRED += march=rv64imac/mabi=lp64
+MULTILIB_REQUIRED += march=rv64imac/mabi=lp64/mcmodel=medany
+MULTILIB_REQUIRED += march=rv64imafdc/mabi=lp64d
+MULTILIB_REQUIRED += march=rv64imafdc/mabi=lp64d/mcmodel=medany
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 24904d1bd74..516db05da8f 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2393,7 +2393,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKSDUS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
- { ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKSDUS,
+ { ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKUDUS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKSWUS, ALTIVEC_BUILTIN_VPKSWUS,
RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 75eab0375af..0797c16b120 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8565,6 +8565,13 @@ mem_operand_gpr (rtx op, machine_mode mode)
int extra;
rtx addr = XEXP (op, 0);
+ /* PR85755: Allow PRE_INC and PRE_DEC addresses. */
+ if (TARGET_UPDATE
+ && (GET_CODE (addr) == PRE_INC || GET_CODE (addr) == PRE_DEC)
+ && mode_supports_pre_incdec_p (mode)
+ && legitimate_indirect_address_p (XEXP (addr, 0), false))
+ return true;
+
/* Don't allow non-offsettable addresses. See PRs 83969 and 84279. */
if (!rs6000_offsettable_memref_p (op, mode, false))
return false;
@@ -14117,6 +14124,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
tree copy = build_call_expr (builtin_decl_implicit (BUILT_IN_MEMCPY),
3, dest_addr, addr, size_int (rsize * 4));
+ TREE_ADDRESSABLE (tmp) = 1;
gimplify_and_add (copy, pre_p);
addr = dest_addr;
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 76c44ef31b3..ba234fda718 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -110,7 +110,8 @@
/* Common ASM definitions used by ASM_SPEC among the various targets for
handling -mcpu=xxx switches. There is a parallel list in driver-rs6000.c to
provide the default assembler options if the user uses -mcpu=native, so if
- you make changes here, make them also there. */
+ you make changes here, make them also there. PR63177: Do not pass -mpower8
+ to the assembler if -mpower9-vector was also used. */
#define ASM_CPU_SPEC \
"%{!mcpu*: \
%{mpowerpc64*: -mppc64} \
@@ -124,7 +125,7 @@
%{mcpu=power6: %(asm_cpu_power6) -maltivec} \
%{mcpu=power6x: %(asm_cpu_power6) -maltivec} \
%{mcpu=power7: %(asm_cpu_power7)} \
-%{mcpu=power8: %(asm_cpu_power8)} \
+%{mcpu=power8: %{!mpower9-vector: %(asm_cpu_power8)}} \
%{mcpu=power9: %(asm_cpu_power9)} \
%{mcpu=a2: -ma2} \
%{mcpu=powerpc: -mppc} \
@@ -173,6 +174,7 @@
%{maltivec: -maltivec} \
%{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
%{mpower8-vector|mcrypto|mdirect-move|mhtm: %{!mcpu*: %(asm_cpu_power8)}} \
+%{mpower9-vector: %{!mcpu*|mcpu=power8: %(asm_cpu_power9)}} \
-many"
#define CPP_DEFAULT_SPEC ""
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index ca7c04e275a..4428a1e2944 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -14463,16 +14463,14 @@
(set_attr "length" "4")])
(define_insn_and_split "pack<mode>"
- [(set (match_operand:FMOVE128 0 "register_operand" "=d,&d")
+ [(set (match_operand:FMOVE128 0 "register_operand" "=&d")
(unspec:FMOVE128
- [(match_operand:<FP128_64> 1 "register_operand" "0,d")
- (match_operand:<FP128_64> 2 "register_operand" "d,d")]
+ [(match_operand:<FP128_64> 1 "register_operand" "d")
+ (match_operand:<FP128_64> 2 "register_operand" "d")]
UNSPEC_PACK_128BIT))]
"FLOAT128_2REG_P (<MODE>mode)"
- "@
- fmr %L0,%2
- #"
- "&& reload_completed && REGNO (operands[0]) != REGNO (operands[1])"
+ "#"
+ "&& reload_completed"
[(set (match_dup 3) (match_dup 1))
(set (match_dup 4) (match_dup 2))]
{
@@ -14485,8 +14483,8 @@
operands[3] = gen_rtx_REG (<FP128_64>mode, dest_hi);
operands[4] = gen_rtx_REG (<FP128_64>mode, dest_lo);
}
- [(set_attr "type" "fpsimple,fp")
- (set_attr "length" "4,8")])
+ [(set_attr "type" "fp")
+ (set_attr "length" "8")])
(define_insn "unpack<mode>"
[(set (match_operand:DI 0 "register_operand" "=d,d")
diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h
index 439199d4cbb..35026efa2c7 100644
--- a/gcc/config/rtems.h
+++ b/gcc/config/rtems.h
@@ -48,3 +48,7 @@
-latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}"
#define TARGET_POSIX_IO
+
+/* Prefer int for int32_t (see stdint-newlib.h). */
+#undef STDINT_LONG32
+#define STDINT_LONG32 (INT_TYPE_SIZE != 32 && LONG_TYPE_SIZE == 32)
diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def
index b7f33030eb9..915b050b2fb 100644
--- a/gcc/config/s390/s390-builtin-types.def
+++ b/gcc/config/s390/s390-builtin-types.def
@@ -124,6 +124,7 @@ DEF_OPAQUE_VECTOR_TYPE (BT_OUV4SI, BT_UINT, 4)
DEF_OPAQUE_VECTOR_TYPE (BT_BV4SI, BT_BINT, 4)
DEF_FN_TYPE_0 (BT_FN_INT, BT_INT)
DEF_FN_TYPE_0 (BT_FN_UINT, BT_UINT)
+DEF_FN_TYPE_0 (BT_FN_VOID, BT_VOID)
DEF_FN_TYPE_1 (BT_FN_INT_INT, BT_INT, BT_INT)
DEF_FN_TYPE_1 (BT_FN_INT_VOIDPTR, BT_INT, BT_VOIDPTR)
DEF_FN_TYPE_1 (BT_FN_OV4SI_INT, BT_OV4SI, BT_INT)
diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def
index 9046cb08f94..c2f278dc9c3 100644
--- a/gcc/config/s390/s390-builtins.def
+++ b/gcc/config/s390/s390-builtins.def
@@ -294,7 +294,7 @@
flags: Flags applying to all its variants should be mentioned in the OB_DEF line instead. */
-B_DEF (tbeginc, tbeginc, 0, B_HTM, 0, BT_FN_INT)
+B_DEF (tbeginc, tbeginc, 0, B_HTM, 0, BT_FN_VOID)
B_DEF (tbegin, tbegin, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR)
B_DEF (tbegin_nofloat, tbegin_nofloat, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR)
B_DEF (tbegin_retry, tbegin_retry, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR_INT)
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 68e3876f51d..f204204b435 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -205,7 +205,7 @@ enum processor_flags
#define OPTION_DEFAULT_SPECS \
{ "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \
{ "arch", "%{!march=*:-march=%(VALUE)}" }, \
- { "tune", "%{!mtune=*:-mtune=%(VALUE)}" }
+ { "tune", "%{!mtune=*:%{!march=*:-mtune=%(VALUE)}}" }
#ifdef __s390__
extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index d5596e25d82..0eba10b742c 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -38,6 +38,7 @@
(UNSPEC_MEMW 11)
(UNSPEC_LSETUP_START 12)
(UNSPEC_LSETUP_END 13)
+ (UNSPEC_FRAME_BLOCKAGE 14)
(UNSPECV_SET_FP 1)
(UNSPECV_ENTRY 2)
@@ -1676,6 +1677,32 @@
;; Miscellaneous instructions.
+;; In windowed ABI stack pointer adjustment must happen before any access
+;; to the space allocated on stack is allowed, otherwise register spill
+;; area may be clobbered. That's what frame blockage is supposed to enforce.
+
+(define_expand "allocate_stack"
+ [(set (match_operand 0 "nonimmed_operand")
+ (minus (reg A1_REG) (match_operand 1 "add_operand")))
+ (set (reg A1_REG)
+ (minus (reg A1_REG) (match_dup 1)))]
+ "TARGET_WINDOWED_ABI"
+{
+ if (CONST_INT_P (operands[1]))
+ {
+ rtx neg_op0 = GEN_INT (-INTVAL (operands[1]));
+ emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, neg_op0));
+ }
+ else
+ {
+ emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx,
+ operands[1]));
+ }
+ emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
+ emit_insn (gen_frame_blockage ());
+ DONE;
+})
+
(define_expand "prologue"
[(const_int 0)]
""
@@ -1767,6 +1794,25 @@
[(set_attr "length" "0")
(set_attr "type" "nop")])
+;; Do not schedule instructions accessing memory before this point.
+
+(define_expand "frame_blockage"
+ [(set (match_dup 0)
+ (unspec:BLK [(match_dup 1)] UNSPEC_FRAME_BLOCKAGE))]
+ ""
+{
+ operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[0]) = 1;
+ operands[1] = stack_pointer_rtx;
+})
+
+(define_insn "*frame_blockage"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_operand:SI 1 "" "")] UNSPEC_FRAME_BLOCKAGE))]
+ ""
+ ""
+ [(set_attr "length" "0")])
+
(define_insn "trap"
[(trap_if (const_int 1) (const_int 0))]
""
diff --git a/gcc/configure b/gcc/configure
index f63729f150f..6804d30eace 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11872,7 +11872,7 @@ EOF
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
@@ -25226,6 +25226,7 @@ $as_echo "#define HAVE_AS_SPARC5_VIS4 1" >>confdefs.h
fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for SPARC6 instructions" >&5
$as_echo_n "checking assembler for SPARC6 instructions... " >&6; }
if test "${gcc_cv_as_sparc_sparc6+set}" = set; then :
@@ -25262,6 +25263,7 @@ $as_echo "#define HAVE_AS_SPARC6 1" >>confdefs.h
fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for LEON instructions" >&5
$as_echo_n "checking assembler for LEON instructions... " >&6; }
if test "${gcc_cv_as_sparc_leon+set}" = set; then :
@@ -29786,8 +29788,10 @@ _ACEOF
# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
# of jit/jit-playback.c.
+gcc_driver_version=`eval "${get_gcc_base_ver} $srcdir/BASE-VER"`
+echo "gcc_driver_version: ${gcc_driver_version}"
cat > gcc-driver-name.h <<EOF
-#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
+#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_driver_version}${exeext}"
EOF
# Check whether --enable-default-pie was given.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 0cdbf8e7a9e..cf21b8f879e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6300,8 +6300,10 @@ AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, $DIAGNOSTICS_COLOR_DEFAULT,
# Generate gcc-driver-name.h containing GCC_DRIVER_NAME for the benefit
# of jit/jit-playback.c.
+gcc_driver_version=`eval "${get_gcc_base_ver} $srcdir/BASE-VER"`
+echo "gcc_driver_version: ${gcc_driver_version}"
cat > gcc-driver-name.h <<EOF
-#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_BASEVER}${exeext}"
+#define GCC_DRIVER_NAME "${target_noncanonical}-gcc-${gcc_driver_version}${exeext}"
EOF
# Check whether --enable-default-pie was given.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2a5f0e0985e..7fabfa0109b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,153 @@
+2018-06-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86291
+ * parser.c (cp_parser_omp_for_loop_init): Change for_block argument
+ type from vec<tree, va_gc> * to vec<tree, va_gc> *&.
+
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85952
+ * init.c (build_aggr_init): For structured binding initialized from
+ array call mark_rvalue_use on the initializer.
+
+ 2018-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85696
+ * cp-tree.h (cxx_omp_predetermined_sharing_1): New prototype.
+ * cp-gimplify.c (cxx_omp_predetermined_sharing): New wrapper around
+ cxx_omp_predetermined_sharing_1. Rename old function to ...
+ (cxx_omp_predetermined_sharing_1): ... this.
+ * semantics.c (finish_omp_clauses): Use cxx_omp_predetermined_sharing_1
+ instead of cxx_omp_predetermined_sharing.
+
+ 2018-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85662
+ * cp-gimplify.c (cp_fold): Use fold_offsetof rather than
+ fold_offsetof_1, pass TREE_TYPE (x) as TYPE to it and drop the
+ fold_convert.
+
+ 2018-04-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84463
+ * typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
+ tricks from here to ...
+ * cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here. Only use it
+ if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.
+
+ 2018-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85210
+ * pt.c (tsubst_decomp_names): Return error_mark_node and assert
+ errorcount is set if tsubst doesn't return a VAR_DECL.
+
+ 2018-04-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85208
+ * decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
+ maybe_apply_pragma_weak here...
+ (cp_maybe_mangle_decomp): ... but call it here instead.
+
+ 2018-04-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/85172
+ * constexpr.c (cxx_eval_builtin_function_call): For calls to
+ builtin_valid_in_constant_expr_p functions, don't call
+ cxx_eval_constant_expression if argument is not
+ potential_constant_expression.
+
+ 2018-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85147
+ * pt.c (fixed_parameter_pack_p_1): Punt if parm is error_mark_node.
+
+ PR c++/85140
+ * name-lookup.c (handle_namespace_attrs): Return early if attributes
+ is error_mark_node.
+
+ 2018-03-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84791
+ * semantics.c (finish_omp_reduction_clause): If
+ OMP_CLAUSE_REDUCTION_PLACEHOLDER is error_mark_node, return true
+ even if processing_template_decl.
+
+ 2018-03-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85076
+ * tree.c (cp_build_reference_type): If to_type is error_mark_node,
+ return it right away.
+
+ PR c++/85068
+ * class.c (update_vtable_entry_for_fn): Don't ICE if base_binfo
+ is NULL. Assert if thunk_binfo is NULL then errorcount is non-zero.
+
+ 2018-03-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84961
+ * cp-tree.h (genericize_compound_lvalue): Declare.
+ * typeck.c (genericize_compound_lvalue): New function.
+ (unary_complex_lvalue, cp_build_modify_expr): Use it.
+ * semantics.c (finish_asm_stmt): Replace MODIFY_EXPR, PREINCREMENT_EXPR
+ and PREDECREMENT_EXPR in output and "m" constrained input operands with
+ COMPOUND_EXPR. Call cxx_mark_addressable on the rightmost
+ COMPOUND_EXPR operand.
+
+ 2018-03-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84874
+ * decl.c (reshape_init_class): Don't assert d->cur->index == field
+ if d->cur->index is a FIELD_DECL, instead set field to d->cur->index.
+
+ 2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84222
+ * cp-tree.h (cp_warn_deprecated_use): Declare.
+ * tree.c (cp_warn_deprecated_use): New function.
+ * typeck2.c (build_functional_cast): Use it.
+ * decl.c (grokparms): Likewise.
+ (grokdeclarator): Likewise. Temporarily push nested class scope
+ around grokparms call for out of class member definitions.
+
+ 2018-03-09 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84076
+ * call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
+ build ADDR_EXPR with REFERENCE_TYPE.
+ (build_over_call): For purposes of check_function_arguments, if
+ argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
+ its operand rather than the argument itself.
+
+ 2018-03-08 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/80598
+ * call.c (build_over_call): In templates set TREE_USED (first_fn) when
+ not calling mark_used for the benefit of -Wunused-function warning.
+
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84662
+ * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
+ RETURN instead of return.
+ <case POINTER_PLUS_EXPR>: Likewise.
+ <case CONVERT_EXPR>: If op0 is error_mark_node, just return
+ it instead of wrapping it into CONVERT_EXPR.
+
+2018-06-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/85815 - reference to member of enclosing template.
+ * parser.c (cp_parser_postfix_dot_deref_expression): Check
+ currently_open_class.
+
+ PR c++/86060 - ICE on range for with -std=c++98.
+ * parser.c (cp_parser_init_statement): Don't clobber *decl after
+ pedwarn.
+
2018-05-07 Jason Merrill <jason@redhat.com>
PR c++/85646 - lambda visibility.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 012134fd47a..5145e438460 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7144,7 +7144,7 @@ convert_arg_to_ellipsis (tree arg, tsubst_flags_t complain)
"passing objects of non-trivially-copyable "
"type %q#T through %<...%> is conditionally supported",
arg_type);
- return cp_build_addr_expr (arg, complain);
+ return build1 (ADDR_EXPR, build_reference_type (arg_type), arg);
}
/* Build up a real lvalue-to-rvalue conversion in case the
copy constructor is trivial but not callable. */
@@ -7568,6 +7568,10 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (undeduced_auto_decl (fn))
mark_used (fn, complain);
+ else
+ /* Otherwise set TREE_USED for the benefit of -Wunused-function.
+ See PR80598. */
+ TREE_USED (fn) = 1;
return_type = TREE_TYPE (TREE_TYPE (fn));
nargs = vec_safe_length (args);
@@ -7931,7 +7935,15 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree *fargs = (!nargs ? argarray
: (tree *) alloca (nargs * sizeof (tree)));
for (j = 0; j < nargs; j++)
- fargs[j] = maybe_constant_value (argarray[j]);
+ {
+ /* For -Wformat undo the implicit passing by hidden reference
+ done by convert_arg_to_ellipsis. */
+ if (TREE_CODE (argarray[j]) == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (argarray[j])) == REFERENCE_TYPE)
+ fargs[j] = TREE_OPERAND (argarray[j], 0);
+ else
+ fargs[j] = maybe_constant_value (argarray[j]);
+ }
warned_p = check_function_arguments (input_location, fn, TREE_TYPE (fn),
nargs, fargs);
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 5a4c9840acf..a1bf77589dc 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2732,19 +2732,20 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
order. Of course it is lame that we have to repeat the
search here anyway -- we should really be caching pieces
of the vtable and avoiding this repeated work. */
- tree thunk_binfo, base_binfo;
+ tree thunk_binfo = NULL_TREE;
+ tree base_binfo = TYPE_BINFO (base_return);
/* Find the base binfo within the overriding function's
return type. We will always find a thunk_binfo, except
when the covariancy is invalid (which we will have
already diagnosed). */
- for (base_binfo = TYPE_BINFO (base_return),
- thunk_binfo = TYPE_BINFO (over_return);
- thunk_binfo;
- thunk_binfo = TREE_CHAIN (thunk_binfo))
- if (SAME_BINFO_TYPE_P (BINFO_TYPE (thunk_binfo),
- BINFO_TYPE (base_binfo)))
- break;
+ if (base_binfo)
+ for (thunk_binfo = TYPE_BINFO (over_return); thunk_binfo;
+ thunk_binfo = TREE_CHAIN (thunk_binfo))
+ if (SAME_BINFO_TYPE_P (BINFO_TYPE (thunk_binfo),
+ BINFO_TYPE (base_binfo)))
+ break;
+ gcc_assert (thunk_binfo || errorcount);
/* See if virtual inheritance is involved. */
for (virtual_offset = thunk_binfo;
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 96f8277bdf2..361a955ba01 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1158,8 +1158,14 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
bool dummy1 = false, dummy2 = false;
for (i = 0; i < nargs; ++i)
{
- args[i] = cxx_eval_constant_expression (&new_ctx, CALL_EXPR_ARG (t, i),
- false, &dummy1, &dummy2);
+ args[i] = CALL_EXPR_ARG (t, i);
+ /* If builtin_valid_in_constant_expr_p is true,
+ potential_constant_expression_1 has not recursed into the arguments
+ of the builtin, verify it here. */
+ if (!builtin_valid_in_constant_expr_p (fun)
+ || potential_constant_expression (args[i]))
+ args[i] = cxx_eval_constant_expression (&new_ctx, args[i], false,
+ &dummy1, &dummy2);
if (bi_const_p)
/* For __built_in_constant_p, fold all expressions with constant values
even if they aren't C++ constant-expressions. */
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index b3c6374416a..4891346a609 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1918,7 +1918,7 @@ cxx_omp_const_qual_no_mutable (tree decl)
/* True if OpenMP sharing attribute of DECL is predetermined. */
enum omp_clause_default_kind
-cxx_omp_predetermined_sharing (tree decl)
+cxx_omp_predetermined_sharing_1 (tree decl)
{
/* Static data members are predetermined shared. */
if (TREE_STATIC (decl))
@@ -1936,6 +1936,32 @@ cxx_omp_predetermined_sharing (tree decl)
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
+/* Likewise, but also include the artificial vars. We don't want to
+ disallow the artificial vars being mentioned in explicit clauses,
+ as we use artificial vars e.g. for loop constructs with random
+ access iterators other than pointers, but during gimplification
+ we want to treat them as predetermined. */
+
+enum omp_clause_default_kind
+cxx_omp_predetermined_sharing (tree decl)
+{
+ enum omp_clause_default_kind ret = cxx_omp_predetermined_sharing_1 (decl);
+ if (ret != OMP_CLAUSE_DEFAULT_UNSPECIFIED)
+ return ret;
+
+ /* Predetermine artificial variables holding integral values, those
+ are usually result of gimplify_one_sizepos or SAVE_EXPR
+ gimplification. */
+ if (VAR_P (decl)
+ && DECL_ARTIFICIAL (decl)
+ && INTEGRAL_TYPE_P (TREE_TYPE (decl))
+ && !(DECL_LANG_SPECIFIC (decl)
+ && DECL_OMP_PRIVATIZED_MEMBER (decl)))
+ return OMP_CLAUSE_DEFAULT_SHARED;
+
+ return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
+}
+
/* Finalize an implicitly determined clause. */
void
@@ -2156,6 +2182,28 @@ cp_fold (tree x)
goto unary;
case ADDR_EXPR:
+ loc = EXPR_LOCATION (x);
+ op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), false);
+
+ /* Cope with user tricks that amount to offsetof. */
+ if (op0 != error_mark_node
+ && TREE_CODE (TREE_TYPE (op0)) != FUNCTION_TYPE
+ && TREE_CODE (TREE_TYPE (op0)) != METHOD_TYPE)
+ {
+ tree val = get_base_address (op0);
+ if (val
+ && INDIRECT_REF_P (val)
+ && COMPLETE_TYPE_P (TREE_TYPE (val))
+ && TREE_CONSTANT (TREE_OPERAND (val, 0)))
+ {
+ val = TREE_OPERAND (val, 0);
+ STRIP_NOPS (val);
+ if (TREE_CODE (val) == INTEGER_CST)
+ return fold_offsetof (op0, TREE_TYPE (x));
+ }
+ }
+ goto finish_unary;
+
case REALPART_EXPR:
case IMAGPART_EXPR:
rval_ops = false;
@@ -2173,6 +2221,7 @@ cp_fold (tree x)
loc = EXPR_LOCATION (x);
op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops);
+ finish_unary:
if (op0 != TREE_OPERAND (x, 0))
{
if (op0 == error_mark_node)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index fadf6ecb1a2..664def60405 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6708,6 +6708,7 @@ extern tree cxx_copy_lang_qualifiers (const_tree, const_tree);
extern void cxx_print_statistics (void);
extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
+extern void cp_warn_deprecated_use (tree);
/* in ptree.c */
extern void cxx_print_xnode (FILE *, tree, int);
@@ -6777,6 +6778,7 @@ extern tree cp_build_addressof (location_t, tree,
extern tree cp_build_addr_expr (tree, tsubst_flags_t);
extern tree cp_build_unary_op (enum tree_code, tree, bool,
tsubst_flags_t);
+extern tree genericize_compound_lvalue (tree);
extern tree unary_complex_lvalue (enum tree_code, tree);
extern tree build_x_conditional_expr (location_t, tree, tree, tree,
tsubst_flags_t);
@@ -6941,6 +6943,7 @@ extern int cp_gimplify_expr (tree *, gimple_seq *,
gimple_seq *);
extern void cp_genericize (tree);
extern bool cxx_omp_const_qual_no_mutable (tree);
+extern enum omp_clause_default_kind cxx_omp_predetermined_sharing_1 (tree);
extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
extern tree cxx_omp_clause_default_ctor (tree, tree, tree);
extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 836506ef7be..950e04a6680 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5022,7 +5022,7 @@ start_decl (const cp_declarator *declarator,
}
/* If #pragma weak was used, mark the decl weak now. */
- if (!processing_template_decl)
+ if (!processing_template_decl && !DECL_DECOMPOSITION_P (decl))
maybe_apply_pragma_weak (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
@@ -5796,8 +5796,18 @@ reshape_init_class (tree type, reshape_iter *d, bool first_initializer_p,
return error_mark_node;
if (TREE_CODE (d->cur->index) == FIELD_DECL)
- /* We already reshaped this. */
- gcc_assert (d->cur->index == field);
+ {
+ /* We already reshaped this. */
+ if (field != d->cur->index)
+ {
+ tree id = DECL_NAME (d->cur->index);
+ gcc_assert (id);
+ gcc_checking_assert (lookup_field_1 (type, id,
+ /*want_type=*/false)
+ == d->cur->index);
+ field = d->cur->index;
+ }
+ }
else if (TREE_CODE (d->cur->index) == IDENTIFIER_NODE)
field = lookup_field_1 (type, d->cur->index, /*want_type=*/false);
else
@@ -7412,6 +7422,7 @@ cp_maybe_mangle_decomp (tree decl, tree first, unsigned int count)
for (unsigned int i = 0; i < count; i++, d = DECL_CHAIN (d))
v[count - i - 1] = d;
SET_DECL_ASSEMBLER_NAME (decl, mangle_decomp (decl, v));
+ maybe_apply_pragma_weak (decl);
}
}
@@ -10400,7 +10411,7 @@ grokdeclarator (const cp_declarator *declarator,
suppress reports of deprecated items. */
if (type && TREE_DEPRECATED (type)
&& deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (type, NULL_TREE);
+ cp_warn_deprecated_use (type);
if (type && TREE_CODE (type) == TYPE_DECL)
{
typedef_decl = type;
@@ -10408,7 +10419,7 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_DEPRECATED (type)
&& DECL_ARTIFICIAL (typedef_decl)
&& deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (type, NULL_TREE);
+ cp_warn_deprecated_use (type);
}
/* No type at all: default to `int', and set DEFAULTED_INT
because it was not a user-defined typedef. */
@@ -11203,8 +11214,18 @@ grokdeclarator (const cp_declarator *declarator,
explicitp = 2;
}
- arg_types = grokparms (declarator->u.function.parameters,
- &parms);
+ tree pushed_scope = NULL_TREE;
+ if (funcdecl_p
+ && decl_context != FIELD
+ && inner_declarator->u.id.qualifying_scope
+ && CLASS_TYPE_P (inner_declarator->u.id.qualifying_scope))
+ pushed_scope
+ = push_scope (inner_declarator->u.id.qualifying_scope);
+
+ arg_types = grokparms (declarator->u.function.parameters, &parms);
+
+ if (pushed_scope)
+ pop_scope (pushed_scope);
if (inner_declarator
&& inner_declarator->kind == cdk_id
@@ -12721,7 +12742,7 @@ grokparms (tree parmlist, tree *parms)
{
tree deptype = type_is_deprecated (type);
if (deptype)
- warn_deprecated_use (deptype, NULL_TREE);
+ cp_warn_deprecated_use (deptype);
}
/* Top-level qualifiers on the parameters are
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e9c39ff25e6..ec01f6b6776 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1632,6 +1632,7 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
if (VAR_P (exp) && DECL_DECOMPOSITION_P (exp))
{
from_array = 1;
+ init = mark_rvalue_use (init);
if (init && DECL_P (init)
&& !(flags & LOOKUP_ONLYCONVERTING))
{
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index dc8e82c2fe2..6ccfdbfdb71 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3684,6 +3684,9 @@ handle_namespace_attrs (tree ns, tree attributes)
tree d;
bool saw_vis = false;
+ if (attributes == error_mark_node)
+ return false;
+
for (d = attributes; d; d = TREE_CHAIN (d))
{
tree name = get_attribute_name (d);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9a65d945232..24ecf17b3b4 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7364,9 +7364,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
if (postfix_expression != current_class_ref
&& scope != error_mark_node
&& !(processing_template_decl
- && current_class_type
- && (same_type_ignoring_top_level_qualifiers_p
- (scope, current_class_type))))
+ && currently_open_class (scope)))
{
scope = complete_type (scope);
if (!COMPLETE_TYPE_P (scope)
@@ -12103,12 +12101,9 @@ cp_parser_init_statement (cp_parser* parser, tree *decl)
cp_lexer_consume_token (parser->lexer);
is_range_for = true;
if (cxx_dialect < cxx11)
- {
- pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
- "range-based %<for%> loops only available with "
- "-std=c++11 or -std=gnu++11");
- *decl = error_mark_node;
- }
+ pedwarn (cp_lexer_peek_token (parser->lexer)->location, 0,
+ "range-based %<for%> loops only available with "
+ "-std=c++11 or -std=gnu++11");
}
else
/* The ';' is not consumed yet because we told
@@ -34291,7 +34286,7 @@ static tree
cp_parser_omp_for_loop_init (cp_parser *parser,
enum tree_code code,
tree &this_pre_body,
- vec<tree, va_gc> *for_block,
+ vec<tree, va_gc> *&for_block,
tree &init,
tree &orig_init,
tree &decl,
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9a1e632fb22..79cfd012922 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4864,7 +4864,7 @@ static void
fixed_parameter_pack_p_1 (tree parm, struct find_parameter_pack_data *ppd)
{
/* A type parm can't refer to another parm. */
- if (TREE_CODE (parm) == TYPE_DECL)
+ if (TREE_CODE (parm) == TYPE_DECL || parm == error_mark_node)
return;
else if (TREE_CODE (parm) == PARM_DECL)
{
@@ -15804,6 +15804,12 @@ tsubst_decomp_names (tree decl, tree pattern_decl, tree args,
DECL_HAS_VALUE_EXPR_P (decl2) = 1;
if (VAR_P (decl3))
DECL_TEMPLATE_INSTANTIATED (decl3) = 1;
+ else
+ {
+ gcc_assert (errorcount);
+ decl = error_mark_node;
+ continue;
+ }
maybe_push_decl (decl3);
if (error_operand_p (decl3))
decl = error_mark_node;
@@ -16792,14 +16798,14 @@ tsubst_copy_and_build (tree t,
if (targs)
targs = tsubst_template_args (targs, args, complain, in_decl);
if (targs == error_mark_node)
- return error_mark_node;
+ RETURN (error_mark_node);
if (TREE_CODE (templ) == SCOPE_REF)
{
tree name = TREE_OPERAND (templ, 1);
tree tid = lookup_template_function (name, targs);
TREE_OPERAND (templ, 1) = tid;
- return templ;
+ RETURN (templ);
}
if (variable_template_p (templ))
@@ -16864,6 +16870,8 @@ tsubst_copy_and_build (tree t,
{
tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
tree op0 = RECUR (TREE_OPERAND (t, 0));
+ if (op0 == error_mark_node)
+ RETURN (error_mark_node);
RETURN (build1 (CONVERT_EXPR, type, op0));
}
@@ -17011,7 +17019,7 @@ tsubst_copy_and_build (tree t,
{
tree op0 = RECUR (TREE_OPERAND (t, 0));
tree op1 = RECUR (TREE_OPERAND (t, 1));
- return fold_build_pointer_plus (op0, op1);
+ RETURN (fold_build_pointer_plus (op0, op1));
}
case SCOPE_REF:
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 481c88b0728..34ca72e10a0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1483,6 +1483,21 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
&& C_TYPE_FIELDS_READONLY (TREE_TYPE (operand)))))
cxx_readonly_error (operand, lv_asm);
+ tree *op = &operand;
+ while (TREE_CODE (*op) == COMPOUND_EXPR)
+ op = &TREE_OPERAND (*op, 1);
+ switch (TREE_CODE (*op))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case MODIFY_EXPR:
+ *op = genericize_compound_lvalue (*op);
+ op = &TREE_OPERAND (*op, 1);
+ break;
+ default:
+ break;
+ }
+
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
oconstraints[i] = constraint;
@@ -1491,7 +1506,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
{
/* If the operand is going to end up in memory,
mark it addressable. */
- if (!allows_reg && !cxx_mark_addressable (operand))
+ if (!allows_reg && !cxx_mark_addressable (*op))
operand = error_mark_node;
}
else
@@ -1533,7 +1548,23 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
/* Strip the nops as we allow this case. FIXME, this really
should be rejected or made deprecated. */
STRIP_NOPS (operand);
- if (!cxx_mark_addressable (operand))
+
+ tree *op = &operand;
+ while (TREE_CODE (*op) == COMPOUND_EXPR)
+ op = &TREE_OPERAND (*op, 1);
+ switch (TREE_CODE (*op))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case MODIFY_EXPR:
+ *op = genericize_compound_lvalue (*op);
+ op = &TREE_OPERAND (*op, 1);
+ break;
+ default:
+ break;
+ }
+
+ if (!cxx_mark_addressable (*op))
operand = error_mark_node;
}
else if (!allows_reg && !allows_mem)
@@ -5607,7 +5638,11 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor)
return false;
}
else if (processing_template_decl)
- return false;
+ {
+ if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (c) == error_mark_node)
+ return true;
+ return false;
+ }
tree id = OMP_CLAUSE_REDUCTION_PLACEHOLDER (c);
@@ -7336,7 +7371,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
if (VAR_P (t) && CP_DECL_THREAD_LOCAL_P (t))
share_name = "threadprivate";
- else switch (cxx_omp_predetermined_sharing (t))
+ else switch (cxx_omp_predetermined_sharing_1 (t))
{
case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
break;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5fef52674f6..3b25ab92a15 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1050,6 +1050,9 @@ cp_build_reference_type (tree to_type, bool rval)
{
tree lvalue_ref, t;
+ if (to_type == error_mark_node)
+ return error_mark_node;
+
if (TREE_CODE (to_type) == REFERENCE_TYPE)
{
rval = rval && TYPE_REF_IS_RVALUE (to_type);
@@ -4900,6 +4903,19 @@ cp_tree_code_length (enum tree_code code)
}
}
+/* Wrapper around warn_deprecated_use that doesn't warn for
+ current_class_type. */
+
+void
+cp_warn_deprecated_use (tree node)
+{
+ if (TYPE_P (node)
+ && current_class_type
+ && TYPE_MAIN_VARIANT (node) == current_class_type)
+ return;
+ warn_deprecated_use (node, NULL_TREE);
+}
+
/* Implement -Wzero_as_null_pointer_constant. Return true if the
conditions for the warning hold, false otherwise. */
bool
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9d7c9aa27d0..0da2da1c30f 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5713,19 +5713,6 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
return arg;
}
- /* ??? Cope with user tricks that amount to offsetof. */
- if (TREE_CODE (argtype) != FUNCTION_TYPE
- && TREE_CODE (argtype) != METHOD_TYPE
- && argtype != unknown_type_node
- && (val = get_base_address (arg))
- && COMPLETE_TYPE_P (TREE_TYPE (val))
- && INDIRECT_REF_P (val)
- && TREE_CONSTANT (TREE_OPERAND (val, 0)))
- {
- tree type = build_pointer_type (argtype);
- return fold_convert (type, fold_offsetof_1 (arg));
- }
-
/* Handle complex lvalues (when permitted)
by reduction to simpler cases. */
val = unary_complex_lvalue (ADDR_EXPR, arg);
@@ -6177,6 +6164,25 @@ build_unary_op (location_t /*location*/,
return cp_build_unary_op (code, xarg, noconvert, tf_warning_or_error);
}
+/* Adjust LVALUE, an MODIFY_EXPR, PREINCREMENT_EXPR or PREDECREMENT_EXPR,
+ so that it is a valid lvalue even for GENERIC by replacing
+ (lhs = rhs) with ((lhs = rhs), lhs)
+ (--lhs) with ((--lhs), lhs)
+ (++lhs) with ((++lhs), lhs)
+ and if lhs has side-effects, calling cp_stabilize_reference on it, so
+ that it can be evaluated multiple times. */
+
+tree
+genericize_compound_lvalue (tree lvalue)
+{
+ if (TREE_SIDE_EFFECTS (TREE_OPERAND (lvalue, 0)))
+ lvalue = build2 (TREE_CODE (lvalue), TREE_TYPE (lvalue),
+ cp_stabilize_reference (TREE_OPERAND (lvalue, 0)),
+ TREE_OPERAND (lvalue, 1));
+ return build2 (COMPOUND_EXPR, TREE_TYPE (TREE_OPERAND (lvalue, 0)),
+ lvalue, TREE_OPERAND (lvalue, 0));
+}
+
/* Apply unary lvalue-demanding operator CODE to the expression ARG
for certain kinds of expressions which are not really lvalues
but which we can accept as lvalues.
@@ -6211,17 +6217,7 @@ unary_complex_lvalue (enum tree_code code, tree arg)
if (TREE_CODE (arg) == MODIFY_EXPR
|| TREE_CODE (arg) == PREINCREMENT_EXPR
|| TREE_CODE (arg) == PREDECREMENT_EXPR)
- {
- tree lvalue = TREE_OPERAND (arg, 0);
- if (TREE_SIDE_EFFECTS (lvalue))
- {
- lvalue = cp_stabilize_reference (lvalue);
- arg = build2 (TREE_CODE (arg), TREE_TYPE (arg),
- lvalue, TREE_OPERAND (arg, 1));
- }
- return unary_complex_lvalue
- (code, build2 (COMPOUND_EXPR, TREE_TYPE (lvalue), arg, lvalue));
- }
+ return unary_complex_lvalue (code, genericize_compound_lvalue (arg));
if (code != ADDR_EXPR)
return NULL_TREE;
@@ -7617,11 +7613,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
case PREINCREMENT_EXPR:
if (compound_side_effects_p)
newrhs = rhs = stabilize_expr (rhs, &preeval);
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
- lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs),
- cp_stabilize_reference (TREE_OPERAND (lhs, 0)),
- TREE_OPERAND (lhs, 1));
- lhs = build2 (COMPOUND_EXPR, lhstype, lhs, TREE_OPERAND (lhs, 0));
+ lhs = genericize_compound_lvalue (lhs);
maybe_add_compound:
/* If we had (bar, --foo) = 5; or (bar, (baz, --foo)) = 5;
and looked through the COMPOUND_EXPRs, readd them now around
@@ -7644,11 +7636,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
case MODIFY_EXPR:
if (compound_side_effects_p)
newrhs = rhs = stabilize_expr (rhs, &preeval);
- if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0)))
- lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs),
- cp_stabilize_reference (TREE_OPERAND (lhs, 0)),
- TREE_OPERAND (lhs, 1));
- lhs = build2 (COMPOUND_EXPR, lhstype, lhs, TREE_OPERAND (lhs, 0));
+ lhs = genericize_compound_lvalue (lhs);
goto maybe_add_compound;
case MIN_EXPR:
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 764fbca832d..c8b9d787ac5 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1957,7 +1957,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
if (complain & tf_warning
&& TREE_DEPRECATED (type)
&& DECL_ARTIFICIAL (exp))
- warn_deprecated_use (type, NULL_TREE);
+ cp_warn_deprecated_use (type);
}
else
type = exp;
diff --git a/gcc/dce.c b/gcc/dce.c
index f7f41e8e71f..91e2f2768a3 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -566,9 +566,19 @@ delete_unmarked_insns (void)
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (NONDEBUG_INSN_P (insn))
{
+ rtx turn_into_use = NULL_RTX;
+
/* Always delete no-op moves. */
if (noop_move_p (insn))
- ;
+ {
+ if (RTX_FRAME_RELATED_P (insn))
+ turn_into_use
+ = find_reg_note (insn, REG_CFA_RESTORE, NULL);
+ if (turn_into_use && REG_P (XEXP (turn_into_use, 0)))
+ turn_into_use = XEXP (turn_into_use, 0);
+ else
+ turn_into_use = NULL_RTX;
+ }
/* Otherwise rely only on the DCE algorithm. */
else if (marked_insn_p (insn))
@@ -608,8 +618,19 @@ delete_unmarked_insns (void)
if (CALL_P (insn))
must_clean = true;
- /* Now delete the insn. */
- delete_insn_and_edges (insn);
+ if (turn_into_use)
+ {
+ /* Don't remove frame related noop moves if they cary
+ REG_CFA_RESTORE note, while we don't need to emit any code,
+ we need it to emit the CFI restore note. */
+ PATTERN (insn)
+ = gen_rtx_USE (GET_MODE (turn_into_use), turn_into_use);
+ INSN_CODE (insn) = -1;
+ df_insn_rescan (insn);
+ }
+ else
+ /* Now delete the insn. */
+ delete_insn_and_edges (insn);
}
/* Deleted a pure or const call. */
diff --git a/gcc/doc/install.texi2html b/gcc/doc/install.texi2html
index 8a7781ef7cd..44e6f0f8a69 100755
--- a/gcc/doc/install.texi2html
+++ b/gcc/doc/install.texi2html
@@ -52,7 +52,10 @@ for x in index.html specific.html prerequisites.html download.html configure.htm
do
define=`echo $x | sed -e 's/\.//g'`
echo "define = $define"
- $MAKEINFO --no-number-sections -I $SOURCEDIR -I $SOURCEDIR/include -I $DESTDIR $SOURCEDIR/install.texi --html --no-split -D$define -o$DESTDIR/$x
+ $MAKEINFO --no-number-sections -I $SOURCEDIR -I $SOURCEDIR/include -I $DESTDIR $SOURCEDIR/install.texi --html --no-split -D$define -o$DESTDIR/temp.html
+ # Use sed to work around makeinfo 4.7 brokenness.
+ sed -e 's/_002d/-/g' -e 's/_002a/*/g' $DESTDIR/temp.html > $DESTDIR/$x
+ rm $DESTDIR/temp.html
done
rm $DESTDIR/gcc-vers.texi
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4822ec3f96f..e1ddf811797 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5170,6 +5170,9 @@ precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
may end in one of the standard suffixes designating a multiple of bytes
such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
@code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
+@option{-Walloc-size-larger-than=}@var{PTRDIFF_MAX} is enabled by default.
+Warnings controlled by the option can be disabled by specifying @var{n}
+of @var{SIZE_MAX} or more.
@xref{Function Attributes}.
@item -Walloca
diff --git a/gcc/dse.c b/gcc/dse.c
index f87dd50024e..174865bbc40 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1342,6 +1342,9 @@ record_store (rtx body, bb_info_t bb_info)
else
width = GET_MODE_SIZE (GET_MODE (mem));
+ if (width == 0)
+ return 0;
+
if (group_id >= 0)
{
/* In the restrictive case where the base is a constant or the
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 8e3e86f224c..d5d0cfb0e8d 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "dwarf2.h"
#include "function.h"
#include "emit-rtl.h"
+#include "fold-const.h"
#ifndef XCOFF_DEBUGGING_INFO
#define XCOFF_DEBUGGING_INFO 0
@@ -925,7 +926,7 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
SET_DECL_ASSEMBLER_NAME (decl, id);
DECL_ARTIFICIAL (decl) = 1;
DECL_IGNORED_P (decl) = 1;
- DECL_INITIAL (decl) = decl;
+ DECL_INITIAL (decl) = build_fold_addr_expr (decl);
TREE_READONLY (decl) = 1;
TREE_STATIC (decl) = 1;
@@ -938,8 +939,23 @@ dw2_output_indirect_constant_1 (const char *sym, tree id)
}
sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym);
+ /* Disable ASan for decl because redzones cause ABI breakage between GCC and
+ libstdc++ for `.LDFCM*' variables. See PR 78651 for details. */
+ unsigned int save_flag_sanitize = flag_sanitize;
+ flag_sanitize &= ~(SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS
+ | SANITIZE_KERNEL_ADDRESS);
+ /* And also temporarily disable -fsection-anchors. These indirect constants
+ are never referenced from code, so it doesn't make any sense to aggregate
+ them in blocks. */
+ int save_flag_section_anchors = flag_section_anchors;
+ flag_section_anchors = 0;
assemble_variable (decl, 1, 1, 1);
+ flag_section_anchors = save_flag_section_anchors;
+ flag_sanitize = save_flag_sanitize;
assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1);
+ /* The following is a hack recognized by use_blocks_for_decl_p to disable
+ section anchor handling of the decl. */
+ DECL_INITIAL (decl) = decl;
return 0;
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 43bb121fb21..7e1ce9e152a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18749,6 +18749,8 @@ rtl_for_decl_init (tree init, tree type)
if (GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_SIZE (mode) == 1
&& domain
+ && TYPE_MAX_VALUE (domain)
+ && TREE_CODE (TYPE_MAX_VALUE (domain)) == INTEGER_CST
&& integer_zerop (TYPE_MIN_VALUE (domain))
&& compare_tree_int (TYPE_MAX_VALUE (domain),
TREE_STRING_LENGTH (init) - 1) == 0
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 0d25d4ec17e..3d47559ec0f 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -5851,7 +5851,7 @@ init_emit_regs (void)
attrs = ggc_cleared_alloc<mem_attrs> ();
attrs->align = BITS_PER_UNIT;
attrs->addrspace = ADDR_SPACE_GENERIC;
- if (mode != BLKmode)
+ if (mode != BLKmode && mode != VOIDmode)
{
attrs->size_known_p = true;
attrs->size = GET_MODE_SIZE (mode);
diff --git a/gcc/expr.c b/gcc/expr.c
index 0d287ecbe68..f8964b84bef 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5109,7 +5109,10 @@ expand_assignment (tree to, tree from, bool nontemporal)
&& bitpos == 0
&& bitsize == mode_bitsize)
result = store_expr (from, to_rtx, false, nontemporal, reversep);
- else if (bitsize == mode_bitsize / 2
+ else if (COMPLEX_MODE_P (GET_MODE (to_rtx))
+ && (TYPE_MODE (TREE_TYPE (from))
+ == GET_MODE_INNER (GET_MODE (to_rtx)))
+ && bitsize == mode_bitsize / 2
&& (bitpos == 0 || bitpos == mode_bitsize / 2))
result = store_expr (from, XEXP (to_rtx, bitpos != 0), false,
nontemporal, reversep);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0781f4212b7..ba8dd498554 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -473,12 +473,15 @@ negate_expr_p (tree t)
case EXACT_DIV_EXPR:
if (TYPE_UNSIGNED (type))
break;
- if (negate_expr_p (TREE_OPERAND (t, 0)))
+ /* In general we can't negate A in A / B, because if A is INT_MIN and
+ B is not 1 we change the sign of the result. */
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == INTEGER_CST
+ && negate_expr_p (TREE_OPERAND (t, 0)))
return true;
/* In general we can't negate B in A / B, because if A is INT_MIN and
B is 1, we may turn this into INT_MIN / -1 which is undefined
and actually traps on some architectures. */
- if (! INTEGRAL_TYPE_P (TREE_TYPE (t))
+ if (! ANY_INTEGRAL_TYPE_P (TREE_TYPE (t))
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (t))
|| (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST
&& ! integer_onep (TREE_OPERAND (t, 1))))
@@ -652,14 +655,17 @@ fold_negate_expr_1 (location_t loc, tree t)
case EXACT_DIV_EXPR:
if (TYPE_UNSIGNED (type))
break;
- if (negate_expr_p (TREE_OPERAND (t, 0)))
+ /* In general we can't negate A in A / B, because if A is INT_MIN and
+ B is not 1 we change the sign of the result. */
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == INTEGER_CST
+ && negate_expr_p (TREE_OPERAND (t, 0)))
return fold_build2_loc (loc, TREE_CODE (t), type,
negate_expr (TREE_OPERAND (t, 0)),
TREE_OPERAND (t, 1));
/* In general we can't negate B in A / B, because if A is INT_MIN and
B is 1, we may turn this into INT_MIN / -1 which is undefined
and actually traps on some architectures. */
- if ((! INTEGRAL_TYPE_P (TREE_TYPE (t))
+ if ((! ANY_INTEGRAL_TYPE_P (TREE_TYPE (t))
|| TYPE_OVERFLOW_WRAPS (TREE_TYPE (t))
|| (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST
&& ! integer_onep (TREE_OPERAND (t, 1))))
@@ -7199,7 +7205,7 @@ native_encode_vector (const_tree expr, unsigned char *ptr, int len, int off)
return 0;
offset += res;
if (offset >= len)
- return offset;
+ return (off == -1 && i < count - 1) ? 0 : offset;
if (off != -1)
off = 0;
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ff480f2824c..756a3301783 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,125 @@
+2018-06-25 Fritz Reese <fritzoreese@gmail.com>
+
+ PR fortran/82972
+ PR fortran/83088
+ PR fortran/85851
+ Backport from trunk.
+ * expr.c (component_initializer): Assign init expr to c->initializer.
+ (generate_isocbinding_initializer): New.
+ (gfc_generate_initializer): Call generate_isocbinding_initializer to
+ generate initializers for c_ptr and c_funptr with -finit-derived.
+
+2018-06-25 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83118
+ Back port from trunk
+ * resolve.c (resolve_ordinary_assign): Force the creation of a
+ vtable for assignment of non-polymorphic expressions to an
+ unlimited polymorphic object.
+ * trans-array.c (gfc_alloc_allocatable_for_assignment): Use the
+ size of the rhs type for such assignments. Set the dtype, _len
+ and vptrs appropriately.
+ * trans-expr.c (gfc_trans_assignment): Force the use of the
+ _copy function for these assignments.
+
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/85313
+ * openmp.c (resolve_omp_do): Remove bogus if (j < i) break;.
+ (resolve_oacc_nested_loops): Likewise. Formatting fix.
+
+2018-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86110
+ * array.c (gfc_resolve_character_array_constructor): Avoid NULL
+ pointer dereference.
+
+2018-06-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/44491
+ * expr.c (gfc_check_assign): Select non-NULL locus.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/38351
+ * resolve.c (resolve_operator): Provide better error message for
+ derived type entity used in an binary intrinsic numeric operator.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/63514
+ * symbol.c (gfc_add_volatile): Enforce F2008:C1282 and F2018:C1588.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78278
+ * data.c (gfc_assign_data_value): Re-arrange code to allow for
+ an error for double initialization of CHARACTER entities.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86059
+ * array.c (match_array_cons_element): NULL() cannot be in an
+ array constructor.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85138
+ PR fortran/85996
+ PR fortran/86051
+ * decl.c (gfc_match_char_spec): Use private namespace in attempt to
+ reduce a charlen to a constant.
+
+2018-06-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86045
+ Backport from trunk.
+ * simplify.c (gfc_simplify_mod): Re-arrange code to test whether
+ 'P' is zero and issue an error if it is.
+
+2018-06-07 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/85641
+ Backport from trunk.
+ * frontend-passes.c (is_fe_temp): Add prototype.
+ (realloc_string_callback): Early return for frontend-generated
+ temporary.
+
+2018-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85981
+ * resolve.c (resolve_allocate_deallocate): Check errmsg is default
+ character kind.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85543
+ Backport from trunk
+ * resolve.c (update_current_proc_array_outer_dependency): Avoid NULL
+ pointer dereference.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85779
+ Backport from trunk
+ * decl.c (gfc_match_derived_decl): Fix NULL point dereference.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85780
+ Backport from trunk
+ * resolve.c (resolve_fl_procedure): Avoid NULL dereference.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85895
+ Backport from trunk
+ * resolve.c (resolve_sync): Resolve expression before checking for
+ an error.
+
2018-05-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/80657
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index e3a8e35ed75..17b3c7d44e8 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -1079,6 +1079,15 @@ match_array_cons_element (gfc_constructor_base *result)
if (m != MATCH_YES)
return m;
+ if (expr->expr_type == EXPR_FUNCTION
+ && expr->ts.type == BT_UNKNOWN
+ && strcmp(expr->symtree->name, "null") == 0)
+ {
+ gfc_error ("NULL() at %C cannot appear in an array constructor");
+ gfc_free_expr (expr);
+ return MATCH_ERROR;
+ }
+
gfc_constructor_append_expr (result, expr, &gfc_current_locus);
return MATCH_YES;
}
@@ -1998,7 +2007,9 @@ got_charlen:
gfc_ref *ref;
for (ref = p->expr->ref; ref; ref = ref->next)
if (ref->type == REF_SUBSTRING
+ && ref->u.ss.start
&& ref->u.ss.start->expr_type == EXPR_CONSTANT
+ && ref->u.ss.end
&& ref->u.ss.end->expr_type == EXPR_CONSTANT)
break;
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index c24e6f3e6e4..5d1d38042f4 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -481,6 +481,21 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
mpz_clear (offset);
gcc_assert (repeat == NULL);
+ /* Overwriting an existing initializer is non-standard but usually only
+ provokes a warning from other compilers. */
+ if (init != NULL && init->where.lb && rvalue->where.lb)
+ {
+ /* Order in which the expressions arrive here depends on whether
+ they are from data statements or F95 style declarations.
+ Therefore, check which is the most recent. */
+ expr = (LOCATION_LINE (init->where.lb->location)
+ > LOCATION_LINE (rvalue->where.lb->location))
+ ? init : rvalue;
+ if (gfc_notify_std (GFC_STD_GNU, "re-initialization of %qs at %L",
+ symbol->name, &expr->where) == false)
+ return false;
+ }
+
if (ref || last_ts->type == BT_CHARACTER)
{
/* An initializer has to be constant. */
@@ -501,22 +516,6 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
return false;
}
- /* Overwriting an existing initializer is non-standard but usually only
- provokes a warning from other compilers. */
- if (init != NULL)
- {
- /* Order in which the expressions arrive here depends on whether
- they are from data statements or F95 style declarations.
- Therefore, check which is the most recent. */
- expr = (LOCATION_LINE (init->where.lb->location)
- > LOCATION_LINE (rvalue->where.lb->location))
- ? init : rvalue;
- if (gfc_notify_std (GFC_STD_GNU,
- "re-initialization of %qs at %L",
- symbol->name, &expr->where) == false)
- return false;
- }
-
expr = gfc_copy_expr (rvalue);
if (!gfc_compare_types (&lvalue->ts, &expr->ts))
gfc_convert_type (expr, &lvalue->ts, 0);
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 69d21633f78..e73f2d76f45 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2998,12 +2998,20 @@ done:
cl->length = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1);
else
{
- /* 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 gfortran ends up here, then len may be reducible to a constant.
+ Try to do that here. If it does not reduce, simply assign len to
+ charlen. A complication occurs with user-defined generic functions,
+ which are not resolved. Use a private namespace to deal with
+ generic functions. */
+
if (len && len->expr_type != EXPR_CONSTANT)
{
+ gfc_namespace *old_ns;
gfc_expr *e;
+
+ old_ns = gfc_current_ns;
+ gfc_current_ns = gfc_get_namespace (NULL, 0);
+
e = gfc_copy_expr (len);
gfc_reduce_init_expr (e);
if (e->expr_type == EXPR_CONSTANT)
@@ -3014,10 +3022,12 @@ done:
}
else
gfc_free_expr (e);
- cl->length = len;
+
+ gfc_free_namespace (gfc_current_ns);
+ gfc_current_ns = old_ns;
}
- else
- cl->length = len;
+
+ cl->length = len;
}
ts->u.cl = cl;
@@ -9035,8 +9045,12 @@ gfc_match_derived_decl (void)
if (!gensym->attr.generic && gensym->ts.type != BT_UNKNOWN)
{
- gfc_error ("Derived type name %qs at %C already has a basic type "
- "of %s", gensym->name, gfc_typename (&gensym->ts));
+ if (gensym->ts.u.derived)
+ gfc_error ("Derived type name %qs at %C already has a basic type "
+ "of %s", gensym->name, gfc_typename (&gensym->ts));
+ else
+ gfc_error ("Derived type name %qs at %C already has a basic type",
+ gensym->name);
return MATCH_ERROR;
}
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index e890c4b2861..85247b65735 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3288,6 +3288,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform,
/* Only DATA Statements come here. */
if (!conform)
{
+ locus *where;
+
/* Numeric can be converted to any other numeric. And Hollerith can be
converted to any other type. */
if ((gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts))
@@ -3297,8 +3299,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform,
if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
return true;
+ where = lvalue->where.lb ? &lvalue->where : &rvalue->where;
gfc_error ("Incompatible types in DATA statement at %L; attempted "
- "conversion of %s to %s", &lvalue->where,
+ "conversion of %s to %s", where,
gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts));
return false;
@@ -4335,7 +4338,7 @@ component_initializer (gfc_typespec *ts, gfc_component *c, bool generate)
gfc_apply_init (&c->ts, &c->attr, init);
}
- return init;
+ return (c->initializer = init);
}
@@ -4347,6 +4350,32 @@ gfc_default_initializer (gfc_typespec *ts)
return gfc_generate_initializer (ts, false);
}
+/* Generate an initializer expression for an iso_c_binding type
+ such as c_[fun]ptr. The appropriate initializer is c_null_[fun]ptr. */
+
+static gfc_expr *
+generate_isocbinding_initializer (gfc_symbol *derived)
+{
+ /* The initializers have already been built into the c_null_[fun]ptr symbols
+ from gen_special_c_interop_ptr. */
+ gfc_symtree *npsym = NULL;
+ if (0 == strcmp (derived->name, "c_ptr"))
+ gfc_find_sym_tree ("c_null_ptr", gfc_current_ns, true, &npsym);
+ else if (0 == strcmp (derived->name, "c_funptr"))
+ gfc_find_sym_tree ("c_null_funptr", gfc_current_ns, true, &npsym);
+ else
+ gfc_internal_error ("generate_isocbinding_initializer(): bad iso_c_binding"
+ " type, expected %<c_ptr%> or %<c_funptr%>");
+ if (npsym)
+ {
+ gfc_expr *init = gfc_copy_expr (npsym->n.sym->value);
+ init->symtree = npsym;
+ init->ts.is_iso_c = true;
+ return init;
+ }
+
+ return NULL;
+}
/* Get or generate an expression for a default initializer of a derived type.
If -finit-derived is specified, generate default initialization expressions
@@ -4357,8 +4386,12 @@ gfc_generate_initializer (gfc_typespec *ts, bool generate)
{
gfc_expr *init, *tmp;
gfc_component *comp;
+
generate = flag_init_derived && generate;
+ if (ts->u.derived->ts.is_iso_c && generate)
+ return generate_isocbinding_initializer (ts->u.derived);
+
/* See if we have a default initializer in this, but not in nested
types (otherwise we could use gfc_has_default_initializer()).
We don't need to check if we are going to generate them. */
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index d7b4f23fe89..ef1d8f97434 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -48,6 +48,8 @@ static gfc_code * create_do_loop (gfc_expr *, gfc_expr *, gfc_expr *,
locus *, gfc_namespace *,
char *vname=NULL);
+static bool is_fe_temp (gfc_expr *e);
+
#ifdef CHECKING_P
static void check_locus (gfc_namespace *);
#endif
@@ -231,6 +233,9 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED,
|| !expr1->ts.deferred)
return 0;
+ if (is_fe_temp (expr1))
+ return 0;
+
expr2 = gfc_discard_nops (co->expr2);
if (expr2->expr_type == EXPR_VARIABLE)
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 746785c8893..8f7c622bbed 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5575,8 +5575,6 @@ resolve_omp_do (gfc_code *code)
"iteration space at %L", name, &do_code->loc);
break;
}
- if (j < i)
- break;
do_code2 = do_code2->block->next;
}
}
@@ -5740,12 +5738,10 @@ resolve_oacc_nested_loops (gfc_code *code, gfc_code* do_code, int collapse,
|| gfc_find_sym_in_expr (ivar, do_code->ext.iterator->end)
|| gfc_find_sym_in_expr (ivar, do_code->ext.iterator->step))
{
- gfc_error ("!$ACC LOOP %s loops don't form rectangular iteration space at %L",
- clause, &do_code->loc);
+ gfc_error ("!$ACC LOOP %s loops don't form rectangular "
+ "iteration space at %L", clause, &do_code->loc);
break;
}
- if (j < i)
- break;
do_code2 = do_code2->block->next;
}
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index ed9b3f1d565..483f3b2a7b7 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2906,8 +2906,8 @@ update_current_proc_array_outer_dependency (gfc_symbol *sym)
/* If SYM has references to outer arrays, so has the procedure calling
SYM. If SYM is a procedure pointer, we can assume the worst. */
- if (sym->attr.array_outer_dependency
- || sym->attr.proc_pointer)
+ if ((sym->attr.array_outer_dependency || sym->attr.proc_pointer)
+ && gfc_current_ns->proc_name)
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
}
@@ -3685,7 +3685,13 @@ resolve_operator (gfc_expr *e)
break;
}
- sprintf (msg,
+ if (op1->ts.type == BT_DERIVED || op2->ts.type == BT_DERIVED)
+ sprintf (msg,
+ _("Unexpected derived-type entities in binary intrinsic "
+ "numeric operator %%<%s%%> at %%L"),
+ gfc_op2string (e->value.op.op));
+ else
+ sprintf (msg,
_("Operands of binary numeric operator %%<%s%%> at %%L are %s/%s"),
gfc_op2string (e->value.op.op), gfc_typename (&op1->ts),
gfc_typename (&op2->ts));
@@ -7554,12 +7560,17 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
gfc_check_vardef_context (errmsg, false, false, false,
_("ERRMSG variable"));
+ /* F18:R928 alloc-opt is ERRMSG = errmsg-variable
+ F18:R930 errmsg-variable is scalar-default-char-variable
+ F18:R906 default-char-variable is variable
+ F18:C906 default-char-variable shall be default character. */
if ((errmsg->ts.type != BT_CHARACTER
&& !(errmsg->ref
&& (errmsg->ref->type == REF_ARRAY
|| errmsg->ref->type == REF_COMPONENT)))
- || errmsg->rank > 0 )
- gfc_error ("Errmsg-variable at %L must be a scalar CHARACTER "
+ || errmsg->rank > 0
+ || errmsg->ts.kind != gfc_default_character_kind)
+ gfc_error ("ERRMSG variable at %L shall be a scalar default CHARACTER "
"variable", &errmsg->where);
for (p = code->ext.alloc.list; p; p = p->next)
@@ -9299,6 +9310,7 @@ resolve_sync (gfc_code *code)
}
/* Check STAT. */
+ gfc_resolve_expr (code->expr2);
if (code->expr2
&& (code->expr2->ts.type != BT_INTEGER || code->expr2->rank != 0
|| code->expr2->expr_type != EXPR_VARIABLE))
@@ -9306,6 +9318,7 @@ resolve_sync (gfc_code *code)
&code->expr2->where);
/* Check ERRMSG. */
+ gfc_resolve_expr (code->expr3);
if (code->expr3
&& (code->expr3->ts.type != BT_CHARACTER || code->expr3->rank != 0
|| code->expr3->expr_type != EXPR_VARIABLE))
@@ -10138,6 +10151,11 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
&& rhs->expr_type != EXPR_ARRAY)
gfc_add_data_component (rhs);
+ /* Make sure there is a vtable and, in particular, a _copy for the
+ rhs type. */
+ if (UNLIMITED_POLY (lhs) && lhs->rank && rhs->ts.type != BT_CLASS)
+ gfc_find_vtab (&rhs->ts);
+
bool caf_convert_to_send = flag_coarray == GFC_FCOARRAY_LIB
&& (lhs_coindexed
|| (code->expr2->expr_type == EXPR_FUNCTION
@@ -12268,7 +12286,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
while (curr_arg != NULL)
{
/* Skip implicitly typed dummy args here. */
- if (curr_arg->sym->attr.implicit_type == 0)
+ if (curr_arg->sym && curr_arg->sym->attr.implicit_type == 0)
if (!gfc_verify_c_interop_param (curr_arg->sym))
/* If something is found to fail, record the fact so we
can mark the symbol for the procedure as not being
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index e34deada3fc..6cfa2283336 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4642,43 +4642,48 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr *p)
gfc_expr *result;
int kind;
- if (a->expr_type != EXPR_CONSTANT || p->expr_type != EXPR_CONSTANT)
+ /* First check p. */
+ if (p->expr_type != EXPR_CONSTANT)
return NULL;
- kind = a->ts.kind > p->ts.kind ? a->ts.kind : p->ts.kind;
- result = gfc_get_constant_expr (a->ts.type, kind, &a->where);
-
- switch (a->ts.type)
+ /* p shall not be 0. */
+ switch (p->ts.type)
{
case BT_INTEGER:
if (mpz_cmp_ui (p->value.integer, 0) == 0)
{
- /* Result is processor-dependent. */
- gfc_error ("Second argument MOD at %L is zero", &a->where);
- gfc_free_expr (result);
+ gfc_error ("Argument %qs of MOD at %L shall not be zero",
+ "P", &p->where);
return &gfc_bad_expr;
}
- mpz_tdiv_r (result->value.integer, a->value.integer, p->value.integer);
break;
-
case BT_REAL:
if (mpfr_cmp_ui (p->value.real, 0) == 0)
{
- /* Result is processor-dependent. */
- gfc_error ("Second argument of MOD at %L is zero", &p->where);
- gfc_free_expr (result);
+ gfc_error ("Argument %qs of MOD at %L shall not be zero",
+ "P", &p->where);
return &gfc_bad_expr;
}
-
- gfc_set_model_kind (kind);
- mpfr_fmod (result->value.real, a->value.real, p->value.real,
- GFC_RND_MODE);
break;
-
default:
gfc_internal_error ("gfc_simplify_mod(): Bad arguments");
}
+ if (a->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+ kind = a->ts.kind > p->ts.kind ? a->ts.kind : p->ts.kind;
+ result = gfc_get_constant_expr (a->ts.type, kind, &a->where);
+
+ if (a->ts.type == BT_INTEGER)
+ mpz_tdiv_r (result->value.integer, a->value.integer, p->value.integer);
+ else
+ {
+ gfc_set_model_kind (kind);
+ mpfr_fmod (result->value.real, a->value.real, p->value.real,
+ GFC_RND_MODE);
+ }
+
return range_check (result, "MOD");
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index ec43e635bf3..6917b22dff2 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1259,6 +1259,20 @@ gfc_add_volatile (symbol_attribute *attr, const char *name, locus *where)
where))
return false;
+ /* F2008: C1282 A designator of a variable with the VOLATILE attribute
+ shall not appear in a pure subprogram.
+
+ F2018: C1588 A local variable of a pure subprogram, or of a BLOCK
+ construct within a pure subprogram, shall not have the SAVE or
+ VOLATILE attribute. */
+ if (gfc_pure (NULL))
+ {
+ gfc_error ("VOLATILE attribute at %L cannot be specified in a "
+ "PURE procedure", where);
+ return false;
+ }
+
+
attr->volatile_ = 1;
attr->volatile_ns = gfc_current_ns;
return check_conflict (attr, name, where);
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 6be9c70a678..cc9eb74f2fa 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -9382,6 +9382,8 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
gfc_array_index_type, tmp,
expr1->ts.u.cl->backend_decl);
}
+ else if (UNLIMITED_POLY (expr1) && expr2->ts.type != BT_CLASS)
+ tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&expr2->ts));
else
tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (&expr1->ts));
tmp = fold_convert (gfc_array_index_type, tmp);
@@ -9408,6 +9410,28 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
gfc_add_modify (&fblock, tmp,
gfc_get_dtype_rank_type (expr1->rank,type));
}
+ else if (UNLIMITED_POLY (expr1) && expr2->ts.type != BT_CLASS)
+ {
+ tree type;
+ tmp = gfc_conv_descriptor_dtype (desc);
+ type = gfc_typenode_for_spec (&expr2->ts);
+ gfc_add_modify (&fblock, tmp,
+ gfc_get_dtype_rank_type (expr2->rank,type));
+ /* Set the _len field as well... */
+ tmp = gfc_class_len_get (TREE_OPERAND (desc, 0));
+ if (expr2->ts.type == BT_CHARACTER)
+ gfc_add_modify (&fblock, tmp,
+ fold_convert (TREE_TYPE (tmp),
+ TYPE_SIZE_UNIT (type)));
+ else
+ gfc_add_modify (&fblock, tmp,
+ build_int_cst (TREE_TYPE (tmp), 0));
+ /* ...and the vptr. */
+ tmp = gfc_class_vptr_get (TREE_OPERAND (desc, 0));
+ tmp2 = gfc_get_symbol_decl (gfc_find_vtab (&expr2->ts));
+ tmp2 = gfc_build_addr_expr (TREE_TYPE (tmp), tmp2);
+ gfc_add_modify (&fblock, tmp, tmp2);
+ }
else if (coarray && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)))
{
gfc_add_modify (&fblock, gfc_conv_descriptor_dtype (desc),
@@ -9513,10 +9537,11 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* We already set the dtype in the case of deferred character
- length arrays. */
+ length arrays and unlimited polymorphic arrays. */
if (!(GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))
&& ((expr1->ts.type == BT_CHARACTER && expr1->ts.deferred)
- || coarray)))
+ || coarray))
+ && !UNLIMITED_POLY (expr1))
{
tmp = gfc_conv_descriptor_dtype (desc);
gfc_add_modify (&alloc_block, tmp, gfc_get_dtype (TREE_TYPE (desc)));
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index e1205e36b97..d7cab27e6ee 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -10330,6 +10330,10 @@ gfc_trans_assignment (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
return tmp;
}
+ if (UNLIMITED_POLY (expr1) && expr1->rank
+ && expr2->ts.type != BT_CLASS)
+ use_vptr_copy = true;
+
/* Fallback to the scalarizer to generate explicit loops. */
return gfc_trans_assignment_1 (expr1, expr2, init_flag, dealloc,
use_vptr_copy, may_alias);
diff --git a/gcc/function.c b/gcc/function.c
index 21eb586a8f7..bde4da073c2 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6576,8 +6576,9 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
/* Only do the transformation for pseudos. */
if (! REG_P (output)
|| rtx_equal_p (output, input)
- || (GET_MODE (input) != VOIDmode
- && GET_MODE (input) != GET_MODE (output)))
+ || !(REG_P (input) || SUBREG_P (input)
+ || MEM_P (input) || CONSTANT_P (input))
+ || !general_operand (input, GET_MODE (output)))
continue;
/* We can't do anything if the output is also used as input,
diff --git a/gcc/gimple-ssa-backprop.c b/gcc/gimple-ssa-backprop.c
index 3acf3d604ea..fa4ef45e555 100644
--- a/gcc/gimple-ssa-backprop.c
+++ b/gcc/gimple-ssa-backprop.c
@@ -260,6 +260,11 @@ private:
post-order walk. */
auto_sbitmap m_visited_blocks;
+ /* A bitmap of phis that we have finished processing in the initial
+ post-order walk, excluding those from blocks mentioned in
+ M_VISITED_BLOCKS. */
+ auto_bitmap m_visited_phis;
+
/* A worklist of SSA names whose definitions need to be reconsidered. */
auto_vec <tree, 64> m_worklist;
@@ -500,8 +505,11 @@ backprop::intersect_uses (tree var, usage_info *info)
{
if (is_gimple_debug (stmt))
continue;
- if (is_a <gphi *> (stmt)
- && !bitmap_bit_p (m_visited_blocks, gimple_bb (stmt)->index))
+ gphi *phi = dyn_cast <gphi *> (stmt);
+ if (phi
+ && !bitmap_bit_p (m_visited_blocks, gimple_bb (phi)->index)
+ && !bitmap_bit_p (m_visited_phis,
+ SSA_NAME_VERSION (gimple_phi_result (phi))))
{
/* Skip unprocessed phis. */
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -509,7 +517,7 @@ backprop::intersect_uses (tree var, usage_info *info)
fprintf (dump_file, "[BACKEDGE] ");
print_generic_expr (dump_file, var, 0);
fprintf (dump_file, " in ");
- print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ print_gimple_stmt (dump_file, phi, 0, TDF_SLIM);
}
}
else
@@ -633,7 +641,12 @@ backprop::process_block (basic_block bb)
}
for (gphi_iterator gpi = gsi_start_phis (bb); !gsi_end_p (gpi);
gsi_next (&gpi))
- process_var (gimple_phi_result (gpi.phi ()));
+ {
+ tree result = gimple_phi_result (gpi.phi ());
+ process_var (result);
+ bitmap_set_bit (m_visited_phis, SSA_NAME_VERSION (result));
+ }
+ bitmap_clear (m_visited_phis);
}
/* Delete the definition of VAR, which has no uses. */
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 2b68c2b1b0a..3e19c4b603e 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -266,6 +266,10 @@ struct slsr_cand_d
of a statement. */
cand_idx next_interp;
+ /* Index of the first candidate record in a chain for the same
+ statement. */
+ cand_idx first_interp;
+
/* Index of the basis statement S0, if any, in the candidate vector. */
cand_idx basis;
@@ -643,6 +647,7 @@ alloc_cand_and_find_basis (enum cand_kind kind, gimple *gs, tree base,
c->kind = kind;
c->cand_num = cand_vec.length () + 1;
c->next_interp = 0;
+ c->first_interp = c->cand_num;
c->dependent = 0;
c->sibling = 0;
c->def_phi = kind == CAND_MULT ? find_phi_def (base) : 0;
@@ -1213,6 +1218,7 @@ slsr_process_mul (gimple *gs, tree rhs1, tree rhs2, bool speed)
is the stride and RHS2 is the base expression. */
c2 = create_mul_ssa_cand (gs, rhs2, rhs1, speed);
c->next_interp = c2->cand_num;
+ c2->first_interp = c->cand_num;
}
else
{
@@ -1450,7 +1456,10 @@ slsr_process_add (gimple *gs, tree rhs1, tree rhs2, bool speed)
{
c2 = create_add_ssa_cand (gs, rhs2, rhs1, false, speed);
if (c)
- c->next_interp = c2->cand_num;
+ {
+ c->next_interp = c2->cand_num;
+ c2->first_interp = c->cand_num;
+ }
else
add_cand_for_stmt (gs, c2);
}
@@ -1573,6 +1582,8 @@ slsr_process_cast (gimple *gs, tree rhs1, bool speed)
if (base_cand && base_cand->kind != CAND_PHI)
{
+ slsr_cand_t first_cand = NULL;
+
while (base_cand)
{
/* Propagate all data from the base candidate except the type,
@@ -1587,6 +1598,12 @@ slsr_process_cast (gimple *gs, tree rhs1, bool speed)
base_cand->index, base_cand->stride,
ctype, base_cand->stride_type,
savings);
+ if (!first_cand)
+ first_cand = c;
+
+ if (first_cand != c)
+ c->first_interp = first_cand->cand_num;
+
if (base_cand->next_interp)
base_cand = lookup_cand (base_cand->next_interp);
else
@@ -1609,6 +1626,7 @@ slsr_process_cast (gimple *gs, tree rhs1, bool speed)
c2 = alloc_cand_and_find_basis (CAND_MULT, gs, rhs1, 0,
integer_one_node, ctype, sizetype, 0);
c->next_interp = c2->cand_num;
+ c2->first_interp = c->cand_num;
}
/* Add the first (or only) interpretation to the statement-candidate
@@ -1633,6 +1651,8 @@ slsr_process_copy (gimple *gs, tree rhs1, bool speed)
if (base_cand && base_cand->kind != CAND_PHI)
{
+ slsr_cand_t first_cand = NULL;
+
while (base_cand)
{
/* Propagate all data from the base candidate. */
@@ -1645,6 +1665,12 @@ slsr_process_copy (gimple *gs, tree rhs1, bool speed)
base_cand->index, base_cand->stride,
base_cand->cand_type,
base_cand->stride_type, savings);
+ if (!first_cand)
+ first_cand = c;
+
+ if (first_cand != c)
+ c->first_interp = first_cand->cand_num;
+
if (base_cand->next_interp)
base_cand = lookup_cand (base_cand->next_interp);
else
@@ -1669,6 +1695,7 @@ slsr_process_copy (gimple *gs, tree rhs1, bool speed)
integer_one_node, TREE_TYPE (rhs1),
sizetype, 0);
c->next_interp = c2->cand_num;
+ c2->first_interp = c->cand_num;
}
/* Add the first (or only) interpretation to the statement-candidate
@@ -1839,8 +1866,9 @@ dump_candidate (slsr_cand_t c)
print_generic_expr (dump_file, c->cand_type, 0);
fprintf (dump_file, "\n basis: %d dependent: %d sibling: %d\n",
c->basis, c->dependent, c->sibling);
- fprintf (dump_file, " next-interp: %d dead-savings: %d\n",
- c->next_interp, c->dead_savings);
+ fprintf (dump_file,
+ " next-interp: %d first-interp: %d dead-savings: %d\n",
+ c->next_interp, c->first_interp, c->dead_savings);
if (c->def_phi)
fprintf (dump_file, " phi: %d\n", c->def_phi);
fputs ("\n", dump_file);
@@ -2098,14 +2126,13 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump)
tree lhs = gimple_assign_lhs (c->cand_stmt);
gassign *copy_stmt = gimple_build_assign (lhs, basis_name);
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, copy_stmt, false);
- c->cand_stmt = copy_stmt;
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = copy_stmt;
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
stmt_to_print = copy_stmt;
@@ -2132,15 +2159,14 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump)
else
{
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_assign_set_rhs_with_ops (&gsi, code,
basis_name, bump_tree);
update_stmt (gsi_stmt (gsi));
- c->cand_stmt = gsi_stmt (gsi);
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = gsi_stmt (gsi);
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
stmt_to_print = gsi_stmt (gsi);
@@ -3426,14 +3452,13 @@ replace_rhs_if_not_dup (enum tree_code new_code, tree new_rhs1, tree new_rhs2,
|| !operand_equal_p (new_rhs2, old_rhs1, 0))))
{
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_assign_set_rhs_with_ops (&gsi, new_code, new_rhs1, new_rhs2);
update_stmt (gsi_stmt (gsi));
- c->cand_stmt = gsi_stmt (gsi);
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = gsi_stmt (gsi);
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3466,6 +3491,11 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
orig_rhs2 = gimple_assign_rhs2 (c->cand_stmt);
cand_incr = cand_increment (c);
+ /* If orig_rhs2 is NULL, we have already replaced this in situ with
+ a copy statement under another interpretation. */
+ if (!orig_rhs2)
+ return;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fputs ("Replacing: ", dump_file);
@@ -3538,14 +3568,13 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
|| !operand_equal_p (rhs2, orig_rhs2, 0))
{
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_assign_set_rhs_with_ops (&gsi, MINUS_EXPR, basis_name, rhs2);
update_stmt (gsi_stmt (gsi));
- c->cand_stmt = gsi_stmt (gsi);
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = gsi_stmt (gsi);
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3565,14 +3594,13 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
{
gassign *copy_stmt = gimple_build_assign (lhs, basis_name);
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_set_location (copy_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, copy_stmt, false);
- c->cand_stmt = copy_stmt;
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = copy_stmt;
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3582,14 +3610,13 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name)
{
gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt);
gassign *cast_stmt = gimple_build_assign (lhs, NOP_EXPR, basis_name);
- slsr_cand_t cc = c;
+ slsr_cand_t cc = lookup_cand (c->first_interp);
gimple_set_location (cast_stmt, gimple_location (c->cand_stmt));
gsi_replace (&gsi, cast_stmt, false);
- c->cand_stmt = cast_stmt;
- while (cc->next_interp)
+ while (cc)
{
- cc = lookup_cand (cc->next_interp);
cc->cand_stmt = cast_stmt;
+ cc = cc->next_interp ? lookup_cand (cc->next_interp) : NULL;
}
if (dump_file && (dump_flags & TDF_DETAILS))
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 15fc7c9ae8f..2a7951f16b3 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4681,7 +4681,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
objects. Initializers for such objects must explicitly set
every field that needs to be set. */
cleared = false;
- else if (!complete_p && !CONSTRUCTOR_NO_CLEARING (ctor))
+ else if (!complete_p)
/* If the constructor isn't complete, clear the whole object
beforehand, unless CONSTRUCTOR_NO_CLEARING is set on it.
@@ -4690,7 +4690,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
we'd need to *find* the elements that are not present, and that
requires trickery to avoid quadratic compile-time behavior in
large cases or excessive memory use in small cases. */
- cleared = true;
+ cleared = !CONSTRUCTOR_NO_CLEARING (ctor);
else if (num_ctor_elements - num_nonzero_elements
> CLEAR_RATIO (optimize_function_for_speed_p (cfun))
&& num_nonzero_elements < num_ctor_elements / 4)
@@ -5773,8 +5773,11 @@ gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
}
else
/* The temporary may not be an SSA name as later abnormal and EH
- control flow may invalidate use/def domination. */
- val = get_initialized_tmp_var (val, pre_p, post_p, false);
+ control flow may invalidate use/def domination. When in SSA
+ form then assume there are no such issues and SAVE_EXPRs only
+ appear via GENERIC foldings. */
+ val = get_initialized_tmp_var (val, pre_p, post_p,
+ gimple_in_ssa_p (cfun));
TREE_OPERAND (*expr_p, 0) = val;
SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index a4dcec51bb5..b1e2e287e15 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -490,7 +490,16 @@ find_decomposable_subregs (rtx *loc, enum classify_move_insn *pcmi)
were the same number and size of pieces. Hopefully this
doesn't happen much. */
- if (outer_words == 1 && inner_words > 1)
+ if (outer_words == 1
+ && inner_words > 1
+ /* Don't allow to decompose floating point subregs of
+ multi-word pseudos if the floating point mode does
+ not have word size, because otherwise we'd generate
+ a subreg with that floating mode from a different
+ sized integral pseudo which is not allowed by
+ validate_subreg. */
+ && (!FLOAT_MODE_P (GET_MODE (x))
+ || outer_size == UNITS_PER_WORD))
{
bitmap_set_bit (decomposable_context, regno);
iter.skip_subrtxes ();
diff --git a/gcc/match.pd b/gcc/match.pd
index dcff0849748..3030352d241 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2801,15 +2801,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(simplify
(cond
(ne (bit_and @0 integer_pow2p@1) integer_zerop)
- integer_pow2p@2 integer_zerop)
- (with {
- int shift = wi::exact_log2 (@2) - wi::exact_log2 (@1);
- }
- (if (shift > 0)
- (bit_and
- (lshift (convert @0) { build_int_cst (integer_type_node, shift); }) @2)
- (bit_and
- (convert (rshift @0 { build_int_cst (integer_type_node, -shift); })) @2))))
+ INTEGER_CST@2 integer_zerop)
+ (if (integer_pow2p (@2))
+ (with {
+ int shift = wi::exact_log2 (@2) - wi::exact_log2 (@1);
+ }
+ (if (shift > 0)
+ (bit_and
+ (lshift (convert @0) { build_int_cst (integer_type_node, shift); }) @2)
+ (bit_and
+ (convert (rshift @0 { build_int_cst (integer_type_node, -shift); }))
+ @2)))))
/* If we have (A & C) != 0 where C is the sign bit of A, convert
this into A < 0. Similarly for (A & C) == 0 into A >= 0. */
@@ -2830,8 +2832,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(simplify
(cond
(lt @0 integer_zerop)
- integer_pow2p@1 integer_zerop)
- (if (!TYPE_UNSIGNED (TREE_TYPE (@0)))
+ INTEGER_CST@1 integer_zerop)
+ (if (integer_pow2p (@1)
+ && !TYPE_UNSIGNED (TREE_TYPE (@0)))
(with {
int shift = element_precision (@0) - wi::exact_log2 (@1) - 1;
}
@@ -2938,10 +2941,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(for cmp (ne eq)
(simplify
(cmp (convert @0) INTEGER_CST@1)
- (if ((POINTER_TYPE_P (TREE_TYPE (@0)) && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@0)))
- && INTEGRAL_TYPE_P (TREE_TYPE (@1)))
- || (INTEGRAL_TYPE_P (TREE_TYPE (@0)) && POINTER_TYPE_P (TREE_TYPE (@1))
- && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@1)))))
+ (if (((POINTER_TYPE_P (TREE_TYPE (@0))
+ && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@0)))
+ && INTEGRAL_TYPE_P (TREE_TYPE (@1)))
+ || (INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ && POINTER_TYPE_P (TREE_TYPE (@1))
+ && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (TREE_TYPE (@1)))))
+ && TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (TREE_TYPE (@1)))
(cmp @0 (convert @1)))))
/* Non-equality compare simplifications from fold_binary */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 714fac76f3c..9591adaae0c 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4294,9 +4294,10 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
save_pending_stack_adjust (&save);
last = get_last_insn ();
do_pending_stack_adjust ();
+ machine_mode cmpmode = cmode;
prepare_cmp_insn (XEXP (comparison, 0), XEXP (comparison, 1),
GET_CODE (comparison), NULL_RTX, unsignedp,
- OPTAB_WIDEN, &comparison, &cmode);
+ OPTAB_WIDEN, &comparison, &cmpmode);
if (comparison)
{
struct expand_operand ops[4];
diff --git a/gcc/postreload.c b/gcc/postreload.c
index e721f2f867d..d60875a257b 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1160,11 +1160,13 @@ reload_combine_recognize_pattern (rtx_insn *insn)
value in PREV, the constant loading instruction. */
validate_change (prev, &SET_DEST (prev_set), index_reg, 1);
if (reg_state[regno].offset != const0_rtx)
- validate_change (prev,
- &SET_SRC (prev_set),
- GEN_INT (INTVAL (SET_SRC (prev_set))
- + INTVAL (reg_state[regno].offset)),
- 1);
+ {
+ HOST_WIDE_INT c
+ = trunc_int_for_mode (UINTVAL (SET_SRC (prev_set))
+ + UINTVAL (reg_state[regno].offset),
+ GET_MODE (index_reg));
+ validate_change (prev, &SET_SRC (prev_set), GEN_INT (c), 1);
+ }
/* Now for every use of REG that we have recorded, replace REG
with REG_SUM. */
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index 253be9d5273..083eebc257c 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -157,7 +157,7 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn,
struct dead_debug_local *debug)
{
rtx set, src, dest;
- bitmap live_out, live_in, bb_uses, bb_defs;
+ bitmap live_out, live_in, bb_uses = NULL, bb_defs = NULL;
unsigned int i, dregno, end_dregno;
unsigned int sregno = FIRST_PSEUDO_REGISTER;
unsigned int end_sregno = FIRST_PSEUDO_REGISTER;
@@ -330,8 +330,11 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn,
/* Check whether BB uses DEST or clobbers DEST. We need to add
INSN to BB if so. Either way, DEST is no longer live on entry,
except for any part that overlaps SRC (next loop). */
- bb_uses = &DF_LR_BB_INFO (bb)->use;
- bb_defs = &DF_LR_BB_INFO (bb)->def;
+ if (!*split_p)
+ {
+ bb_uses = &DF_LR_BB_INFO (bb)->use;
+ bb_defs = &DF_LR_BB_INFO (bb)->def;
+ }
if (df_live)
{
for (i = dregno; i < end_dregno; i++)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e82b118da39..1752201a47d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,472 @@
+2018-06-26 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ Backported from mainline
+ 2018-06-20 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ * gcc.target/powerpc/builtins-1.c: Add dg directives to scan
+ for vpkudus.
+
+2018-06-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/86314
+ * gcc.dg/pr86314.c: New test.
+
+2018-06-25 Fritz Reese <fritzoreese@gmail.com>
+
+ PR fortran/82972
+ PR fortran/83088
+ PR fortran/85851
+ Backport from trunk.
+ * gfortran.dg/init_flag_17.f90: New testcase.
+
+2018-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84786
+ * gcc.target/i386/avx512f-pr84786-3.c: New test.
+
+2018-06-25 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83118
+ Back port from trunk
+ * gfortran.dg/unlimited_polymorphic_30.f03: New test.
+
+2018-06-23 Richard Sandiford <richard.sandiford@linaro.org>
+
+ PR tree-optimization/85989
+ * gcc.dg/torture/pr85989.c: New test.
+
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85662
+ * g++.dg/ext/offsetof3.C: New test.
+
+ 2018-06-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86210
+ * g++.dg/warn/Wnonnull4.C: New test.
+
+ PR tree-optimization/86231
+ * gcc.dg/tree-ssa/vrp119.c: New test.
+ * gcc.c-torture/execute/pr86231.c: New test.
+
+ 2018-06-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/85878
+ * gfortran.fortran-torture/compile/pr85878.f90: New test.
+
+ 2018-06-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85945
+ * gcc.c-torture/compile/pr85945.c: New test.
+
+ 2018-06-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86025
+ * c-c++-common/gomp/pr86025.c: New test.
+
+ 2018-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85952
+ * g++.dg/warn/Wunused-var-33.C: New test.
+
+ 2018-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/85696
+ * c-c++-common/gomp/pr85696.c: New test.
+
+ 2018-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85662
+ * g++.dg/ext/offsetof2.C: New test.
+
+ 2018-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85659
+ * g++.dg/ext/asm14.C: New test.
+ * g++.dg/ext/asm15.C: New test.
+ * g++.dg/ext/asm16.C: New test.
+
+ 2018-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85529
+ * gcc.c-torture/execute/pr85529-1.c: New test.
+ * gcc.c-torture/execute/pr85529-2.c: New test.
+ * gcc.dg/pr85529.c: New test.
+
+ 2018-04-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84463
+ * g++.dg/cpp0x/constexpr-nullptr-1.C: Add -O1 to dg-options.
+ * g++.dg/cpp0x/constexpr-nullptr-2.C: Expect different diagnostics
+ in two cases. Uncomment two other tests and add expected dg-error for
+ them.
+ * g++.dg/init/struct2.C: Cast to int rather than long to avoid
+ -Wnarrowing diagnostics on some targets for c++11.
+ * g++.dg/parse/array-size2.C: Remove xfail.
+ * g++.dg/cpp0x/constexpr-84463.C: New test.
+
+ 2018-04-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85430
+ * gcc.dg/pr85430.c: New test.
+
+ 2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85300
+ * gcc.dg/pr85300.c: New test.
+
+ PR fortran/85313
+ * gfortran.dg/gomp/pr85313.f90: New test.
+
+ 2018-04-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85257
+ * gcc.dg/pr85257.c: New test.
+
+ 2018-04-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/85252
+ * gcc.dg/debug/pr85252.c: New test.
+
+ PR c++/85210
+ * g++.dg/cpp1z/decomp42.C: New test.
+
+ 2018-04-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85208
+ * g++.dg/cpp1z/decomp41.C: New test.
+
+ 2018-04-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/85172
+ * g++.dg/ext/builtin13.C: New test.
+ * g++.dg/ext/atomic-4.C: New test.
+
+ 2018-04-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85167
+ * gcc.dg/pr85167.c: New test.
+
+ PR c++/85147
+ * g++.dg/cpp0x/pr85147.C: New test.
+
+ PR c++/85140
+ * g++.dg/cpp0x/gen-attrs-64.C: New test.
+
+ 2018-03-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84791
+ * g++.dg/gomp/pr84791.C: New test.
+
+ 2018-03-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85095
+ * gcc.target/i386/pr85095-1.c: New test.
+ * gcc.target/i386/pr85095-2.c: New test.
+ * gcc.c-torture/execute/pr85095.c: New test.
+
+ 2018-03-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/85076
+ * g++.dg/cpp1y/pr85076.C: New test.
+
+ PR c++/85068
+ * g++.dg/inherit/covariant22.C: New test.
+
+ 2018-03-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/85034
+ * gcc.target/i386/pr85034.c: New test.
+
+ PR inline-asm/85022
+ * c-c++-common/torture/pr85022.c: New test.
+
+ 2018-03-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR inline-asm/84941
+ * gcc.dg/pr84941.c: New test.
+
+ 2018-03-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/84999
+ * c-c++-common/pr84999.c: New test.
+
+ PR c++/84961
+ * c-c++-common/pr43690.c: Don't expect errors on "m" (--x) and
+ "m" (++x) in C++.
+ * g++.dg/torture/pr84961-1.C: New test.
+ * g++.dg/torture/pr84961-2.C: New test.
+
+ 2018-03-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/84875
+ * gcc.dg/pr84875.c: New test.
+
+ PR c/84953
+ * gcc.dg/pr84953.c: New test.
+
+ 2018-03-19 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR sanitizer/78651
+ * g++.dg/asan/pr78651.C: New test.
+
+ 2018-03-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84899
+ * gcc.dg/pr84899.c: New test.
+
+ PR c++/84874
+ * g++.dg/cpp1z/desig8.C: New test.
+
+ PR tree-optimization/84841
+ * gcc.dg/pr84841.c: New test.
+
+ PR c++/84874
+ * g++.dg/cpp1z/desig7.C: New test.
+
+ 2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/79085
+ * g++.dg/opt/pr79085.C: New test.
+
+ PR c++/84222
+ * g++.dg/warn/deprecated.C (T::member3): Change dg-warning to dg-bogus.
+ * g++.dg/warn/deprecated-6.C (T::member3): Likewise.
+ * g++.dg/warn/deprecated-13.C: New test.
+
+ PR target/84860
+ * gcc.c-torture/compile/pr84860.c: New test.
+
+ PR c/84853
+ * gcc.dg/pr84853.c: New test.
+
+ 2018-03-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/84834
+ * gcc.dg/pr84834.c: New test.
+
+ PR target/84827
+ * gcc.target/i386/pr84827.c: New test.
+
+ PR target/84786
+ * gcc.target/i386/avx512f-pr84786-1.c: New test.
+ * gcc.target/i386/avx512f-pr84786-2.c: New test.
+
+ 2018-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84772
+ * gcc.dg/pr84772.c: New test.
+
+ 2018-03-09 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84076
+ * g++.dg/warn/Wformat-2.C: New test.
+
+ 2018-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84767
+ * g++.dg/ext/vla18.C: New test.
+
+ 2018-03-08 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/80598
+ * g++.dg/warn/Wunused-function4.C: New test.
+
+ 2018-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/84739
+ * gcc.dg/pr84739.c: New test.
+
+ 2018-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/84700
+ * gcc.target/powerpc/pr84700.c: New test.
+
+ 2018-03-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/84662
+ * g++.dg/cpp1y/pr84662.C: New test.
+
+2018-06-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ Backport from mainline
+ 2018-06-05 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * gcc.target/arm/cmse/cmse-1c99.c: New test.
+
+2018-06-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/aggr24.adb: New test.
+ * gnat.dg/aggr24_pkg.ad[sb]: New helper.
+
+2018-06-18 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/82063
+ * gcc.dg/Walloc-size-larger-than-1.c: New test.
+ * gcc.dg/Walloc-size-larger-than-10.c: New test.
+ * gcc.dg/Walloc-size-larger-than-11.c: New test.
+ * gcc.dg/Walloc-size-larger-than-12.c: New test.
+ * gcc.dg/Walloc-size-larger-than-13.c: New test.
+ * gcc.dg/Walloc-size-larger-than-14.c: New test.
+ * gcc.dg/Walloc-size-larger-than-15.c: New test.
+ * gcc.dg/Walloc-size-larger-than-16.c: New test.
+ * gcc.dg/Walloc-size-larger-than-2.c: New test.
+ * gcc.dg/Walloc-size-larger-than-3.c: New test.
+ * gcc.dg/Walloc-size-larger-than-4.c: New test.
+ * gcc.dg/Walloc-size-larger-than-5.c: New test.
+ * gcc.dg/Walloc-size-larger-than-6.c: New test.
+ * gcc.dg/Walloc-size-larger-than-7.c: New test.
+ * gcc.dg/Walloc-size-larger-than-8.c: New test.
+ * gcc.dg/Walloc-size-larger-than-9.c: New test.
+ * gcc.dg/Walloc-size-larger-than.c: New test.
+
+2018-06-13 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86110
+ * gfortran.dg/pr86110.f90: New test.
+
+2018-06-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/44491
+ * gfortran.dg/pr44491.f90: New testcase
+
+2018-06-11 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-06-08 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/85755
+ * gcc.target/powerpc/pr85755.c: New test.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/38351
+ * gfortran.dg/pr38351.f90: New test.
+ * gfortran.dg/typebound_operator_4.f03: Adjust for new error message.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/63514
+ * gfortran.dg/pr63514.f90: New test.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/78278
+ * gfortran.dg/data_bounds_1.f90: Add -std=gnu option.
+ * gfortran.dg/data_char_1.f90: Ditto.
+ * gfortran.dg/pr78571.f90: Ditto.
+ * gfortran.dg/pr78278.f90: New test.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86059
+ * gfortran.dg/associate_30.f90: Remove code tested ...
+ * gfortran.dg/pr67803.f90: Ditto.
+ * gfortran.dg/pr67805.f90: Ditto.
+ * gfortran.dg/pr86059.f90: ... here. New test.
+
+2018-06-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85138
+ PR fortran/85996
+ PR fortran/86051
+ * gfortran.dg/pr85138_1.f90: New test.
+ * gfortran.dg/pr85138_2.f90: Ditto.
+ * gfortran.dg/pr85996.f90: Ditto.
+
+2018-06-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86045
+ Backport from trunk.
+ * gfortran.dg/pr86045.f90: New test.
+
+2018-06-07 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/85641
+ Backport from trunk.
+ * gfortran.dg/realloc_on_assign_30.f90: New test.
+
+2018-06-07 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-05-04 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85588
+ * gcc.dg/torture/pr85588.c: New testcase.
+ * gcc.dg/torture/pr57656.c: Use dg-additional-options.
+
+ 2018-05-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85567
+ * gcc.dg/torture/pr85567.c: New testcase.
+
+ 2018-05-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85597
+ * gcc.dg/vect/pr85597.c: New testcase.
+
+2018-06-05 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ Backport from mainline
+ 2018-06-05 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/htm-builtins-compile-4.c: New test.
+
+2018-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85981
+ * gfortran.dg/allocate_alloc_opt_14.f90: New test.
+ * gfortran.dg/allocate_alloc_opt_1.f90: Update error string.
+ * gfortran.dg/allocate_stat_2.f90: Ditto.
+ * gfortran.dg/deallocate_alloc_opt_1.f90: Ditto.
+
+2018-06-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/opt3.ads: New test.
+ * gnat.dg/specs/opt3_pkg.ads: New helper.
+
+2018-06-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr53.ad[sb]: New test.
+ * gnat.dg/discr53_pkg.ads: New helper.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85543
+ Backport from trunk
+ * gfortran.dg/pr85543.f90: New test.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85779
+ Backport from trunk
+ * gfortran.dg/pr85779_1.f90: New test.
+ * gfortran.dg/pr85779_2.f90: Ditto.
+ * gfortran.dg/pr85779_3.f90: Ditto.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85780
+ Backport from trunk
+ * gfortran.dg/pr85780.f90: New test.
+
+2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85895
+ Backport from trunk
+ * gfortran.dg/coarray_3.f90: Fix invalid testcase.
+ * gfortran.dg/pr85895.f90: New test.
+
+2018-05-24 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/avx512f-vcvtusi2sd64-1.c: Update scan string.
+ * gcc.target/i386/avx512f-vcvtusi2ss64-1.c: Ditto.
+
2018-05-21 Pat Haugen <pthaugen@us.ibm.com>
Backport from mainline:
diff --git a/gcc/testsuite/c-c++-common/gomp/pr85696.c b/gcc/testsuite/c-c++-common/gomp/pr85696.c
new file mode 100644
index 00000000000..798718b563d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr85696.c
@@ -0,0 +1,20 @@
+/* PR c/85696 */
+
+#ifndef __cplusplus
+void
+foo (int n, int a[][n])
+{
+ #pragma omp parallel shared(a) default(none)
+ #pragma omp master
+ a[23][0] = 42;
+}
+#endif
+
+void
+bar (int n, void *p)
+{
+ int (*a)[n] = (int (*)[n]) p;
+ #pragma omp parallel shared(a) default(none)
+ #pragma omp master
+ a[23][0] = 42;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr86025.c b/gcc/testsuite/c-c++-common/gomp/pr86025.c
new file mode 100644
index 00000000000..c1c50799413
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr86025.c
@@ -0,0 +1,20 @@
+/* PR c++/86025 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Wduplicated-branches" } */
+
+int i;
+
+void
+foo (int x)
+{
+ if (x)
+ {
+ #pragma omp critical (foo)
+ i++;
+ }
+ else
+ {
+ #pragma omp critical
+ i++;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/pr43690.c b/gcc/testsuite/c-c++-common/pr43690.c
index 67c6cb0f88c..8d10744903f 100644
--- a/gcc/testsuite/c-c++-common/pr43690.c
+++ b/gcc/testsuite/c-c++-common/pr43690.c
@@ -6,8 +6,8 @@ void
foo (char *x)
{
asm ("" : : "m" (x++)); /* { dg-error "is not directly addressable" } */
- asm ("" : : "m" (++x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (++x)); /* { dg-error "is not directly addressable" "" { target c } } */
asm ("" : : "m" (x--)); /* { dg-error "is not directly addressable" } */
- asm ("" : : "m" (--x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (--x)); /* { dg-error "is not directly addressable" "" { target c } } */
asm ("" : : "m" (x + 1)); /* { dg-error "is not directly addressable" } */
}
diff --git a/gcc/testsuite/c-c++-common/pr84999.c b/gcc/testsuite/c-c++-common/pr84999.c
new file mode 100644
index 00000000000..42d53769a3b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr84999.c
@@ -0,0 +1,12 @@
+/* PR c/84999 */
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "" } */
+
+typedef __float128 V __attribute__ ((__vector_size__ (2 * sizeof (__float128))));
+V a;
+typeof (a != 0) b; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
+typeof (a == 0) c; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
+typeof (a < 0) d; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
+typeof (a <= 0) e; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
+typeof (a > 0) f; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
+typeof (a >= 0) g; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */
diff --git a/gcc/testsuite/c-c++-common/torture/pr85022.c b/gcc/testsuite/c-c++-common/torture/pr85022.c
new file mode 100644
index 00000000000..3ec2c781aa1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr85022.c
@@ -0,0 +1,9 @@
+/* PR inline-asm/85022 */
+
+extern struct B b;
+
+void
+foo ()
+{
+ __asm ("" : "+m" (b));
+}
diff --git a/gcc/testsuite/g++.dg/asan/pr78651.C b/gcc/testsuite/g++.dg/asan/pr78651.C
new file mode 100644
index 00000000000..09f1be538c3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr78651.C
@@ -0,0 +1,26 @@
+// PR sanitizer/78651
+// { dg-do run }
+// { dg-additional-options "-fpic" { target fpic } }
+
+struct A { };
+
+namespace {
+
+void thisThrows () {
+ throw A();
+}
+
+struct SomeRandomType {};
+}
+
+int main() {
+ try {
+ thisThrows();
+ }
+ catch (SomeRandomType) {
+ throw;
+ }
+ catch (A) {
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C
new file mode 100644
index 00000000000..0743059be53
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C
@@ -0,0 +1,22 @@
+// PR c++/84463
+// { dg-do compile { target c++11 } }
+
+struct S { int r; const unsigned char s[5]; };
+static constexpr S a[] = { { 0, "abcd" } };
+struct T { const unsigned char s[5]; };
+static constexpr T b[] = { { "abcd" } };
+
+constexpr int
+foo (const unsigned char *x)
+{
+ return x[0];
+}
+
+constexpr static const S *j = &a[0];
+constexpr static const int k = j->s[0];
+constexpr static int l = foo (a[0].s);
+constexpr static int m = foo (j->s);
+constexpr static const T *n = &b[0];
+constexpr static const int o = n->s[0];
+constexpr static int p = foo (b[0].s);
+constexpr static int q = foo (n->s);
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C
index e2f7917d36e..ed53fcd69aa 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C
@@ -6,7 +6,7 @@
// c++/67376 on gcc-patches for additional background.
// { dg-do compile { target c++11 } }
-// { dg-options "-fdelete-null-pointer-checks -fdump-tree-optimized" }
+// { dg-options "-O1 -fdelete-null-pointer-checks -fdump-tree-optimized" }
// Runtime assert. Used for potentially invalid expressions.
#define RA(e) ((e) ? (void)0 : __builtin_abort ())
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C
index aeea87c2ae7..3b3f01adea3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C
@@ -192,12 +192,11 @@ constexpr bool b11 = ps >= (S*)0;
constexpr S* ps1 = ps;
constexpr S* ps2 = ps1;
-// The following aren't diagnosed due to a bug.
-// constexpr int* pi0 = &((S*)0)->i;
-// constexpr int* pi1 = &((S*)nullptr)->i;
+constexpr int* pi0 = &((S*)0)->i; // { dg-error "null pointer|not a constant" }
+constexpr int* pi1 = &((S*)nullptr)->i; // { dg-error "null pointer|not a constant" }
-constexpr int* pj0 = &((S*)0)->j; // { dg-error "not a constant expression" }
-constexpr int* pj1 = &((S*)nullptr)->j; // { dg-error "not a constant expression" }
+constexpr int* pj0 = &((S*)0)->j; // { dg-error "null pointer|not a constant" }
+constexpr int* pj1 = &((S*)nullptr)->j; // { dg-error "null pointer|not a constant" }
constexpr int* psi = &ps->i; // { dg-error "null pointer|not a constant" }
constexpr int* psj = &ps->j; // { dg-error "null pointer|not a constant" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
new file mode 100644
index 00000000000..c0d48fc88e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-64.C
@@ -0,0 +1,4 @@
+// PR c++/85140
+// { dg-do compile { target c++11 } }
+
+namespace N alignas() {} // { dg-error "expected" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-dependent1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-dependent1.C
new file mode 100644
index 00000000000..6fd2bb379bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-dependent1.C
@@ -0,0 +1,19 @@
+// PR c++/85815
+// { dg-do compile { target c++11 } }
+
+template<class T>
+class A {
+ static A* INSTANCE;
+ void foobar();
+ void moo() {}
+};
+
+template<class T>
+A<T>* A<T>::INSTANCE = nullptr;
+
+template<class T>
+void A<T>::foobar() {
+ auto x = []() {
+ INSTANCE->moo();
+ };
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr85147.C b/gcc/testsuite/g++.dg/cpp0x/pr85147.C
new file mode 100644
index 00000000000..68c0022d80a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr85147.C
@@ -0,0 +1,9 @@
+// PR c++/85147
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct A
+{
+ template<template<...T> class...> struct B {}; // { dg-error "expected|mismatch" }
+};
+
+A<int>::B<> b; // { dg-error "does not name a template type" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for35.C b/gcc/testsuite/g++.dg/cpp0x/range-for35.C
new file mode 100644
index 00000000000..c77a5af5a44
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for35.C
@@ -0,0 +1,8 @@
+// PR c++/86060
+// { dg-options -Wpedantic }
+
+template <typename T> void foo(T (&a)[8]) {
+ for (int i : a) // { dg-warning "range-based" "" { target c++98_only } }
+ i;
+}
+void fn1() { foo<int>; }
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for9.C b/gcc/testsuite/g++.dg/cpp0x/range-for9.C
index 6a50ec36c14..eaa5b406880 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for9.C
@@ -5,6 +5,6 @@
void test()
{
int a[] = {0,1,2};
- for (int x : a) // { dg-error "range-based 'for'" }
+ for (int x : a) // { dg-error "range-based 'for'|forming reference" }
;
}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr84662.C b/gcc/testsuite/g++.dg/cpp1y/pr84662.C
new file mode 100644
index 00000000000..36bd201073e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr84662.C
@@ -0,0 +1,6 @@
+// PR c++/84662
+// { dg-do compile { target c++14 } }
+// { dg-options "" }
+
+double b;
+a (__attribute__((c (0 && int() - ([] {} && b) || auto)))); // { dg-error "expected constructor, destructor, or type conversion before" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr85076.C b/gcc/testsuite/g++.dg/cpp1y/pr85076.C
new file mode 100644
index 00000000000..6d54dea6c01
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr85076.C
@@ -0,0 +1,6 @@
+// PR c++/85076
+// { dg-do compile { target c++14 } }
+
+template<typename> struct A*; // { dg-error "expected unqualified-id before" }
+
+auto a = [](A<auto>) {}; // { dg-error "is not a template|has incomplete type" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp41.C b/gcc/testsuite/g++.dg/cpp1z/decomp41.C
new file mode 100644
index 00000000000..1ce836bd6dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp41.C
@@ -0,0 +1,9 @@
+// PR c++/85208
+// { dg-do compile { target c++11 } }
+// { dg-require-weak "" }
+// { dg-options "" }
+
+#pragma weak _ZDC1d1e1fE
+struct A { int i, j, k; };
+auto [a, b, c] = A (); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+auto [d, e, f] = A (); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp42.C b/gcc/testsuite/g++.dg/cpp1z/decomp42.C
new file mode 100644
index 00000000000..22c68ebd3a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp42.C
@@ -0,0 +1,18 @@
+// PR c++/85210
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { int i; };
+
+template <int>
+void
+foo (int j)
+{
+ auto [j] = A{j}; // { dg-error "shadows a parameter" }
+} // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 }
+
+void
+bar ()
+{
+ foo<0> (0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/desig7.C b/gcc/testsuite/g++.dg/cpp1z/desig7.C
new file mode 100644
index 00000000000..83688375f78
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/desig7.C
@@ -0,0 +1,18 @@
+// PR c++/84874
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct A { int a, b; };
+struct B { A d; };
+
+void
+foo (B *x)
+{
+ *x = { .d = { .b = 5 } }; // { dg-message "non-trivial designated initializers not supported" }
+}
+
+void
+bar (A *x)
+{
+ *x = { .b = 6 }; // { dg-message "non-trivial designated initializers not supported" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/desig8.C b/gcc/testsuite/g++.dg/cpp1z/desig8.C
new file mode 100644
index 00000000000..a6fc1600f5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/desig8.C
@@ -0,0 +1,18 @@
+// PR c++/84874
+// { dg-do compile { target c++1z } }
+// { dg-options "" }
+
+struct A { int a; struct { int b; }; };
+struct B { A d; };
+
+void
+foo (B *x)
+{
+ *x = { .d = { .b = 5 } }; // { dg-message "non-trivial designated initializers not supported" }
+}
+
+void
+bar (A *x)
+{
+ *x = { .b = 6 }; // { dg-message "non-trivial designated initializers not supported" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/asm14.C b/gcc/testsuite/g++.dg/ext/asm14.C
new file mode 100644
index 00000000000..f7f61aabd93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/asm14.C
@@ -0,0 +1,10 @@
+// PR c++/85659
+// { dg-do compile }
+
+struct S { S (); ~S (); int s; };
+
+void
+foo (S &s)
+{
+ __asm volatile ("" : "+m,r" (s) : : "memory");
+}
diff --git a/gcc/testsuite/g++.dg/ext/asm15.C b/gcc/testsuite/g++.dg/ext/asm15.C
new file mode 100644
index 00000000000..c4946ddc536
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/asm15.C
@@ -0,0 +1,10 @@
+// PR c++/85659
+// { dg-do compile }
+
+struct S { S (); ~S (); int s; };
+
+void
+foo (S &s)
+{
+ __asm volatile ("" : "+r" (s) : : "memory"); // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/asm16.C b/gcc/testsuite/g++.dg/ext/asm16.C
new file mode 100644
index 00000000000..565cbb33e5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/asm16.C
@@ -0,0 +1,10 @@
+// PR c++/85659
+// { dg-do compile }
+
+struct S { S (); ~S (); int s[64]; } s;
+
+void
+foo ()
+{
+ __asm volatile ("" : "=r" (s) : : "memory"); // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/atomic-4.C b/gcc/testsuite/g++.dg/ext/atomic-4.C
new file mode 100644
index 00000000000..1eba11773e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/atomic-4.C
@@ -0,0 +1,9 @@
+// PR inline-asm/85172
+// { dg-do compile }
+// { dg-options "" }
+
+int
+foo (int *p)
+{
+ return !__atomic_always_lock_free (4, ({ __asm (""); p; }));
+}
diff --git a/gcc/testsuite/g++.dg/ext/builtin13.C b/gcc/testsuite/g++.dg/ext/builtin13.C
new file mode 100644
index 00000000000..7007fe8a6ef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/builtin13.C
@@ -0,0 +1,9 @@
+// PR inline-asm/85172
+// { dg-do compile }
+// { dg-options "" }
+
+int
+foo ()
+{
+ return !__builtin_constant_p (({ __asm (""); 0; }));
+}
diff --git a/gcc/testsuite/g++.dg/ext/offsetof2.C b/gcc/testsuite/g++.dg/ext/offsetof2.C
new file mode 100644
index 00000000000..647cf8d0b77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/offsetof2.C
@@ -0,0 +1,6 @@
+// PR c++/85662
+// { dg-do compile { target c++11 } }
+
+struct S { unsigned long x[31]; };
+struct T { bool b; S f; };
+static_assert (__builtin_offsetof (T, f.x[31 - 1]) == __builtin_offsetof (T, f.x[30]), "");
diff --git a/gcc/testsuite/g++.dg/ext/offsetof3.C b/gcc/testsuite/g++.dg/ext/offsetof3.C
new file mode 100644
index 00000000000..6bf4c506fe3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/offsetof3.C
@@ -0,0 +1,5 @@
+// PR c++/85662
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+#include "offsetof2.C"
diff --git a/gcc/testsuite/g++.dg/ext/vla18.C b/gcc/testsuite/g++.dg/ext/vla18.C
new file mode 100644
index 00000000000..31a1bb32f1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vla18.C
@@ -0,0 +1,19 @@
+// PR c++/84767
+// { dg-do compile }
+// { dg-options "" }
+
+int v[1][10];
+
+struct A
+{
+ A (int);
+};
+
+A::A (int i)
+{
+ typedef int T[1][i];
+ T *x = (T *) v;
+ (*x)[0][0] = 0;
+}
+
+A a = 10;
diff --git a/gcc/testsuite/g++.dg/gomp/pr84791.C b/gcc/testsuite/g++.dg/gomp/pr84791.C
new file mode 100644
index 00000000000..4e6d3b8fd44
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr84791.C
@@ -0,0 +1,15 @@
+// PR c++/84791
+// { dg-do compile }
+
+typedef int I;
+
+template <int>
+void
+foo ()
+{
+ I i;
+ #pragma omp parallel reduction (I::I: i) // { dg-error "'I' is not a class, namespace, or enumeration" "" { target c++11 } }
+ ; // { dg-error "'I' is not a class or namespace" "" { target c++98_only } .-1 }
+}
+
+template void foo<0> ();
diff --git a/gcc/testsuite/g++.dg/inherit/covariant22.C b/gcc/testsuite/g++.dg/inherit/covariant22.C
new file mode 100644
index 00000000000..26c96e6abfc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/covariant22.C
@@ -0,0 +1,19 @@
+// PR c++/85068
+// { dg-do compile }
+
+struct A;
+
+struct B
+{
+ virtual A *foo (); // { dg-error "overriding" }
+};
+
+struct C : virtual B
+{
+ virtual C *foo (); // { dg-error "invalid covariant return type for" }
+};
+
+struct D : C
+{
+ virtual C *foo ();
+};
diff --git a/gcc/testsuite/g++.dg/init/struct2.C b/gcc/testsuite/g++.dg/init/struct2.C
index 85aacc6fa09..4396febdc46 100644
--- a/gcc/testsuite/g++.dg/init/struct2.C
+++ b/gcc/testsuite/g++.dg/init/struct2.C
@@ -15,7 +15,7 @@ void saveOrLoad() {
};
SaveLoadEntry trackEntries = {
- ((long) (__SIZE_TYPE__) (&((Track *) 42)->soundName[0])) - 42,
+ ((int) (__SIZE_TYPE__) (&((Track *) 42)->soundName[0])) - 42,
0, 1
};
saveLoadEntries(&trackEntries);
diff --git a/gcc/testsuite/g++.dg/opt/pr79085.C b/gcc/testsuite/g++.dg/opt/pr79085.C
new file mode 100644
index 00000000000..1d75d6a7300
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr79085.C
@@ -0,0 +1,24 @@
+// PR c++/79085
+// { dg-do compile }
+// { dg-options "-Os" }
+// { dg-additional-options "-mstrict-align" { target { aarch64*-*-* powerpc*-*-linux* powerpc*-*-elf* } } }
+
+void *operator new (__SIZE_TYPE__, void *p) { return p; }
+
+struct S
+{
+ S ();
+ S (const S &);
+ ~S (void);
+ int i;
+};
+
+S foo ();
+
+static char buf [sizeof (S) + 1];
+
+S *
+bar ()
+{
+ return new (buf + 1) S (foo ());
+}
diff --git a/gcc/testsuite/g++.dg/parse/array-size2.C b/gcc/testsuite/g++.dg/parse/array-size2.C
index 3c833472d69..d0bc47fe746 100644
--- a/gcc/testsuite/g++.dg/parse/array-size2.C
+++ b/gcc/testsuite/g++.dg/parse/array-size2.C
@@ -15,6 +15,6 @@ void
foo (void)
{
char g[(char *) &((struct S *) 0)->b - (char *) 0]; // { dg-error "constant" }
- char h[(__SIZE_TYPE__) &((struct S *) 8)->b]; // { dg-error "constant" "" { xfail *-*-* } }
+ char h[(__SIZE_TYPE__) &((struct S *) 8)->b]; // { dg-error "constant" }
bar (g, h);
}
diff --git a/gcc/testsuite/g++.dg/torture/pr84961-1.C b/gcc/testsuite/g++.dg/torture/pr84961-1.C
new file mode 100644
index 00000000000..6a72ad5134f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr84961-1.C
@@ -0,0 +1,24 @@
+// PR c++/84961
+// { dg-do compile }
+
+short a;
+volatile int b;
+int c, d;
+
+void
+foo ()
+{
+ asm volatile ("" : "=r" (b = a));
+}
+
+void
+bar ()
+{
+ asm volatile ("" : "=r" (++c, ++d, b = a));
+}
+
+void
+baz ()
+{
+ asm volatile ("" : "=r" (--b));
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr84961-2.C b/gcc/testsuite/g++.dg/torture/pr84961-2.C
new file mode 100644
index 00000000000..0909eedb7f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr84961-2.C
@@ -0,0 +1,24 @@
+// PR c++/84961
+// { dg-do compile }
+
+short a;
+volatile int b;
+int c, d;
+
+void
+foo ()
+{
+ asm volatile ("" : : "m" (b = a));
+}
+
+void
+bar ()
+{
+ asm volatile ("" : : "m" (++c, ++d, b = a));
+}
+
+void
+baz ()
+{
+ asm volatile ("" : : "m" (--b));
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wformat-2.C b/gcc/testsuite/g++.dg/warn/Wformat-2.C
new file mode 100644
index 00000000000..ff8b54b4899
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wformat-2.C
@@ -0,0 +1,17 @@
+// PR c++/84076
+// { dg-do compile }
+// { dg-options "-Wformat" }
+
+struct S { ~S (); };
+struct T { T (); T (const T &); };
+
+void
+foo ()
+{
+ S s;
+ T t;
+ __builtin_printf ("%s\n", s); // { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'S'" }
+ __builtin_printf ("%s\n", t); // { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'T'" }
+ __builtin_printf ("%s\n", &s);// { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'S\\*'" }
+ __builtin_printf ("%s\n", &t);// { dg-warning "format '%s' expects argument of type 'char\\*', but argument 2 has type 'T\\*'" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull4.C b/gcc/testsuite/g++.dg/warn/Wnonnull4.C
new file mode 100644
index 00000000000..d07a4452ddb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wnonnull4.C
@@ -0,0 +1,21 @@
+// PR c++/86210
+// { dg-do compile }
+// { dg-options "-Wnonnull" }
+
+void *declared_not_defined (void *p) __attribute__((nonnull));
+
+inline void *declared_and_defined (void *p) __attribute__((nonnull));
+
+int
+main ()
+{
+ int *const p = 0;
+ declared_not_defined (p); // { dg-warning "null argument where non-null required" }
+ declared_and_defined (p); // { dg-warning "null argument where non-null required" }
+}
+
+void *
+declared_and_defined (void *p)
+{
+ return p;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-function4.C b/gcc/testsuite/g++.dg/warn/Wunused-function4.C
new file mode 100644
index 00000000000..00d5d70fc90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-function4.C
@@ -0,0 +1,21 @@
+// PR c++/80598
+// { dg-do compile }
+// { dg-options "-Wunused-function" }
+
+static void
+foo () // { dg-bogus "defined but not used" }
+{
+}
+
+static void
+bar () // { dg-warning "defined but not used" }
+{
+}
+
+template <class T>
+int
+baz (T x)
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-33.C b/gcc/testsuite/g++.dg/warn/Wunused-var-33.C
new file mode 100644
index 00000000000..5f10d781082
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-33.C
@@ -0,0 +1,37 @@
+// PR c++/85952
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wunused-but-set-variable" }
+
+int
+foo ()
+{
+ int a[2] = {1, 2}; // { dg-bogus "set but not used" } */
+ auto [x, y] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+struct S { int d, e; };
+
+int
+bar ()
+{
+ S a = {1, 2};
+ auto [x, y] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+int
+baz ()
+{
+ S a = {1, 2};
+ auto & [x, y] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ return x + y;
+}
+
+int
+qux ()
+{
+ int a[2] = {1, 2};
+ auto & [x, y] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+ return x + y;
+}
diff --git a/gcc/testsuite/g++.dg/warn/deprecated-13.C b/gcc/testsuite/g++.dg/warn/deprecated-13.C
new file mode 100644
index 00000000000..ef05b95f026
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/deprecated-13.C
@@ -0,0 +1,44 @@
+// PR c++/84222
+// { dg-do compile }
+
+struct __attribute__((deprecated)) C { // { dg-message "declared here" }
+ C () {}
+ C (const C &); // { dg-bogus "'C' is deprecated" }
+ C (const C &x, const C &y) { C z = x; } // { dg-bogus "'C' is deprecated" }
+ void foo (const C &x, const C &y); // { dg-bogus "'C' is deprecated" }
+};
+
+void
+C::foo (const C &x, const C &y) // { dg-bogus "'C' is deprecated" }
+{
+ C z = x; // { dg-bogus "'C' is deprecated" }
+}
+
+void
+bar (const C &x, const C &y) // { dg-warning "'C' is deprecated" }
+{
+ C z = x; // { dg-warning "'C' is deprecated" }
+}
+
+template <int N>
+struct __attribute__((deprecated)) D { // { dg-message "declared here" }
+ D () {}
+ D (const D &); // { dg-bogus "is deprecated" }
+ D (const D &x, const D &y) { D z = x; } // { dg-bogus "is deprecated" }
+ void foo (const D &x, const D &y); // { dg-bogus "is deprecated" }
+};
+
+template <int N>
+void
+D<N>::foo // { dg-bogus "is deprecated" "" { xfail *-*-* } }
+(const D &x, const D &y) // { dg-bogus "is deprecated" }
+{
+ D z = x; // { dg-bogus "is deprecated" }
+}
+
+template <int N>
+void
+bar (const D<N> &x, const D<N> &y) // { dg-warning "is deprecated" }
+{
+ D<N> z = x; // { dg-warning "is deprecated" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/deprecated-6.C b/gcc/testsuite/g++.dg/warn/deprecated-6.C
index ad9eb3d4820..682e9b226ca 100644
--- a/gcc/testsuite/g++.dg/warn/deprecated-6.C
+++ b/gcc/testsuite/g++.dg/warn/deprecated-6.C
@@ -98,7 +98,7 @@ T *p3; // { dg-warning "'T' is deprecated: Please avoid T" }
inline void T::member1(int) {}
-int T::member3(T *p) // { dg-warning "'T' is deprecated: Please avoid T" }
+int T::member3(T *p) // { dg-bogus "'T' is deprecated: Please avoid T" }
{
p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated: Please avoid member1" "" } */
(*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated: Please avoid member1" "" } */
diff --git a/gcc/testsuite/g++.dg/warn/deprecated.C b/gcc/testsuite/g++.dg/warn/deprecated.C
index a5b2aee03e3..0420a6afd22 100644
--- a/gcc/testsuite/g++.dg/warn/deprecated.C
+++ b/gcc/testsuite/g++.dg/warn/deprecated.C
@@ -102,7 +102,7 @@ T *p3; // { dg-warning "'T' is deprecated" }
inline void T::member1(int) {}
-int T::member3(T *p) // { dg-warning "'T' is deprecated" }
+int T::member3(T *p) // { dg-bogus "'T' is deprecated" }
{
p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
(*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */
@@ -113,5 +113,3 @@ int T::member3(T *p) // { dg-warning "'T' is deprecated" }
return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */
}
#endif
-
-
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr84860.c b/gcc/testsuite/gcc.c-torture/compile/pr84860.c
new file mode 100644
index 00000000000..002737c71b5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr84860.c
@@ -0,0 +1,11 @@
+/* PR target/84860 */
+
+void
+foo (int x, int y)
+{
+ while (x < 1)
+ {
+ x = y;
+ y = ((float)1 / 0) ? 2 : 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr85945.c b/gcc/testsuite/gcc.c-torture/compile/pr85945.c
new file mode 100644
index 00000000000..93b2023f25c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr85945.c
@@ -0,0 +1,16 @@
+/* PR target/85945 */
+
+typedef float V __attribute__((vector_size(16)));
+union U { V v; float f[4]; };
+int f;
+float g[4];
+
+void
+foo (void)
+{
+ V d;
+ union U i;
+ i.v = d;
+ for (f = 0; f < 4; f++)
+ g[f] = i.f[f];
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85095.c b/gcc/testsuite/gcc.c-torture/execute/pr85095.c
new file mode 100644
index 00000000000..abcb1785a16
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr85095.c
@@ -0,0 +1,52 @@
+/* PR target/85095 */
+
+__attribute__((noinline, noclone)) unsigned long
+f1 (unsigned long a, unsigned long b)
+{
+ unsigned long i = __builtin_add_overflow (a, b, &a);
+ return a + i;
+}
+
+__attribute__((noinline, noclone)) unsigned long
+f2 (unsigned long a, unsigned long b)
+{
+ unsigned long i = __builtin_add_overflow (a, b, &a);
+ return a - i;
+}
+
+__attribute__((noinline, noclone)) unsigned long
+f3 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a + i;
+}
+
+__attribute__((noinline, noclone)) unsigned long
+f4 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a - i;
+}
+
+int
+main ()
+{
+ if (f1 (16UL, -18UL) != -2UL
+ || f1 (16UL, -17UL) != -1UL
+ || f1 (16UL, -16UL) != 1UL
+ || f1 (16UL, -15UL) != 2UL
+ || f2 (24UL, -26UL) != -2UL
+ || f2 (24UL, -25UL) != -1UL
+ || f2 (24UL, -24UL) != -1UL
+ || f2 (24UL, -23UL) != 0UL
+ || f3 (32U, -34U) != -2U
+ || f3 (32U, -33U) != -1U
+ || f3 (32U, -32U) != 1U
+ || f3 (32U, -31U) != 2U
+ || f4 (35U, -37U) != -2U
+ || f4 (35U, -36U) != -1U
+ || f4 (35U, -35U) != -1U
+ || f4 (35U, -34U) != 0U)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85529-1.c b/gcc/testsuite/gcc.c-torture/execute/pr85529-1.c
new file mode 100644
index 00000000000..83d5cdd997e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr85529-1.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/85529 */
+
+struct S { int a; };
+
+int b, c = 1, d, e, f;
+static int g;
+volatile struct S s;
+
+signed char
+foo (signed char i, int j)
+{
+ return i < 0 ? i : i << j;
+}
+
+int
+main ()
+{
+ signed char k = -83;
+ if (!d)
+ goto L;
+ k = e || f;
+L:
+ for (; b < 1; b++)
+ s.a != (k < foo (k, 2) && (c = k = g));
+ if (c != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr85529-2.c b/gcc/testsuite/gcc.c-torture/execute/pr85529-2.c
new file mode 100644
index 00000000000..727280de061
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr85529-2.c
@@ -0,0 +1,25 @@
+/* PR tree-optimization/85529 */
+
+__attribute__((noinline, noclone)) int
+foo (int x)
+{
+ x &= 63;
+ x -= 50;
+ x |= 1;
+ if (x < 0)
+ return 1;
+ int y = x >> 2;
+ if (x >= y)
+ return 1;
+ return 0;
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 63; i++)
+ if (foo (i) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr86231.c b/gcc/testsuite/gcc.c-torture/execute/pr86231.c
new file mode 100644
index 00000000000..1eafe794dd3
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr86231.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/86231 */
+
+#define ONE ((void *) 1)
+#define TWO ((void *) 2)
+
+__attribute__((noinline, noclone)) int
+foo (void *p, int x)
+{
+ if (p == ONE) return 0;
+ if (!p)
+ p = x ? TWO : ONE;
+ return p == ONE ? 0 : 1;
+}
+
+int v[8];
+
+int
+main ()
+{
+ if (foo ((void *) 0, 0) != 0
+ || foo ((void *) 0, 1) != 1
+ || foo (ONE, 0) != 0
+ || foo (ONE, 1) != 0
+ || foo (TWO, 0) != 1
+ || foo (TWO, 1) != 1
+ || foo (&v[7], 0) != 1
+ || foo (&v[7], 1) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-1.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-1.c
new file mode 100644
index 00000000000..2e0b76554f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-1.c
@@ -0,0 +1,19 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1KB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ unsigned n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1024; /* 1 kibibyte (KB or KiB) */
+ T (__builtin_malloc (n));
+
+ n = 1025;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1025. exceeds maximum object size 1024" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-10.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-10.c
new file mode 100644
index 00000000000..559309d5531
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-10.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1PiB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1024 * 1024 * 1024 * 1024 * 1024; /* 1 pebibyte (PiB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1125899906842625. exceeds maximum object size 1125899906842624" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
new file mode 100644
index 00000000000..41e523c6958
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-11.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1PB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1000 * 1000 * 1000 * 1000 * 1000; /* 1 petabyte (PB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000000000000001. exceeds maximum object size 1000000000000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-12.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-12.c
new file mode 100644
index 00000000000..24269a8a102
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-12.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1EiB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1024 * 1024 * 1024 * 1024 * 1024 * 1024; /* 1 exbibyte (EiB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1152921504606846977. exceeds maximum object size 1152921504606846976" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-13.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-13.c
new file mode 100644
index 00000000000..b96e3892bd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-13.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1EB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1000 * 1000 * 1000 * 1000 * 1000 * 1000; /* 1 exabyte (EB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000000000000000001. exceeds maximum object size 1000000000000000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-14.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-14.c
new file mode 100644
index 00000000000..e632e2236a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-14.c
@@ -0,0 +1,30 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=123456789123456789123456789123456789 -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+/* Verify that an exceedingly large -Walloc-size-larger-than argument
+ with no suffix is accepted and treated as infinite. */
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n));
+
+ n = __SIZE_MAX__ - 1;
+ T (__builtin_malloc (n));
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n));
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-15.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-15.c
new file mode 100644
index 00000000000..b699cc09c22
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-15.c
@@ -0,0 +1,30 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=123456789123456789123456789123456789gb -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+/* Verify that an exceeingly large -Walloc-size-larger-than argument
+ with a valid suffic is accepted and treated as infinite. */
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n));
+
+ n = __SIZE_MAX__ - 1;
+ T (__builtin_malloc (n));
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n));
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-16.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-16.c
new file mode 100644
index 00000000000..837b69a36d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-16.c
@@ -0,0 +1,32 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1zb -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+/* Verify that an invalid -Walloc-size-larger-than argument is diagnosed
+ and rejected without changing the default setting of PTRDIFF_MAX. */
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__ - 1;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
+
+/* { dg-warning "invalid argument .1zb. to .-Walloc-size-larger-than=." "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c
new file mode 100644
index 00000000000..1ded37b0b5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c
@@ -0,0 +1,20 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1KiB -ftrack-macro-expansion=0" }
+*/
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ unsigned n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1024; /* 1 kibibyte (KB or KiB) */
+ T (__builtin_malloc (n));
+
+ n = 1025;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1025. exceeds maximum object size 1024" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-3.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-3.c
new file mode 100644
index 00000000000..500ddbf7c74
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-3.c
@@ -0,0 +1,19 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1kB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ unsigned n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1000; /* 1 kilobyte (kB, not to be confused with KB or KiB) */
+ T (__builtin_malloc (n));
+
+ n = 1001;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1001. exceeds maximum object size 1000" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c
new file mode 100644
index 00000000000..e4fde5a8eb9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c
@@ -0,0 +1,19 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1MiB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ unsigned n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1024 * 1024; /* 1 mebibyte (MiB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1048577. exceeds maximum object size 1048576" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c
new file mode 100644
index 00000000000..bfea259e0ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c
@@ -0,0 +1,25 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1MB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ __SIZE_TYPE__ n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1000 * 1000; /* 1 megabyte (MB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000001. exceeds maximum object size 1000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size 1000000" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c
new file mode 100644
index 00000000000..1eb83a5f613
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c
@@ -0,0 +1,25 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1GiB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ __SIZE_TYPE__ n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1024 * 1024 * 1024; /* 1 gigibyte (GiB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1073741825. exceeds maximum object size 1073741824" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c
new file mode 100644
index 00000000000..5188203337d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c
@@ -0,0 +1,25 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-O -Walloc-size-larger-than=1GB -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ __SIZE_TYPE__ n = 0;
+ T (__builtin_malloc (n));
+
+ n = 1000 * 1000 * 1000; /* 1 gigabyte (GB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000000001. exceeds maximum object size 1000000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-8.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-8.c
new file mode 100644
index 00000000000..4f84a027d79
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-8.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1TiB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1024 * 1024 * 1024 * 1024; /* 1 tebibyte (TiB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1099511627777. exceeds maximum object size 1099511627776" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-9.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-9.c
new file mode 100644
index 00000000000..f3927f1456e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-9.c
@@ -0,0 +1,27 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile { target lp64 } }
+ { dg-options "-O -Walloc-size-larger-than=1TB -ftrack-macro-expansion=0" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ size_t n = 0;
+ T (__builtin_malloc (n));
+
+ n = (size_t)1000 * 1000 * 1000 * 1000; /* 1 terabyte (TB) */
+ T (__builtin_malloc (n));
+
+ n += 1;
+ T (__builtin_malloc (n)); /* { dg-warning "argument 1 value .1000000000001. exceeds maximum object size 1000000000000" } */
+
+ n = __PTRDIFF_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+
+ n = __SIZE_MAX__;
+ T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than.c
new file mode 100644
index 00000000000..8096ff1d3dd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than.c
@@ -0,0 +1,13 @@
+/* PR middle-end/82063 - issues with arguments enabled by -Wall
+ { dg-do compile }
+ { dg-options "-Walloc-size-larger-than=0 -ftrack-macro-expansion=0" } */
+
+void sink (void*);
+
+#define T(x) sink (x)
+
+void f (void)
+{
+ T (__builtin_malloc (0));
+ T (__builtin_malloc (1)); /* { dg-warning "argument 1 value .1. exceeds maximum object size 0" } */
+}
diff --git a/gcc/testsuite/gcc.dg/debug/pr85252.c b/gcc/testsuite/gcc.dg/debug/pr85252.c
new file mode 100644
index 00000000000..6e5ca85bc86
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr85252.c
@@ -0,0 +1,11 @@
+/* PR debug/85252 */
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+ static char a[0] = "";
+ static char b[0] = "b"; /* { dg-warning "initializer-string for array of chars is too long" } */
+ static char c[1] = "c";
+ static char d[1] = "de"; /* { dg-warning "initializer-string for array of chars is too long" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr84739.c b/gcc/testsuite/gcc.dg/pr84739.c
new file mode 100644
index 00000000000..9864f990b0c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84739.c
@@ -0,0 +1,26 @@
+/* PR tree-optimization/84739 */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "-O2 -w" } */
+
+static void baz (void) __attribute__((weakref("bar")));
+
+int
+foo (int x, int y)
+{
+ if (x)
+ y = 0;
+ if (y)
+ goto lab;
+ y = 0;
+lab:
+ return y;
+}
+
+void
+bar (int x, int y)
+{
+ y = foo (x, y);
+ if (y != 0)
+ baz ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr84772.c b/gcc/testsuite/gcc.dg/pr84772.c
new file mode 100644
index 00000000000..1241d212350
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84772.c
@@ -0,0 +1,13 @@
+/* PR target/84772 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+#include <stdarg.h>
+
+void
+foo (int *x, int y, va_list ap)
+{
+ __builtin_memset (x, 0, sizeof (int));
+ for (int i = 0; i < y; i++)
+ va_arg (ap, long double); /* { dg-bogus "uninitialized" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr84834.c b/gcc/testsuite/gcc.dg/pr84834.c
new file mode 100644
index 00000000000..38c056bb4ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84834.c
@@ -0,0 +1,15 @@
+/* PR middle-end/84834 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+_Complex int
+foo (int a)
+{
+ return a < 0;
+}
+
+_Complex int
+bar (int a)
+{
+ return (a & 8) ? (_Complex int) 16 : (_Complex int) 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84841.c b/gcc/testsuite/gcc.dg/pr84841.c
new file mode 100644
index 00000000000..4f7422a659f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84841.c
@@ -0,0 +1,9 @@
+/* PR tree-optimization/84841 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fassociative-math -frounding-math -fno-signed-zeros -fno-trapping-math -fno-tree-forwprop" } */
+
+double
+foo (double x)
+{
+ return -x * 0.1 * 0.1;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84853.c b/gcc/testsuite/gcc.dg/pr84853.c
new file mode 100644
index 00000000000..c74526369a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84853.c
@@ -0,0 +1,19 @@
+/* PR c/84853 */
+/* { dg-do compile } */
+
+typedef float V __attribute__((__vector_size__ (16)));
+typedef int W __attribute__((__vector_size__ (16)));
+
+void
+foo (int x, V *y, V *z, W *w)
+{
+ *y = *y << x; /* { dg-error "invalid operands to binary <<" } */
+ *z = *z << *w; /* { dg-error "invalid operands to binary <<" } */
+}
+
+void
+bar (int x, V *y, V *z, W *w)
+{
+ *y = *y >> x; /* { dg-error "invalid operands to binary >>" } */
+ *z = *z >> *w; /* { dg-error "invalid operands to binary >>" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr84875.c b/gcc/testsuite/gcc.dg/pr84875.c
new file mode 100644
index 00000000000..257176de205
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84875.c
@@ -0,0 +1,28 @@
+/* PR debug/84875 */
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+/* { dg-additional-options "-fpie" { target pie } } */
+/* { dg-additional-options "-march=z196" { target s390*-*-* } } */
+
+static long *a[100];
+static int b[100];
+long *c;
+int d;
+void foo (long *);
+
+void
+bar ()
+{
+ long *g = c;
+ g--;
+ d = *g;
+ if (d)
+ if (b[d] < 8)
+ {
+ *(void **)g = a[d];
+ a[d] = g;
+ b[d]++;
+ return;
+ }
+ foo (g);
+}
diff --git a/gcc/testsuite/gcc.dg/pr84899.c b/gcc/testsuite/gcc.dg/pr84899.c
new file mode 100644
index 00000000000..0706fecada3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84899.c
@@ -0,0 +1,12 @@
+/* PR target/84899 */
+/* { dg-do compile } */
+/* { dg-options "-O -funroll-all-loops -fno-move-loop-invariants" } */
+
+void
+foo (int x)
+{
+ int a = 1 / x, b = 0;
+
+ while ((a + b + 1) < x)
+ b = __INT_MAX__;
+}
diff --git a/gcc/testsuite/gcc.dg/pr84941.c b/gcc/testsuite/gcc.dg/pr84941.c
new file mode 100644
index 00000000000..6f4674e54f0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84941.c
@@ -0,0 +1,10 @@
+/* PR inline-asm/84941 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (void)
+{
+ short *b[1] = { 0 };
+ asm volatile ("" : "=m,m" (b), "=r,r" (b) : "1,p" (b));
+}
diff --git a/gcc/testsuite/gcc.dg/pr84953.c b/gcc/testsuite/gcc.dg/pr84953.c
new file mode 100644
index 00000000000..723a8a67dda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr84953.c
@@ -0,0 +1,11 @@
+/* PR c/84953 */
+/* { dg-do compile } */
+
+char *strpbrk (const char *, const char *);
+
+char *
+test (char *p)
+{
+ p = strpbrk (p, ""); /* { dg-bogus "assignment discards 'const' qualifier from pointer target type" } */
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/pr85167.c b/gcc/testsuite/gcc.dg/pr85167.c
new file mode 100644
index 00000000000..e4277e3ef72
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85167.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/85167 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+struct A { long b; };
+int c, d, e;
+int bar (void);
+
+int
+foo (void)
+{
+ long g;
+ for (; g == c ? 0 : (e = 1); g = ((struct A *)g)->b)
+ if (bar ())
+ return d;
+}
diff --git a/gcc/testsuite/gcc.dg/pr85257.c b/gcc/testsuite/gcc.dg/pr85257.c
new file mode 100644
index 00000000000..75fafd96fd3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85257.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/85257 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O2 -fno-tree-ccp" } */
+
+typedef __int128 V __attribute__ ((__vector_size__ (16 * sizeof (__int128))));
+
+__int128 __attribute__ ((noinline, noclone))
+foo (void)
+{
+ V v = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ return v[5];
+}
+
+int
+main ()
+{
+ if (foo () != 6)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr85300.c b/gcc/testsuite/gcc.dg/pr85300.c
new file mode 100644
index 00000000000..87a30b8d419
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85300.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/85300 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g -funroll-all-loops -fno-tree-ter -fno-web" } */
+
+void
+foo (double x, unsigned char y)
+{
+ while ((int) x < 1)
+ {
+ float a;
+
+ a = y | 0x100;
+ y = 0;
+ x = a;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr85430.c b/gcc/testsuite/gcc.dg/pr85430.c
new file mode 100644
index 00000000000..7b58a3cd567
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85430.c
@@ -0,0 +1,12 @@
+/* PR target/85430 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-ccp -fno-tree-fre" } */
+
+typedef char V __attribute__((vector_size (4)));
+
+V
+foo (V v)
+{
+ v[(V){}[0]] <<= 1;
+ return v;
+}
diff --git a/gcc/testsuite/gcc.dg/pr85529.c b/gcc/testsuite/gcc.dg/pr85529.c
new file mode 100644
index 00000000000..0b732284749
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85529.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/85529 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-ssa-phiopt" } */
+
+__attribute__((noinline, noclone)) int
+foo (int x)
+{
+ x &= 31;
+ x -= 25;
+ x *= 2;
+ if (x < 0)
+ return 1;
+ int y = x >> 2;
+ if (x >= y)
+ return 1;
+ return 0;
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 63; i++)
+ if (foo (i) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr86314.c b/gcc/testsuite/gcc.dg/pr86314.c
new file mode 100644
index 00000000000..8962a3cf2ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86314.c
@@ -0,0 +1,20 @@
+// PR target/86314
+// { dg-do run { target sync_int_long } }
+// { dg-options "-O2" }
+
+__attribute__((noinline, noclone)) unsigned long
+foo (unsigned long *p)
+{
+ unsigned long m = 1UL << ((*p & 1) ? 1 : 0);
+ unsigned long n = __atomic_fetch_or (p, m, __ATOMIC_SEQ_CST);
+ return (n & m) == 0;
+}
+
+int
+main ()
+{
+ unsigned long v = 1;
+ if (foo (&v) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr57656.c b/gcc/testsuite/gcc.dg/torture/pr57656.c
index 4f3645e4693..02490140105 100644
--- a/gcc/testsuite/gcc.dg/torture/pr57656.c
+++ b/gcc/testsuite/gcc.dg/torture/pr57656.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-fstrict-overflow" } */
+/* { dg-additional-options "-fstrict-overflow" } */
int main (void)
{
diff --git a/gcc/testsuite/gcc.dg/torture/pr85567.c b/gcc/testsuite/gcc.dg/torture/pr85567.c
new file mode 100644
index 00000000000..f20c69f4201
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85567.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+extern void sincos(double x, double *sinx, double *cosx);
+
+void apply(void (*f)(double, double *, double *),
+ double x, double *sinx, double *cosx)
+{
+ f(x, sinx, cosx);
+ return;
+}
+
+void apply_sincos(double x, double *sinx, double *cosx)
+{
+ apply(sincos, x, sinx, cosx);
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr85588.c b/gcc/testsuite/gcc.dg/torture/pr85588.c
new file mode 100644
index 00000000000..5d95c96bc35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85588.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fwrapv" } */
+
+#include "pr57656.c"
diff --git a/gcc/testsuite/gcc.dg/torture/pr85989.c b/gcc/testsuite/gcc.dg/torture/pr85989.c
new file mode 100644
index 00000000000..5cfd7016fb5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85989.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+
+#define N 9
+
+void __attribute__((noinline, noclone))
+f (double x, double y, double *res)
+{
+ y = -y;
+ for (int i = 0; i < N; ++i)
+ {
+ double tmp = y;
+ y = x;
+ x = tmp;
+ res[i] = i;
+ }
+ res[N] = y * y;
+ res[N + 1] = x;
+}
+
+int
+main (void)
+{
+ double res[N + 2];
+ f (10, 20, res);
+ for (int i = 0; i < N; ++i)
+ if (res[i] != i)
+ __builtin_abort ();
+ if (res[N] != 100 || res[N + 1] != -20)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp119.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp119.c
new file mode 100644
index 00000000000..92c490e542c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp119.c
@@ -0,0 +1,20 @@
+/* PR tree-optimization/86231 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-final { scan-tree-dump-not "link_error" "vrp1" } } */
+
+int bar (int);
+void link_error (void);
+
+int
+foo (int x, int y, int z)
+{
+ if (x < 4 || x > 8) __builtin_unreachable ();
+ if (y >= 2 && y <= 6) __builtin_unreachable ();
+ /* x is [4, 8], y is ~[2, 6], resulting range of e should be ~[2, 3]. */
+ int e = (z ? x : y);
+ bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (bar (e))))))))))));
+ if (e == 2 || e == 3)
+ link_error ();
+ return e;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr85597.c b/gcc/testsuite/gcc.dg/vect/pr85597.c
new file mode 100644
index 00000000000..cf615f9c464
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr85597.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-mfma" { target { x86_64-*-* i?86-*-* } } } */
+
+extern double fma (double, double, double);
+
+static inline void
+bar (int i, double *D, double *S)
+{
+ while (i-- > 0)
+ {
+ D[0] = fma (1, S[0], D[0]);
+ D[1] = fma (1, S[1], D[1]);
+ D[2] = fma (1, S[2], D[2]);
+ D[3] = fma (1, S[3], D[3]);
+ D += 4;
+ S += 4;
+ }
+}
+
+void
+foo (double *d, double *s)
+{
+ bar (10, d, s);
+}
+
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c
new file mode 100644
index 00000000000..0f99dd341b7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mcmse -std=c99" } */
+/* This is a copy of cmse-1.c to test arm_mve.h ISO C compatibility. */
+#include "cmse-1.c"
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c
new file mode 100644
index 00000000000..d57b53b7e36
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c
@@ -0,0 +1,25 @@
+/* PR target/84786 */
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -mno-avx512vl -O2" } */
+/* { dg-require-effective-target avx512f } */
+
+#include "avx512f-check.h"
+
+typedef double V __attribute__((vector_size (16)));
+
+__attribute__((noinline, noclone)) V
+foo (V x, double y)
+{
+ register double z __asm ("xmm18");
+ asm volatile ("" : "=v" (z) : "0" (y));
+ x[1] = z;
+ return x;
+}
+
+static void
+avx512f_test (void)
+{
+ V a = foo ((V) { 1.0, 2.0 }, 3.0);
+ if (a[0] != 1.0 || a[1] != 3.0)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c
new file mode 100644
index 00000000000..5ac28aa4a47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c
@@ -0,0 +1,16 @@
+/* PR target/84786 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -mno-avx512vl -O2" } */
+
+typedef double V __attribute__((vector_size (16)));
+
+__attribute__((noinline, noclone)) V
+foo (V x, double y)
+{
+ register double z __asm ("xmm18");
+ asm volatile ("" : "=v" (z) : "0" (y));
+ x[1] = z;
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vunpcklpd\[\^\n\r]*xmm(1\[6-9]|\[23]\[0-9])" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr84786-3.c b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-3.c
new file mode 100644
index 00000000000..4d125b9933f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-3.c
@@ -0,0 +1,50 @@
+/* PR target/84786 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -mno-avx512vl -O2" } */
+
+#include <x86intrin.h>
+
+__m512i v;
+__m128i w;
+
+__m128i
+foo (__m128i x, int y)
+{
+ __m128i z;
+#define A(n) register __m512i zmm##n __asm ("zmm" #n);
+#define B A(1) A(2) A(3) A(4) A(5) A(6) A(7) \
+ A(8) A(9) A(10) A(11) A(12) A(13) A(14)
+ B
+#undef A
+#define A(n) asm volatile ("" : "=v" (zmm##n) : "0" (v));
+ B
+ asm volatile ("" : "=x" (z) : "0" (w));
+ x = _mm_srli_epi16 (x, y);
+ asm volatile ("" : : "x" (z));
+#undef A
+#define A(n) asm volatile ("" : : "v" (zmm##n));
+ B
+ return x;
+}
+
+__m256i
+bar (__m256i x, int y)
+{
+ __m128i z;
+#undef A
+#define A(n) register __m512i zmm##n __asm ("zmm" #n);
+ B
+#undef A
+#define A(n) asm volatile ("" : "=v" (zmm##n) : "0" (v));
+ B
+ asm volatile ("" : "=x" (z) : "0" (w));
+ x = _mm256_slli_epi16 (x, y);
+ asm volatile ("" : : "x" (z));
+#undef A
+#define A(n) asm volatile ("" : : "v" (zmm##n));
+ B
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vpsrlw\[\^\n\r]*xmm(1\[6-9]|\[23]\[0-9])" } } */
+/* { dg-final { scan-assembler-not "vpsllw\[\^\n\r]*xmm(1\[6-9]|\[23]\[0-9])" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2sd64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2sd64-1.c
index 8675450f0c4..66476c3013f 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2sd64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2sd64-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vcvtusi2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtusi2sd\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{ru-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtusi2sdq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtusi2sdq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{ru-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2ss64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2ss64-1.c
index 38ecf39ad65..f4dae536873 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2ss64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtusi2ss64-1.c
@@ -1,7 +1,7 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-mavx512f -O2" } */
-/* { dg-final { scan-assembler-times "vcvtusi2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vcvtusi2ss\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtusi2ssq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtusi2ssq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr84827.c b/gcc/testsuite/gcc.target/i386/pr84827.c
new file mode 100644
index 00000000000..003258c8204
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr84827.c
@@ -0,0 +1,21 @@
+/* PR target/84827 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -fno-fp-int-builtin-inexact -ftrapping-math -fno-associative-math -mfpmath=387" } */
+
+double
+f1 (double a)
+{
+ return __builtin_round (a);
+}
+
+float
+f2 (float a)
+{
+ return __builtin_roundf (a);
+}
+
+long double
+f3 (long double a)
+{
+ return __builtin_roundl (a);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr85034.c b/gcc/testsuite/gcc.target/i386/pr85034.c
new file mode 100644
index 00000000000..4a35b112174
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85034.c
@@ -0,0 +1,11 @@
+/* PR inline-asm/85034 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (void)
+{
+ volatile float a;
+ struct S { char a; } b = { 0 };
+ asm volatile ("" : "=r" (a) : "0ir" (b));
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr85095-1.c b/gcc/testsuite/gcc.target/i386/pr85095-1.c
new file mode 100644
index 00000000000..4c882e0ed9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85095-1.c
@@ -0,0 +1,33 @@
+/* PR target/85095 *
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+
+unsigned int
+foo (unsigned int a, unsigned int b)
+{
+ a += b;
+ if (a < b) a++;
+ return a;
+}
+
+#ifdef __x86_64__
+unsigned long long
+bar (unsigned long long a, unsigned long long b)
+{
+ a += b;
+ if (a < b) a++;
+ return a;
+}
+
+unsigned long long
+baz (unsigned int a, unsigned int b)
+{
+ a += b;
+ if (a < b) a++;
+ return a;
+}
+#endif
+
+/* { dg-final { scan-assembler-times "adcl\t\\\$0," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "adcl\t\\\$0," 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "adcq\t\\\$0," 1 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr85095-2.c b/gcc/testsuite/gcc.target/i386/pr85095-2.c
new file mode 100644
index 00000000000..fbd7992bf4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85095-2.c
@@ -0,0 +1,54 @@
+/* PR target/85095 *
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+
+unsigned int
+f1 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a + i;
+}
+
+unsigned int
+f2 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a - i;
+}
+
+#ifdef __x86_64__
+unsigned long long
+f3 (unsigned long long a, unsigned long long b)
+{
+ unsigned long long i = __builtin_add_overflow (a, b, &a);
+ return a + i;
+}
+
+unsigned long long
+f4 (unsigned long long a, unsigned long long b)
+{
+ unsigned long long i = __builtin_add_overflow (a, b, &a);
+ return a - i;
+}
+
+unsigned long long
+f5 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a + i;
+}
+
+unsigned long long
+f6 (unsigned int a, unsigned int b)
+{
+ unsigned int i = __builtin_add_overflow (a, b, &a);
+ return a - i;
+}
+#endif
+
+/* { dg-final { scan-assembler-times "adcl\t\\\$0," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "sbbl\t\\\$0," 1 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "adcl\t\\\$0," 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "sbbl\t\\\$0," 2 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "adcq\t\\\$0," 1 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "sbbq\t\\\$0," 1 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-1.c b/gcc/testsuite/gcc.target/powerpc/builtins-1.c
index 8d0b7c9b19a..6289302a2b5 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-1.c
@@ -165,3 +165,6 @@ int main ()
return 0;
}
+
+/* Translation of vec_packsu (unsigned long long, unsigned long long) */
+/* { dg-final { scan-assembler-times {\mvpkudus\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84700.c b/gcc/testsuite/gcc.target/powerpc/pr84700.c
new file mode 100644
index 00000000000..c89094a56d3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr84700.c
@@ -0,0 +1,12 @@
+/* PR target/84700 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -misel" } */
+
+long long int
+foo (long long int x)
+{
+ long long int a = x < 2;
+ int b = a >= 0;
+
+ return a + ((x == 0) ? a : b);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr85755.c b/gcc/testsuite/gcc.target/powerpc/pr85755.c
new file mode 100644
index 00000000000..2d8741d639e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr85755.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O1" } */
+
+void
+preinc (long *q, long n)
+{
+ long i;
+ for (i = 0; i < n; i++)
+ q[i] = i;
+}
+
+void
+predec (long *q, long n)
+{
+ long i;
+ for (i = n; i >= 0; i--)
+ q[i] = i;
+}
+
+/* { dg-final { scan-assembler-times {\mstwu\M} 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\mstdu\M} 2 { target lp64 } } } */
+/* { dg-final { scan-assembler-not {\mstfdu\M} } } */
diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c
new file mode 100644
index 00000000000..c3866bde4a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=zEC12 -mzarch" } */
+
+/* A bug in the builtin definition made__builtin_tbeginc to have an
+ integer return argument. */
+void
+must_not_compile1 (void)
+{
+ int rc = __builtin_tbeginc (); /* { dg-error "void value not ignored as it ought to be" } */
+}
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90
index 95571fdfe12..12005a6cc16 100644
--- a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90
@@ -22,7 +22,7 @@ program a
allocate(i(2))) ! { dg-error "Syntax error in ALLOCATE" }
allocate(i(2), errmsg=err, errmsg=err) ! { dg-error "Redundant ERRMSG" }
allocate(i(2), errmsg=err) ! { dg-warning "useless without a STAT" }
- allocate(i(2), stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" }
+ allocate(i(2), stat=j, errmsg=x) ! { dg-error "shall be a scalar default CHARACTER" }
allocate(err) ! { dg-error "neither a data pointer nor an allocatable" }
diff --git a/gcc/testsuite/gfortran.dg/allocate_alloc_opt_14.f90 b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_14.f90
new file mode 100644
index 00000000000..6de43a7597f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_alloc_opt_14.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+program p
+ integer, allocatable :: arr(:)
+ integer :: stat
+ character(len=128, kind=4) :: errmsg = ' '
+ allocate (arr(3), stat=stat, errmsg=errmsg) ! { dg-error "shall be a scalar default CHARACTER" }
+ print *, allocated(arr), stat, trim(errmsg)
+end
diff --git a/gcc/testsuite/gfortran.dg/allocate_stat_2.f90 b/gcc/testsuite/gfortran.dg/allocate_stat_2.f90
index 7cf6d659ea2..a28a2536046 100644
--- a/gcc/testsuite/gfortran.dg/allocate_stat_2.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_stat_2.f90
@@ -5,6 +5,6 @@ program main
character(len=30), dimension(2) :: er
integer, dimension (:), allocatable :: a
allocate (a (16), stat = ier) ! { dg-error "must be a scalar INTEGER" }
- allocate (a (14), stat=ier(1),errmsg=er) ! { dg-error "must be a scalar CHARACTER" }
+ allocate (a (14), stat=ier(1),errmsg=er) ! { dg-error "shall be a scalar default CHARACTER" }
end
diff --git a/gcc/testsuite/gfortran.dg/associate_30.f90 b/gcc/testsuite/gfortran.dg/associate_30.f90
index ad15d8bf576..ecc9ad06a56 100644
--- a/gcc/testsuite/gfortran.dg/associate_30.f90
+++ b/gcc/testsuite/gfortran.dg/associate_30.f90
@@ -8,8 +8,3 @@
associate (x => null()) ! { dg-error "cannot be NULL()" }
end associate
end subroutine
-
- subroutine s2
- associate (x => [null()]) ! { dg-error "has no type" }
- end associate
- end subroutine
diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90
index aba4eb1bc84..d152ce1b2bd 100644
--- a/gcc/testsuite/gfortran.dg/coarray_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_3.f90
@@ -13,7 +13,7 @@ end critical fkl ! { dg-error "Expecting END PROGRAM" }
sync all (stat=1) ! { dg-error "Syntax error in SYNC ALL" }
sync all ( stat = n,stat=k) ! { dg-error "Redundant STAT" }
-sync memory (errmsg=str)
+sync memory (errmsg=str) ! { dg-error "must be a scalar CHARACTER variable" }
sync memory (errmsg=n) ! { dg-error "must be a scalar CHARACTER variable" }
sync images (*, stat=1.0) ! { dg-error "Syntax error in SYNC IMAGES" }
sync images (-1) ! { dg-error "must between 1 and num_images" }
diff --git a/gcc/testsuite/gfortran.dg/data_bounds_1.f90 b/gcc/testsuite/gfortran.dg/data_bounds_1.f90
index b20aa415b8a..24cdc7c9815 100644
--- a/gcc/testsuite/gfortran.dg/data_bounds_1.f90
+++ b/gcc/testsuite/gfortran.dg/data_bounds_1.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=gnu" }
! Checks the fix for PR32315, in which the bounds checks below were not being done.
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/data_char_1.f90 b/gcc/testsuite/gfortran.dg/data_char_1.f90
index 96db4fd30eb..24785b636fa 100644
--- a/gcc/testsuite/gfortran.dg/data_char_1.f90
+++ b/gcc/testsuite/gfortran.dg/data_char_1.f90
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-options "-std=gnu" }
! Test character variables in data statements
! Also substrings of character variables.
! PR14976 PR16228
diff --git a/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90 b/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90
index 969ce257efe..58790ebfb58 100644
--- a/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90
+++ b/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_1.f90
@@ -22,7 +22,7 @@ program a
deallocate(i)) ! { dg-error "Syntax error in DEALLOCATE" }
deallocate(i, errmsg=err, errmsg=err) ! { dg-error "Redundant ERRMSG" }
deallocate(i, errmsg=err) ! { dg-warning "useless without a STAT" }
- deallocate(i, stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" }
+ deallocate(i, stat=j, errmsg=x) ! { dg-error "shall be a scalar default CHARACTER" }
deallocate(err) ! { dg-error "nonprocedure pointer nor an allocatable" }
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr85313.f90 b/gcc/testsuite/gfortran.dg/gomp/pr85313.f90
new file mode 100644
index 00000000000..04599849ed7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr85313.f90
@@ -0,0 +1,25 @@
+! PR fortran/85313
+! { dg-do compile }
+
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = i, 20 ! { dg-error "form rectangular iteration space" }
+ do k = 1, 2
+ end do
+ end do
+ end do
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = 1, 5
+ do k = i, 20 ! { dg-error "form rectangular iteration space" }
+ end do
+ end do
+ end do
+!$omp do collapse(3)
+ do i = 1, 10
+ do j = 1, 5
+ do k = j, 20 ! { dg-error "form rectangular iteration space" }
+ end do
+ end do
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/init_flag_17.f90 b/gcc/testsuite/gfortran.dg/init_flag_17.f90
new file mode 100644
index 00000000000..401830fccbc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/init_flag_17.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-options "-finit-derived -finit-local-zero -fdump-tree-original" }
+!
+! PR fortran/82972
+!
+! Make sure we do not ICE when generating initializers for c_ptr and c_funptr
+! components of derived types (and make sure they are properly initialized to
+! zero).
+!
+
+program init_flag_17
+ use iso_c_binding
+ implicit none
+
+ type :: ty
+ type(c_ptr) :: ptr ! = c_null_ptr
+ type(c_funptr) :: fptr ! = c_null_funptr
+ end type
+
+ type(ty) :: t
+
+ print *, t%ptr
+ print *, t%fptr
+
+end program
+
+! { dg-final { scan-tree-dump "\.ptr=0" "original" } }
+! { dg-final { scan-tree-dump "\.fptr=0" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr38351.f90 b/gcc/testsuite/gfortran.dg/pr38351.f90
new file mode 100644
index 00000000000..08e1724dc0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr38351.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+module m1
+ type t1
+ integer :: i
+ end type t1
+ interface operator(+)
+ module procedure add
+ end interface
+ contains
+ type(t1) function add(a,b)
+ type(t1), intent(in) :: a,b
+ end function
+end module m1
+
+program foo
+ use m1
+ type(t1), dimension(2,2) :: a = t1(1), b = t1(2)
+ type(t1) :: c=t1(1), d=t1(2)
+ c = c + d
+ a = a + b ! { dg-error "Unexpected derived-type entities" }
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/pr44491.f90 b/gcc/testsuite/gfortran.dg/pr44491.f90
new file mode 100644
index 00000000000..406bb262f71
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr44491.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! { dg-options "-std=gnu" }
+! PR fortran/44491
+ character*2 escape /z'1B'/ ! { dg-error "Incompatible types in DATA" }
+ end
diff --git a/gcc/testsuite/gfortran.dg/pr63514.f90 b/gcc/testsuite/gfortran.dg/pr63514.f90
new file mode 100644
index 00000000000..389fb92608e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr63514.f90
@@ -0,0 +1,41 @@
+! { dg-do compile }
+! PR fortran/63514.f90
+program foo
+
+ implicit none
+
+ integer, volatile :: n
+
+ n = 0
+
+ call bar
+ call bah
+
+ contains
+
+ subroutine bar
+ integer k
+ integer, volatile :: m
+ block
+ integer, save :: i
+ integer, volatile :: j
+ i = 42
+ j = 2 * i
+ k = i + j + n
+ end block
+ end subroutine bar
+
+ pure subroutine bah
+ integer k
+ integer, volatile :: m ! { dg-error "cannot be specified in a PURE" }
+ block
+ integer, save :: i ! { dg-error "cannot be specified in a PURE" }
+ integer, volatile :: j ! { dg-error "cannot be specified in a PURE" }
+ i = 42 ! { dg-error "has no IMPLICIT type" }
+ j = 2 * i ! { dg-error "has no IMPLICIT type" }
+ k = i + j + n
+ end block
+ m = k * m ! { dg-error "has no IMPLICIT type" }
+ end subroutine bah
+
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/pr67803.f90 b/gcc/testsuite/gfortran.dg/pr67803.f90
index 9a8ff309feb..55a1bbf5794 100644
--- a/gcc/testsuite/gfortran.dg/pr67803.f90
+++ b/gcc/testsuite/gfortran.dg/pr67803.f90
@@ -10,5 +10,4 @@ program p
x = '0' // [character :: 1d1] ! { dg-error "Incompatible typespec for" }
x = '0' // [character :: (0.,1.)] ! { dg-error "Incompatible typespec for" }
x = '0' // [character :: .true.] ! { dg-error "Incompatible typespec for" }
- x = '0' // [character :: null()] ! { dg-error "Incompatible typespec for" }
end
diff --git a/gcc/testsuite/gfortran.dg/pr67805.f90 b/gcc/testsuite/gfortran.dg/pr67805.f90
index 7371991717d..2aedde8977b 100644
--- a/gcc/testsuite/gfortran.dg/pr67805.f90
+++ b/gcc/testsuite/gfortran.dg/pr67805.f90
@@ -22,7 +22,6 @@ subroutine p
s = [character([1.]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }
s = [character([1d1]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }
s = [character([(0.,1.)]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }
- s = [character([null()]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }
s = [character(null()) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }
call foo(s)
end subroutine p
diff --git a/gcc/testsuite/gfortran.dg/pr78278.f90 b/gcc/testsuite/gfortran.dg/pr78278.f90
new file mode 100644
index 00000000000..fd50e3e1c18
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr78278.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+! PR fortran/78278
+program p
+ character, pointer :: x => null()
+ data x /null()/ ! { dg-error "GNU Extension: re-initialization" }
+ print *, associated(x)
+end
+
+subroutine foo
+ real :: x = 42
+ data x /0/ ! { dg-error "GNU Extension: re-initialization" }
+ print *, x
+end subroutine foo
diff --git a/gcc/testsuite/gfortran.dg/pr85138_1.f90 b/gcc/testsuite/gfortran.dg/pr85138_1.f90
new file mode 100644
index 00000000000..a64d9ce9329
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85138_1.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+module fox_m_fsys_format
+
+ interface len
+ module procedure str_real_sp_len, str_real_sp_fmt_len
+ end interface
+
+contains
+
+ pure function str_real_sp_fmt_len(x, fmt) result(n)
+ real, intent(in) :: x
+ character(len=*), intent(in) :: fmt
+ if (.not.checkFmt(fmt)) then
+ endif
+ end function str_real_sp_fmt_len
+ pure function str_real_sp_len(x) result(n)
+ real, intent(in) :: x
+ n = len(x, "")
+ end function str_real_sp_len
+ pure function str_real_dp_matrix(xa) result(s)
+ real, intent(in) :: xa
+ character(len=len(xa)) :: s
+ end function str_real_dp_matrix
+
+ pure function checkfmt(s) result(a)
+ logical a
+ character(len=*), intent(in) :: s
+ end function checkfmt
+end module fox_m_fsys_format
diff --git a/gcc/testsuite/gfortran.dg/pr85138_2.f90 b/gcc/testsuite/gfortran.dg/pr85138_2.f90
new file mode 100644
index 00000000000..942cc6684d8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85138_2.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+module fox_m_fsys_format
+ interface len
+ module procedure str_real_dp_len, str_real_dp_fmt_len
+ end interface
+contains
+ pure function str_real_dp_fmt_len(x, fmt) result(n)
+ real, intent(in) :: x
+ character(len=*), intent(in) :: fmt
+ if (.not.checkFmt(fmt)) then
+ endif
+ end function str_real_dp_fmt_len
+ pure function str_real_dp_len(x) result(n)
+ real, intent(in) :: x
+ end function str_real_dp_len
+ pure function str_real_dp_array_len(xa) result(n)
+ real, dimension(:), intent(in) :: xa
+ end function str_real_dp_array_len
+ pure function str_real_dp_array_fmt_len(xa, fmt) result(n)
+ real, dimension(:), intent(in) :: xa
+ character(len=*), intent(in) :: fmt
+ end function str_real_dp_array_fmt_len
+ pure function str_real_dp_fmt(x, fmt) result(s)
+ real, intent(in) :: x
+ character(len=*), intent(in) :: fmt
+ character(len=len(x, fmt)) :: s
+ end function str_real_dp_fmt
+ pure function checkFmt(fmt) result(good)
+ character(len=*), intent(in) :: fmt
+ logical :: good
+ end function checkFmt
+end module fox_m_fsys_format
diff --git a/gcc/testsuite/gfortran.dg/pr85543.f90 b/gcc/testsuite/gfortran.dg/pr85543.f90
new file mode 100644
index 00000000000..d3f83276a7f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85543.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/85543
+program p
+ procedure(), pointer :: z
+contains
+ real(z()) function f() ! { dg-error "in initialization expression at" }
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85779_1.f90 b/gcc/testsuite/gfortran.dg/pr85779_1.f90
new file mode 100644
index 00000000000..186568ff124
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85779_1.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/85779
+type(t) function f() ! { dg-error "is not accessible" }
+ type f ! { dg-error "already has a basic type" }
+ end type ! { dg-error "END FUNCTION statement" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85779_2.f90 b/gcc/testsuite/gfortran.dg/pr85779_2.f90
new file mode 100644
index 00000000000..4cc3c62979c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85779_2.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/85779
+type(t) function f() result(z) ! { dg-error "is not accessible" }
+ type z ! { dg-error "already has a basic type" }
+ end type ! { dg-error "END FUNCTION statement" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr85779_3.f90 b/gcc/testsuite/gfortran.dg/pr85779_3.f90
new file mode 100644
index 00000000000..fba1133b3ea
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85779_3.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/85779
+class(t) function f() ! { dg-error "must be dummy, allocatable or pointer" }
+ type f ! { dg-error "already has a basic type" }
+ end type ! { dg-error "END FUNCTION statement" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr85780.f90 b/gcc/testsuite/gfortran.dg/pr85780.f90
new file mode 100644
index 00000000000..ad6b27fc4db
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85780.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR fortran/85780
+subroutine s(*) bind(c)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85895.f90 b/gcc/testsuite/gfortran.dg/pr85895.f90
new file mode 100644
index 00000000000..184266e5ec8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85895.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/85895
+subroutine p
+ character(80) :: c(2)
+ sync memory (errmsg=c) ! { dg-error "scalar CHARACTER variable" }
+end subroutine p
+
+subroutine q
+ character(80) :: c(2)
+ sync memory (errmsg=c(1:2)) ! { dg-error "scalar CHARACTER variable" }
+end subroutine q
+
+subroutine r
+ character(80) :: c(2)
+ sync memory (errmsg=c(1))
+end subroutine r
diff --git a/gcc/testsuite/gfortran.dg/pr85996.f90 b/gcc/testsuite/gfortran.dg/pr85996.f90
new file mode 100644
index 00000000000..e594d6771c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85996.f90
@@ -0,0 +1,69 @@
+! { dg-do compile }
+module strings
+
+ type string
+ integer :: len = 0, size = 0
+ character, pointer :: chars(:) => null()
+ end type string
+
+ interface length
+ module procedure len_s
+ end interface
+
+ interface char
+ module procedure s_to_c, s_to_slc
+ end interface
+
+ interface uppercase
+ module procedure uppercase_c
+ end interface
+
+ interface replace
+ module procedure replace_ccs
+ end interface
+
+ contains
+
+ elemental function len_s(s)
+ type(string), intent(in) :: s
+ integer :: len_s
+ end function len_s
+
+ pure function s_to_c(s)
+ type(string),intent(in) :: s
+ character(length(s)) :: s_to_c
+ end function s_to_c
+
+ pure function s_to_slc(s,long)
+ type(string),intent(in) :: s
+ integer, intent(in) :: long
+ character(long) :: s_to_slc
+ end function s_to_slc
+
+ pure function lr_sc_s(s,start,ss) result(l)
+ type(string), intent(in) :: s
+ character(*), intent(in) :: ss
+ integer, intent(in) :: start
+ integer :: l
+ end function lr_sc_s
+
+ pure function lr_ccc(s,tgt,ss,action) result(l)
+ character(*), intent(in) :: s,tgt,ss,action
+ integer :: l
+ select case(uppercase(action))
+ case default
+ end select
+ end function lr_ccc
+
+ function replace_ccs(s,tgt,ss) result(r)
+ character(*), intent(in) :: s,tgt
+ type(string), intent(in) :: ss
+ character(lr_ccc(s,tgt,char(ss),'first')) :: r
+ end function replace_ccs
+
+ pure function uppercase_c(c)
+ character(*), intent(in) :: c
+ character(len(c)) :: uppercase_c
+ end function uppercase_c
+
+end module strings
diff --git a/gcc/testsuite/gfortran.dg/pr86045.f90 b/gcc/testsuite/gfortran.dg/pr86045.f90
new file mode 100644
index 00000000000..685672f1dbd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr86045.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program p
+ logical :: a(2) = (mod([2,3],0) == 0) ! { dg-error "shall not be zero" }
+ integer :: b = count(mod([2,3],0) == 0) ! { dg-error "shall not be zero" }
+ integer :: c = all(mod([2,3],0) == 0) ! { dg-error "shall not be zero" }
+ integer :: d = any(mod([2,3],0) == 0) ! { dg-error "shall not be zero" }
+end
diff --git a/gcc/testsuite/gfortran.dg/pr86059.f90 b/gcc/testsuite/gfortran.dg/pr86059.f90
new file mode 100644
index 00000000000..e0caed102d7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr86059.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/86059
+program foo
+ integer :: i(2) = [ null(), 1 ] ! { dg-error "cannot appear in an array constructor" }
+ integer :: j(2) = [ (null(), n = 1, 2) ] ! { dg-error "cannot appear in an array constructor" }
+ integer k(2)
+ k = 42 + [1, null()] ! { dg-error "cannot appear in an array constructor" }
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/pr86110.f90 b/gcc/testsuite/gfortran.dg/pr86110.f90
new file mode 100644
index 00000000000..890670f5854
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr86110.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/86110
+program p
+ character(:), allocatable :: x, y
+ x = 'abc'
+ y = [x(:)] ! { dg-error "Incompatible ranks 0 and 1" }
+end
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_30.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_30.f90
new file mode 100644
index 00000000000..4e7eb4ba220
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_30.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! PR 85641 - this used to ICE due do infinite recursion.
+! Test case by Antony Lewis.
+program tester
+character(LEN=:), allocatable :: fields
+integer j
+character(LEN=4), parameter :: CMB_CL_Fields = 'TEBP'
+
+fields = ''
+j=1
+fields = fields // CMB_CL_Fields(j:j)
+
+end program tester
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_4.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_4.f03
index 836505bba3d..cd0e8f602ae 100644
--- a/gcc/testsuite/gfortran.dg/typebound_operator_4.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_4.f03
@@ -84,6 +84,6 @@ PROGRAM main
TYPE(myint) :: x
x = 0 ! { dg-error "Can't convert" }
- x = x + 42 ! { dg-error "Operands of" }
+ x = x + 42 ! { dg-error "binary intrinsic numeric operator" }
x = x .PLUS. 5 ! { dg-error "Unknown operator" }
END PROGRAM main
diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_30.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_30.f03
new file mode 100644
index 00000000000..4d0c2e7250b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_30.f03
@@ -0,0 +1,38 @@
+! { dg-do run }
+!
+! Test the fix for PR83318.
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+type :: any_vector
+ class(*), allocatable :: v(:)
+end type
+type(any_vector) :: x, y
+
+! This did not work correctly
+ x%v = ['foo','bar']
+ call foo (x, 1)
+
+! This was reported as not working correctly but was OK before the above was fixed
+ y = x
+ call foo (y, 2)
+
+ x%v = [1_4,2_4]
+ call foo (x, 3)
+
+ y = x
+ call foo (y, 4)
+
+contains
+
+ subroutine foo (arg, n)
+ type (any_vector) :: arg
+ integer :: n
+ select type (v => arg%v)
+ type is (character(*))
+ if (any (v .ne. ["foo","bar"])) stop n
+ type is (integer(4))
+ if (any (v .ne. [1_4,2_4])) stop n
+ end select
+ end subroutine
+end
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90
new file mode 100644
index 00000000000..e52e95faa00
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr85878.f90
@@ -0,0 +1,8 @@
+! PR middle-end/85878
+
+program pr85878
+ real :: a
+ complex :: c = (2.0, 3.0)
+ print *, c
+ print *, transfer (a, c)
+end
diff --git a/gcc/testsuite/gnat.dg/aggr24.adb b/gcc/testsuite/gnat.dg/aggr24.adb
new file mode 100644
index 00000000000..b739c54fdc4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr24.adb
@@ -0,0 +1,13 @@
+-- { dg-do run }
+
+with Aggr24_Pkg; use Aggr24_Pkg;
+
+procedure Aggr24 is
+ V : Rec;
+begin
+ V.S := "Hello";
+ Init (V);
+ if V.S /= "Hello" then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/aggr24_pkg.adb b/gcc/testsuite/gnat.dg/aggr24_pkg.adb
new file mode 100644
index 00000000000..2ae3e79e322
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr24_pkg.adb
@@ -0,0 +1,15 @@
+package body Aggr24_Pkg is
+
+ procedure Init (R : out Rec) is
+ begin
+ R := (I1 => 0,
+ I2 => 0,
+ I3 => 0,
+ I4 => 0,
+ I5 => 0,
+ I6 => 0,
+ I7 => 0,
+ S => <>);
+ end;
+
+end Aggr24_Pkg;
diff --git a/gcc/testsuite/gnat.dg/aggr24_pkg.ads b/gcc/testsuite/gnat.dg/aggr24_pkg.ads
new file mode 100644
index 00000000000..5918f5e8bd4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/aggr24_pkg.ads
@@ -0,0 +1,16 @@
+package Aggr24_Pkg is
+
+ type Rec is record
+ I1 : Integer;
+ I2 : Integer;
+ I3 : Integer;
+ I4 : Integer;
+ I5 : Integer;
+ I6 : Integer;
+ I7 : Integer;
+ S : String (1 .. 5);
+ end record;
+
+ procedure Init (R : out Rec);
+
+end Aggr24_Pkg;
diff --git a/gcc/testsuite/gnat.dg/discr53.adb b/gcc/testsuite/gnat.dg/discr53.adb
new file mode 100644
index 00000000000..2e362a7fd29
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr53.adb
@@ -0,0 +1,19 @@
+-- { dg-do compile }
+
+package body Discr53 is
+
+ function F return Rec is
+ Data : Rec;
+ begin
+ return Data;
+ end;
+
+ type Ptr is access Rec;
+
+ procedure Proc is
+ Local : Ptr;
+ begin
+ Local := new Rec'(F);
+ end;
+
+end Discr53;
diff --git a/gcc/testsuite/gnat.dg/discr53.ads b/gcc/testsuite/gnat.dg/discr53.ads
new file mode 100644
index 00000000000..3fa9f0f4845
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr53.ads
@@ -0,0 +1,16 @@
+with Discr53_Pkg;
+
+package Discr53 is
+
+ type Rec (D : Boolean := False) is record
+ case D is
+ when True => S : String (1 .. Discr53_Pkg.Max);
+ when False => null;
+ end case;
+ end record;
+
+ function F return Rec;
+
+ procedure Proc;
+
+end Discr53;
diff --git a/gcc/testsuite/gnat.dg/discr53_pkg.ads b/gcc/testsuite/gnat.dg/discr53_pkg.ads
new file mode 100644
index 00000000000..d36e1ba2a12
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr53_pkg.ads
@@ -0,0 +1,5 @@
+package Discr53_Pkg is
+
+ function Max return Natural;
+
+end Discr53_Pkg;
diff --git a/gcc/testsuite/gnat.dg/specs/opt3.ads b/gcc/testsuite/gnat.dg/specs/opt3.ads
new file mode 100644
index 00000000000..531cf59eae3
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt3.ads
@@ -0,0 +1,13 @@
+-- { dg-do compile }
+-- { dg-options "-O3" }
+
+with Ada.Containers.Vectors;
+with Opt3_Pkg;
+
+package Opt3 is
+
+ type Arr is array (1 .. Opt3_Pkg.Max) of Integer;
+
+ package Arr_Container is new Ada.Containers.Vectors (Natural, Arr);
+
+end Opt3;
diff --git a/gcc/testsuite/gnat.dg/specs/opt3_pkg.ads b/gcc/testsuite/gnat.dg/specs/opt3_pkg.ads
new file mode 100644
index 00000000000..4145ac4abaa
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt3_pkg.ads
@@ -0,0 +1,7 @@
+-- { dg-excess-errors "no code generated" }
+
+package Opt3_Pkg is
+
+ function Max return Natural;
+
+end Opt3_Pkg;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 92c861383a2..eae7953a660 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1183,6 +1183,7 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
*tp = gimple_fold_indirect_ref (ptr);
if (! *tp)
{
+ type = remap_type (type, id);
if (TREE_CODE (ptr) == ADDR_EXPR)
{
*tp
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index e57a343c532..e6562c6c9ba 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -470,7 +470,8 @@ get_rank (tree e)
/* We want integer ones to end up last no matter what, since they are
the ones we can do the most with. */
-#define INTEGER_CONST_TYPE 1 << 3
+#define INTEGER_CONST_TYPE 1 << 4
+#define FLOAT_ONE_CONST_TYPE 1 << 3
#define FLOAT_CONST_TYPE 1 << 2
#define OTHER_CONST_TYPE 1 << 1
@@ -482,7 +483,14 @@ constant_type (tree t)
if (INTEGRAL_TYPE_P (TREE_TYPE (t)))
return INTEGER_CONST_TYPE;
else if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (t)))
- return FLOAT_CONST_TYPE;
+ {
+ /* Sort -1.0 and 1.0 constants last, while in some cases
+ const_binop can't optimize some inexact operations, multiplication
+ by -1.0 or 1.0 can be always merged with others. */
+ if (real_onep (t) || real_minus_onep (t))
+ return FLOAT_ONE_CONST_TYPE;
+ return FLOAT_CONST_TYPE;
+ }
else
return OTHER_CONST_TYPE;
}
@@ -501,7 +509,7 @@ sort_by_operand_rank (const void *pa, const void *pb)
if (oeb->rank == 0 && oea->rank == 0)
{
if (constant_type (oeb->op) != constant_type (oea->op))
- return constant_type (oeb->op) - constant_type (oea->op);
+ return constant_type (oea->op) - constant_type (oeb->op);
else
/* To make sorting result stable, we use unique IDs to determine
order. */
@@ -2870,7 +2878,8 @@ optimize_range_tests_to_bit_test (enum tree_code opcode, int first, int length,
static bool
optimize_range_tests_var_bound (enum tree_code opcode, int first, int length,
vec<operand_entry *> *ops,
- struct range_entry *ranges)
+ struct range_entry *ranges,
+ basic_block first_bb)
{
int i;
bool any_changes = false;
@@ -2967,6 +2976,60 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length,
if (idx == NULL)
continue;
+ /* maybe_optimize_range_tests allows statements without side-effects
+ in the basic blocks as long as they are consumed in the same bb.
+ Make sure rhs2's def stmt is not among them, otherwise we can't
+ use safely get_nonzero_bits on it. E.g. in:
+ # RANGE [-83, 1] NONZERO 173
+ # k_32 = PHI <k_47(13), k_12(9)>
+ ...
+ if (k_32 >= 0)
+ goto <bb 5>; [26.46%]
+ else
+ goto <bb 9>; [73.54%]
+
+ <bb 5> [local count: 140323371]:
+ # RANGE [0, 1] NONZERO 1
+ _5 = (int) k_32;
+ # RANGE [0, 4] NONZERO 4
+ _21 = _5 << 2;
+ # RANGE [0, 4] NONZERO 4
+ iftmp.0_44 = (char) _21;
+ if (k_32 < iftmp.0_44)
+ goto <bb 6>; [84.48%]
+ else
+ goto <bb 9>; [15.52%]
+ the ranges on _5/_21/iftmp.0_44 are flow sensitive, assume that
+ k_32 >= 0. If we'd optimize k_32 >= 0 to true and k_32 < iftmp.0_44
+ to (unsigned) k_32 < (unsigned) iftmp.0_44, then we would execute
+ those stmts even for negative k_32 and the value ranges would be no
+ longer guaranteed and so the optimization would be invalid. */
+ if (opcode == ERROR_MARK)
+ {
+ gimple *g = SSA_NAME_DEF_STMT (rhs2);
+ basic_block bb2 = gimple_bb (g);
+ if (bb2
+ && bb2 != first_bb
+ && dominated_by_p (CDI_DOMINATORS, bb2, first_bb))
+ {
+ /* As an exception, handle a few common cases. */
+ if (gimple_assign_cast_p (g)
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (g)))
+ && TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (g)))
+ && (TYPE_PRECISION (TREE_TYPE (rhs2))
+ > TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (g)))))
+ /* Zero-extension is always ok. */ ;
+ else if (is_gimple_assign (g)
+ && gimple_assign_rhs_code (g) == BIT_AND_EXPR
+ && TREE_CODE (gimple_assign_rhs2 (g)) == INTEGER_CST
+ && !wi::neg_p (gimple_assign_rhs2 (g)))
+ /* Masking with INTEGER_CST with MSB clear is always ok
+ too. */ ;
+ else
+ continue;
+ }
+ }
+
wide_int nz = get_nonzero_bits (rhs2);
if (wi::neg_p (nz))
continue;
@@ -3093,11 +3156,12 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length,
maybe_optimize_range_tests for inter-bb range optimization.
In that case if oe->op is NULL, oe->id is bb->index whose
GIMPLE_COND is && or ||ed into the test, and oe->rank says
- the actual opcode. */
+ the actual opcode.
+ FIRST_BB is the first basic block if OPCODE is ERROR_MARK. */
static bool
optimize_range_tests (enum tree_code opcode,
- vec<operand_entry *> *ops)
+ vec<operand_entry *> *ops, basic_block first_bb)
{
unsigned int length = ops->length (), i, j, first;
operand_entry *oe;
@@ -3175,7 +3239,7 @@ optimize_range_tests (enum tree_code opcode,
any_changes |= optimize_range_tests_to_bit_test (opcode, first, length,
ops, ranges);
any_changes |= optimize_range_tests_var_bound (opcode, first, length, ops,
- ranges);
+ ranges, first_bb);
if (any_changes && opcode != ERROR_MARK)
{
@@ -3922,7 +3986,7 @@ maybe_optimize_range_tests (gimple *stmt)
break;
}
if (ops.length () > 1)
- any_changes = optimize_range_tests (ERROR_MARK, &ops);
+ any_changes = optimize_range_tests (ERROR_MARK, &ops, first_bb);
if (any_changes)
{
unsigned int idx, max_idx = 0;
@@ -5674,7 +5738,7 @@ reassociate_bb (basic_block bb)
if (is_vector)
optimize_vec_cond_expr (rhs_code, &ops);
else
- optimize_range_tests (rhs_code, &ops);
+ optimize_range_tests (rhs_code, &ops, NULL);
}
if (rhs_code == MULT_EXPR && !is_vector)
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 0607b4bf083..00bb229b4a2 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1981,8 +1981,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
if (TREE_CODE (rhs) == SSA_NAME)
rhs = SSA_VAL (rhs);
len = native_encode_expr (gimple_assign_rhs1 (def_stmt),
- buffer, sizeof (buffer));
- if (len > 0)
+ buffer, sizeof (buffer),
+ (offset - offset2) / BITS_PER_UNIT);
+ if (len > 0 && len * BITS_PER_UNIT >= ref->size)
{
tree type = vr->type;
/* Make sure to interpret in a type that has a range
@@ -1991,10 +1992,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
&& ref->size != TYPE_PRECISION (vr->type))
type = build_nonstandard_integer_type (ref->size,
TYPE_UNSIGNED (type));
- tree val = native_interpret_expr (type,
- buffer
- + ((offset - offset2)
- / BITS_PER_UNIT),
+ tree val = native_interpret_expr (type, buffer,
ref->size / BITS_PER_UNIT);
/* If we chop off bits because the types precision doesn't
match the memory access size this is ok when optimizing
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index f586edcd730..ed443fa0883 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -473,7 +473,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
{
tree arg;
- for (param = DECL_ARGUMENTS (func), idx = 0;
+ for (param = DECL_ARGUMENTS (current_function_decl), idx = 0;
param && idx < gimple_call_num_args (call);
param = DECL_CHAIN (param), idx ++)
{
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index b5601727c53..04237dbb9fe 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5479,15 +5479,34 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi,
/* Handle uses. */
if (j == 0)
{
- if (op_type == binary_op || op_type == ternary_op)
+ if (op_type == binary_op)
vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
slp_node, -1);
+ else if (op_type == ternary_op)
+ {
+ if (slp_node)
+ {
+ auto_vec<tree> ops(3);
+ ops.quick_push (op0);
+ ops.quick_push (op1);
+ ops.quick_push (op2);
+ auto_vec<vec<tree> > vec_defs(3);
+ vect_get_slp_defs (ops, slp_node, &vec_defs, -1);
+ vec_oprnds0 = vec_defs[0];
+ vec_oprnds1 = vec_defs[1];
+ vec_oprnds2 = vec_defs[2];
+ }
+ else
+ {
+ vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
+ NULL, -1);
+ vect_get_vec_defs (op2, NULL_TREE, stmt, &vec_oprnds2, NULL,
+ NULL, -1);
+ }
+ }
else
vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
slp_node, -1);
- if (op_type == ternary_op)
- vect_get_vec_defs (op2, NULL_TREE, stmt, &vec_oprnds2, NULL,
- slp_node, -1);
}
else
{
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 9431b90cf52..b5424befc78 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8671,9 +8671,9 @@ union_ranges (enum value_range_type *vr0type,
if (TREE_CODE (*vr0min) == INTEGER_CST)
{
*vr0type = vr1type;
- *vr0min = vr1min;
*vr0max = int_const_binop (MINUS_EXPR, *vr0min,
build_int_cst (TREE_TYPE (*vr0min), 1));
+ *vr0min = vr1min;
}
else
goto give_up;
diff --git a/gcc/tree.c b/gcc/tree.c
index 0e98f53af96..c28f87606ab 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7888,6 +7888,9 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
inchash::add_expr (TREE_VEC_ELT (t, i), hstate, flags);
return;
+ case IDENTIFIER_NODE:
+ hstate.add_object (IDENTIFIER_HASH_VALUE (t));
+ return;
case FUNCTION_DECL:
/* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
Otherwise nodes that compare equal according to operand_equal_p might
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e240ba77430..9ffef8abe38 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1241,10 +1241,9 @@ use_blocks_for_decl_p (tree decl)
if (!VAR_P (decl) && TREE_CODE (decl) != CONST_DECL)
return false;
- /* Detect decls created by dw2_force_const_mem. Such decls are
- special because DECL_INITIAL doesn't specify the decl's true value.
- dw2_output_indirect_constants will instead call assemble_variable
- with dont_output_data set to 1 and then print the contents itself. */
+ /* DECL_INITIAL (decl) set to decl is a hack used for some decls that
+ are never used from code directly and we never want object block handling
+ for those. */
if (DECL_INITIAL (decl) == decl)
return false;
diff --git a/libada/ChangeLog b/libada/ChangeLog
index 6a950729892..452a58a4d48 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libada/configure b/libada/configure
index 17a52c81db2..13e267a7f4e 100755
--- a/libada/configure
+++ b/libada/configure
@@ -3018,7 +3018,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 629048c3e64..5faddcc6a7a 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-03-09 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Backport from mainline
diff --git a/libatomic/configure b/libatomic/configure
index c05fc9d1141..2ae9b8d40f3 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -12333,6 +12333,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 2" >&5
$as_echo_n "checking for __atomic_load/store for size 2... " >&6; }
if test "${libat_cv_have_at_ldst_2+set}" = set; then :
@@ -12400,6 +12401,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 4" >&5
$as_echo_n "checking for __atomic_load/store for size 4... " >&6; }
if test "${libat_cv_have_at_ldst_4+set}" = set; then :
@@ -12467,6 +12469,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 8" >&5
$as_echo_n "checking for __atomic_load/store for size 8... " >&6; }
if test "${libat_cv_have_at_ldst_8+set}" = set; then :
@@ -12534,6 +12537,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 16" >&5
$as_echo_n "checking for __atomic_load/store for size 16... " >&6; }
if test "${libat_cv_have_at_ldst_16+set}" = set; then :
@@ -12602,6 +12606,7 @@ _ACEOF
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_test_and_set for size 1" >&5
$as_echo_n "checking for __atomic_test_and_set for size 1... " >&6; }
if test "${libat_cv_have_at_tas_1+set}" = set; then :
@@ -15267,7 +15272,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog
index c61190f7a7f..98501d05276 100644
--- a/libcc1/ChangeLog
+++ b/libcc1/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libcc1/configure b/libcc1/configure
index d6f480fe930..962d34d9271 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -14315,7 +14315,7 @@ _ACEOF
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index ec16da84f00..1893d0dfbfb 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libcilkrts/configure b/libcilkrts/configure
index 3cc8c999733..503337dc4b4 100644
--- a/libcilkrts/configure
+++ b/libcilkrts/configure
@@ -15413,7 +15413,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index ec5dc75d463..f3136eabbc2 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libffi/configure b/libffi/configure
index 74b747b3b7e..790a291011f 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -16444,7 +16444,7 @@ $as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 70e5bc3baa2..7d54d6800f5 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,19 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
+2018-06-22 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ Backport from mainline
+ 2018-05-17 Jerome Lambourg <lambourg@adacore.com>
+
+ * config/arm/cmse.c (cmse_check_address_range): Replace
+ UINTPTR_MAX with __UINTPTR_MAX__ and uintptr_t with __UINTPTR_TYPE__.
+
2018-04-02 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline
diff --git a/libgcc/config/arm/cmse.c b/libgcc/config/arm/cmse.c
index 4ef7102064e..e284bae4293 100644
--- a/libgcc/config/arm/cmse.c
+++ b/libgcc/config/arm/cmse.c
@@ -36,7 +36,7 @@ cmse_check_address_range (void *p, size_t size, int flags)
char *pb = (char *) p, *pe;
/* Check if the range wraps around. */
- if (UINTPTR_MAX - (uintptr_t) p < size)
+ if (__UINTPTR_MAX__ - (__UINTPTR_TYPE__) p < size)
return NULL;
/* Check if an unknown flag is present. */
@@ -51,7 +51,8 @@ cmse_check_address_range (void *p, size_t size, int flags)
/* Execute the right variant of the TT instructions. */
pe = pb + size - 1;
- const int singleCheck = (((uintptr_t) pb ^ (uintptr_t) pe) < 32);
+ const int singleCheck
+ = (((__UINTPTR_TYPE__) pb ^ (__UINTPTR_TYPE__) pe) < 32);
switch (flags & known_secure_level)
{
case 0:
diff --git a/libgcc/configure b/libgcc/configure
index 9a7eb8446bb..441601a1f76 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5298,7 +5298,7 @@ esac
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 798a50ea85b..afe561b2162 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,25 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
+2018-06-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk.
+ PR libgfortran/86070
+ * io/write_float.def (build_float_string): Initialize *len.
+
+2018-06-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backport from trunk.
+ PR libgfortran/85840
+ * io/write.c (write_float_0, write_real, write_real_g0,
+ write_complex): Use separate local variables for the float
+ string length.
+
2018-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
diff --git a/libgfortran/configure b/libgfortran/configure
index 81238fcb79c..1db8f5f5224 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -26370,7 +26370,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index a7307a8f762..70af7703b7e 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1483,7 +1483,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length,
/* Floating point helper functions. */
-#define BUF_STACK_SZ 256
+#define BUF_STACK_SZ 384
static int
get_precision (st_parameter_dt *dtp, const fnode *f, const char *source, int kind)
@@ -1584,7 +1584,7 @@ write_float_0 (st_parameter_dt *dtp, const fnode *f, const char *source, int kin
char buf_stack[BUF_STACK_SZ];
char str_buf[BUF_STACK_SZ];
char *buffer, *result;
- size_t buf_size, res_len;
+ size_t buf_size, res_len, flt_str_len;
/* Precision for snprintf call. */
int precision = get_precision (dtp, f, source, kind);
@@ -1595,8 +1595,8 @@ write_float_0 (st_parameter_dt *dtp, const fnode *f, const char *source, int kin
buffer = select_buffer (dtp, f, precision, buf_stack, &buf_size, kind);
get_float_string (dtp, f, source , kind, 0, buffer,
- precision, buf_size, result, &res_len);
- write_float_string (dtp, result, res_len);
+ precision, buf_size, result, &flt_str_len);
+ write_float_string (dtp, result, flt_str_len);
if (buf_size > BUF_STACK_SZ)
free (buffer);
@@ -1699,7 +1699,7 @@ write_real (st_parameter_dt *dtp, const char *source, int kind)
char buf_stack[BUF_STACK_SZ];
char str_buf[BUF_STACK_SZ];
char *buffer, *result;
- size_t buf_size, res_len;
+ size_t buf_size, res_len, flt_str_len;
int orig_scale = dtp->u.p.scale_factor;
dtp->u.p.scale_factor = 1;
set_fnode_default (dtp, &f, kind);
@@ -1714,8 +1714,8 @@ write_real (st_parameter_dt *dtp, const char *source, int kind)
buffer = select_buffer (dtp, &f, precision, buf_stack, &buf_size, kind);
get_float_string (dtp, &f, source , kind, 1, buffer,
- precision, buf_size, result, &res_len);
- write_float_string (dtp, result, res_len);
+ precision, buf_size, result, &flt_str_len);
+ write_float_string (dtp, result, flt_str_len);
dtp->u.p.scale_factor = orig_scale;
if (buf_size > BUF_STACK_SZ)
@@ -1734,7 +1734,7 @@ write_real_g0 (st_parameter_dt *dtp, const char *source, int kind, int d)
char buf_stack[BUF_STACK_SZ];
char str_buf[BUF_STACK_SZ];
char *buffer, *result;
- size_t buf_size, res_len;
+ size_t buf_size, res_len, flt_str_len;
int comp_d;
set_fnode_default (dtp, &f, kind);
@@ -1758,8 +1758,8 @@ write_real_g0 (st_parameter_dt *dtp, const char *source, int kind, int d)
buffer = select_buffer (dtp, &f, precision, buf_stack, &buf_size, kind);
get_float_string (dtp, &f, source , kind, comp_d, buffer,
- precision, buf_size, result, &res_len);
- write_float_string (dtp, result, res_len);
+ precision, buf_size, result, &flt_str_len);
+ write_float_string (dtp, result, flt_str_len);
dtp->u.p.g0_no_blanks = 0;
if (buf_size > BUF_STACK_SZ)
@@ -1784,7 +1784,7 @@ write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size)
char str1_buf[BUF_STACK_SZ];
char str2_buf[BUF_STACK_SZ];
char *buffer, *result1, *result2;
- size_t buf_size, res_len1, res_len2;
+ size_t buf_size, res_len1, res_len2, flt_str_len1, flt_str_len2;
int width, lblanks, orig_scale = dtp->u.p.scale_factor;
dtp->u.p.scale_factor = 1;
@@ -1807,18 +1807,18 @@ write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size)
buffer = select_buffer (dtp, &f, precision, buf_stack, &buf_size, kind);
get_float_string (dtp, &f, source , kind, 0, buffer,
- precision, buf_size, result1, &res_len1);
+ precision, buf_size, result1, &flt_str_len1);
get_float_string (dtp, &f, source + size / 2 , kind, 0, buffer,
- precision, buf_size, result2, &res_len2);
+ precision, buf_size, result2, &flt_str_len2);
if (!dtp->u.p.namelist_mode)
{
- lblanks = width - res_len1 - res_len2 - 3;
+ lblanks = width - flt_str_len1 - flt_str_len2 - 3;
write_x (dtp, lblanks, lblanks);
}
write_char (dtp, '(');
- write_float_string (dtp, result1, res_len1);
+ write_float_string (dtp, result1, flt_str_len1);
write_char (dtp, semi_comma);
- write_float_string (dtp, result2, res_len2);
+ write_float_string (dtp, result2, flt_str_len2);
write_char (dtp, ')');
dtp->u.p.scale_factor = orig_scale;
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 7f0aa1d6143..b4971fd335e 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -135,6 +135,7 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer,
w = f->u.real.w;
d = f->u.real.d;
p = dtp->u.p.scale_factor;
+ *len = 0;
rchar = '5';
diff --git a/libgo/config.h.in b/libgo/config.h.in
index a7b1d47ac9b..312da8b2837 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -340,9 +340,6 @@
/* Define to 1 if you have the `unshare' function. */
#undef HAVE_UNSHARE
-/* Define to 1 if you have the <ustat.h> header file and it works. */
-#undef HAVE_USTAT_H
-
/* Define to 1 if you have the `utimensat' function. */
#undef HAVE_UTIMENSAT
diff --git a/libgo/configure b/libgo/configure
index 1d3d714fc05..94c42f67e82 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14784,39 +14784,6 @@ fi
done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <ustat.h> can be used" >&5
-$as_echo_n "checking whether <ustat.h> can be used... " >&6; }
-if test "${libgo_cv_c_ustat_h+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- CFLAGS_hold=$CFLAGS
-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <sys/types.h>
-#ifdef HAVE_LINUX_FILTER_H
-#include <linux/filter.h>
-#endif
-#include <ustat.h>
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- libgo_cv_c_ustat_h=yes
-else
- libgo_cv_c_ustat_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS=$CFLAGS_hold
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_ustat_h" >&5
-$as_echo "$libgo_cv_c_ustat_h" >&6; }
-if test $libgo_cv_c_ustat_h = yes; then
-
-$as_echo "#define HAVE_USTAT_H 1" >>confdefs.h
-
-fi
-
if test "$ac_cv_header_sys_mman_h" = yes; then
HAVE_SYS_MMAN_H_TRUE=
HAVE_SYS_MMAN_H_FALSE='#'
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 51b2c161846..0adbadf20d4 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -572,24 +572,6 @@ AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h
#endif
])
-AC_CACHE_CHECK([whether <ustat.h> can be used],
-[libgo_cv_c_ustat_h],
-[CFLAGS_hold=$CFLAGS
-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS"
-AC_COMPILE_IFELSE(
-[AC_LANG_SOURCE([
-#include <sys/types.h>
-#ifdef HAVE_LINUX_FILTER_H
-#include <linux/filter.h>
-#endif
-#include <ustat.h>
-])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no])
-CFLAGS=$CFLAGS_hold])
-if test $libgo_cv_c_ustat_h = yes; then
- AC_DEFINE(HAVE_USTAT_H, 1,
- [Define to 1 if you have the <ustat.h> header file and it works.])
-fi
-
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr)
diff --git a/libgo/go/syscall/libcall_linux_ustat.go b/libgo/go/syscall/libcall_linux_ustat.go
deleted file mode 100644
index 261f086f47e..00000000000
--- a/libgo/go/syscall/libcall_linux_ustat.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// GNU/Linux library ustat call.
-// This is not supported on some kernels, such as arm64.
-// +build !arm64
-
-package syscall
-
-//sys Ustat(dev int, ubuf *Ustat_t) (err error)
-//ustat(dev _dev_t, ubuf *Ustat_t) _C_int
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 61d39d7e2dd..2284928ae53 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1107,20 +1107,6 @@ grep '^type _sysinfo ' gen-sysinfo.go | \
-e 's/mem_unit/Unit/' \
>> ${OUT}
-# The ustat struct.
-grep '^type _ustat ' gen-sysinfo.go | \
- sed -e 's/_ustat/Ustat_t/' \
- -e 's/f_tfree/Tfree/' \
- -e 's/f_tinode/Tinoe/' \
- -e 's/f_fname/Fname/' \
- -e 's/f_fpack/Fpack/' \
- >> ${OUT}
-# Force it to be defined, as on some older GNU/Linux systems the
-# header file fails when using with <linux/filter.h>.
-if ! grep 'type _ustat ' gen-sysinfo.go >/dev/null 2>&1; then
- echo 'type Ustat_t struct { Tfree int32; Tinoe uint64; Fname [5+1]int8; Fpack [5+1]int8; }' >> ${OUT}
-fi
-
# The utimbuf struct.
grep '^type _utimbuf ' gen-sysinfo.go | \
sed -e 's/_utimbuf/Utimbuf/' \
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index a1afc7d119c..7ff721816f9 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -135,9 +135,6 @@
#if defined(HAVE_SYS_SYSINFO_H)
#include <sys/sysinfo.h>
#endif
-#if defined(HAVE_USTAT_H)
-#include <ustat.h>
-#endif
#if defined(HAVE_UTIME_H)
#include <utime.h>
#endif
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index cc463532157..f020f1b040e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,16 @@
+2018-06-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86291
+ * testsuite/libgomp.c++/pr86291.C: New test.
+
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-05-01 Tom de Vries <tom@codesourcery.com>
backport from trunk:
diff --git a/libgomp/configure b/libgomp/configure
index b7e9f40b852..06166c66120 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -16823,7 +16823,7 @@ CFLAGS="$save_CFLAGS"
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libgomp/testsuite/libgomp.c++/pr86291.C b/libgomp/testsuite/libgomp.c++/pr86291.C
new file mode 100644
index 00000000000..89c4b2d37cd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/pr86291.C
@@ -0,0 +1,51 @@
+// PR c++/86291
+// { dg-do run }
+// { dg-additional-options "-std=c++11" }
+
+extern "C" void abort ();
+
+struct I
+{
+ using size_type = __SIZE_TYPE__;
+ using difference_type = __PTRDIFF_TYPE__;
+ using value_type = int;
+ using reference = int &;
+ using pointer = int *;
+ static I begin () { return I{}; }
+ static I end () { I res; res.pos = res.num; return res; }
+ I &operator++ () { ++pos; return *this; }
+ reference operator* () const { return val; }
+ I &operator+= (size_type diff) { pos += diff; return *this; }
+ friend bool operator< (const I &a, const I &b) { return a.pos < b.pos; }
+ friend difference_type operator- (const I &a, const I &b) { return a.pos - b.pos; }
+ size_type pos = 0;
+ size_type num = 1;
+ mutable int val = 0;
+};
+
+int c;
+
+int
+main ()
+{
+#pragma omp parallel for collapse(10)
+ for (auto i = I::begin (); i < I::end (); ++i)
+ for (auto j = I::begin (); j < I::end (); ++j)
+ for (auto k = I::begin (); k < I::end (); ++k)
+ for (auto l = I::begin (); l < I::end (); ++l)
+ for (auto m = I::begin (); m < I::end (); ++m)
+ for (auto n = I::begin (); n < I::end (); ++n)
+ for (auto o = I::begin (); o < I::end (); ++o)
+ for (auto p = I::begin (); p < I::end (); ++p)
+ for (auto q = I::begin (); q < I::end (); ++q)
+ for (auto r = I::begin (); r < I::end (); ++r)
+ {
+ if (*i != 0 || *j != 0 || *k != 0 || *l != 0 || *m != 0
+ || *n != 0 || *o != 0 || *p != 0 || *q != 0 || *r != 0)
+ abort ();
+ #pragma omp atomic
+ c++;
+ }
+ if (c != 1)
+ abort ();
+}
diff --git a/libhsail-rt/ChangeLog b/libhsail-rt/ChangeLog
index ae7bfb6854c..5d18dbb66b4 100644
--- a/libhsail-rt/ChangeLog
+++ b/libhsail-rt/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libhsail-rt/configure b/libhsail-rt/configure
index a490125f5b3..a4fcc10c1f9 100755
--- a/libhsail-rt/configure
+++ b/libhsail-rt/configure
@@ -14414,7 +14414,7 @@ _ACEOF
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index f66dd31b03a..2d2fee851d0 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libitm/configure b/libitm/configure
index 775f370fbb5..96c494d4a3f 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -17647,7 +17647,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libmpx/ChangeLog b/libmpx/ChangeLog
index af0595017c9..e10a10c719b 100644
--- a/libmpx/ChangeLog
+++ b/libmpx/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libmpx/configure b/libmpx/configure
index 853993a522f..2fd71ca89f6 100644
--- a/libmpx/configure
+++ b/libmpx/configure
@@ -11596,7 +11596,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 78121927ba0..1f1e198cc45 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libobjc/configure b/libobjc/configure
index abf5aed71cf..84862a82864 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -11708,7 +11708,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog
index 42d03b2e7be..2b20f8a3f1a 100644
--- a/liboffloadmic/ChangeLog
+++ b/liboffloadmic/ChangeLog
@@ -1,3 +1,12 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+ * plugin/confugure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/liboffloadmic/configure b/liboffloadmic/configure
index e22b214ddbc..f873716991b 100644
--- a/liboffloadmic/configure
+++ b/liboffloadmic/configure
@@ -14492,7 +14492,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/liboffloadmic/plugin/configure b/liboffloadmic/plugin/configure
index 8b8c041d2bf..c031eb3e7fa 100644
--- a/liboffloadmic/plugin/configure
+++ b/liboffloadmic/plugin/configure
@@ -14187,7 +14187,7 @@ hardcode_into_libs=no
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index 4c66b338b2c..004c808fb3d 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libquadmath/configure b/libquadmath/configure
index d2f13bf7751..76a2c20b7e1 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -12929,7 +12929,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 07096babbda..a127bb0c2d6 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,39 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
+2018-06-07 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/84761
+ * sanitizer_common/sanitizer_linux_libcdep.cc (__GLIBC_PREREQ):
+ Define if not defined.
+ (DL_INTERNAL_FUNCTION): Don't define.
+ (InitTlsSize): For __i386__ if not compiled against glibc 2.27+
+ determine at runtime whether to use regparm(3), stdcall calling
+ convention for older glibcs or normal calling convention for
+ newer glibcs for call to _dl_get_tls_static_info.
+
+2018-05-31 Matthias Klose <doko@ubuntu.com>
+
+ PR sanitizer/86012
+ * sanitizer_common/sanitizer_platform_limits_posix.cc: Define
+ SIZEOF_STRUCT_USTAT for 32bit sparc.
+
+2018-05-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR sanitizer/85835
+ * sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
+ include <sys/ustat.h> for Linux.
+ (SIZEOF_STRUCT_USTAT): New.
+ (struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.
+
2018-04-24 Martin Liska <mliska@suse.cz>
Backport from mainline
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 8e0c47ea838..a3a08d635f4 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -16511,7 +16511,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
index 63e70660cf3..dc342de6e10 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
@@ -153,28 +153,43 @@ bool SanitizerGetThreadName(char *name, int max_len) {
#endif
}
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
#if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO
static uptr g_tls_size;
-#ifdef __i386__
-# define DL_INTERNAL_FUNCTION __attribute__((regparm(3), stdcall))
-#else
-# define DL_INTERNAL_FUNCTION
-#endif
-
void InitTlsSize() {
// all current supported platforms have 16 bytes stack alignment
const size_t kStackAlign = 16;
- typedef void (*get_tls_func)(size_t*, size_t*) DL_INTERNAL_FUNCTION;
- get_tls_func get_tls;
- void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
- CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
- internal_memcpy(&get_tls, &get_tls_static_info_ptr,
- sizeof(get_tls_static_info_ptr));
- CHECK_NE(get_tls, 0);
size_t tls_size = 0;
size_t tls_align = 0;
- get_tls(&tls_size, &tls_align);
+ void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
+#if defined(__i386__) && !__GLIBC_PREREQ(2, 27)
+ /* On i?86, _dl_get_tls_static_info used to be internal_function, i.e.
+ __attribute__((regparm(3), stdcall)) before glibc 2.27 and is normal
+ function in 2.27 and later. */
+ if (!dlvsym(RTLD_NEXT, "glob", "GLIBC_2.27")) {
+ typedef void (*get_tls_func)(size_t*, size_t*)
+ __attribute__((regparm(3), stdcall));
+ get_tls_func get_tls;
+ CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
+ internal_memcpy(&get_tls, &get_tls_static_info_ptr,
+ sizeof(get_tls_static_info_ptr));
+ CHECK_NE(get_tls, 0);
+ get_tls(&tls_size, &tls_align);
+ } else
+#endif
+ {
+ typedef void (*get_tls_func)(size_t*, size_t*);
+ get_tls_func get_tls;
+ CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
+ internal_memcpy(&get_tls, &get_tls_static_info_ptr,
+ sizeof(get_tls_static_info_ptr));
+ CHECK_NE(get_tls, 0);
+ get_tls(&tls_size, &tls_align);
+ }
if (tls_align < kStackAlign)
tls_align = kStackAlign;
g_tls_size = RoundUpTo(tls_size, tls_align);
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 31a5e697eae..97eae3fc7bc 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -154,7 +154,6 @@ typedef struct user_fpregs elf_fpregset_t;
# include <sys/procfs.h>
#endif
#include <sys/user.h>
-#include <sys/ustat.h>
#include <linux/cyclades.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
@@ -247,7 +246,19 @@ namespace __sanitizer {
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- unsigned struct_ustat_sz = sizeof(struct ustat);
+ // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
+ // has been removed from glibc 2.28.
+#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
+ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
+ || defined(__x86_64__)
+#define SIZEOF_STRUCT_USTAT 32
+#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
+ || defined(__powerpc__) || defined(__s390__) || defined(__sparc__)
+#define SIZEOF_STRUCT_USTAT 20
+#else
+#error Unknown size of struct ustat
+#endif
+ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index 299029f8521..9ae263e73ba 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libssp/configure b/libssp/configure
index b14e922e6f1..ee1751d20db 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -11082,7 +11082,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index de8f0dab995..60a81cc0941 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,48 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
+2018-06-22 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2018-06-22 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/86138
+ * include/bits/basic_string.tcc:
+ [__cplusplus > 201402 && !_GLIBCXX_USE_CXX11_ABI]
+ (basic_string<char>::_Rep::_S_empty_rep_storage)
+ (basic_string<wchar_t>::_Rep::_S_empty_rep_storage): Add explicit
+ instantiation declarations.
+ [__cplusplus > 201402] (operator>>, operator<<, getline): Re-enable
+ explicit instantiation declarations.
+ * testsuite/21_strings/basic_string/cons/char/86138.cc: New.
+ * testsuite/21_strings/basic_string/cons/wchar_t/86138.cc: New.
+
+2018-06-21 Jonathan Wakely <jwakely@redhat.com>
+
+ * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
+
+2018-06-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/std/utility: Remove unused <exception> header.
+
+2018-06-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/86169
+ * include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
+ (basic_string::data()): Unshare string.
+ * testsuite/21_strings/basic_string/operations/data/char/86169.cc:
+ New.
+
+2018-06-15 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/char_traits.h (__cpp_lib_constexpr_char_traits): Only
+ define for C++17 and above.
+
2018-05-17 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/85812
diff --git a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt
index a31597e906f..06c61236f34 100644
--- a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt
+++ b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt
@@ -4004,6 +4004,7 @@ OBJECT:0:GLIBCXX_3.4.20
OBJECT:0:GLIBCXX_3.4.21
OBJECT:0:GLIBCXX_3.4.22
OBJECT:0:GLIBCXX_3.4.23
+OBJECT:0:GLIBCXX_3.4.24
OBJECT:0:GLIBCXX_3.4.3
OBJECT:0:GLIBCXX_3.4.4
OBJECT:0:GLIBCXX_3.4.5
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 9e56113b872..bc624207ce6 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -81697,7 +81697,7 @@ $as_echo "$gxx_include_dir" >&6; }
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 7df39685ad3..674fe0963eb 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -5130,7 +5130,10 @@ _GLIBCXX_END_NAMESPACE_CXX11
*/
_CharT*
data() noexcept
- { return _M_data(); }
+ {
+ _M_leak();
+ return _M_data();
+ }
#endif
/**
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 41b7fa196b0..d185a54aaf0 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1597,8 +1597,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
-#if _GLIBCXX_EXTERN_TEMPLATE > 0 && __cplusplus <= 201402L
+#if _GLIBCXX_EXTERN_TEMPLATE > 0
+ // The explicit instantiations definitions in src/c++11/string-inst.cc
+ // are compiled as C++14, so the new C++17 members aren't instantiated.
+ // Until those definitions are compiled as C++17 suppress the declaration,
+ // so C++17 code will implicitly instantiate std::string and std::wstring
+ // as needed.
+# if __cplusplus <= 201402L
extern template class basic_string<char>;
+# elif ! _GLIBCXX_USE_CXX11_ABI
+ // Still need to prevent implicit instantiation of the COW empty rep,
+ // to ensure the definition in libstdc++.so is unique (PR 86138).
+ extern template basic_string<char>::size_type
+ basic_string<char>::_Rep::_S_empty_rep_storage[];
+# endif
+
extern template
basic_istream<char>&
operator>>(basic_istream<char>&, string&);
@@ -1613,7 +1626,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
getline(basic_istream<char>&, string&);
#ifdef _GLIBCXX_USE_WCHAR_T
+# if __cplusplus <= 201402L
extern template class basic_string<wchar_t>;
+# elif ! _GLIBCXX_USE_CXX11_ABI
+ extern template basic_string<wchar_t>::size_type
+ basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];
+# endif
+
extern template
basic_istream<wchar_t>&
operator>>(basic_istream<wchar_t>&, wstring&);
@@ -1626,8 +1645,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
extern template
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&);
-#endif
-#endif
+#endif // _GLIBCXX_USE_WCHAR_T
+#endif // _GLIBCXX_EXTERN_TEMPLATE > 0
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index 3ecc30e46cb..791608ad3db 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -143,8 +143,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
};
-#define __cpp_lib_constexpr_char_traits 201611
-
template<typename _CharT>
_GLIBCXX14_CONSTEXPR int
char_traits<_CharT>::
@@ -217,6 +215,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus > 201402
+#define __cpp_lib_constexpr_char_traits 201611
+
/**
* @brief Determine whether the characters of a NULL-terminated
* string are known at compile time.
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 978acb747e9..847e5184c5b 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -75,10 +75,6 @@
#include <bits/move.h>
#include <initializer_list>
-#if __cplusplus > 201402L
-#include <exception>
-#endif
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc
new file mode 100644
index 00000000000..a85fd9c82c9
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/86138.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+// { dg-final { scan-assembler-not "_ZNSs4_Rep20_S_empty_rep_storageE:" } }
+
+#undef _GLIBCXX_USE_CXX11_ABI
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include <string>
+
+void
+test01(std::string* s)
+{
+ s->~basic_string();
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc
new file mode 100644
index 00000000000..d77922976d0
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/86138.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+// { dg-final { scan-assembler-not "_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE:" } }
+
+#undef _GLIBCXX_USE_CXX11_ABI
+#define _GLIBCXX_USE_CXX11_ABI 0
+#include <string>
+
+void
+test01(std::wstring* s)
+{
+ s->~basic_string();
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc
new file mode 100644
index 00000000000..a8b0ff4aa3f
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/operations/data/char/86169.cc
@@ -0,0 +1,37 @@
+// 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 } }
+
+// PR libstdc++/86169
+
+#ifndef _GLIBCXX_USE_CXX11_ABI
+# define _GLIBCXX_USE_CXX11_ABI 0
+#endif
+
+#include <string>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ const std::string s0{"hello world"};
+ std::string s1 {s0};
+ char* p = s1.data();
+ *p = ' ';
+ VERIFY(s0.compare("hello world") == 0);
+}
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 4f4d7e00de4..1f5a9f6deb8 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-22 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * configure: Regenerate.
+
2018-01-25 Release Manager
* GCC 7.3.0 released.
diff --git a/libvtv/configure b/libvtv/configure
index c3bed2dfc70..dfb9162c79f 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -15516,7 +15516,7 @@ fi
# Check whether --with-gcc-major-version-only was given.
if test "${with_gcc_major_version_only+set}" = set; then :
withval=$with_gcc_major_version_only; if test x$with_gcc_major_version_only = xyes ; then
- get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
+ get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
fi
fi