aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog278
-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/c-family/ChangeLog14
-rw-r--r--gcc/c-family/c-gimplify.c4
-rw-r--r--gcc/calls.c122
-rw-r--r--gcc/config.gcc20
-rw-r--r--gcc/config/arm/arm_cmse.h7
-rw-r--r--gcc/config/i386/sse.md9
-rw-r--r--gcc/config/riscv/t-rtems25
-rw-r--r--gcc/config/rs6000/rs6000-c.c9
-rw-r--r--gcc/config/rs6000/rs6000.c26
-rw-r--r--gcc/config/rs6000/rs6000.h6
-rw-r--r--gcc/config/rs6000/rs6000.md4
-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/xtensa/xtensa.md46
-rw-r--r--gcc/cp/ChangeLog49
-rw-r--r--gcc/cp/decl.c34
-rw-r--r--gcc/cp/decl2.c14
-rw-r--r--gcc/cp/parser.c13
-rw-r--r--gcc/cp/typeck2.c7
-rw-r--r--gcc/doc/invoke.texi3
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/fold-const.c14
-rw-r--r--gcc/fortran/ChangeLog208
-rw-r--r--gcc/fortran/array.c14
-rw-r--r--gcc/fortran/check.c7
-rw-r--r--gcc/fortran/data.c34
-rw-r--r--gcc/fortran/decl.c36
-rw-r--r--gcc/fortran/expr.c7
-rw-r--r--gcc/fortran/frontend-passes.c5
-rw-r--r--gcc/fortran/match.c27
-rw-r--r--gcc/fortran/resolve.c38
-rw-r--r--gcc/fortran/simplify.c41
-rw-r--r--gcc/fortran/symbol.c14
-rw-r--r--gcc/fortran/trans-array.c38
-rw-r--r--gcc/fortran/trans-decl.c11
-rw-r--r--gcc/fortran/trans-expr.c38
-rw-r--r--gcc/fortran/trans-intrinsic.c140
-rw-r--r--gcc/fortran/trans-stmt.c3
-rw-r--r--gcc/fortran/trans-types.c8
-rw-r--r--gcc/fortran/trans.h2
-rw-r--r--gcc/gimple-ssa-strength-reduction.c81
-rw-r--r--gcc/gimplify.c21
-rw-r--r--gcc/ipa-cp.c4
-rw-r--r--gcc/ipa-devirt.c11
-rw-r--r--gcc/ipa-icf.c113
-rw-r--r--gcc/ipa-icf.h12
-rw-r--r--gcc/lto/ChangeLog26
-rw-r--r--gcc/lto/lto-symtab.c20
-rw-r--r--gcc/omp-expand.c8
-rw-r--r--gcc/testsuite/ChangeLog380
-rw-r--r--gcc/testsuite/c-c++-common/pr84873.c8
-rw-r--r--gcc/testsuite/g++.dg/asan/pr85081.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/extern_template-4.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-dependent1.C19
-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/cpp1z/decomp10.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp37.C62
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp38.C48
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/decomp4.C4
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/pr85464.C5
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/lambda1.C14
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr84658.C30
-rw-r--r--gcc/testsuite/g++.dg/torture/pr85496.C18
-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/lto/pr85248_0.c45
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr85248_1.c9
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57656.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85168.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85244-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85244-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr85284.c20
-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/vect/pr85597.c26
-rw-r--r--gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c4
-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/powerpc/pr83660.C14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83969.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr85698.c79
-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_assumed_charlen_4.f9039
-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/associate_33.f0311
-rw-r--r--gcc/testsuite/gfortran.dg/char_result_18.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/get_to_indexed_array_1.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/get_to_indirect_array.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_dependency_1.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f905
-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/goacc/pr84963.f907
-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/pr70870_1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr78278.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149_1.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149_a.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/pr83149_b.f9016
-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/pr85520.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr85521_1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr85521_2.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr85542.f907
-rw-r--r--gcc/testsuite/gfortran.dg/pr85543.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr85687.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/select_type_42.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/submodule_31.f0854
-rw-r--r--gcc/testsuite/gfortran.dg/temporary_2.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/temporary_3.f90121
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_operator_4.f032
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_polymorphic_29.f9084
-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/testsuite/go.dg/pr85436.go21
-rw-r--r--gcc/testsuite/lib/target-supports.exp2
-rw-r--r--gcc/tree-dfa.c13
-rw-r--r--gcc/tree-ssa-loop-niter.c4
-rw-r--r--gcc/tree-ssa-sccvn.c5
-rw-r--r--gcc/tree-vect-stmts.c27
173 files changed, 4026 insertions, 407 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 220d222986c..37d23da6c5e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,281 @@
+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
+ 2018-05-17 Pat Haugen <pthaugen@us.ibm.com>
+ Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/85698
+ * config/rs6000/rs6000.c (rs6000_output_move_128bit): Check
+ dest operand.
+
+2018-05-17 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2018-05-11 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/85655
+ * ipa-cp.c (intersect_with_plats): Check that the lattice contains
+ single const.
+
+2018-05-01 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ 2018-04-16 Cesar Philippidis <cesar@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+
+ PR middle-end/84955
+ * omp-expand.c (expand_oacc_for): Add dummy false branch for
+ tiled basic blocks without omp continue statements.
+
+2018-04-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-04-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85284
+ * tree-ssa-loop-niter.c (number_of_iterations_exit_assumptions):
+ Only use the niter constraining form of simple_iv when the exit
+ is always executed.
+
+ 2018-04-06 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85244
+ * tree-dfa.c (get_ref_base_and_extent): Reset seen_variable_array_ref
+ after seeing a component reference with an adjacent field. Treat
+ refs to arrays at struct end of external decls similar to
+ refs to unconstrained commons.
+
+ 2018-04-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85168
+ * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Avoid
+ propagating abnormals.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-17 Martin Liska <mliska@suse.cz>
+
+ PR lto/85405
+ * ipa-devirt.c (odr_types_equivalent_p): Remove trailing
+ in message, remote space in between '_G' and '('.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-17 Jan Hubicka <jh@suse.cz>
+
+ PR lto/85405
+ * ipa-devirt.c (odr_types_equivalent_p): Handle bit fields.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-28 Jakub Jelinek <jakub@redhat.com>
+ Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/85081
+ * gimplify.c (asan_poison_variable): Don't do the check for
+ gimplify_omp_ctxp here.
+ (gimplify_decl_expr): Do it here.
+ (gimplify_target_expr): Likewise.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-21 Martin Liska <mliska@suse.cz>
+
+ PR ipa/84963
+ * ipa-icf.c (sem_item_optimizer::fixup_points_to_sets): Remove
+ not intended return statement.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-13 Martin Liska <mliska@suse.cz>
+
+ PR ipa/84658.
+ * (sem_item_optimizer::sem_item_optimizer): Initialize new
+ vector.
+ (sem_item_optimizer::~sem_item_optimizer): Release it.
+ (sem_item_optimizer::merge_classes): Register variable aliases.
+ (sem_item_optimizer::fixup_pt_set): New function.
+ (sem_item_optimizer::fixup_points_to_sets): Likewise.
+ * ipa-icf.h: Declare new variables and functions.
+
+2018-04-23 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ Backport from mainline
+ 2018-04-16 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ PR target/83660
+ * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Mark
+ vec_extract expression as having side effects to make sure it gets
+ a cleanup point.
+
+2018-04-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/85496
+ * expr.c (store_field): In the bitfield case, if the value comes from
+ a function call and is returned in registers by means of a PARALLEL,
+ do not change the mode of the temporary unless BLKmode and VOIDmode.
+
+2018-04-20 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2018-03-09 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/83969
+ * config/rs6000/rs6000.c (rs6000_offsettable_memref_p): New prototype.
+ Add strict argument and use it.
+ (rs6000_split_multireg_move): Update for new strict argument.
+ (mem_operand_gpr): Disallow all non-offsettable addresses.
+ * config/rs6000/rs6000.md (*movdi_internal64): Use YZ constraint.
+
2018-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 4a263217f2d..29a22e10baa 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20180418
+20180622
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/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7a83a0a9062..962f62844a3 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,17 @@
+2018-04-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-03-16 Richard Biener <rguenther@suse.de>
+
+ PR c/84873
+ * c-gimplify.c (c_gimplify_expr): Revert previous change. Instead
+ unshare the possibly folded expression.
+
+ 2018-03-15 Richard Biener <rguenther@suse.de>
+
+ PR c/84873
+ * c-gimplify.c (c_gimplify_expr): Do not fold expressions.
+
2018-03-03 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 57edb41af0f..deecb1a3e4a 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -244,7 +244,9 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
unsigned_type_node)
&& !types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (*op1_p)),
integer_type_node))
- *op1_p = convert (unsigned_type_node, *op1_p);
+ /* Make sure to unshare the result, tree sharing is invalid
+ during gimplification. */
+ *op1_p = unshare_expr (convert (unsigned_type_node, *op1_p));
break;
}
diff --git a/gcc/calls.c b/gcc/calls.c
index b183be63dd4..31663f4f67b 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;
}
diff --git a/gcc/config.gcc b/gcc/config.gcc
index b54345dcda5..3e41aa5b764 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/sse.md b/gcc/config/i386/sse.md
index 1cd6efb300e..0ed1ac053c5 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>")])
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 c6fd52439eb..24904d1bd74 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -6075,6 +6075,15 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
stmt = build_binary_op (loc, PLUS_EXPR, stmt, arg2, 1);
stmt = build_indirect_ref (loc, stmt, RO_NULL);
+ /* PR83660: We mark this as having side effects so that
+ downstream in fold_build_cleanup_point_expr () it will get a
+ CLEANUP_POINT_EXPR. If it does not we can run into an ICE
+ later in gimplify_cleanup_point_expr (). Potentially this
+ causes missed optimization because the actually is no side
+ effect. */
+ if (c_dialect_cxx ())
+ TREE_SIDE_EFFECTS (stmt) = 1;
+
return stmt;
}
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index edddff7aeca..01ae6ad8787 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1372,6 +1372,7 @@ static rtx rs6000_debug_legitimize_reload_address (rtx, machine_mode, int,
int, int, int *);
static bool rs6000_mode_dependent_address (const_rtx);
static bool rs6000_debug_mode_dependent_address (const_rtx);
+static bool rs6000_offsettable_memref_p (rtx, machine_mode, bool);
static enum reg_class rs6000_secondary_reload_class (enum reg_class,
machine_mode, rtx);
static enum reg_class rs6000_debug_secondary_reload_class (enum reg_class,
@@ -8564,10 +8565,15 @@ mem_operand_gpr (rtx op, machine_mode mode)
int extra;
rtx addr = XEXP (op, 0);
- /* Don't allow altivec type addresses like (mem (and (plus ...))).
- See PR target/84279. */
+ /* 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;
- if (GET_CODE (addr) == AND)
+ /* Don't allow non-offsettable addresses. See PRs 83969 and 84279. */
+ if (!rs6000_offsettable_memref_p (op, mode, false))
return false;
op = address_offset (addr);
@@ -10340,7 +10346,7 @@ rs6000_find_base_term (rtx op)
in 32-bit mode, that the recog predicate rejects. */
static bool
-rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode)
+rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode, bool strict)
{
bool worst_case;
@@ -10348,7 +10354,7 @@ rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode)
return false;
/* First mimic offsettable_memref_p. */
- if (offsettable_address_p (true, GET_MODE (op), XEXP (op, 0)))
+ if (offsettable_address_p (strict, GET_MODE (op), XEXP (op, 0)))
return true;
/* offsettable_address_p invokes rs6000_mode_dependent_address, but
@@ -10362,7 +10368,7 @@ rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode)
worst_case = ((TARGET_POWERPC64 && GET_MODE_CLASS (reg_mode) == MODE_INT)
|| GET_MODE_SIZE (reg_mode) == 4);
return rs6000_legitimate_offset_address_p (GET_MODE (op), XEXP (op, 0),
- true, worst_case);
+ strict, worst_case);
}
/* Determine the reassociation width to be used in reassociate_bb.
@@ -23281,7 +23287,7 @@ rs6000_output_move_128bit (rtx operands[])
}
else if (TARGET_ALTIVEC && src_vmx_p
- && altivec_indexed_or_indirect_operand (src, mode))
+ && altivec_indexed_or_indirect_operand (dest, mode))
return "stvx %1,%y0";
else if (TARGET_VSX && src_vsx_p)
@@ -26559,7 +26565,7 @@ rs6000_split_multireg_move (rtx dst, rtx src)
emit_insn (gen_add3_insn (breg, breg, delta_rtx));
src = replace_equiv_address (src, breg);
}
- else if (! rs6000_offsettable_memref_p (src, reg_mode))
+ else if (! rs6000_offsettable_memref_p (src, reg_mode, true))
{
if (GET_CODE (XEXP (src, 0)) == PRE_MODIFY)
{
@@ -26626,7 +26632,7 @@ rs6000_split_multireg_move (rtx dst, rtx src)
emit_insn (gen_add3_insn (breg, breg, delta_rtx));
dst = replace_equiv_address (dst, breg);
}
- else if (!rs6000_offsettable_memref_p (dst, reg_mode)
+ else if (!rs6000_offsettable_memref_p (dst, reg_mode, true)
&& GET_CODE (XEXP (dst, 0)) != LO_SUM)
{
if (GET_CODE (XEXP (dst, 0)) == PRE_MODIFY)
@@ -26665,7 +26671,7 @@ rs6000_split_multireg_move (rtx dst, rtx src)
}
}
else if (GET_CODE (XEXP (dst, 0)) != LO_SUM)
- gcc_assert (rs6000_offsettable_memref_p (dst, reg_mode));
+ gcc_assert (rs6000_offsettable_memref_p (dst, reg_mode, true));
}
for (i = 0; i < nregs; i++)
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 40eda587137..ca7c04e275a 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -8640,14 +8640,14 @@
;; FPR->GPR GPR->FPR VSX->GPR GPR->VSX
(define_insn "*movdi_internal64"
[(set (match_operand:DI 0 "nonimmediate_operand"
- "=Y, r, r, r, r, r,
+ "=YZ, r, r, r, r, r,
^m, ^d, ^d, ^wY, $Z, $wb,
$wv, ^wi, *wo, *wo, *wv, *wi,
*wi, *wv, *wv, r, *h, *h,
?*r, ?*wg, ?*r, ?*wj")
(match_operand:DI 1 "input_operand"
- "r, Y, r, I, L, nF,
+ "r, YZ, r, I, L, nF,
d, m, d, wb, wv, wY,
Z, wi, Oj, wM, OjwM, Oj,
wM, wS, wB, *h, r, 0,
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/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/cp/ChangeLog b/gcc/cp/ChangeLog
index 87633e9343c..2d06819d455 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,52 @@
+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.
+ * decl2.c (determine_visibility): Don't mess with template arguments
+ from the containing scope.
+ (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
+ thunk.
+
+2018-04-23 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Implement P0969
+ * decl.c (find_decomp_class_base): Check accessibility instead
+ of declared access, adjust diagnostic.
+
+2018-04-23 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/85470 - wrong error with static data member.
+ * decl.c (check_initializer): Check DECL_INITIALIZED_IN_CLASS_P.
+ * typeck2.c (store_init_value): Likewise.
+
+2018-04-23 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Backport from mainline
+ 2018-04-05 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Implement P0961
+ * decl.c (get_tuple_decomp_init): Check the templatedness
+ of a member get.
+
+2018-04-19 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/85464 - missing location for -Wignored-qualifiers diagnostic
+ * decl.c (grokdeclarator): If declspecs->locations[ds_type_spec]
+ is UNKNOWN_LOCATION fall back to input_location.
+
2018-04-09 Jason Merrill <jason@redhat.com>
PR c++/85279 - dump_expr doesn't understand decltype.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5c519146043..836506ef7be 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6400,7 +6400,9 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
}
if (init_code
- && (DECL_IN_AGGR_P (decl) && !DECL_VAR_DECLARED_INLINE_P (decl)))
+ && (DECL_IN_AGGR_P (decl)
+ && DECL_INITIALIZED_IN_CLASS_P (decl)
+ && !DECL_VAR_DECLARED_INLINE_P (decl)))
{
static int explained = 0;
@@ -7228,9 +7230,9 @@ find_decomp_class_base (location_t loc, tree type, tree ret)
inform (DECL_SOURCE_LOCATION (field), "declared here");
return error_mark_node;
}
- else if (TREE_PRIVATE (field) || TREE_PROTECTED (field))
+ else if (!accessible_p (type, field, true))
{
- error_at (loc, "cannot decompose non-public member %qD of %qT",
+ error_at (loc, "cannot decompose inaccessible member %qD of %qT",
field, type);
inform (DECL_SOURCE_LOCATION (field),
TREE_PRIVATE (field)
@@ -7338,7 +7340,29 @@ get_tuple_decomp_init (tree decl, unsigned i)
tree fns = lookup_qualified_name (TREE_TYPE (e), get_id,
/*type*/false, /*complain*/false);
- if (fns != error_mark_node)
+ bool use_member_get = false;
+
+ /* To use a member get, member lookup must find at least one
+ declaration that is a function template
+ whose first template parameter is a non-type parameter. */
+ for (tree iter = BASELINK_P (fns) ? BASELINK_FUNCTIONS (fns) : fns;
+ iter;
+ iter = OVL_NEXT (iter))
+ {
+ tree fn = OVL_CURRENT (iter);
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ {
+ tree tparms = DECL_TEMPLATE_PARMS (fn);
+ tree parm = TREE_VEC_ELT (INNERMOST_TEMPLATE_PARMS (tparms), 0);
+ if (TREE_CODE (TREE_VALUE (parm)) == PARM_DECL)
+ {
+ use_member_get = true;
+ break;
+ }
+ }
+ }
+
+ if (use_member_get)
{
fns = lookup_template_function (fns, targs);
return build_new_method_call (e, fns, /*args*/NULL,
@@ -10105,6 +10129,8 @@ grokdeclarator (const cp_declarator *declarator,
declspecs->locations);
if (typespec_loc == UNKNOWN_LOCATION)
typespec_loc = declspecs->locations[ds_type_spec];
+ if (typespec_loc == UNKNOWN_LOCATION)
+ typespec_loc = input_location;
/* Look inside a declarator for the name being declared
and get it as a string, for an error message. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 982f35f558f..7ad6a108224 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1829,10 +1829,13 @@ vague_linkage_p (tree decl)
{
if (!TREE_PUBLIC (decl))
{
- /* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor
- variants, check one of the "clones" for the real linkage. */
+ /* maybe_thunk_body clears TREE_PUBLIC and DECL_ABSTRACT_P on the
+ maybe-in-charge 'tor variants; in that case we need to check one of
+ the "clones" for the real linkage. But only in that case; before
+ maybe_clone_body we haven't yet copied the linkage to the clones. */
if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
|| DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ && !DECL_ABSTRACT_P (decl)
&& DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION (DECL_CHAIN (decl)))
return vague_linkage_p (DECL_CHAIN (decl));
@@ -2310,11 +2313,8 @@ determine_visibility (tree decl)
}
/* Local classes in templates have CLASSTYPE_USE_TEMPLATE set,
- but have no TEMPLATE_INFO. Their containing template
- function does, and the local class could be constrained
- by that. */
- if (template_decl)
- template_decl = fn;
+ but have no TEMPLATE_INFO, so don't try to check it. */
+ template_decl = NULL_TREE;
}
else if (VAR_P (decl) && DECL_TINFO_P (decl)
&& flag_visibility_ms_compat)
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 9a65d945232..6d9b712e243 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
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 1f0eb454754..764fbca832d 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -817,9 +817,12 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
bool const_init;
value = instantiate_non_dependent_expr (value);
if (DECL_DECLARED_CONSTEXPR_P (decl)
- || (DECL_IN_AGGR_P (decl) && !DECL_VAR_DECLARED_INLINE_P (decl)))
+ || (DECL_IN_AGGR_P (decl)
+ && DECL_INITIALIZED_IN_CLASS_P (decl)
+ && !DECL_VAR_DECLARED_INLINE_P (decl)))
{
- /* Diagnose a non-constant initializer for constexpr. */
+ /* Diagnose a non-constant initializer for constexpr variable or
+ non-inline in-class-initialized static data member. */
if (processing_template_decl
&& !require_potential_constant_expression (value))
value = error_mark_node;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9abf7783313..109be3bd7a5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5171,6 +5171,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/expr.c b/gcc/expr.c
index d87e24f0634..9fe4ec91c1c 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6893,8 +6893,9 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
if (GET_CODE (temp) == PARALLEL)
{
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
- machine_mode temp_mode
- = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
+ machine_mode temp_mode = GET_MODE (temp);
+ if (temp_mode == BLKmode || temp_mode == VOIDmode)
+ temp_mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
rtx temp_target = gen_reg_rtx (temp_mode);
emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
temp = temp_target;
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0781f4212b7..8e1b0623763 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))))
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 9554295e6d0..6541331e05e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,211 @@
+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
+ Backport from trunk
+ * resolve.c (flag_fn_result_spec): Use the 'sym' argument to
+ test for self refs to the function result in the character len
+ expression. If a self reference is found, emit an error and
+ return true.
+ (resolve_fntype): Use the function symbol in the calls to the
+ above.
+
+2018-05-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82275
+ Backport from trunk
+ * match.c (gfc_match_type_spec): Go through the array ref and
+ decrement 'rank' for every dimension that is an element.
+
+2018-05-19 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82923
+ PR fortran/66694
+ PR fortran/82617
+ Backport from trunk
+ * trans-array.c (gfc_alloc_allocatable_for_assignment): Set the
+ charlen backend_decl of the rhs expr to ss->info->string_length
+ so that the value in the current scope is used.
+
+2018-05-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83149
+ Backport from trunk
+ * trans-decl.c (gfc_finish_var_decl): Test sym->ns->proc_name
+ before accessing its components.
+ * trans-types.c (gfc_sym_type): If a character result has null
+ backend_decl, try the procedure symbol..
+
+2018-16-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83898
+ Backport from trunk
+ * trans-stmt.c (trans_associate_var): Do not set cst_array_ctor
+ for characters.
+
+2018-05-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/84546
+ Backport from trunk
+ * trans-array.c (structure_alloc_comps): Make sure that the
+ vptr is copied and that the unlimited polymorphic _len is used
+ to compute the size to be allocated.
+ (build_array_ref): Set the 'unlimited' argument false in the
+ call to gfc_get_class_array_ref.
+ * trans-expr.c (gfc_get_class_array_ref): If unlimited, use the
+ unlimited polymorphic _len for the offset to the element.
+ (gfc_copy_class_to_class): Set the new 'unlimited' argument.
+ * trans.h : Add the boolean 'unlimited' to the prototype.
+
+2018-05-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85542
+ Backport from trunk
+ * expr.c (check_inquiry): Avoid NULL pointer dereference.
+
+2018-05-12 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/68846
+ PR fortran/70864
+ Backport from trunk
+ * resolve.c (get_temp_from_expr): The temporary must not have
+ dummy or intent attributes.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/70870
+ Backport from trunk
+ * data.c (gfc_assign_data_value): Check that a data object does
+ not also have default initialization.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85521
+ Backport from trunk
+ * array.c (gfc_resolve_character_array_constructor): Substrings
+ with upper bound smaller than lower bound are zero length strings.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85687
+ Backport from trunk
+ * check.c (gfc_check_rank): Check that the argument is a data object.
+
+2018-05-06 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/85507
+ Backport from trunk.
+ * dependency.c (gfc_dep_resolver): Revert looking at coarray dimension
+ introduced by r259385.
+ * trans-intrinsic.c (conv_caf_send): Always report a dependency for
+ same variables in coarray assignments.
+
+2018-04-28 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/81773
+ PR fortran/83606
+ Backport from trunk.
+ * dependency.c (gfc_dep_resolver): Coarray indexes are to be ignored
+ during dependency computation. They define no data dependency.
+ * trans-array.c (conv_array_index_offset): The stride can not be set
+ here, prevent fail.
+ * trans-intrinsic.c (conv_caf_send): Add creation of temporary array
+ for caf_get's result and copying to the array with vectorial
+ indexing.
+
+2018-04-24 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85520
+ * decl.c (gfc_match_char_spec): Check for negative length and set to 0.
+
2018-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/85084
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index ec0c26656ff..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;
@@ -2021,7 +2032,8 @@ got_charlen:
else
return true;
- gcc_assert (current_length != -1);
+ if (current_length < 0)
+ current_length = 0;
if (found_length == -1)
found_length = current_length;
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 6e62d409e7b..f5e0ab5f5b8 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -3764,8 +3764,11 @@ gfc_check_rank (gfc_expr *a)
? a->value.function.esym->result->attr.pointer
: a->symtree->n.sym->result->attr.pointer;
- if (a->expr_type == EXPR_OP || a->expr_type == EXPR_NULL
- || a->expr_type == EXPR_COMPCALL|| a->expr_type == EXPR_PPC
+ if (a->expr_type == EXPR_OP
+ || a->expr_type == EXPR_NULL
+ || a->expr_type == EXPR_COMPCALL
+ || a->expr_type == EXPR_PPC
+ || a->ts.type == BT_PROCEDURE
|| !is_variable)
{
gfc_error ("The argument of the RANK intrinsic at %L must be a data "
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 184e53d480f..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. */
@@ -492,20 +507,13 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
}
else
{
- /* Overwriting an existing initializer is non-standard but usually only
- provokes a warning from other compilers. */
- if (init != NULL)
+ if (lvalue->ts.type == BT_DERIVED
+ && gfc_has_default_initializer (lvalue->ts.u.derived))
{
- /* 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;
+ gfc_error ("Nonpointer object %qs with default initialization "
+ "shall not appear in a DATA statement at %L",
+ symbol->name, &lvalue->where);
+ return false;
}
expr = gfc_copy_expr (rvalue);
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index ac5e462a524..e73f2d76f45 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2998,22 +2998,36 @@ 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)
- gfc_replace_expr (len, e);
+ {
+ gfc_replace_expr (len, e);
+ if (mpz_cmp_si (len->value.integer, 0) < 0)
+ mpz_set_ui (len->value.integer, 0);
+ }
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;
@@ -9031,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 f302ef70b86..0d553c0bea2 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2315,7 +2315,7 @@ check_inquiry (gfc_expr *e, int not_restricted)
/* Assumed character length will not reduce to a constant expression
with LEN, as required by the standard. */
- if (i == 5 && not_restricted
+ if (i == 5 && not_restricted && ap->expr->symtree
&& ap->expr->symtree->n.sym->ts.type == BT_CHARACTER
&& (ap->expr->symtree->n.sym->ts.u.cl->length == NULL
|| ap->expr->symtree->n.sym->ts.deferred))
@@ -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;
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/match.c b/gcc/fortran/match.c
index 682f7b021b0..89fb43dc048 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2063,7 +2063,7 @@ gfc_match_type_spec (gfc_typespec *ts)
or list item in a type-list of an OpenMP reduction clause. Need to
differentiate REAL([KIND]=scalar-int-initialization-expr) from
REAL(A,[KIND]) and REAL(KIND,A). Logically, when this code was
- written the use of LOGICAL as a type-spec or intrinsic subprogram
+ written the use of LOGICAL as a type-spec or intrinsic subprogram
was overlooked. */
m = gfc_match (" %n", name);
@@ -5714,6 +5714,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
{
gfc_ref *ref;
gfc_symbol *assoc_sym;
+ int rank = 0;
assoc_sym = associate->symtree->n.sym;
@@ -5750,14 +5751,28 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector)
selector->rank = ref->u.ar.dimen;
else
selector->rank = 0;
+
+ rank = selector->rank;
}
- if (selector->rank)
+ if (rank)
{
- assoc_sym->attr.dimension = 1;
- assoc_sym->as = gfc_get_array_spec ();
- assoc_sym->as->rank = selector->rank;
- assoc_sym->as->type = AS_DEFERRED;
+ for (int i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++)
+ if (ref->u.ar.dimen_type[i] == DIMEN_ELEMENT
+ || (ref->u.ar.dimen_type[i] == DIMEN_UNKNOWN
+ && ref->u.ar.end[i] == NULL
+ && ref->u.ar.stride[i] == NULL))
+ rank--;
+
+ if (rank)
+ {
+ assoc_sym->attr.dimension = 1;
+ assoc_sym->as = gfc_get_array_spec ();
+ assoc_sym->as->rank = rank;
+ assoc_sym->as->type = AS_DEFERRED;
+ }
+ else
+ assoc_sym->as = NULL;
}
else
assoc_sym->as = NULL;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 4baa0e036fc..d5e74823c71 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))
@@ -10276,6 +10289,8 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
tmp->n.sym->attr.function = 0;
tmp->n.sym->attr.result = 0;
tmp->n.sym->attr.flavor = FL_VARIABLE;
+ tmp->n.sym->attr.dummy = 0;
+ tmp->n.sym->attr.intent = INTENT_UNKNOWN;
if (as)
{
@@ -12266,7 +12281,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
@@ -15868,7 +15883,7 @@ resolve_equivalence (gfc_equiv *eq)
static bool
flag_fn_result_spec (gfc_expr *expr,
- gfc_symbol *sym ATTRIBUTE_UNUSED,
+ gfc_symbol *sym,
int *f ATTRIBUTE_UNUSED)
{
gfc_namespace *ns;
@@ -15881,6 +15896,13 @@ flag_fn_result_spec (gfc_expr *expr,
if (!ns->parent)
break;
+ if (sym == s)
+ {
+ gfc_error ("Self reference in character length expression "
+ "for %qs at %L", sym->name, &expr->where);
+ return true;
+ }
+
if (!s->fn_result_spec
&& s->attr.flavor == FL_PARAMETER)
{
@@ -15963,7 +15985,7 @@ resolve_fntype (gfc_namespace *ns)
}
if (sym->ts.type == BT_CHARACTER)
- gfc_traverse_expr (sym->ts.u.cl->length, NULL, flag_fn_result_spec, 0);
+ gfc_traverse_expr (sym->ts.u.cl->length, sym, flag_fn_result_spec, 0);
}
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 10790dce6b3..6be9c70a678 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3073,7 +3073,7 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
}
/* Multiply by the stride. */
- if (!integer_onep (stride))
+ if (stride != NULL && !integer_onep (stride))
index = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
index, stride);
@@ -3338,7 +3338,10 @@ build_array_ref (tree desc, tree offset, tree decl, tree vptr)
{
type = gfc_get_element_type (type);
tmp = TREE_OPERAND (cdecl, 0);
- tmp = gfc_get_class_array_ref (offset, tmp, NULL_TREE);
+ /* Note that the fourth argument in this call has been set false.
+ should any character dynamic types come this way, the 'len'
+ field of the unlimited object will not be used. */
+ tmp = gfc_get_class_array_ref (offset, tmp, NULL_TREE, false);
tmp = fold_convert (build_pointer_type (type), tmp);
tmp = build_fold_indirect_ref_loc (input_location, tmp);
return tmp;
@@ -8650,6 +8653,31 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_init_block (&tmpblock);
+ gfc_add_modify (&tmpblock, gfc_class_vptr_get (dcmp),
+ gfc_class_vptr_get (comp));
+
+ /* Copy the unlimited '_len' field. If it is greater than zero
+ (ie. a character(_len)), multiply it by size and use this
+ for the malloc call. */
+ if (UNLIMITED_POLY (c))
+ {
+ tree ctmp;
+ gfc_add_modify (&tmpblock, gfc_class_len_get (dcmp),
+ gfc_class_len_get (comp));
+
+ size = gfc_evaluate_now (size, &tmpblock);
+ tmp = gfc_class_len_get (comp);
+ ctmp = fold_build2_loc (input_location, MULT_EXPR,
+ size_type_node, size,
+ fold_convert (size_type_node, tmp));
+ tmp = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, tmp,
+ build_zero_cst (TREE_TYPE (tmp)));
+ size = fold_build3_loc (input_location, COND_EXPR,
+ size_type_node, tmp, ctmp, size);
+ size = gfc_evaluate_now (size, &tmpblock);
+ }
+
/* Coarray component have to have the same allocation status and
shape/type-parameter/effective-type on the LHS and RHS of an
intrinsic assignment. Hence, we did not deallocated them - and
@@ -9104,6 +9132,12 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
if (expr2 && rss == gfc_ss_terminator)
return NULL_TREE;
+ /* Ensure that the string length from the current scope is used. */
+ if (expr2->ts.type == BT_CHARACTER
+ && expr2->expr_type == EXPR_FUNCTION
+ && !expr2->value.function.isym)
+ expr2->ts.u.cl->backend_decl = rss->info->string_length;
+
gfc_start_block (&fblock);
/* Since the lhs is allocatable, this must be a descriptor type.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 796fd6da008..1e2be2f2d0e 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -603,10 +603,12 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
function scope. */
if (current_function_decl != NULL_TREE)
{
- if (sym->ns->proc_name->backend_decl == current_function_decl
- || sym->result == sym)
+ if (sym->ns->proc_name
+ && (sym->ns->proc_name->backend_decl == current_function_decl
+ || sym->result == sym))
gfc_add_decl_to_function (decl);
- else if (sym->ns->proc_name->attr.flavor == FL_LABEL)
+ else if (sym->ns->proc_name
+ && sym->ns->proc_name->attr.flavor == FL_LABEL)
/* This is a BLOCK construct. */
add_decl_as_local (decl);
else
@@ -698,7 +700,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
}
/* Keep variables larger than max-stack-var-size off stack. */
- if (!sym->ns->proc_name->attr.recursive && !sym->attr.automatic
+ if (!(sym->ns->proc_name && sym->ns->proc_name->attr.recursive)
+ && !sym->attr.automatic
&& INTEGER_CST_P (DECL_SIZE_UNIT (decl))
&& !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
/* Put variable length auto array pointers always into stack. */
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 49486c5328a..e1205e36b97 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1156,15 +1156,32 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
of the referenced element. */
tree
-gfc_get_class_array_ref (tree index, tree class_decl, tree data_comp)
+gfc_get_class_array_ref (tree index, tree class_decl, tree data_comp,
+ bool unlimited)
{
- tree data = data_comp != NULL_TREE ? data_comp :
- gfc_class_data_get (class_decl);
- tree size = gfc_class_vtab_size_get (class_decl);
- tree offset = fold_build2_loc (input_location, MULT_EXPR,
- gfc_array_index_type,
- index, size);
- tree ptr;
+ tree data, size, tmp, ctmp, offset, ptr;
+
+ data = data_comp != NULL_TREE ? data_comp :
+ gfc_class_data_get (class_decl);
+ size = gfc_class_vtab_size_get (class_decl);
+
+ if (unlimited)
+ {
+ tmp = fold_convert (gfc_array_index_type,
+ gfc_class_len_get (class_decl));
+ ctmp = fold_build2_loc (input_location, MULT_EXPR,
+ gfc_array_index_type, size, tmp);
+ tmp = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, tmp,
+ build_zero_cst (TREE_TYPE (tmp)));
+ size = fold_build3_loc (input_location, COND_EXPR,
+ gfc_array_index_type, tmp, ctmp, size);
+ }
+
+ offset = fold_build2_loc (input_location, MULT_EXPR,
+ gfc_array_index_type,
+ index, size);
+
data = gfc_conv_descriptor_data_get (data);
ptr = fold_convert (pvoid_type_node, data);
ptr = fold_build_pointer_plus_loc (input_location, ptr, offset);
@@ -1266,14 +1283,15 @@ gfc_copy_class_to_class (tree from, tree to, tree nelems, bool unlimited)
if (is_from_desc)
{
- from_ref = gfc_get_class_array_ref (index, from, from_data);
+ from_ref = gfc_get_class_array_ref (index, from, from_data,
+ unlimited);
vec_safe_push (args, from_ref);
}
else
vec_safe_push (args, from_data);
if (is_to_class)
- to_ref = gfc_get_class_array_ref (index, to, to_data);
+ to_ref = gfc_get_class_array_ref (index, to, to_data, unlimited);
else
{
tmp = gfc_conv_array_data (to);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 05a1a7aa346..18cae832c64 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1860,7 +1860,7 @@ conv_caf_send (gfc_code *code) {
lhs_expr = code->ext.actual->expr;
rhs_expr = code->ext.actual->next->expr;
- may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, false) == 0
+ may_require_tmp = gfc_check_dependency (lhs_expr, rhs_expr, true) == 0
? boolean_false_node : boolean_true_node;
gfc_init_block (&block);
@@ -1906,34 +1906,124 @@ conv_caf_send (gfc_code *code) {
}
else
{
- /* If has_vector, pass descriptor for whole array and the
- vector bounds separately. */
- gfc_array_ref *ar, ar2;
- bool has_vector = false;
+ bool has_vector = gfc_has_vector_subscript (lhs_expr);
- if (gfc_is_coindexed (lhs_expr) && gfc_has_vector_subscript (lhs_expr))
+ if (gfc_is_coindexed (lhs_expr) || !has_vector)
{
- has_vector = true;
- ar = gfc_find_array_ref (lhs_expr);
- ar2 = *ar;
- memset (ar, '\0', sizeof (*ar));
- ar->as = ar2.as;
- ar->type = AR_FULL;
+ /* If has_vector, pass descriptor for whole array and the
+ vector bounds separately. */
+ gfc_array_ref *ar, ar2;
+ bool has_tmp_lhs_array = false;
+ if (has_vector)
+ {
+ has_tmp_lhs_array = true;
+ ar = gfc_find_array_ref (lhs_expr);
+ ar2 = *ar;
+ memset (ar, '\0', sizeof (*ar));
+ ar->as = ar2.as;
+ ar->type = AR_FULL;
+ }
+ lhs_se.want_pointer = 1;
+ gfc_conv_expr_descriptor (&lhs_se, lhs_expr);
+ /* Using gfc_conv_expr_descriptor, we only get the descriptor, but
+ that has the wrong type if component references are done. */
+ lhs_type = gfc_typenode_for_spec (&lhs_expr->ts);
+ tmp = build_fold_indirect_ref_loc (input_location, lhs_se.expr);
+ gfc_add_modify (&lhs_se.pre, gfc_conv_descriptor_dtype (tmp),
+ gfc_get_dtype_rank_type (has_vector ? ar2.dimen
+ : lhs_expr->rank,
+ lhs_type));
+ if (has_tmp_lhs_array)
+ {
+ vec = conv_caf_vector_subscript (&block, lhs_se.expr, &ar2);
+ *ar = ar2;
+ }
}
- lhs_se.want_pointer = 1;
- gfc_conv_expr_descriptor (&lhs_se, lhs_expr);
- /* Using gfc_conv_expr_descriptor, we only get the descriptor, but that
- has the wrong type if component references are done. */
- lhs_type = gfc_typenode_for_spec (&lhs_expr->ts);
- tmp = build_fold_indirect_ref_loc (input_location, lhs_se.expr);
- gfc_add_modify (&lhs_se.pre, gfc_conv_descriptor_dtype (tmp),
- gfc_get_dtype_rank_type (has_vector ? ar2.dimen
- : lhs_expr->rank,
- lhs_type));
- if (has_vector)
+ else
{
- vec = conv_caf_vector_subscript (&block, lhs_se.expr, &ar2);
- *ar = ar2;
+ /* Special casing for arr1 ([...]) = arr2[...], i.e. caf_get to
+ indexed array expression. This is rewritten to:
+
+ tmp_array = arr2[...]
+ arr1 ([...]) = tmp_array
+
+ because using the standard gfc_conv_expr (lhs_expr) did the
+ assignment with lhs and rhs exchanged. */
+
+ gfc_ss *lss_for_tmparray, *lss_real;
+ gfc_loopinfo loop;
+ gfc_se se;
+ stmtblock_t body;
+ tree tmparr_desc, src;
+ tree index = gfc_index_zero_node;
+ tree stride = gfc_index_zero_node;
+ int n;
+
+ /* Walk both sides of the assignment, once to get the shape of the
+ temporary array to create right. */
+ lss_for_tmparray = gfc_walk_expr (lhs_expr);
+ /* And a second time to be able to create an assignment of the
+ temporary to the lhs_expr. gfc_trans_create_temp_array replaces
+ the tree in the descriptor with the one for the temporary
+ array. */
+ lss_real = gfc_walk_expr (lhs_expr);
+ gfc_init_loopinfo (&loop);
+ gfc_add_ss_to_loop (&loop, lss_for_tmparray);
+ gfc_add_ss_to_loop (&loop, lss_real);
+ gfc_conv_ss_startstride (&loop);
+ gfc_conv_loop_setup (&loop, &lhs_expr->where);
+ lhs_type = gfc_typenode_for_spec (&lhs_expr->ts);
+ gfc_trans_create_temp_array (&lhs_se.pre, &lhs_se.post,
+ lss_for_tmparray, lhs_type, NULL_TREE,
+ false, true, false,
+ &lhs_expr->where);
+ tmparr_desc = lss_for_tmparray->info->data.array.descriptor;
+ gfc_start_scalarized_body (&loop, &body);
+ gfc_init_se (&se, NULL);
+ gfc_copy_loopinfo_to_se (&se, &loop);
+ se.ss = lss_real;
+ gfc_conv_expr (&se, lhs_expr);
+ gfc_add_block_to_block (&body, &se.pre);
+
+ /* Walk over all indexes of the loop. */
+ for (n = loop.dimen - 1; n > 0; --n)
+ {
+ tmp = loop.loopvar[n];
+ tmp = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type, tmp, loop.from[n]);
+ tmp = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type, tmp, index);
+
+ stride = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type,
+ loop.to[n - 1], loop.from[n - 1]);
+ stride = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type,
+ stride, gfc_index_one_node);
+
+ index = fold_build2_loc (input_location, MULT_EXPR,
+ gfc_array_index_type, tmp, stride);
+ }
+
+ index = fold_build2_loc (input_location, MINUS_EXPR,
+ gfc_array_index_type,
+ index, loop.from[0]);
+
+ index = fold_build2_loc (input_location, PLUS_EXPR,
+ gfc_array_index_type,
+ loop.loopvar[0], index);
+
+ src = build_fold_indirect_ref (gfc_conv_array_data (tmparr_desc));
+ src = gfc_build_array_ref (src, index, NULL);
+ /* Now create the assignment of lhs_expr = tmp_array. */
+ gfc_add_modify (&body, se.expr, src);
+ gfc_add_block_to_block (&body, &se.post);
+ lhs_se.expr = gfc_build_addr_expr (NULL_TREE, tmparr_desc);
+ gfc_trans_scalarizing_loops (&loop, &body);
+ gfc_add_block_to_block (&loop.pre, &loop.post);
+ gfc_add_expr_to_block (&lhs_se.post, gfc_finish_block (&loop.pre));
+ gfc_free_ss (lss_for_tmparray);
+ gfc_free_ss (lss_real);
}
}
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 79ec6c2e13b..ac90c97e544 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1566,7 +1566,8 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
desc = sym->backend_decl;
cst_array_ctor = e->expr_type == EXPR_ARRAY
- && gfc_constant_array_constructor_p (e->value.constructor);
+ && gfc_constant_array_constructor_p (e->value.constructor)
+ && e->ts.type != BT_CHARACTER;
/* If association is to an expression, evaluate it and create temporary.
Otherwise, get descriptor of target for pointer assignment. */
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 724c0fa979f..9a96ae7b69d 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2168,6 +2168,14 @@ gfc_sym_type (gfc_symbol * sym)
if (sym->backend_decl && !sym->attr.function)
return TREE_TYPE (sym->backend_decl);
+ if (sym->attr.result
+ && sym->ts.type == BT_CHARACTER
+ && sym->ts.u.cl->backend_decl == NULL_TREE
+ && sym->ns->proc_name
+ && sym->ns->proc_name->ts.u.cl
+ && sym->ns->proc_name->ts.u.cl->backend_decl != NULL_TREE)
+ sym->ts.u.cl->backend_decl = sym->ns->proc_name->ts.u.cl->backend_decl;
+
if (sym->ts.type == BT_CHARACTER
&& ((sym->attr.function && sym->attr.is_bind_c)
|| (sym->attr.result
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index d02f3470eeb..4fcc389a53b 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -431,7 +431,7 @@ tree gfc_vptr_deallocate_get (tree);
void gfc_reset_vptr (stmtblock_t *, gfc_expr *);
void gfc_reset_len (stmtblock_t *, gfc_expr *);
tree gfc_get_vptr_from_expr (tree);
-tree gfc_get_class_array_ref (tree, tree, tree);
+tree gfc_get_class_array_ref (tree, tree, tree, bool);
tree gfc_copy_class_to_class (tree, tree, tree, bool);
bool gfc_add_finalizer_call (stmtblock_t *, gfc_expr *);
bool gfc_add_comp_finalizer_call (stmtblock_t *, tree, gfc_component *, bool);
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 5264a4f3d40..2a7951f16b3 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1125,10 +1125,6 @@ static void
asan_poison_variable (tree decl, bool poison, gimple_stmt_iterator *it,
bool before)
{
- /* When within an OMP context, do not emit ASAN_MARK internal fns. */
- if (gimplify_omp_ctxp)
- return;
-
tree unit_size = DECL_SIZE_UNIT (decl);
tree base = build_fold_addr_expr (decl);
@@ -1640,7 +1636,8 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
&& TREE_ADDRESSABLE (decl)
&& !TREE_STATIC (decl)
&& !DECL_HAS_VALUE_EXPR_P (decl)
- && dbg_cnt (asan_use_after_scope))
+ && dbg_cnt (asan_use_after_scope)
+ && !gimplify_omp_ctxp)
{
asan_poisoned_variables->add (decl);
asan_poison_variable (decl, false, seq_p);
@@ -4684,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.
@@ -4693,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)
@@ -5776,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;
@@ -6458,7 +6458,8 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber);
gimple_push_cleanup (temp, clobber, false, pre_p, true);
}
- if (asan_poisoned_variables && dbg_cnt (asan_use_after_scope))
+ if (asan_poisoned_variables && dbg_cnt (asan_use_after_scope)
+ && !gimplify_omp_ctxp)
{
tree asan_cleanup = build_asan_poison_call_expr (temp);
if (asan_cleanup)
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f5dcfc0341b..3902d3a8a00 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -4027,7 +4027,9 @@ intersect_with_plats (struct ipcp_param_lattices *plats,
if (aglat->offset - offset == item->offset)
{
gcc_checking_assert (item->value);
- if (values_equal_for_ipcp_p (item->value, aglat->values->value))
+ if (aglat->is_single_const ()
+ && values_equal_for_ipcp_p (item->value,
+ aglat->values->value))
found = true;
break;
}
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 0d214170c24..c1b7aa3bea6 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1577,8 +1577,15 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
"in another translation unit"));
return false;
}
- gcc_assert (DECL_NONADDRESSABLE_P (f1)
- == DECL_NONADDRESSABLE_P (f2));
+ if (DECL_BIT_FIELD (f1) != DECL_BIT_FIELD (f2))
+ {
+ warn_odr (t1, t2, f1, f2, warn, warned,
+ G_("one field is bitfield while other is not"));
+ return false;
+ }
+ else
+ gcc_assert (DECL_NONADDRESSABLE_P (f1)
+ == DECL_NONADDRESSABLE_P (f2));
}
/* If one aggregate has more fields than the other, they
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 95fad30e83a..c8ca9566cb7 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -2132,23 +2132,6 @@ sem_variable::get_hash (void)
return m_hash;
}
-/* Set all points-to UIDs of aliases pointing to node N as UID. */
-
-static void
-set_alias_uids (symtab_node *n, int uid)
-{
- ipa_ref *ref;
- FOR_EACH_ALIAS (n, ref)
- {
- if (dump_file)
- fprintf (dump_file, " Setting points-to UID of [%s] as %d\n",
- xstrdup_for_dump (ref->referring->asm_name ()), uid);
-
- SET_DECL_PT_UID (ref->referring->decl, uid);
- set_alias_uids (ref->referring, uid);
- }
-}
-
/* Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can
be applied. */
@@ -2275,7 +2258,6 @@ sem_variable::merge (sem_item *alias_item)
if (dump_file)
fprintf (dump_file, "Unified; Variable alias has been created.\n");
- set_alias_uids (original, DECL_UID (original->decl));
return true;
}
}
@@ -2295,7 +2277,7 @@ unsigned int sem_item_optimizer::class_id = 0;
sem_item_optimizer::sem_item_optimizer ()
: worklist (0), m_classes (0), m_classes_count (0), m_cgraph_node_hooks (NULL),
- m_varpool_node_hooks (NULL)
+ m_varpool_node_hooks (NULL), m_merged_variables ()
{
m_items.create (0);
bitmap_obstack_initialize (&m_bmstack);
@@ -2320,6 +2302,7 @@ sem_item_optimizer::~sem_item_optimizer ()
m_items.release ();
bitmap_obstack_release (&m_bmstack);
+ m_merged_variables.release ();
}
/* Write IPA ICF summary for symbols. */
@@ -3571,13 +3554,103 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count)
}
if (dbg_cnt (merged_ipa_icf))
- merged_p |= source->merge (alias);
+ {
+ bool merged = source->merge (alias);
+ merged_p |= merged;
+
+ if (merged && alias->type == VAR)
+ {
+ symtab_pair p = symtab_pair (source->node, alias->node);
+ m_merged_variables.safe_push (p);
+ }
+ }
}
}
+ if (!m_merged_variables.is_empty ())
+ fixup_points_to_sets ();
+
return merged_p;
}
+/* Fixup points to set PT. */
+
+void
+sem_item_optimizer::fixup_pt_set (struct pt_solution *pt)
+{
+ if (pt->vars == NULL)
+ return;
+
+ unsigned i;
+ symtab_pair *item;
+ FOR_EACH_VEC_ELT (m_merged_variables, i, item)
+ if (bitmap_bit_p (pt->vars, DECL_UID (item->second->decl)))
+ bitmap_set_bit (pt->vars, DECL_UID (item->first->decl));
+}
+
+/* Set all points-to UIDs of aliases pointing to node N as UID. */
+
+static void
+set_alias_uids (symtab_node *n, int uid)
+{
+ ipa_ref *ref;
+ FOR_EACH_ALIAS (n, ref)
+ {
+ if (dump_file)
+ fprintf (dump_file, " Setting points-to UID of [%s] as %d\n",
+ xstrdup_for_dump (ref->referring->asm_name ()), uid);
+
+ SET_DECL_PT_UID (ref->referring->decl, uid);
+ set_alias_uids (ref->referring, uid);
+ }
+}
+
+/* Fixup points to analysis info. */
+
+void
+sem_item_optimizer::fixup_points_to_sets (void)
+{
+ /* TODO: remove in GCC 9 and trigger PTA re-creation after IPA passes. */
+ cgraph_node *cnode;
+
+ FOR_EACH_DEFINED_FUNCTION (cnode)
+ {
+ tree name;
+ unsigned i;
+ function *fn = DECL_STRUCT_FUNCTION (cnode->decl);
+ if (!gimple_in_ssa_p (fn))
+ continue;
+
+ FOR_EACH_SSA_NAME (i, name, fn)
+ if (POINTER_TYPE_P (TREE_TYPE (name))
+ && SSA_NAME_PTR_INFO (name))
+ fixup_pt_set (&SSA_NAME_PTR_INFO (name)->pt);
+ fixup_pt_set (&fn->gimple_df->escaped);
+
+ /* The above get's us to 99% I guess, at least catching the
+ address compares. Below also gets us aliasing correct
+ but as said we're giving leeway to the situation with
+ readonly vars anyway, so ... */
+ basic_block bb;
+ FOR_EACH_BB_FN (bb, fn)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ gcall *call = dyn_cast<gcall *> (gsi_stmt (gsi));
+ if (call)
+ {
+ fixup_pt_set (gimple_call_use_set (call));
+ fixup_pt_set (gimple_call_clobber_set (call));
+ }
+ }
+ }
+
+ unsigned i;
+ symtab_pair *item;
+ FOR_EACH_VEC_ELT (m_merged_variables, i, item)
+ set_alias_uids (item->first, DECL_UID (item->first->decl));
+}
+
/* Dump function prints all class members to a FILE with an INDENT. */
void
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index c57224c1517..2101747bfd6 100644
--- a/gcc/ipa-icf.h
+++ b/gcc/ipa-icf.h
@@ -141,6 +141,8 @@ public:
unsigned int index;
};
+typedef std::pair<symtab_node *, symtab_node *> symtab_pair;
+
/* Semantic item is a base class that encapsulates all shared functionality
for both semantic function and variable items. */
class sem_item
@@ -563,6 +565,12 @@ private:
processed. */
bool merge_classes (unsigned int prev_class_count);
+ /* Fixup points to analysis info. */
+ void fixup_points_to_sets (void);
+
+ /* Fixup points to set PT. */
+ void fixup_pt_set (struct pt_solution *pt);
+
/* Adds a newly created congruence class CLS to worklist. */
void worklist_push (congruence_class *cls);
@@ -632,6 +640,10 @@ private:
/* Bitmap stack. */
bitmap_obstack m_bmstack;
+
+ /* Vector of merged variables. Needed for fixup of points-to-analysis
+ info. */
+ vec <symtab_pair> m_merged_variables;
}; // class sem_item_optimizer
} // ipa_icf namespace
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 1ebbb907ec1..17431acfe90 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,29 @@
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-19 Martin Liska <mliska@suse.cz>
+
+ * lto-symtab.c (lto_symtab_resolve_symbols): Do not bail out
+ for multiple PREVAILING_DEF_IRONLY for common symbols.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-10 Martin Liska <mliska@suse.cz>
+
+ PR lto/85248
+ * lto-symtab.c (lto_symtab_merge_p): Do not check for
+ TREE_VALUES of error attributes.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-10 Richard Biener <rguenther@suse.de>
+ Martin Liska <mliska@suse.cz>
+
+ PR lto/85248
+ * lto-symtab.c (lto_symtab_merge_p): Handle noreturn attribute.
+
2018-03-06 Martin Liska <mliska@suse.cz>
Backport from mainline
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 10c3fbe49f3..01cc0b7602e 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -465,9 +465,14 @@ lto_symtab_resolve_symbols (symtab_node *first)
/* If the chain is already resolved there is nothing else to do. */
if (prevailing)
{
- /* Assert it's the only one. */
+ /* Assert it's the only one.
+ GCC should silence multiple PREVAILING_DEF_IRONLY defs error
+ on COMMON symbols since it isn't error.
+ See: https://sourceware.org/bugzilla/show_bug.cgi?id=23079. */
for (e = prevailing->next_sharing_asm_name; e; e = e->next_sharing_asm_name)
if (lto_symtab_symbol_p (e)
+ && !DECL_COMMON (prevailing->decl)
+ && !DECL_COMMON (e->decl)
&& (e->resolution == LDPR_PREVAILING_DEF_IRONLY
|| e->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP
|| e->resolution == LDPR_PREVAILING_DEF))
@@ -571,6 +576,9 @@ lto_symtab_merge_p (tree prevailing, tree decl)
return false;
}
}
+
+ /* FIXME: after MPX is removed, use flags_from_decl_or_type
+ function instead. PR lto/85248. */
if (DECL_ATTRIBUTES (prevailing) != DECL_ATTRIBUTES (decl))
{
tree prev_attr = lookup_attribute ("error", DECL_ATTRIBUTES (prevailing));
@@ -598,6 +606,16 @@ lto_symtab_merge_p (tree prevailing, tree decl)
"warning attribute mismatch\n");
return false;
}
+
+ prev_attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (prevailing));
+ attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (decl));
+ if ((prev_attr == NULL) != (attr == NULL))
+ {
+ if (symtab->dump_file)
+ fprintf (symtab->dump_file, "Not merging decls; "
+ "noreturn attribute mismatch\n");
+ return false;
+ }
}
return true;
}
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index a1e668d99d2..549a5db000a 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -5628,6 +5628,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd)
split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE;
+ /* Add a dummy exit for the tiled block when cont_bb is missing. */
+ if (cont_bb == NULL)
+ {
+ edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE);
+ e->probability = PROB_EVEN;
+ split->probability = PROB_EVEN;
+ }
+
/* Initialize the user's loop vars. */
gsi = gsi_start_bb (elem_body_bb);
expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 248c5d57fdc..c0cc3694262 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,383 @@
+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:
+ 2018-05-17 Pat Haugen <pthaugen@us.ibm.com>
+
+ PR target/85698
+ * gcc.target/powerpc/pr85698.c: New test.
+
+2018-05-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/80657
+ Backport from trunk
+ * gfortran.dg/char_result_18.f90: New test.
+
+2018-05-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82275
+ Backport from trunk
+ * gfortran.dg/select_type_42.f90: New test.
+
+2018-05-19 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82923
+ Backport from trunk
+ * gfortran.dg/allocate_assumed_charlen_4.f90: New test. Note
+ that the patch fixes PR66694 & PR82617, although the testcases
+ are not explicitly included.
+
+2017-05-17 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/82814
+ Backport from trunk
+ * gfortran.dg/submodule_31.f08: New test.
+
+2018-05-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83149
+ Backport from trunk
+ * gfortran.dg/pr83149_1.f90: New test.
+ * gfortran.dg/pr83149.f90: Additional source for previous.
+ * gfortran.dg/pr83149_b.f90: New test.
+ * gfortran.dg/pr83149_a.f90: Additional source for previous.
+
+2018-16-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/83898
+ Backport from trunk
+ * gfortran.dg/associate_33.f03 : New test.
+
+2018-05-16 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/84546
+ Backport from trunk
+ * gfortran.dg/unlimited_polymorphic_29.f90 : New test.
+
+2018-05-12 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85542
+ Backport from trunk
+ * gfortran.dg/pr85542.f90: New test.
+
+2018-05-12 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/68846
+ Backport from trunk
+ * gfortran.dg/temporary_3.f90 : New test.
+
+ PR fortran/70864
+ Backport from trunk
+ * gfortran.dg/temporary_2.f90 : New test.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/70870
+ Backport from trunk
+ * gfortran.dg/pr70870_1.f90: New test.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85521
+ Backport from trunk
+ * gfortran.dg/pr85521_1.f90: New test.
+ * gfortran.dg/pr85521_2.f90: New test.
+
+2018-05-11 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85687
+ Backport from trunk
+ * gfortran.dg/pr85687.f90: new test.
+
+2018-05-06 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/85507
+ Backport from trunk.
+ * gfortran.dg/coarray_dependency_1.f90: New test.
+ * gfortran.dg/coarray_lib_comm_1.f90: Fix counting caf-expressions.
+
+2018-05-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from trunk
+ 2018-04-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82518
+ * lib/target-supports.exp (check_effective_target_vect_load_lanes):
+ Use check_effective_target_arm_little_endian.
+
+2018-04-28 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/81773
+ PR fortran/83606
+ Backport from trunk.
+ * gfortran.dg/coarray/get_to_indexed_array_1.f90: New test.
+ * gfortran.dg/coarray/get_to_indirect_array.f90: New test.
+
+2018-04-26 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-04-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85284
+ * gcc.dg/torture/pr85284.c: New testcase.
+
+ 2018-04-06 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/85244
+ * gcc.dg/torture/pr85244-1.c: New testcase.
+ * gcc.dg/torture/pr85244-2.c: Likewise.
+
+ 2018-04-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/85168
+ * gcc.dg/torture/pr85168.c: New testcase.
+
+ 2018-03-15 Richard Biener <rguenther@suse.de>
+
+ PR c/84873
+ * c-c++-common/pr84873.c: New testcase.
+
+2018-04-24 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85520
+ * gfortran.dg/pr85520.f90: New test.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR lto/85248
+ * gcc.dg/lto/pr85248_0.c: New test.
+ * gcc.dg/lto/pr85248_1.c: New test.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-28 Jakub Jelinek <jakub@redhat.com>
+ Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/85081
+ * g++.dg/asan/pr85081.C: New test.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-21 Martin Liska <mliska@suse.cz>
+
+ PR ipa/84963
+ * gfortran.dg/goacc/pr84963.f90: New test.
+
+2018-04-24 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-03-13 Martin Liska <mliska@suse.cz>
+
+ PR ipa/84658.
+ * g++.dg/ipa/pr84658.C: New test.
+
+2018-04-23 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ Backport from mainline
+ 2018-04-16 Aaron Sawdey <acsawdey@linux.ibm.com>
+
+ PR target/83660
+ * gcc.target/powerpc/pr83660.C: New test.
+
+2018-04-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/torture/pr85496.C: New test.
+
+2018-04-20 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/85436
+ * go.dg/pr85436.go: New test.
+
+ Backport from mainline
+ 2018-03-09 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/83969
+ * gcc.target/powerpc/pr83969.c: New test.
+
+2018-04-19 Jonathan Wakely <jwakely@redhat.com>
+
+ PR c++/85464 - missing location for -Wignored-qualifiers diagnostic
+ * g++.dg/diagnostic/pr85464.C: New.
+
2018-04-18 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
diff --git a/gcc/testsuite/c-c++-common/pr84873.c b/gcc/testsuite/c-c++-common/pr84873.c
new file mode 100644
index 00000000000..5eb8a8df81d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr84873.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-frounding-math" } */
+
+int
+i1 (int w3, int n9)
+{
+ return w3 >> ((long int)(1 + 0.1) + -!n9);
+}
diff --git a/gcc/testsuite/g++.dg/asan/pr85081.C b/gcc/testsuite/g++.dg/asan/pr85081.C
new file mode 100644
index 00000000000..d7dec311450
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr85081.C
@@ -0,0 +1,20 @@
+/* PR sanitizer/85081 */
+/* { dg-do run } */
+/* { dg-options "-fopenmp-simd" } */
+/* { dg-require-effective-target fopenmp } */
+
+inline const int& max(const int& a, const int& b)
+{
+ return a < b ? b : a;
+}
+
+int main()
+{
+ #pragma omp simd
+ for ( int i = 0; i < 20; ++i )
+ {
+ const int j = max(i, 1);
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/extern_template-4.C b/gcc/testsuite/g++.dg/cpp0x/extern_template-4.C
new file mode 100644
index 00000000000..9f0c7d720ab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/extern_template-4.C
@@ -0,0 +1,23 @@
+// PR c++/85470
+// { dg-do compile { target c++11 } }
+
+template <class T>
+struct StaticObject
+{
+ static T& create()
+ {
+ static T t;
+ return t;
+ }
+
+ static T & instance;
+};
+
+template <class T> T & StaticObject<T>::instance = StaticObject<T>::create();
+
+extern template class StaticObject<int>;
+
+void test()
+{
+ StaticObject<int>::instance;
+}
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/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/cpp1z/decomp10.C b/gcc/testsuite/g++.dg/cpp1z/decomp10.C
index f27cbfbc0d9..95d8bf6364e 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp10.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp10.C
@@ -20,7 +20,7 @@ void f3() { auto [ x ] = a3; } // { dg-error "get" }
struct A3a { int i,j; int get(); } a3a;
template<> struct std::tuple_size<A3a> { enum { value = 1 }; };
-void f3a() { auto [ x ] = a3a; } // { dg-error "get<0>" }
+void f3a() { auto [ x ] = a3a; } // { dg-error "get" }
struct A3b { int i,j; } a3b;
int get(A3b&&);
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp37.C b/gcc/testsuite/g++.dg/cpp1z/decomp37.C
new file mode 100644
index 00000000000..dc47908cddf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp37.C
@@ -0,0 +1,62 @@
+// { dg-additional-options -std=c++17 }
+// { dg-do compile }
+
+#include <memory>
+#include <tuple>
+#include <string>
+
+struct X : private std::shared_ptr<int>
+{
+ std::string fun_payload;
+};
+
+template<int N> std::string& get(X& x)
+{
+ if constexpr(N==0) return x.fun_payload;
+}
+
+namespace std {
+ template<> class tuple_size<X> : public std::integral_constant<int, 1> {};
+ template<> class tuple_element<0, X> {public: using type = std::string;};
+}
+
+struct X2 : private std::shared_ptr<int>
+{
+ int fun_payload;
+ template <class T> void get();
+};
+
+template<int N> int& get(X2& x)
+{
+ if constexpr(N==0) return x.fun_payload;
+}
+
+namespace std {
+ template<> class tuple_size<X2> : public std::integral_constant<int, 1> {};
+ template<> class tuple_element<0, X2> {public: using type = int;};
+}
+
+class X3
+{
+ double fun_payload;
+public:
+ template <int N> double& get()
+ {
+ if constexpr(N==0) return fun_payload;
+ }
+};
+
+namespace std {
+ template<> class tuple_size<X3> : public std::integral_constant<int, 1> {};
+ template<> class tuple_element<0, X3> {public: using type = double;};
+}
+
+int main()
+{
+ X x;
+ auto& [b1] = x;
+ X2 x2;
+ auto& [b2] = x2;
+ X3 x3;
+ auto& [b3] = x3;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp38.C b/gcc/testsuite/g++.dg/cpp1z/decomp38.C
new file mode 100644
index 00000000000..fc69c02e4d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp38.C
@@ -0,0 +1,48 @@
+// { dg-additional-options -std=c++17 }
+// { dg-do compile }
+
+class X
+{
+ int a, b;
+ void f()
+ {
+ auto[x,y] = *this;
+ }
+};
+
+class X2
+{
+ int a, b;
+ void f(X2& other)
+ {
+ auto[x,y] = other;
+ }
+};
+
+struct X3
+{
+ friend void foo();
+private:
+ int a;
+};
+
+void foo()
+{
+ X3 x;
+ auto [a] = x;
+}
+
+struct X4
+{
+ int a;
+};
+
+struct X5 : private X4
+{
+ friend void foo2();
+};
+
+void foo2() {
+ X5 x;
+ auto [a] = x;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp4.C b/gcc/testsuite/g++.dg/cpp1z/decomp4.C
index bc85263e986..30068592553 100644
--- a/gcc/testsuite/g++.dg/cpp1z/decomp4.C
+++ b/gcc/testsuite/g++.dg/cpp1z/decomp4.C
@@ -18,10 +18,10 @@ test (A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h, I &i)
// { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ k ] { b }; // { dg-error "cannot decompose class type 'B' because it has an anonymous union member" }
// { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
- auto [ l, l2 ] = c; // { dg-error "cannot decompose non-public member 'C::b' of 'C'" }
+ auto [ l, l2 ] = c; // { dg-error "cannot decompose inaccessible member 'C::b' of 'C'" }
// { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ m ] = d; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
- auto [ n ] { e }; // { dg-error "cannot decompose non-public member 'E::a' of 'E'" }
+ auto [ n ] { e }; // { dg-error "cannot decompose inaccessible member 'E::a' of 'E'" }
// { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 }
auto [ o ] { f }; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } }
auto & [ p ] { g }; // { dg-error "cannot decompose class type 'G': both it and its base class 'F' have non-static data members" }
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr85464.C b/gcc/testsuite/g++.dg/diagnostic/pr85464.C
new file mode 100644
index 00000000000..ee8b65185e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/pr85464.C
@@ -0,0 +1,5 @@
+// { dg-options "-Wignored-qualifiers" }
+struct Test {
+ operator int const(); // { dg-warning "type qualifiers ignored" }
+ operator int const() const; // { dg-warning "type qualifiers ignored" }
+};
diff --git a/gcc/testsuite/g++.dg/ext/visibility/lambda1.C b/gcc/testsuite/g++.dg/ext/visibility/lambda1.C
new file mode 100644
index 00000000000..359f8e4af5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/lambda1.C
@@ -0,0 +1,14 @@
+// PR c++/85646
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -fvisibility=hidden }
+
+template<typename T>
+void foo() {
+ struct inner {
+ inner() {
+ (void)([this] { });
+ }
+ };
+}
+
+int main() { foo<int>(); }
diff --git a/gcc/testsuite/g++.dg/ipa/pr84658.C b/gcc/testsuite/g++.dg/ipa/pr84658.C
new file mode 100644
index 00000000000..6846e1832bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr84658.C
@@ -0,0 +1,30 @@
+/* PR ipa/84658 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fmerge-all-constants -std=c++11" } */
+
+const int kTestCasesFoo[] = { 0, 1, 2, 3, 4, 5, 8, 15, 16, 17, 512, 1020, 1021, 1022, 1023, 1024 };
+const int kTestCasesBar[] = { 0, 1, 2, 3, 4, 5, 8, 15, 16, 17, 512, 1020, 1021, 1022, 1023, 1024 };
+
+void Foo() {
+ __builtin_printf("foo:");
+ for (int count : kTestCasesFoo) {
+ __builtin_printf("%d,", count);
+ }
+ __builtin_printf(";\n");
+}
+
+void Bar() {
+ __builtin_printf("bar:");
+ for (int count : kTestCasesBar) {
+ __builtin_printf("%d,", count);
+ }
+ __builtin_printf(";\n");
+}
+
+int main() {
+ Foo();
+ Bar();
+}
+
+/* { dg-output "foo:0,1,2,3,4,5,8,15,16,17,512,1020,1021,1022,1023,1024,;(\n|\n\r|\r)*" } */
+/* { dg-output "bar:0,1,2,3,4,5,8,15,16,17,512,1020,1021,1022,1023,1024,;(\n|\n\r|\r)*" } */
diff --git a/gcc/testsuite/g++.dg/torture/pr85496.C b/gcc/testsuite/g++.dg/torture/pr85496.C
new file mode 100644
index 00000000000..3f504a37791
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr85496.C
@@ -0,0 +1,18 @@
+// PR middle-end/85496
+// Reported by Marek Polacek <mpolacek@gcc.gnu.org>
+
+template <typename> class complex;
+template <typename _Tp> complex<_Tp> operator*(complex<_Tp>, complex<_Tp>);
+template <> struct complex<float> { _Complex float _M_value; };
+class A {
+ complex<float> _f0, _f1;
+
+public:
+ complex<float> &m_fn1() { return _f1; }
+};
+complex<float> a;
+void cos() {
+ A b;
+ complex<float> c;
+ b.m_fn1() = c * a;
+}
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/lto/pr85248_0.c b/gcc/testsuite/gcc.dg/lto/pr85248_0.c
new file mode 100644
index 00000000000..df61ac976a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr85248_0.c
@@ -0,0 +1,45 @@
+/* PR lto/85248 */
+/* { dg-lto-do run } */
+/* { dg-lto-options { { -flto -O2 } } } */
+
+extern void test_alias (int s, int e) __asm__ (__USER_LABEL_PREFIX__ "test");
+extern void test_noreturn (int s, int e) __asm__ (__USER_LABEL_PREFIX__ "test")
+ __attribute__ ((__noreturn__));
+
+extern inline __attribute__ ((__always_inline__, __gnu_inline__)) void
+test (int s, int e)
+{
+ if (__builtin_constant_p (s) && s != 0)
+ test_noreturn (s, e);
+ else
+ test_alias (s, e);
+}
+
+int
+foo (void)
+{
+ static volatile int a;
+ return a;
+}
+
+static void
+bar (void)
+{
+ test (0, 1);
+ __builtin_exit (0);
+}
+
+static void
+baz ()
+{
+ test (1, 0);
+}
+
+int
+main ()
+{
+ if (foo ())
+ baz ();
+ bar ();
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr85248_1.c b/gcc/testsuite/gcc.dg/lto/pr85248_1.c
new file mode 100644
index 00000000000..5ce257181fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr85248_1.c
@@ -0,0 +1,9 @@
+/* { dg-options "-fno-lto" } */
+
+void
+test (int s, int e)
+{
+ asm volatile ("" : "+g" (s), "+g" (e) : : "memory");
+ if (s)
+ __builtin_abort ();
+}
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/pr85168.c b/gcc/testsuite/gcc.dg/torture/pr85168.c
new file mode 100644
index 00000000000..cc5e6648c7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85168.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target indirect_jumps } */
+
+typedef struct {
+ struct {
+ char a;
+ } b;
+} c;
+
+int d, f;
+c *e;
+
+extern void i(void);
+extern void sejtmp () __attribute__((returns_twice));
+
+void g(void)
+{
+ c *h = e;
+ if (f)
+ {
+ i();
+ h--;
+ if (d)
+ if (h->b.a)
+ i();
+ }
+ if (h->b.a)
+ sejtmp();
+ e = h;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr85244-1.c b/gcc/testsuite/gcc.dg/torture/pr85244-1.c
new file mode 100644
index 00000000000..44716aa9e04
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85244-1.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr85244-2.c" } */
+
+struct s {
+ long a;
+ int b;
+ int tab[];
+};
+
+extern const struct s val;
+extern int idx;
+extern void abort (void);
+
+int main()
+{
+ if (val.tab[0] != 42 || val.tab[1] != 1337 || val.tab[idx] != 1337)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr85244-2.c b/gcc/testsuite/gcc.dg/torture/pr85244-2.c
new file mode 100644
index 00000000000..d57cb712420
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85244-2.c
@@ -0,0 +1,8 @@
+struct s {
+ long a;
+ int b;
+ int tab[];
+};
+
+int idx = 1;
+const struct s val = { 0, 0, { 42, 1337 } };
diff --git a/gcc/testsuite/gcc.dg/torture/pr85284.c b/gcc/testsuite/gcc.dg/torture/pr85284.c
new file mode 100644
index 00000000000..80e2c5b247b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr85284.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+
+static int p[48], v;
+
+int
+main ()
+{
+ p[32] = 1;
+ for (int i = 48; i--;)
+ {
+ if (!p[i])
+ continue;
+ if ((i & 7) > 2)
+ break;
+ v = i & 1;
+ }
+ if (v != 0)
+ __builtin_abort ();
+ return 0;
+}
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/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-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/powerpc/pr83660.C b/gcc/testsuite/gcc.target/powerpc/pr83660.C
new file mode 100644
index 00000000000..60adcdacb4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83660.C
@@ -0,0 +1,14 @@
+/* PR target/83660 */
+/* { dg-do compile } */
+/* { dg-options "-mcpu=power7" } */
+
+#include <altivec.h>
+
+typedef __vector unsigned int uvec32_t __attribute__((__aligned__(16)));
+
+unsigned get_word(uvec32_t v)
+{
+ return ({const unsigned _B1 = 32;
+ vec_extract((uvec32_t)v, 2);});
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83969.c b/gcc/testsuite/gcc.target/powerpc/pr83969.c
new file mode 100644
index 00000000000..fe61594be16
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr83969.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=G5" } } */
+/* { dg-options "-O1 -mcpu=G5 -fno-split-wide-types -ftree-loop-vectorize" } */
+
+long long int
+n7 (int po, long long int r4)
+{
+ while (po < 1)
+ {
+ r4 |= 1;
+ ++po;
+ }
+ return r4;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr85698.c b/gcc/testsuite/gcc.target/powerpc/pr85698.c
new file mode 100644
index 00000000000..294a5665b32
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr85698.c
@@ -0,0 +1,79 @@
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
+/* { dg-options "-O3 -mcpu=power7" } */
+
+/* PR85698: Incorrect code generated on LE due to use of stxvw4x. */
+
+typedef unsigned char uint8_t;
+typedef short int16_t;
+extern void abort (void);
+extern int memcmp(const void *, const void *, __SIZE_TYPE__);
+
+uint8_t expected[128] =
+{14, 0, 4, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 28, 35, 33, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 66, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 96,
+ 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+ 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127};
+
+static uint8_t x264_clip_uint8( int x )
+{
+ return x&(~255) ? (-x)>>31 : x;
+}
+void add4x4_idct( uint8_t *p_dst, int16_t dct[16])
+{
+ int16_t d[16];
+ int16_t tmp[16];
+ int i, y, x;
+ for( i = 0; i < 4; i++ )
+ {
+ int s02 = dct[0*4+i] + dct[2*4+i];
+ int d02 = dct[0*4+i] - dct[2*4+i];
+ int s13 = dct[1*4+i] + (dct[3*4+i]>>1);
+ int d13 = (dct[1*4+i]>>1) - dct[3*4+i];
+ tmp[i*4+0] = s02 + s13;
+ tmp[i*4+1] = d02 + d13;
+ tmp[i*4+2] = d02 - d13;
+ tmp[i*4+3] = s02 - s13;
+ }
+ for( i = 0; i < 4; i++ )
+ {
+ int s02 = tmp[0*4+i] + tmp[2*4+i];
+ int d02 = tmp[0*4+i] - tmp[2*4+i];
+ int s13 = tmp[1*4+i] + (tmp[3*4+i]>>1);
+ int d13 = (tmp[1*4+i]>>1) - tmp[3*4+i];
+ d[0*4+i] = ( s02 + s13 + 32 ) >> 6;
+ d[1*4+i] = ( d02 + d13 + 32 ) >> 6;
+ d[2*4+i] = ( d02 - d13 + 32 ) >> 6;
+ d[3*4+i] = ( s02 - s13 + 32 ) >> 6;
+ }
+ for( y = 0; y < 4; y++ )
+ {
+ for( x = 0; x < 4; x++ )
+ p_dst[x] = x264_clip_uint8( p_dst[x] + d[y*4+x] );
+ p_dst += 32;
+ }
+}
+
+int main()
+{
+ uint8_t dst[128];
+ int16_t dct[16];
+ int i;
+
+ for (i = 0; i < 16; i++)
+ dct[i] = i*10 + i;
+ for (i = 0; i < 128; i++)
+ dst[i] = i;
+
+ add4x4_idct(dst, dct);
+
+ if (memcmp (dst, expected, 128))
+ abort();
+
+ return 0;
+}
+
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_assumed_charlen_4.f90 b/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_4.f90
new file mode 100644
index 00000000000..1a5539a642b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocate_assumed_charlen_4.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+!
+! Test the fix for PR82923, in which an ICE occurred because the
+! character length from 'getchars' scope was being used in the
+! automatic allocation of 'mine'.
+!
+! Contributed by "Werner Blokbuster" <werner.blokbuster@gmail.com>
+!
+module m
+ implicit none
+contains
+ function getchars(my_len,my_size)
+ integer, intent(in) :: my_len, my_size
+ character(my_len) :: getchars(my_size)
+ getchars = 'A-'
+ end function getchars
+
+ function getchars2(my_len)
+ integer, intent(in) :: my_len
+ character(my_len) :: getchars2
+ getchars2 = 'B--'
+ end function getchars2
+end module m
+
+program testca
+ use m, only: getchars, getchars2
+ implicit none
+ character(:), allocatable :: mine(:)
+ character(:), allocatable :: mine2
+ integer :: i
+
+ ! ICE occured at this line:
+ mine = getchars(2,4)
+ if (any (mine .ne. [('A-', i = 1, 4)])) stop 1
+
+ ! The scalar version was fine and this will keep it so:
+ mine2 = getchars2(3)
+ if (mine2 .ne. 'B--') stop 2
+end program testca
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/associate_33.f03 b/gcc/testsuite/gfortran.dg/associate_33.f03
new file mode 100644
index 00000000000..1f87b22e8e4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/associate_33.f03
@@ -0,0 +1,11 @@
+! { dg-do run }
+!
+! Test the fix for PR83898.f90
+!
+! Contributed by G Steinmetz <gscfq@t-online.de>
+!
+program p
+ associate (x => ['1','2'])
+ if (any (x .ne. ['1','2'])) call abort
+ end associate
+end
diff --git a/gcc/testsuite/gfortran.dg/char_result_18.f90 b/gcc/testsuite/gfortran.dg/char_result_18.f90
new file mode 100644
index 00000000000..f47c88ad4b3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_result_18.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! Tests the fix for PR80657.
+!
+! Contributed by Vittorio Zecca <zeccav@gmail.com>
+!
+function f(x)
+implicit character(len(f)) (x) ! { dg-error "Self reference in character length" }
+character(len(x)) f
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray/get_to_indexed_array_1.f90 b/gcc/testsuite/gfortran.dg/coarray/get_to_indexed_array_1.f90
new file mode 100644
index 00000000000..04714711707
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/get_to_indexed_array_1.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+
+! Test that index vector on lhs of caf-expression works correctly.
+
+program pr81773
+
+ integer, parameter :: ndim = 5
+ integer :: i
+ integer :: vec(ndim) = -1
+ integer :: res(ndim)[*] = [ (i, i=1, ndim) ]
+ type T
+ integer :: padding
+ integer :: dest(ndim)
+ integer :: src(ndim)
+ end type
+
+ type(T) :: dest
+ type(T), allocatable :: caf[:]
+
+ vec([ndim, 3, 1]) = res(1:3)[1]
+ if (any (vec /= [ 3, -1, 2, -1, 1])) stop 1
+
+ dest = T(42, [ ( -1, i = 1, ndim ) ], [ ( i - 2, i = ndim, 1, -1) ] )
+ dest%dest([ 4,3,2 ]) = res(3:5)[1]
+ if (any (dest%dest /= [-1, 5, 4, 3, -1])) stop 2
+
+ vec(:) = -1
+ allocate(caf[*], source = T(42, [ ( -1, i = 1, ndim ) ], [ ( i - 2, i = ndim, 1, -1) ] ))
+ vec([ 5,3,2 ]) = caf[1]%src(2:4)
+ if (any (vec /= [ -1, 0, 1, -1, 2])) stop 3
+end
+
diff --git a/gcc/testsuite/gfortran.dg/coarray/get_to_indirect_array.f90 b/gcc/testsuite/gfortran.dg/coarray/get_to_indirect_array.f90
new file mode 100644
index 00000000000..efb78353637
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/get_to_indirect_array.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+!
+! Test that pr81773/fortran is fixed.
+
+program get_to_indexed_array
+
+ integer, parameter :: ndim = 5
+ integer :: i
+ integer :: vec(1:ndim) = 0
+ integer :: indx(1:2) = [3, 2]
+ integer :: mat(1:ndim, 1:ndim) = 0
+ integer :: res(1:ndim)[*]=[ (i, i=1, ndim) ]
+
+ ! No sync needed, because this test always is running on single image
+ vec([ndim , 1]) = res(1:2)[1]
+ if (vec(1) /= res(2) .or. vec(ndim) /= res(1)) then
+ print *,"vec: ", vec, " on image: ", this_image()
+ stop 1
+ end if
+
+ mat(2:3,[indx(:)]) = reshape(res(1:4)[1], [2, 2])
+ if (any(mat(2:3, 3:2:-1) /= reshape(res(1:4), [2,2]))) then
+ print *, "mat: ", mat, " on image: ", this_image()
+ stop 2
+ end if
+end
+
+! vim:ts=2:sts=2:sw=2:
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/coarray_dependency_1.f90 b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90
new file mode 100644
index 00000000000..dc4cbacba1e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_dependency_1.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+!
+! Check that reffing x on both sides of a coarray send does not ICE.
+! PR 85507
+
+program check_dependency
+ integer :: x[*]
+ x[42] = x
+end program check_dependency
+
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
index 8ad6b081a13..df3b9d439b1 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
@@ -38,9 +38,8 @@ B(1:5) = B(3:7)
if (any (A-B /= 0)) call abort
end
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 2 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }
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/goacc/pr84963.f90 b/gcc/testsuite/gfortran.dg/goacc/pr84963.f90
new file mode 100644
index 00000000000..4548082bee3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr84963.f90
@@ -0,0 +1,7 @@
+! PR ipa/84963
+! { dg-options "-O2" }
+
+program p
+ print *, sin([1.0, 2.0])
+ print *, cos([1.0, 2.0])
+end
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/pr70870_1.f90 b/gcc/testsuite/gfortran.dg/pr70870_1.f90
new file mode 100644
index 00000000000..0f9584a36db
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr70870_1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/70870
+! Contributed by Vittorio Zecca <zeccav at gmail dot com >
+ type t
+ integer :: g=0 ! default initialization
+ end type
+ type(t) :: v2
+ data v2/t(2)/ ! { dg-error "default initialization shall not" }
+ end
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/pr83149.f90 b/gcc/testsuite/gfortran.dg/pr83149.f90
new file mode 100644
index 00000000000..fc0607e1369
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83149.f90
@@ -0,0 +1,14 @@
+! Compiled with pr83149_1.f90
+!
+module mod1
+ integer :: ncells
+end module
+
+module mod2
+contains
+ function get() result(array)
+ use mod1
+ real array(ncells)
+ array = 1.0
+ end function
+end module
diff --git a/gcc/testsuite/gfortran.dg/pr83149_1.f90 b/gcc/testsuite/gfortran.dg/pr83149_1.f90
new file mode 100644
index 00000000000..3a8f5d55d9b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83149_1.f90
@@ -0,0 +1,24 @@
+! Compiled with pr83149.f90
+! { dg-do run }
+! { dg-options "-fno-whole-file" }
+! { dg-compile-aux-modules "pr83149.f90" }
+! { dg-additional-sources pr83149.f90 }
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+subroutine sub(s)
+ use mod2
+ real :: s
+ s = sum(get())
+end
+
+ use mod1
+ real :: s
+ ncells = 2
+ call sub (s)
+ if (int (s) .ne. ncells) stop 1
+ ncells = 10
+ call sub (s)
+ if (int (s) .ne. ncells) stop 2
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr83149_a.f90 b/gcc/testsuite/gfortran.dg/pr83149_a.f90
new file mode 100644
index 00000000000..3f15198bfe9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83149_a.f90
@@ -0,0 +1,11 @@
+! Compiled with pr83149_b.f90
+!
+module mod
+ character(8) string
+contains
+ function get_string() result(s)
+ character(len_trim(string)) s
+ s = string
+ end function
+end module
+
diff --git a/gcc/testsuite/gfortran.dg/pr83149_b.f90 b/gcc/testsuite/gfortran.dg/pr83149_b.f90
new file mode 100644
index 00000000000..f67ffd95159
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr83149_b.f90
@@ -0,0 +1,16 @@
+! Compiled with pr83149_a.f90
+! { dg-do run }
+! { dg-options "-fno-whole-file" }
+! { dg-compile-aux-modules "pr83149_a.f90" }
+! { dg-additional-sources pr83149_a.f90 }
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+ use mod
+ string = 'fubar'
+ select case (get_string())
+ case ('fubar')
+ case default
+ stop 1
+ end select
+end
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/pr85520.f90 b/gcc/testsuite/gfortran.dg/pr85520.f90
new file mode 100644
index 00000000000..3e66a9020f8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85520.f90
@@ -0,0 +1,7 @@
+! { dg-do run }
+! PR fortran/85520
+! Original code from Gerhard Steinmetz <gscfq at t-online dot de>
+program p
+ character(-huge(1)) :: c = ' '
+ if (len(c) /= 0) stop 1
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85521_1.f90 b/gcc/testsuite/gfortran.dg/pr85521_1.f90
new file mode 100644
index 00000000000..57e4620fe0d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85521_1.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/85521
+program p
+ character(3) :: c = 'abc'
+ character(3) :: z(1)
+ z = [ c(:-1) ]
+ print *, z
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85521_2.f90 b/gcc/testsuite/gfortran.dg/pr85521_2.f90
new file mode 100644
index 00000000000..737b61a11b9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85521_2.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/85521
+program p
+ character(3) :: c = 'abc'
+ character(3) :: z(1)
+ z = [ c(:-2) ]
+ print *, z
+end
diff --git a/gcc/testsuite/gfortran.dg/pr85542.f90 b/gcc/testsuite/gfortran.dg/pr85542.f90
new file mode 100644
index 00000000000..f61d2c9beb0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85542.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/85542
+function f(x)
+ character(*), intent(in) :: x
+ character((len((x)))) :: f
+ f = x
+end
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/pr85687.f90 b/gcc/testsuite/gfortran.dg/pr85687.f90
new file mode 100644
index 00000000000..03bc2119364
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr85687.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/85687
+! Code original contributed by Gerhard Steinmetz gscfq at t-oline dot de
+program p
+ type t
+ end type
+ print *, rank(t) ! { dg-error "must be a data object" }
+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/select_type_42.f90 b/gcc/testsuite/gfortran.dg/select_type_42.f90
new file mode 100644
index 00000000000..ff73e6c7858
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_42.f90
@@ -0,0 +1,26 @@
+! { dg-do run }
+!
+! Tests the fix for PR82275.
+! Associating a name with a reduced-dimension section of a
+! multidimensional array precluded subsequent use of the name
+! with the appropriately reduced dimensionality and instead
+! required use of the (invalid) full set of original dimensions.
+!
+! Contributed by Damian Rouson <damian@sourceryinstitute.org>
+!
+ type component
+ integer :: i
+ end type
+ type container
+ class(component), allocatable :: component_array(:,:)
+ end type
+ type(container) bag
+ type(component) section_copy
+ allocate(bag%component_array, source = reshape ([component(10), component (100)], [1,2]))
+ select type(associate_name=>bag%component_array(1,:))
+ type is (component)
+ section_copy = associate_name(2) ! gfortran rejected valid
+! section_copy = associate_name(1,1)! gfortran accepted invalid
+ end select
+ if (section_copy%i .ne. 100) stop 1
+end
diff --git a/gcc/testsuite/gfortran.dg/submodule_31.f08 b/gcc/testsuite/gfortran.dg/submodule_31.f08
new file mode 100644
index 00000000000..72594d05df3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/submodule_31.f08
@@ -0,0 +1,54 @@
+! { dg-do run }
+!
+! Test the fix for PR82814 in which an ICE occurred for the submodule allocation.
+!
+! Contributed by "Werner Blokbuster" <werner.blokbuster@gmail.com>
+!
+module u
+
+ implicit none
+
+ interface unique
+ module function uniq_char(input) result(uniq)
+ character(*), intent(in) :: input(:)
+ character(size(input)), allocatable :: uniq(:)
+ end function uniq_char
+ end interface unique
+
+contains
+
+ module function uniq2(input) result(uniq)
+ character(*), intent(in) :: input(:)
+ character(size(input)), allocatable :: uniq(:)
+ allocate(uniq(1))
+ uniq = 'A'
+ end function uniq2
+
+end module u
+
+
+submodule (u) z
+
+ implicit none
+
+contains
+
+ module function uniq_char(input) result(uniq)
+ character(*), intent(in) :: input(:)
+ character(size(input)), allocatable :: uniq(:)
+ allocate(uniq(1)) ! This used to ICE
+ uniq = 'A'
+ end function uniq_char
+
+end submodule z
+
+
+program test_uniq
+ use u
+ implicit none
+ character(1), dimension(4) :: chr = ['1','2','1','2']
+
+ write(*,*) unique(chr)
+ write(*,*) uniq2(chr)
+
+end program test_uniq
diff --git a/gcc/testsuite/gfortran.dg/temporary_2.f90 b/gcc/testsuite/gfortran.dg/temporary_2.f90
new file mode 100644
index 00000000000..0598ea54f28
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/temporary_2.f90
@@ -0,0 +1,39 @@
+! { dg-do compile }
+!
+! Tests the fix for PR70864 in which compiler generated temporaries received
+! the attributes of a dummy argument. This is the original testcase.
+! The simplified version by Gerhard Steinmetz is gratefully acknowledged.
+!
+! Contributed by Weiqun Zhang <weiqun.zhang@gmail.com>
+!
+module boxarray_module
+ implicit none
+ type :: BoxArray
+ integer :: i = 0
+ contains
+ procedure :: boxarray_assign
+ generic :: assignment(=) => boxarray_assign
+ end type BoxArray
+contains
+ subroutine boxarray_assign (dst, src)
+ class(BoxArray), intent(inout) :: dst
+ type (BoxArray), intent(in ) :: src
+ dst%i =src%i
+ end subroutine boxarray_assign
+end module boxarray_module
+
+module multifab_module
+ use boxarray_module
+ implicit none
+ type, public :: MultiFab
+ type(BoxArray) :: ba
+ end type MultiFab
+contains
+ subroutine multifab_swap(mf1, mf2)
+ type(MultiFab), intent(inout) :: mf1, mf2
+ type(MultiFab) :: tmp
+ tmp = mf1
+ mf1 = mf2 ! Generated an ICE in trans-decl.c.
+ mf2 = tmp
+ end subroutine multifab_swap
+end module multifab_module
diff --git a/gcc/testsuite/gfortran.dg/temporary_3.f90 b/gcc/testsuite/gfortran.dg/temporary_3.f90
new file mode 100644
index 00000000000..84b300a38d9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/temporary_3.f90
@@ -0,0 +1,121 @@
+! { dg-do run }
+!
+! Tests the fix for PR68846 in which compiler generated temporaries were
+! receiving the attributes of dummy arguments. This test is the original.
+! The simplified versions by Gerhard Steinmetz are gratefully acknowledged.
+!
+! Contributed by Mirco Valentini <mirco.valentini@polimi.it>
+!
+MODULE grid
+ IMPLICIT NONE
+ PRIVATE
+ REAL(KIND=8), DIMENSION(100,100), TARGET :: WORKSPACE
+ TYPE, PUBLIC :: grid_t
+ REAL(KIND=8), DIMENSION(:,:), POINTER :: P => NULL ()
+ END TYPE
+ PUBLIC :: INIT
+CONTAINS
+ SUBROUTINE INIT (DAT)
+ IMPLICIT NONE
+ TYPE(grid_t), INTENT(INOUT) :: DAT
+ INTEGER :: I, J
+ DAT%P => WORKSPACE
+ DO I = 1, 100
+ DO J = 1, 100
+ DAT%P(I,J) = REAL ((I-1)*100+J-1)
+ END DO
+ ENDDO
+ END SUBROUTINE INIT
+END MODULE grid
+
+MODULE subgrid
+ USE :: grid, ONLY: grid_t
+ IMPLICIT NONE
+ PRIVATE
+ TYPE, PUBLIC :: subgrid_t
+ INTEGER, DIMENSION(4) :: range
+ CLASS(grid_t), POINTER :: grd => NULL ()
+ CONTAINS
+ PROCEDURE, PASS :: INIT => LVALUE_INIT
+ PROCEDURE, PASS :: JMP => LVALUE_JMP
+ END TYPE
+CONTAINS
+ SUBROUTINE LVALUE_INIT (HOBJ, P, D)
+ IMPLICIT NONE
+ CLASS(subgrid_t), INTENT(INOUT) :: HOBJ
+ TYPE(grid_t), POINTER, INTENT(INOUT) :: P
+ INTEGER, DIMENSION(4), INTENT(IN) :: D
+ HOBJ%range = D
+ HOBJ%grd => P
+ END SUBROUTINE LVALUE_INIT
+
+ FUNCTION LVALUE_JMP(HOBJ, I, J) RESULT(P)
+ IMPLICIT NONE
+ CLASS(subgrid_t), INTENT(INOUT) :: HOBJ
+ INTEGER, INTENT(IN) :: I, J
+ REAL(KIND=8), POINTER :: P
+ P => HOBJ%grd%P(HOBJ%range(1)+I-1, HOBJ%range(3)+J-1)
+ END FUNCTION LVALUE_JMP
+END MODULE subgrid
+
+MODULE geom
+ IMPLICIT NONE
+CONTAINS
+ SUBROUTINE fillgeom_03( subgrid, value )
+ USE :: subgrid, ONLY: subgrid_t
+ IMPLICIT NONE
+ TYPE(subgrid_T), intent(inout) :: subgrid
+ REAL(kind=8), intent(in) :: value
+ INTEGER :: I, J
+ DO i = 1, 3
+ DO J = 1, 4
+ subgrid%jmp(i,j) = value ! Dummy argument '_F.DA0' with INTENT(IN)
+ ! in pointer association context or ICE
+ ! in trans_decl.c, depending on INTENT of
+ ! 'VALUE'
+ ENDDO
+ ENDDO
+ END SUBROUTINE fillgeom_03
+END MODULE geom
+
+PROGRAM test_lvalue
+ USE :: grid
+ USE :: subgrid
+ USE :: geom
+ IMPLICIT NONE
+ TYPE(grid_t), POINTER :: GRD => NULL()
+ TYPE(subgrid_t) :: STENCIL
+ REAL(KIND=8), POINTER :: real_tmp_ptr
+ REAL(KIND=8), DIMENSION(10,10), TARGET :: AA
+ REAL(KIND=8), DIMENSION(3,4) :: VAL
+ INTEGER :: I, J, chksum
+ integer, parameter :: r1 = 50
+ integer, parameter :: r2 = 52
+ integer, parameter :: r3 = 50
+ integer, parameter :: r4 = 53
+ DO I = 1, 3
+ DO J = 1, 4
+ VAL(I,J) = dble(I)*dble(J)
+ ENDDO
+ ENDDO
+
+ ALLOCATE (GRD)
+ CALL INIT (GRD)
+ chksum = sum([([((i-1)*100 + j -1, j=1,100)], i = 1,100)])
+ if (int(sum(grd%p)) .ne. chksum) stop 1
+
+ CALL STENCIL%INIT (GRD, [r1, r2, r3, r4])
+ if (.not.associated (stencil%grd, grd)) stop 2
+ if (int(sum(grd%p)) .ne. chksum) stop 3
+
+ CALL fillgeom_03(stencil, 42.0_8)
+ if (any (int (grd%p(r1:r2,r3:r4)) .ne. 42)) stop 4
+
+ chksum = chksum - sum([([((i - 1) * 100 + j -1, j=r3,r4)], i = r1,r2)]) &
+ + (r4 - r3 + 1) * (r2 - r1 +1) * 42
+ if (int(sum(grd%p)) .ne. chksum) stop 5
+
+ deallocate (grd)
+END PROGRAM test_lvalue
+
+
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_29.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_29.f90
new file mode 100644
index 00000000000..d4ad39cda1e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_29.f90
@@ -0,0 +1,84 @@
+! { dg-do run }
+!
+! Test the fix for PR84546 in which the failing cases would
+! have x%vec = ['foo','b '].
+!
+! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
+!
+module any_vector_type
+
+ type :: any_vector
+ class(*), allocatable :: vec(:)
+ end type
+
+ interface any_vector
+ procedure any_vector1
+ end interface
+
+contains
+
+ function any_vector1(vec) result(this)
+ class(*), intent(in) :: vec(:)
+ type(any_vector) :: this
+ allocate(this%vec, source=vec)
+ end function
+
+end module
+
+program main
+
+ use any_vector_type
+ implicit none
+
+ class(*), allocatable :: x
+ character(*), parameter :: vec(2) = ['foo','bar']
+ integer :: vec1(3) = [7,8,9]
+
+ call foo1
+ call foo2
+ call foo3
+ call foo4
+
+contains
+
+ subroutine foo1 ! This always worked
+ allocate (any_vector :: x)
+ select type (x)
+ type is (any_vector)
+ x = any_vector(vec)
+ end select
+ call bar(1)
+ deallocate (x)
+ end
+
+ subroutine foo2 ! Failure found during diagnosis
+ x = any_vector (vec)
+ call bar(2)
+ deallocate (x)
+ end
+
+ subroutine foo3 ! Original failure
+ allocate (x, source = any_vector (vec))
+ call bar(3)
+ deallocate (x)
+ end
+
+ subroutine foo4 ! This always worked
+ allocate (x, source = any_vector (vec1))
+ call bar(4)
+ deallocate (x)
+ end
+
+ subroutine bar (stop_flag)
+ integer :: stop_flag
+ select type (x)
+ type is (any_vector)
+ select type (xvec => x%vec)
+ type is (character(*))
+ if (any(xvec /= vec)) stop stop_flag
+ type is (integer)
+ if (any(xvec /= (vec1))) stop stop_flag
+ end select
+ end select
+ end
+end program
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/testsuite/go.dg/pr85436.go b/gcc/testsuite/go.dg/pr85436.go
new file mode 100644
index 00000000000..225c2734561
--- /dev/null
+++ b/gcc/testsuite/go.dg/pr85436.go
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mcpu=power9" { target { powerpc*-*-* } } } */
+
+package main
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+)
+type testFuncs struct { }
+func (t *testFuncs) load(filename, pkg string, doImport, seen *bool) {
+ var testFileSet = token.NewFileSet()
+ f, err := parser.ParseFile(testFileSet, filename, nil, parser.ParseComments)
+ if err != nil { }
+ for _, d := range f.Decls {
+ n, ok := d.(*ast.FuncDecl)
+ if !ok { }
+ ptr := n.Type.Params.List[0].Type.(*ast.StarExpr)
+ if sel := ptr.X.(*ast.SelectorExpr); sel.Sel.Name == "M" { }
+ }
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 5aa05b877a9..c2a593d5ac0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -5942,7 +5942,7 @@ proc check_effective_target_vect_load_lanes { } {
} else {
set et_vect_load_lanes 0
# We don't support load_lanes correctly on big-endian arm.
- if { ([istarget arm-*-*] && [check_effective_target_arm_neon_ok])
+ if { ([check_effective_target_arm_little_endian] && [check_effective_target_arm_neon_ok])
|| [istarget aarch64*-*-*] } {
set et_vect_load_lanes 1
}
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 4e47be1dc05..645db9e1459 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -438,7 +438,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
referenced the last field of a struct or a union member
then we have to adjust maxsize by the padding at the end
of our field. */
- if (seen_variable_array_ref && maxsize != -1)
+ if (seen_variable_array_ref)
{
tree stype = TREE_TYPE (TREE_OPERAND (exp, 0));
tree next = DECL_CHAIN (field);
@@ -454,7 +454,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
|| ssize == NULL
|| TREE_CODE (ssize) != INTEGER_CST)
maxsize = -1;
- else
+ else if (maxsize != -1)
{
offset_int tem = (wi::to_offset (ssize)
- wi::to_offset (fsize));
@@ -463,6 +463,11 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
maxsize += tem;
}
}
+ /* An component ref with an adjacent field up in the
+ structure hierarchy constrains the size of any variable
+ array ref lower in the access hierarchy. */
+ else
+ seen_variable_array_ref = false;
}
}
else
@@ -617,7 +622,9 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (DECL_P (exp))
{
- if (flag_unconstrained_commons && VAR_P (exp) && DECL_COMMON (exp))
+ if (VAR_P (exp)
+ && ((flag_unconstrained_commons && DECL_COMMON (exp))
+ || (DECL_EXTERNAL (exp) && seen_variable_array_ref)))
{
tree sz_tree = TYPE_SIZE (TREE_TYPE (exp));
/* If size is unknown, or we have read to the end, assume there
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 6b829cc4d79..3f51cb98788 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2320,11 +2320,11 @@ number_of_iterations_exit_assumptions (struct loop *loop, edge exit,
tree iv0_niters = NULL_TREE;
if (!simple_iv_with_niters (loop, loop_containing_stmt (stmt),
- op0, &iv0, &iv0_niters, false))
+ op0, &iv0, safe ? &iv0_niters : NULL, false))
return false;
tree iv1_niters = NULL_TREE;
if (!simple_iv_with_niters (loop, loop_containing_stmt (stmt),
- op1, &iv1, &iv1_niters, false))
+ op1, &iv1, safe ? &iv1_niters : NULL, false))
return false;
/* Give up on complicated case. */
if (iv0_niters && iv1_niters)
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 01e060b6690..0607b4bf083 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1245,7 +1245,9 @@ vn_reference_maybe_forwprop_address (vec<vn_reference_op_s> *ops,
return true;
}
if (!addr_base
- || TREE_CODE (addr_base) != MEM_REF)
+ || TREE_CODE (addr_base) != MEM_REF
+ || (TREE_CODE (TREE_OPERAND (addr_base, 0)) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (addr_base, 0))))
return false;
off += addr_offset;
@@ -1258,6 +1260,7 @@ vn_reference_maybe_forwprop_address (vec<vn_reference_op_s> *ops,
ptr = gimple_assign_rhs1 (def_stmt);
ptroff = gimple_assign_rhs2 (def_stmt);
if (TREE_CODE (ptr) != SSA_NAME
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ptr)
|| TREE_CODE (ptroff) != INTEGER_CST)
return false;
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
{