1. 24 May, 2018 5 commits
    • Use canonicalize_math_after_vectorization_p for FMA folds · c453ccc2
      The folds in r260348 kicked in before vectorisation, which hurts
      for two reasons:
      
      (1) the current suboptimal handling of nothrow meant that we could
          drop the flag early and so prevent if-conversion
      
      (2) some architectures provide more scalar forms than vector forms
          (true for Advanced SIMD)
      
      (1) is a bug in itself that needs to be fixed eventually, but delaying
      the folds is still needed for (2).
      
      2018-05-24  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* match.pd: Delay FMA folds until after vectorization.
      
      gcc/testsuite/
      	* gcc.dg/vect/vect-fma-1.c: New test.
      
      From-SVN: r260639
      Richard Sandiford committed
    • Fix dumpfile name in gcc.dg/tree-prof/update-loopch.c · 0c08e1f8
      	* gcc.dg/tree-prof/update-loopch.c: Fix dumpfile name in
      	scan-tree-dump*.
      
      From-SVN: r260638
      Rainer Orth committed
    • PR target/83009: Relax strict address checking for store pair lanes · ac025fd6
      The operand constraint for the memory address of store/load pair lanes was
      enforcing strictly hardware registers be allowed as memory addresses.  We want
      to relax that such that these patterns can be used by combine.  During register
      allocation the register constraint will enforce the correct register is chosen.
      
      gcc
      2018-05-24  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      
      	PR target/83009
      	* config/aarch64/predicates.md (aarch64_mem_pair_lanes_operand): Make
      	address check not strict.
      
      gcc/testsuite
      2018-05-24  Andre Vieira  <andre.simoesdiasvieira@arm.com>
      
      	PR target/83009
      	* gcc/target/aarch64/store_v2vec_lanes.c: Add extra tests.
      
      From-SVN: r260635
      Andre Vieira committed
    • Add a class to represent a gimple match result · 5d75ad95
      Gimple match results are represented by a code_helper for the operation,
      a tree for the type, and an array of three trees for the operands.
      This patch wraps them up in a class so that they don't need to be
      passed around individually.
      
      The main reason for doing this is to make it easier to increase the
      number of operands (for calls) or to support more complicated kinds
      of operation.  But passing around fewer operands also helps to reduce
      the size of gimple-match.o (about 7% for development builds and 4% for
      release builds).
      
      2018-05-24  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* gimple-match.h (gimple_match_op): New class.
      	(mprts_hook): Replace parameters with a gimple_match_op *.
      	(maybe_build_generic_op): Likewise.
      	(gimple_simplified_result_is_gimple_val): Replace parameters with
      	a const gimple_match_op *.
      	(gimple_simplify): Replace code_helper * and tree * parameters with
      	a gimple_match_op * parameter.
      	(gimple_resimplify1): Replace code_helper *, tree and tree *
      	parameters with a gimple_match_op * parameter.
      	(gimple_resimplify2): Likewise.
      	(gimple_resimplify3): Likewise.
      	(maybe_push_res_to_seq): Replace code_helper, tree and tree *
      	parameters with a gimple_match_op * parameter.
      	* gimple-match-head.c (gimple_simplify): Change prototypes of
      	auto-generated functions to take a gimple_match_op * instead of
      	separate code_helper * and tree * parameters.  Make the same
      	change in the top-level overload and update calls to the
      	gimple_resimplify routines.  Update calls to the auto-generated
      	functions and to maybe_push_res_to_seq in the publicly-facing
      	operation-specific gimple_simplify overloads.
      	(gimple_match_op::MAX_NUM_OPS): Define.
      	(gimple_resimplify1): Replace rcode and ops with a single res_op
      	parameter.  Update call to gimple_simplify.
      	(gimple_resimplify2): Likewise.
      	(gimple_resimplify3): Likewise.
      	(mprts_hook): Replace parameters with a gimple_match_op *.
      	(maybe_build_generic_op): Likewise.
      	(build_call_internal): Replace type, nargs and ops with
      	a gimple_match_op *.
      	(maybe_push_res_to_seq): Replace res_code, type and ops parameters
      	with a single gimple_match_op *.  Update calls to mprts_hook,
      	build_call_internal and gimple_simplified_result_is_gimple_val.
      	Factor out code that is common to the tree_code and combined_fn cases.
      	* genmatch.c (expr::gen_transform): Replace tem_code and
      	tem_ops with a gimple_match_op called tem_op.  Update calls
      	to the gimple_resimplify functions and maybe_push_res_to_seq.
      	(dt_simplify::gen_1): Manipulate res_op instead of res_code and
      	res_ops.  Update call to the gimple_resimplify functions.
      	(dt_simplify::gen): Pass res_op instead of res_code and res_ops.
      	(decision_tree::gen): Make the functions take a gimple_match_op *
      	called res_op instead of separate res_code and res_ops parameters.
      	Update call accordingly.
      	* gimple-fold.c (replace_stmt_with_simplification): Replace rcode
      	and ops with a single res_op parameter.  Update calls to
      	maybe_build_generic_op and maybe_push_res_to_seq.
      	(fold_stmt_1): Update calls to gimple_simplify and
      	replace_stmt_with_simplification.
      	(gimple_fold_stmt_to_constant_1): Update calls to gimple_simplify
      	and gimple_simplified_result_is_gimple_val.
      	* tree-cfgcleanup.c (cleanup_control_expr_graph): Update call to
      	gimple_simplify.
      	* tree-ssa-sccvn.c (vn_lookup_simplify_result): Replace parameters
      	with a gimple_match_op *.
      	(vn_nary_build_or_lookup): Likewise.  Update call to
      	vn_nary_build_or_lookup_1.
      	(vn_nary_build_or_lookup_1): Replace rcode, type and ops with a
      	gimple_match_op *.  Update calls to the gimple_resimplify routines
      	and to gimple_simplified_result_is_gimple_val.
      	(vn_nary_simplify): Update call to vn_nary_build_or_lookup_1.
      	Use gimple_match_op::MAX_NUM_OPS instead of a hard-coded 3.
      	(vn_reference_lookup_3): Update call to vn_nary_build_or_lookup.
      	(visit_nary_op): Likewise.
      	(visit_reference_op_load): Likewise.
      
      From-SVN: r260634
      Richard Sandiford committed
    • Daily bump. · e29ea483
      From-SVN: r260633
      GCC Administrator committed
  2. 23 May, 2018 35 commits
    • Fix bootstrap breakage on i686 · 79bf1170
      gcc/ChangeLog:
      
      2018-05-23  Luis Machado  <luis.machado@linaro.org>
      
      	* tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Use correct type
      	modifier for printing the step amount.
      
      From-SVN: r260629
      Luis Machado committed
    • Refactor path construction from null terminated iterator ranges · 49d729ea
      Move duplicated code to new _S_string_from_iter function and fix
      constraints to accept iterators with const value type.
      
      	* include/bits/fs_path.h (path::__is_encoded_char): Change from class
      	template to alias template.
      	(path::__value_type_is_char): Use remove_const_t.
      	(path:_S_string_from_iter): New helper function.
      	(path::_S_convert(InputIter, __null_terminated))
      	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
      	Use _S_string_from_iter.
      	(path::string<_CharT, _Allocator>(const _Allocator&)): Allow sharing
      	rep for COW strings.
      	* include/experimental/bits/fs_path.h (path::__is_encoded_char):
      	Change from class template to alias template.
      	(path::__value_type_is_char): Use remove_const.
      	(path:_S_string_from_iter): New helper function.
      	(path::_S_convert(InputIter, __null_terminated))
      	(path::_S_convert_loc(InputIter, __null_terminated, const locale&)):
      	Use _S_string_from_iter.
      	* testsuite/27_io/filesystem/path/append/source.cc: Test appending
      	wide strings.
      	* testsuite/27_io/filesystem/path/concat/strings.cc: Check for exact
      	string equality, not path equivalence.
      	* testsuite/27_io/filesystem/path/construct/format.cc: Check
      	construction from std::string and std::wstring and input iterators.
      	* testsuite/27_io/filesystem/path/construct/locale.cc: Check
      	construction from iterators.
      	* testsuite/experimental/filesystem/path/concat/strings.cc: Check for
      	exact string equality, not path equivalence.
      	* testsuite/experimental/filesystem/path/construct/locale.cc: Check
      	construction from iterators.
      
      From-SVN: r260628
      Jonathan Wakely committed
    • re PR target/78849 (ICE on initialization of global struct containing __int20… · 2aece9c1
      re PR target/78849 (ICE on initialization of global struct containing __int20 array at varasm.c:4968)
      
      	PR target/78849
      	* gcc/tree.c (build_common_tree_nodes): Dont set TYPE_SIZE for __intN
      	types.
      
      	PR target/78849
      	* gcc.target/msp430/msp430.exp: Remove -pedantic-errors from
      	DEFAULT_CFLAGS.
      	* gcc.target/msp430/pr78849.c: New test.
      
      From-SVN: r260627
      Jeff Law committed
    • lb1sf68.S (Laddsf$nf): Fix sign bit handling in path to Lf$finfty. · 54fd1590
      2018-05-23  Kalamatee  <kalamatee@gmail.com>
      
      	* config/m68k/lb1sf68.S (Laddsf$nf): Fix sign bit handling in
      	path to Lf$finfty.
      
      From-SVN: r260626
      Kalamatee committed
    • range-for8.C: New test. · 62207518
      	* g++.dg/cpp2a/range-for8.C: New test.
      	* g++.dg/cpp2a/range-for9.C: New test.
      	* g++.dg/cpp2a/range-for10.C: New test.
      
      From-SVN: r260625
      Marek Polacek committed
    • testsuite: Introduce be/le selectors · 89453706
      This patch creates "be" and "le" selectors, which can be used by all
      architectures, similar to ilp32 and lp64.
      
      
      	* doc/sourcebuild.texi (Endianness): New subsubsection.
      
      gcc/testsuite/
      	* lib/target-supports.exp (check_effective_target_be): New.
      	(check_effective_target_le): New.
      
      From-SVN: r260623
      Segher Boessenkool committed
    • Fix cast to rvalue reference from prvalue. · a347241b
      	* cvt.c (diagnose_ref_binding): Handle rvalue reference.
      	* rtti.c (build_dynamic_cast_1): Don't try to build a reference to
      	non-class type.  Handle xvalue argument.
      	* typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
      	rvalue reference.
      	* semantics.c (finish_compound_literal): Do direct-initialization,
      	not cast, to initialize a reference.
      
      From-SVN: r260622
      Jason Merrill committed
    • CWG 616, 1213 - value category of subobject references. · 955da5e5
      	* tree.c (lvalue_kind): A reference to a subobject of a prvalue is
      	an xvalue.
      	* typeck2.c (build_m_component_ref): Likewise.
      	* typeck.c (cp_build_addr_expr_1, lvalue_or_else): Remove diagnostic
      	distinction between temporary and xvalue.
      
      From-SVN: r260621
      Jason Merrill committed
    • * system.h: #include <new> earlier. · a6b29221
      From-SVN: r260620
      Jason Merrill committed
    • Implement P0614R1, Range-based for statements with initializer. · 3d76db63
      	* parser.c (cp_parser_range_based_for_with_init_p): New.
      	(cp_parser_init_statement): Use it.  Parse the optional init-statement
      	for a range-based for loop.
      	(cp_parser_skip_to_closing_parenthesis_1): Handle balancing ?:.
      
      	* g++.dg/cpp2a/range-for1.C: New test.
      	* g++.dg/cpp2a/range-for2.C: New test.
      	* g++.dg/cpp2a/range-for3.C: New test.
      	* g++.dg/cpp2a/range-for4.C: New test.
      	* g++.dg/cpp2a/range-for5.C: New test.
      	* g++.dg/cpp2a/range-for6.C: New test.
      	* g++.dg/cpp2a/range-for7.C: New test.
      
      From-SVN: r260619
      Marek Polacek committed
    • [Patch 02/02] Introduce prefetch-dynamic-strides option · d2ff35c0
      The following patch adds an option to control software prefetching of memory
      references with non-constant/unknown strides.
      
      Currently we prefetch these references if the pass thinks there is benefit to
      doing so. But, since this is all based on heuristics, it's not always the case
      that we end up with better performance.
      
      For Falkor there is also the problem of conflicts with the hardware prefetcher,
      so we need to be more conservative in terms of what we issue software prefetch
      hints for.
      
      This also aligns GCC with what LLVM does for Falkor.
      
      Similarly to the previous patch, the defaults guarantee no change in behavior
      for other targets and architectures.
      
      gcc/ChangeLog:
      
      2018-05-23  Luis Machado  <luis.machado@linaro.org>
      
      	* config/aarch64/aarch64-protos.h (cpu_prefetch_tune)
      	<prefetch_dynamic_strides>: New const bool field.
      	* config/aarch64/aarch64.c (generic_prefetch_tune): Update to include
      	prefetch_dynamic_strides.
      	(exynosm1_prefetch_tune): Likewise.
      	(thunderxt88_prefetch_tune): Likewise.
      	(thunderx_prefetch_tune): Likewise.
      	(thunderx2t99_prefetch_tune): Likewise.
      	(qdf24xx_prefetch_tune): Likewise. Set prefetch_dynamic_strides to
      	false.
      	(aarch64_override_options_internal): Update to set
      	PARAM_PREFETCH_DYNAMIC_STRIDES.
      	* doc/invoke.texi (prefetch-dynamic-strides): Document new option.
      	* params.def (PARAM_PREFETCH_DYNAMIC_STRIDES): New.
      	* params.h (PARAM_PREFETCH_DYNAMIC_STRIDES): Define.
      	* tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Account for
      	prefetch-dynamic-strides setting.
      
      From-SVN: r260618
      Luis Machado committed
    • [Patch 01/02] Introduce prefetch-minimum stride option · 59100dfc
      This patch adds a new option to control the minimum stride, for a memory
      reference, after which the loop prefetch pass may issue software prefetch
      hints for. There are two motivations:
      
      * Make the pass less aggressive, only issuing prefetch hints for bigger strides
      that are more likely to benefit from prefetching. I've noticed a case in cpu2017
      where we were issuing thousands of hints, for example.
      
      * For processors that have a hardware prefetcher, like Falkor, it allows the
      loop prefetch pass to defer prefetching of smaller (less than the threshold)
      strides to the hardware prefetcher instead. This prevents conflicts between
      the software prefetcher and the hardware prefetcher.
      
      I've noticed considerable reduction in the number of prefetch hints and
      slightly positive performance numbers. This aligns GCC and LLVM in terms of
      prefetch behavior for Falkor.
      
      The default settings should guarantee no changes for existing targets. Those
      are free to tweak the settings as necessary.
      
      gcc/ChangeLog:
      
      2018-05-23  Luis Machado  <luis.machado@linaro.org>
      
      	* config/aarch64/aarch64-protos.h (cpu_prefetch_tune)
      	<minimum_stride>: New const int field.
      	* config/aarch64/aarch64.c (generic_prefetch_tune): Update to include
      	minimum_stride field defaulting to -1.
      	(exynosm1_prefetch_tune): Likewise.
      	(thunderxt88_prefetch_tune): Likewise.
      	(thunderx_prefetch_tune): Likewise.
      	(thunderx2t99_prefetch_tune): Likewise.
      	(qdf24xx_prefetch_tune) <minimum_stride>: Set to 2048.
      	<default_opt_level>: Set to 3.
      	(aarch64_override_options_internal): Update to set
      	PARAM_PREFETCH_MINIMUM_STRIDE.
      	* doc/invoke.texi (prefetch-minimum-stride): Document new option.
      	* params.def (PARAM_PREFETCH_MINIMUM_STRIDE): New.
      	* params.h (PARAM_PREFETCH_MINIMUM_STRIDE): Define.
      	* tree-ssa-loop-prefetch.c (should_issue_prefetch_p): Return false if
      	stride is constant and is below the minimum stride threshold.
      
      From-SVN: r260617
      Luis Machado committed
    • Fix handling of an empty filename at end of a path · cf290ea3
      The C++17 std::filesystem::path grammar allows an empty filename as the
      last component (to signify a trailing slash). The existing code does not
      handle this consistently, sometimes an empty filename has type _Multi
      and sometimes it has type _Filename. This can result in a non-empty
      iterator range for an empty filename component.
      
      This change ensures that empty paths always have type _Filename and will
      yield an empty iterator range.
      
      	* include/bits/fs_path.h (path::_M_type): Change default member
      	initializer to _Filename.
      	(path::begin): Create past-the-end iterator for empty path.
      	* src/filesystem/std-path.cc (path::remove_filename()): Remove
      	debugging check.
      	(path::has_relative_path()): Return false for empty filenames.
      	(path::_M_split_cmpts): Set _M_type to _Filename for empty paths.
      	Fix offset of empty final component.
      	* testsuite/27_io/filesystem/path/itr/components.cc: New.
      	* testsuite/27_io/filesystem/path/itr/traversal.cc: Add new inputs.
      
      From-SVN: r260616
      Jonathan Wakely committed
    • [arm] Remove mode26 feature bit · 7aa13250
      
          * config/arm/arm-cpus.in (mode26): Delete.
          (armv4): Delete mode26 reference.
          * config/arm/arm.c (arm_configure_build_target): Delete use of
          isa_bit_mode26.
      
      From-SVN: r260615
      Kyrylo Tkachov committed
    • i386.md (*floatuns<SWI48:mode><MODEF:mode>2_avx512): New insn pattern. · 4b3f4964
      	* config/i386/i386.md (*floatuns<SWI48:mode><MODEF:mode>2_avx512):
      	New insn pattern.
      	(floatunssi<mode>2): Also enable for AVX512F and TARGET_SSE_MATH.
      	Rewrite expander pattern.  Emit gen_floatunssi<mode>2_i387_with_xmm
      	for non-SSE modes.
      	(floatunsdisf2): Rewrite expander pattern.  Hanlde TARGET_AVX512F.
      	(floatunsdidf2): Ditto.
      
      	* config/i386/i386.md (fixuns_trunc<mode>di2): New insn pattern.
      	(fixuns_trunc<mode>si2_avx512f): Ditto.
      	(*fixuns_trunc<mode>si2_avx512f_zext): Ditto.
      	(fixuns_trunc<mode>si2): Also enable for AVX512F and TARGET_SSE_MATH.
      	Emit fixuns_trunc<mode>si2_avx512f for AVX512F targets.
      
      testsuite/ChangeLog:
      
      	* gcc.target/i386/cvt-2.c: New test.
      
      	* gcc.target/i386/cvt-3.c: New test.
      
      From-SVN: r260614
      Uros Bizjak committed
    • df-scan: remove ad-hoc handling of global regs in asms · 3f131545
      	PR rtl-optimization/79985
      	* df-scan.c (df_insn_refs_collect): Remove special case for
      	global registers and asm statements.
      
      testsuite/
      	* gcc.dg/pr79985.c: New testcase.
      
      From-SVN: r260613
      Alexander Monakov committed
    • extend.texi: update Global Register Variables section · 8851a511
      	* extend.texi (Global Register Variables): Rewrite the bullet list.
      	Note that the register is available for allocation. Note that access
      	via inline asm must use constraints. Add note about async-signal
      	handlers. Remove paragraph about automagic register selection.
      
      From-SVN: r260610
      Alexander Monakov committed
    • tree-ssa-sccvn.c (vn_reference_lookup_3): Remove restriction of fixed offset from memset VN. · 52388096
      2018-05-23  Richard Biener  <rguenther@suse.de>
      
      	* tree-ssa-sccvn.c (vn_reference_lookup_3): Remove restriction
      	of fixed offset from memset VN.
      
      	* gcc.dg/tree-ssa/ssa-fre-66.c: New testcase.
      
      From-SVN: r260609
      Richard Biener committed
    • gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add first_interp field. · d71dc990
      2018-05-23  Bill Schmidt  <wschmidt@linux.ibm.com>
      
      	* 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.
      
      From-SVN: r260608
      Bill Schmidt committed
    • [AArch64] Simplify frame pointer logic · d6cb6d6a
      Simplify frame pointer logic.  Add aarch64_needs_frame_chain to
      decide when to emit the frame chain using clearer logic.
      Introduce aarch64_use_frame_pointer which contains the value of
      -fno-omit-frame-pointer (flag_omit_frame_pointer is set to a magic
      value so that the mid-end won't force the frame pointer in all
      cases, and leaf frame pointer emission can't be supported). 
      
          gcc/
      	* config/aarch64/aarch64.c (aarch64_use_frame_pointer):
      	Add new boolean.
      	(aarch64_needs_frame_chain): New function.
      	(aarch64_parse_override_string): Set aarch64_use_frame_pointer.
      
      From-SVN: r260606
      Wilco Dijkstra committed
    • [AArch64][PR target/84882] Add mno-strict-align · 675d044c
      *** gcc/ChangeLog ***
      
      2018-05-23  Sudakshina Das  <sudi.das@arm.com>
      
      	PR target/84882
      	* common/config/aarch64/aarch64-common.c (aarch64_handle_option):
      	Check val before adding MASK_STRICT_ALIGN to opts->x_target_flags.
      	* config/aarch64/aarch64.opt (mstrict-align): Remove RejectNegative.
      	* config/aarch64/aarch64.c (aarch64_attributes): Mark allow_neg
      	as true for strict-align.
      	(aarch64_can_inline_p): Perform checks even when callee has no
      	attributes to check for strict alignment.
      	* doc/extend.texi (AArch64 Function Attributes): Document
      	no-strict-align.
      	* doc/invoke.texi: (AArch64 Options): Likewise.
      
      *** gcc/testsuite/ChangeLog ***
      
      2018-05-23  Sudakshina Das  <sudi.das@arm.com>
      
      	PR target/84882
      	* gcc.target/aarch64/pr84882.c: New test.
      	* gcc.target/aarch64/target_attr_18.c: Likewise.
      
      From-SVN: r260604
      Sudakshina Das committed
    • x86: libatomic: Do not assume ELF constructors run before IFUNC resolvers · cb3c90cc
      	PR libgcc/60790
      	x86: Do not assume ELF constructors run before IFUNC resolvers.
      	* config/x86/host-config.h (libat_feat1_ecx, libat_feat1_edx):
      	Remove declarations.
      	(__libat_feat1, __libat_feat1_init): Declare.
      	(FEAT1_REGISTER): Define.
      	(load_feat1): New function.
      	(IFUNC_COND_1): Adjust.
      	* config/x86/init.c (libat_feat1_ecx, libat_feat1_edx)
      	(init_cpuid): Remove definitions.
      	(__libat_feat1): New variable.
      	(__libat_feat1_init): New function.
      
      From-SVN: r260603
      Florian Weimer committed
    • Fix SLP def type when computing masks (PR85853) · 15944069
      In this PR, SLP failed to include a comparison node in the SLP
      tree and so marked the node as external.  It then went on to call
      vect_is_simple_use on the comparison with its STMT_VINFO_DEF_TYPE
      still claiming that it was an internal definition.
      
      We already avoid that for vect_analyze_stmt by temporarily copying
      the node's definition type to each STMT_VINFO_DEF_TYPE.  This patch
      extends that to the vector type calculation.  The easiest thing
      seemed to be to split the analysis of the root node out into
      a subroutine, so that it's possible to return false early without
      awkward control flow.
      
      2018-05-23  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	PR tree-optimization/85853
      	* tree-vect-slp.c (vect_slp_analyze_node_operations): Split out
      	the handling of the root of the node to...
      	(vect_slp_analyze_node_operations_1): ...this new function,
      	and run the whole thing with the child nodes' def types
      	set according to their SLP node's def type.
      
      gcc/testsuite/
      	PR tree-optimization/85853
      	* gfortran.dg/vect/pr85853.f90: New test.
      
      From-SVN: r260601
      Richard Sandiford committed
    • [Ada] Minor reformattings · 162ea0d3
      2018-05-23  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_disp.adb, freeze.adb, gnat1drv.adb, sem_ch5.adb, sem_spark.adb:
      	Minor reformattings.
      
      From-SVN: r260600
      Hristian Kirtchev committed
    • [Ada] Fix memory leak in win32_wait error handling · cd742f4a
      2018-05-23  Pascal Obry  <obry@adacore.com>
      
      gcc/ada/
      
      	* adaint.c (win32_wait): Properly free the handle/pid lists when
      	WaitForMultipleObjects fails (return WAIT_FAILED).
      
      From-SVN: r260599
      Pascal Obry committed
    • [Ada] Fix computation of handle/pid lists in win32_wait · c2d2963d
      An obvious mistake due to missing parentheses was not properly computing the
      size of the handle and pid list passed to WaitForMultipleObjects(). This
      resulted in a memory corruption.
      
      2018-05-23  Pascal Obry  <obry@adacore.com>
      
      gcc/ada/
      
      	* adaint.c (win32_wait): Add missing parentheses.
      
      From-SVN: r260598
      Pascal Obry committed
    • [Ada] Spurious Storage_Error on imported array · 7f4b58c2
      This patch moves the check which verifies that a large modular array is created
      from expansion to freezing in order to take interfacing pragmas in account. The
      check is no longer performed on imported objects because no object is created
      in that case.
      
      2018-05-23  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch3.adb (Check_Large_Modular_Array): Moved to Freeze.
      	(Expand_N_Object_Declaration): Do not check for a large modular array
      	here.
      	* freeze.adb (Check_Large_Modular_Array): Moved from Exp_Ch3.
      	(Freeze_Object_Declaration): Code cleanup. Check for a large modular
      	array.
      	* sem_ch3.adb: Minor reformatting.
      
      gcc/testsuite/
      
      	* gnat.dg/import2.adb: New testcase.
      
      From-SVN: r260597
      Hristian Kirtchev committed
    • [Ada] Spurious error on instantiation with type with unknown discriminants · ffdd5248
      This patch fixes a spurious error when instantiating an indefinite container
      with a private type with unknown discriminants, when its full view is an
      unconstrained array type. It also cleans up the inheritance of dynamic
      predicates inherited by anonymous subtypes of array types.
      
      2018-05-23  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads: New attribute on types: Predicated_Parent, to simplify the
      	retrieval of the applicable predicate function to an itype created for
      	a constrained array component.
      	* einfo.adb: Subprograms for Predicated_Parent.
      	(Predicate_Function): Use new attribute.
      	* exp_util.adb (Make_Predicate_Call): If the predicate function is not
      	available for a subtype, retrieve it from the base type, which may have
      	been frozen after the subtype declaration and not captured by the
      	subtype declaration.
      	* sem_aggr.adb (Resolve_Array_Aggregate): An Others association is
      	legal within a generated initiqlization procedure, as may happen with a
      	predicate check on a component, when the predicate function applies to
      	the base type of the component.
      	* sem_ch3.adb (Analyze_Subtype_Declaration): Clean up inheritance of
      	predicates for subtype declarations and for subtype indications in
      	other contexts.
      	(Process_Subtype): Likewise. Handle properly the case of a private type
      	with unknown discriminants whose full view is an unconstrained array.
      	Use Predicated_Parent to indicate source of predicate function on an
      	itype whose parent is itself an itype.
      	(Complete_Private_Subtype): If the private view has unknown
      	discriminants and the full view is an unconstrained array, set base
      	type of completion to the full view of parent.
      	(Inherit_Predicate_Flags): Prevent double assignment of predicate
      	function and flags.
      	(Build_Subtype): For a constrained array component, propagate predicate
      	information from original component type declaration.
      
      gcc/testsuite/
      
      	* gnat.dg/discr51.adb: New testcase.
      
      From-SVN: r260596
      Ed Schonberg committed
    • [Ada] Fix faulty preconditions for trigonometric functions · 39a4daf9
      2018-05-23  Boris Yakobowski  <yakobowski@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-ngelfu.ads (Arctanh, Arccoth): Fix faulty preconditions.
      
      From-SVN: r260595
      Boris Yakobowski committed
    • [Ada] Fix various defects found by static analysis · bc3fb397
      2018-05-23  Arnaud Charlet  <charlet@adacore.com>
      
      gcc/ada/
      
      	* checks.adb (Minimize_Eliminate_Overflows): Default initialize Lo and
      	Hi.
      	* sem_elab.adb: Make "out" parameters instead of "in out" when
      	relevant.
      
      From-SVN: r260594
      Arnaud Charlet committed
    • [Ada] gnatbind: do not list No_Implementation_Restrictions · b77c24b8
      When the gnatbind -r switch is used, do not list
      No_Implementation_Restrictions, because after using the new restriction list,
      No_Implementation_Restrictions will cause an error.
      
      2018-05-23  Bob Duff  <duff@adacore.com>
      
      gcc/ada/
      
      	* gnatbind.adb (List_Applicable_Restrictions): Add
      	No_Implementation_Restrictions to the list of restrictions not to list.
      	Remove double negative "not No_Restriction_List".  Comment the
      	commentary that is output, so it won't cause errors if used directly in
      	a gnat.adc.
      
      From-SVN: r260593
      Bob Duff committed
    • [Ada] Implementation of AI12-0131: legality of class-wide precondition · b30f86de
      This patch refines the legality check on a class-wide precondition on a type
      extension when ancestor does not have a class-wide precondition. Previously the
      compiler accepted such a precondition when the ancestor had a class-wide
      postcondition.
      
      Compiling pck.ads must yield:
      
        pck.ads:7:04: illegal class-wide precondition on overriding operation
      
      ----
      package Pck is
         type Parent is tagged null record;
         procedure Init (P : Parent) with Post'Class => True;
      
         type Child is new Parent with null record;
         overriding procedure Init (C : Child) with
         Pre'Class => True;
      end Pck;
      
      2018-05-23  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_prag.adb (Inherit_Class_Wide_Pre): Refine legality check on
      	class-wide precondition on a type extension when ancestor does not have
      	a class-wide precondition.  Previously the compiler accepted such a
      	precondition when the ancestor had a class-wide postcondition.
      
      From-SVN: r260592
      Ed Schonberg committed
    • [Ada] Crash processing Valid_Scalars whose evaluation is always true · 026733d8
      The compiler blows up generating code associated with occurrences of attribute
      Valid_Scalars whose evaluation is always true. After this patch the following
      test compiles fine.
      
      2018-05-23  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* sem_attr.adb (Valid_Scalars): Do not invoke Error_Attr_P to report
      	the warning on occurrences of this attribute whose evaluation is always
      	true (since that subprogram aborts processing the attribute). In
      	addition, replace the node by its boolean result 'True' (required
      	because the backend has no knowledge of this attribute).
      
      gcc/testsuite/
      
      	* gnat.dg/valid_scalars1.adb: New testcase.
      
      From-SVN: r260591
      Javier Miranda committed
    • [Ada] Vectors: spurious error in -gnatwE mode · aeaa0347
      This patch fixes a bug in which if Ada.Containers.Vectors is instantiated with
      an Index_Type such that Index_Type'Base'Last is less than Count_Type'Last, and
      the -gnatwE switch is used, the compiler gives spurious error messages.
      
      The following test should compile quietly with -gnatwE:
      
      gnatmake short_vectors.ads -gnatwa -gnatwE -gnatf
      
      with Ada.Containers.Vectors;
      package Short_Vectors is
      
         type Index_Type is range 1 .. 256;
      
         package Map_Pkg is new Ada.Containers.Vectors
           (Index_Type => Index_Type,
            Element_Type => Integer);
      
      end Short_Vectors;
      
      2018-05-23  Bob Duff  <duff@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-convec.adb: (Insert, Insert_Space): Suppress warnings. The
      	code in question is not reachable in the case where Count_Type'Last is
      	out of range.
      
      From-SVN: r260590
      Bob Duff committed
    • [Ada] Clarify meaning of local pragma Warnings Off without On · 5e1c231e
      A local use of pragma Warnings Off to suppress specific messages, when
      not followed by a matching pragma Warnings On, extends until the end of
      the file.
      
      2018-05-23  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* doc/gnat_rm/implementation_defined_pragmas.rst: Clarify meaning of
      	local pragma Warnings Off without On.
      	* gnat_rm.texi: Regenerate.
      
      From-SVN: r260589
      Yannick Moy committed