1. 25 May, 2018 6 commits
    • Support SHF_EXCLUDE on non-x86 and with Solaris as · f8d70404
      	* configure.ac (gcc_cv_as_section_has_e): Move to common section.
      	Rename to...
      	(gcc_cv_as_section_exclude): ... this.
      	Try Solaris as #exclude syntax.
      	* configure: Regenerate.
      	* config.in: Regenerate.
      	* config/i386/i386.c (i386_solaris_elf_named_section): Handle
      	SECTION_EXCLUDE.
      	* config/sparc/sparc.c (sparc_solaris_elf_asm_named_section)
      	[HAVE_GAS_SECTION_EXCLUDE]: Handle SECTION_EXCLUDE.
      
      	* varasm.c (default_elf_asm_named_section): Don't check if
      	HAVE_GAS_SECTION_EXCLUDE is defined.
      
      From-SVN: r260708
      Rainer Orth committed
    • Add an "else" argument to IFN_COND_* functions · 9d4ac06e
      As suggested by Richard B, this patch changes the IFN_COND_*
      functions so that they take the else value of the ?: operation
      as a final argument, rather than always using argument 1.
      
      All current callers will still use the equivalent of argument 1,
      so this patch makes the SVE code assert that for now.  Later patches
      add the general case.
      
      2018-05-25  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* doc/md.texi: Update the documentation of the cond_* optabs
      	to mention the new final operand.  Fix GET_MODE_NUNITS call.
      	Describe the scalar case too.
      	* internal-fn.def (IFN_EXTRACT_LAST): Change type to fold_left.
      	* internal-fn.c (expand_cond_unary_optab_fn): Expect 3 operands
      	instead of 2.
      	(expand_cond_binary_optab_fn): Expect 4 operands instead of 3.
      	(get_conditional_internal_fn): Update comment.
      	* tree-vect-loop.c (vectorizable_reduction): Pass the original
      	accumulator value as a final argument to conditional functions.
      	* config/aarch64/aarch64-sve.md (cond_<optab><mode>): Turn into
      	a define_expand and add an "else" operand.  Assert for now that
      	the else operand is equal to operand 2.  Use SVE_INT_BINARY and
      	SVE_COND_FP_BINARY instead of SVE_COND_INT_OP and SVE_COND_FP_OP.
      	(*cond_<optab><mode>): New patterns.
      	* config/aarch64/iterators.md (UNSPEC_COND_SMAX, UNSPEC_COND_UMAX)
      	(UNSPEC_COND_SMIN, UNSPEC_COND_UMIN, UNSPEC_COND_AND, UNSPEC_COND_ORR)
      	(UNSPEC_COND_EOR): Delete.
      	(optab): Remove associated mappings.
      	(SVE_INT_BINARY): New code iterator.
      	(sve_int_op): Remove int attribute and add "minus" to the code
      	attribute.
      	(SVE_COND_INT_OP): Delete.
      	(SVE_COND_FP_OP): Rename to...
      	(SVE_COND_FP_BINARY): ...this.
      
      From-SVN: r260707
      Richard Sandiford committed
    • Try harder to preserve operand ties in maybe_legitimize_operands · b883fc9b
      maybe_legitimize_operands normally goes through each operand in turn
      and legitimises it in isolation.  For example, if two operands to
      an instruction initially have constant value C, and the instruction
      requires both operands to be registers, the function ends up forcing
      C into a register twice and passing two different registers to the
      instruction.
      
      I think we should try a bit harder to preserve the rtx_equal_p
      property, if it's easy to do.  Some targets can optimise that
      case better than they would the general case of all operands
      being different.  This is particularly true for SVE after the
      upcoming changes to the IFN_COND_* routines.
      
      This is hard to test on its own, but is covered by the upcoming
      IFN_COND_* patches.
      
      2018-05-25  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* optabs.c (can_reuse_operands_p): New function.
      	(maybe_legitimize_operands): Try to reuse the results for
      	earlier operands.
      
      From-SVN: r260706
      Richard Sandiford committed
    • re PR fortran/85839 ([F2018] warn for obsolescent features) · 9143aa52
      2018-05-25  Janus Weil  <janus@gcc.gnu.org>
      
      	PR fortran/85839
      	* match.c (gfc_match_block_data): Call gfc_notify_std to warn about
      	an obsolescent feature in Fortran 2018.
      	(gfc_match_equivalence): Ditto.
      	* resolve.c (resolve_common_blocks): Ditto.
      	(gfc_resolve_forall): Ditto.
      	* symbol.c (gfc_define_st_label): Ditto.
      
      
      2018-05-25  Janus Weil  <janus@gcc.gnu.org>
      
      	PR fortran/85839
      	* gfortran.dg/f2018_obs.f90: New test case.
      
      From-SVN: r260705
      Janus Weil committed
    • re PR fortran/85543 (ICE in update_current_proc_array_outer_dependency, at fortran/resolve.c:3060) · 55157d5e
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85543
      	* resolve.c (update_current_proc_array_outer_dependency): Avoid NULL
      	pointer dereference.
      
      
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85543
      	* gfortran.dg/pr85543.f90: New test.
      
      From-SVN: r260704
      Steven G. Kargl committed
    • Daily bump. · afb4d6a8
      From-SVN: r260703
      GCC Administrator committed
  2. 24 May, 2018 34 commits
    • re PR fortran/85780 (ICE in resolve_fl_procedure, at fortran/resolve.c:12504) · 67b8d50c
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85780
      	* resolve.c (resolve_fl_procedure): Avoid NULL dereference.
      
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85780
      	* gfortran.dg/pr85780.f90: New test.
      
      From-SVN: r260698
      Steven G. Kargl committed
    • re PR fortran/85779 (ICE in gfc_typename, at fortran/misc.c:156) · 1072bff8
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85779
      	* decl.c (gfc_match_derived_decl): Fix NULL point dereference.
      
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85779
      	* gfortran.dg/pr85779_1.f90: New test.
      	* gfortran.dg/pr85779_2.f90: Ditto.
      	* gfortran.dg/pr85779_3.f90: Ditto.
      
      From-SVN: r260697
      Steven G. Kargl committed
    • re PR fortran/85895 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3518) · 8909fee2
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85895
      	* resolve.c (resolve_sync): Resolve expression before checking for
      	an error.
      
      2018-05-24  Steven G. Kargl  <kargl@gcc.gnu.org>
      
      	PR fortran/85895
      
      	* gfortran.dg/coarray_3.f90: Fix invalid testcase.
      	* gfortran.dg/pr85895.f90: New test.
      
      From-SVN: r260696
      Steven G. Kargl committed
    • * dwarf2.def (DW_FORM_strx*, DW_FORM_addrx*): New. · 91294f1e
      From-SVN: r260695
      Tom Rix committed
    • sse.md (cvtusi2<ssescalarmodesuffix>64<round_name>): Add {q} suffix to insn mnemonic. · b0eb19e7
      	* config/i386/sse.md (cvtusi2<ssescalarmodesuffix>64<round_name>):
      	Add {q} suffix to insn mnemonic.
      
      testsuite/Changelog:
      
      	* gcc.target/i386/avx512f-vcvtusi2sd64-1.c: Update scan string.
      	* gcc.target/i386/avx512f-vcvtusi2ss64-1.c: Ditto.
      
      From-SVN: r260691
      Uros Bizjak committed
    • msp430.c (TARGET_WARN_FUNC_RETURN): Define. · 1d0d518e
      	* config/msp430/msp430.c (TARGET_WARN_FUNC_RETURN): Define.
      	(msp430_warn_func_return): New.
      
      From-SVN: r260690
      Jozef Lawrynowicz committed
    • fold-const.c (tree_nonzero_bits): New function. · ba6557e2
              * fold-const.c (tree_nonzero_bits): New function.
              * fold-const.h (tree_nonzero_bits): Likewise.
              * match.pd (POPCOUNT): New patterns to fold BUILTIN_POPCOUNT and
              friends.  POPCOUNT(x&1) => x&1, POPCOUNT(x)==0 => x==0, etc.
      
              * gcc.dg/fold-popcount-1.c: New testcase.
              * gcc.dg/fold-popcount-2.c: New testcase.
              * gcc.dg/fold-popcount-3.c: New testcase.
              * gcc.dg/fold-popcount-4.c: New testcase.
      
      From-SVN: r260689
      Roger Sayle committed
    • PR c++/85842 - -Wreturn-type, constexpr if and generic lambda. · 520fe2e3
      	* pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
      	generic lambda.
      
      From-SVN: r260685
      Jason Merrill committed
    • libsanitizer: Use pre-computed size of struct ustat for Linux · 71b55d45
      Cherry-pick compiler-rt revision 333213:
      
      <sys/ustat.h> has been removed from glibc 2.28 by:
      
      commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
      Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
      Date:   Sun Mar 18 11:28:59 2018 +0800
      
          Deprecate ustat syscall interface
      
      This patch uses pre-computed size of struct ustat for Linux.
      
      	PR sanitizer/85835
      	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
      	include <sys/ustat.h> for Linux.
      	(SIZEOF_STRUCT_USTAT): New.
      	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.
      
      From-SVN: r260684
      H.J. Lu committed
    • Check ifunc_resolver only on FUNCTION_DECL · e935be36
      Since ifunc_resolver is only valid on FUNCTION_DECL, check ifunc_resolver
      only on FUNCTION_DECL.
      
      	PR target/85900
      	PR target/85345
      	* varasm.c (assemble_alias): Check ifunc_resolver only on
      	FUNCTION_DECL.
      
      From-SVN: r260683
      H.J. Lu committed
    • Pedwarn on a non-standard position of a C++ attribute. · 9635923d
      From-SVN: r260682
      Ville Voutilainen committed
    • re PR target/85903 (FAIL: gcc.target/i386/avx512dq-vcvtuqq2pd-2.c) · fd657f1a
      	PR target/85903
      	* config/i386/sse.md (movdi_to_sse): Do not generate pseudo
      	when memory input operand is handled.
      
      From-SVN: r260681
      Uros Bizjak committed
    • PR target/85904 check for aligned_alloc on netbsd cross-compilation · 95c921d1
      2018-05-24  Maya Rashish  <coypu@sdf.org>
      
      	PR target/85904
      	* crossconfig.m4: Test for aligned_alloc on netbsd.
      	* configure: Regenerate.
      
      From-SVN: r260678
      Maya Rashish committed
    • cp-tree.h (INDIRECT_TYPE_P): New. · 71a93b08
      2018-05-24  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	* cp-tree.h (INDIRECT_TYPE_P): New.
      	* call.c (build_trivial_dtor_call, maybe_warn_class_memaccess,
      	joust): Use it instead of POINTER_TYPE_P.
      	* class.c (update_vtable_entry_for_fn, find_flexarrays,
      	* fixed_type_or_null, resolves_to_fixed_type_p): Likewise.
      	* constexpr.c (cxx_eval_binary_expression, cxx_fold_indirect_ref,
      	* cxx_eval_increment_expression, potential_constant_expression_1):
      	Likewise.
      	* cp-gimplify.c (cp_gimplify_expr, cp_genericize_r): Likewise.
      	* cp-objcp-common.c (cxx_get_alias_set): Likewise.
      	* cp-ubsan.c (cp_ubsan_maybe_instrument_member_call,
      	cp_ubsan_maybe_instrument_downcast): Likewise.
      	* cvt.c (cp_convert_to_pointer, ocp_convert,
      	cp_get_fndecl_from_callee, maybe_warn_nodiscard, convert): Likewise.
      	* cxx-pretty-print.c (cxx_pretty_printer::abstract_declarator,
      	pp_cxx_offsetof_expression_1): Likewise.
      	* decl.c (grokparms, static_fn_type): Likewise.
      	* decl2.c (grokbitfield): Likewise.
      	* error.c (dump_expr): Likewise.
      	* except.c (initialize_handler_parm, check_noexcept_r): Likewise.
      	* init.c (warn_placement_new_too_small): Likewise.
      	* lambda.c (build_capture_proxy, add_capture): Likewise.
      	* parser.c (cp_parser_omp_for_loop): Likewise.
      	* pt.c (convert_nontype_argument, fn_type_unification,
      	uses_deducible_template_parms, check_cv_quals_for_unify,
      	dependent_type_p_r): Likewise.
      	* search.c (check_final_overrider): Likewise.
      	* semantics.c (handle_omp_array_sections, finish_omp_clauses,
      	finish_omp_for): Likewise.
      	* tree.c (cp_build_qualified_type_real): Likewise.
      	* typeck.c (build_class_member_access_expr,
      	finish_class_member_access_expr, build_x_indirect_ref,
      	cp_build_indirect_ref_1, cp_build_binary_op, build_const_cast_1):
      	Likewise.
      
      From-SVN: r260677
      Paolo Carlini committed
    • Implement P0558R2 changes to std::atomic · 25999a11
      The restrictions forbidding arithmetic on atomic pointer types are only
      enabled for C++17 and later, retaining the GNU extension for older
      standards. The new nested typedefs and changes to prevent scalar
      parameters participating in template argument deduction are enabled
      unconditionally.
      
      	PR libstdc++/69769
      	PR libstdc++/85886
      	* include/bits/atomic_base.h (__atomic_base::value_type)
      	(__atomic_base::difference_type): Add new typedefs.
      	* include/std/atomic (atomic<bool>::value_type, atomic<T>::value_type)
      	(atomic<T*>::value_type, atomic<T*>::difference_type): Likewise.
      	(atomic<T*>::operator++, atomic<T*>::operator--)
      	(atomic<T*>::operator+=, atomic<T*>::operator-=)
      	(atomic<T*>::fetch_add, atomic<T*>::fetch_sub): Add static assertion
      	to enforce C++17 requirement on pointer arithmetic.
      	(__atomic_val_t, __atomic_diff_t): New alias templates.
      	(atomic_init, atomic_store_explicit, atomic_exchange_explicit)
      	(atomic_compare_exchange_weak_explicit)
      	(atomic_compare_exchange_strong_explicit, atomic_store)
      	(atomic_exchange, atomic_compare_exchange_weak)
      	(atomic_compare_exchange_strong): Use __atomic_val_t to make
      	scalar parameters be non-deduced contexts.
      	(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
      	(atomic_fetch_add, atomic_fetch_sub): Change first parameter to be
      	atomic instead of __atomic_base, and use __atomic_diff_t for scalar
      	parameters.
      	(atomic_fetch_and_explicit, atomic_fetch_or_explicit)
      	(atomic_fetch_xor_explicit, atomic_fetch_and, atomic_fetch_or)
      	(atomic_fetch_xor): Use __atomic_val_t for scalar parameters.
      	(atomic_fetch_add_explicit, atomic_fetch_sub_explicit)
      	(atomic_fetch_add, atomic_fetch_sub): Remove overloads for atomic
      	address types.
      	* testsuite/29_atomics/atomic/60695.cc: Adjust dg-error lineno.
      	* testsuite/29_atomics/atomic/69769.cc: New test.
      	* testsuite/29_atomics/atomic/nonmembers.cc: New test.
      	* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
      	Disable test for C++17 and later.
      	* testsuite/29_atomics/atomic/requirements/typedefs.cc: New test.
      	* testsuite/29_atomics/atomic_integral/nonmembers.cc: New test.
      	* testsuite/29_atomics/atomic_integral/requirements/typedefs.cc: New
      	test.
      
      From-SVN: r260676
      Jonathan Wakely committed
    • [AArch64, Falkor] Falkor address costs tuning · 8d39ea2f
      Switch from using generic address costs to using Falkor-specific ones, which
      give Falkor better results overall.
      
      gcc/ChangeLog:
      
      2018-05-24  Luis Machado  <luis.machado@linaro.org>
      
      	* config/aarch64/aarch64.c (qdf24xx_addrcost_table): New static
      	global.
      	(qdf24xx_tunings) <addr_costs>: Set to qdf24xx_addrcost_table.
      
      From-SVN: r260675
      Luis Machado committed
    • PR c++/85864 - literal template and default template arg. · 1268ecc2
      	* pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
      
      From-SVN: r260672
      Jason Merrill committed
    • re PR c++/85847 (unexpected expression of kind template_id_expr) · ea219e6e
      	PR c++/85847
      	* init.c (build_new_1): Use fold_non_dependent_expr.  Use a dedicated
      	variable for its result.  Fix a condition.
      	(build_new): Use fold_non_dependent_expr.  Tweak a condition.
      
      	* g++.dg/cpp0x/new3.C: New test.
      
      From-SVN: r260671
      Marek Polacek committed
    • [Ada] Simplify routines with a local Result variable · 672dfc39
      Local variable Result that is modified inside IF statements makes a seemingly
      trivial code slightly hard to understand. This patch rewrites such a pattern.
      
      Semantics unaffected.
      
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* sem_elab.adb (Non_Private_View): Simplify by removing a local Result
      	variable.
      	* sem_prag.adb (Get_Base_Subprogram): Same as above.
      
      From-SVN: r260670
      Piotr Trojanek committed
    • [Ada] Fix irregular output with -gnatR3 · 63a329f8
      This fixes a long-standing quirk present in the layout information for record
      types displayed by the -gnatR3 switch: when a component has a variable
      (starting) position, its corresponding line in the output has an irregular and
      awkward format.  After this change, the format is the same as in all the other
      cases.
      
      For the following record:
      
          type R (m : natural) is record
              s : string (1 .. m);
              r : natural;
              b : boolean;
          end record;
          for R'alignment use 4;
          pragma Pack (R);
      
      the output of -gnatR3 used to be:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at bit offset (((#1 + 4) * 8)) size in bits = 31
         b at bit offset ((((#1 + 7) * 8) + 7)) size in bits = 1
      end record;
      
      and is changed into:
      
      for R'Object_Size use 17179869248;
      for R'Value_Size use ((#1 + 8) * 8);
      for R'Alignment use 4;
      for R use record
         m at  0 range  0 .. 30;
         s at  4 range  0 .. ((#1 * 8)) - 1;
         r at (#1 + 4) range  0 .. 30;
         b at (#1 + 7) range  7 ..  7;
      end record;
      
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* fe.h (Set_Normalized_First_Bit): Declare.
      	(Set_Normalized_Position): Likewise.
      	* repinfo.adb (List_Record_Layout): Do not use irregular output for a
      	variable position.  Fix minor spacing issue.
      	* gcc-interface/decl.c (annotate_rep): If a field has a variable
      	offset, compute the normalized position and annotate it in addition to
      	the bit offset.
      
      From-SVN: r260669
      Eric Botcazou committed
    • [Ada] Minor clean-ups in gigi · 736e16ef
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu):
      	Constify and rename variables.  Fix formatting.
      	(gnat_to_gnu) <N_Exception_Handler>: Minor tweak.
      	<N_Raise_Statement>: Likewise.
      
      From-SVN: r260668
      Eric Botcazou committed
    • [Ada] Wrong renaming of variant record equality · 01243764
      For a renaming of the equality operator of a variant record the compiler
      erroneously generates code that compares all the record component (thus
      computing wrong results).
      
      After this patch the following test provides the correct results.
      
      package Types is
         type Data (Bool : Boolean := False) is record
            case Bool is
               when False =>
                  null;
      
               when True =>
                  Val1 : Integer range 0 .. 2 ** 23 - 1;
                  Val2 : Float;
            end case;
         end record;
      
         function IsEqual (Left, Right : Data) return Boolean renames "=";
      end Types;
      
      with Types;
      with Ada.Text_IO;
      procedure Main is
         A : Types.Data := Types.Data'(Bool => True,
                                       Val1 => 16#05A5A5#,
                                       Val2 => 999999999.0);
      
         B : Types.Data := Types.Data'(Bool => True,
                                       Val1 => 16#0A5A5A#,
                                       Val2 => 6666666666.0);
         use type Types.Data;
      begin
         A := (Bool => False);             --  Test
         B := (Bool => False);             --  Test
      
         if Types.IsEqual (A, B) then      --  Test
            Ada.Text_IO.Put_Line ("OK");
         else
            Ada.Text_IO.Put_Line ("ERROR");
         end if;
      end Main;
      
      Command: gnatmake main; ./main
       Output: OK
      
      2018-05-24  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* exp_ch8.adb (Build_Body_For_Renaming): Adding support to build the
      	body of a variant record equality renaming.
      	(Expand_N_Subprogram_Renaming_Declaration): Adapt the code to the new
      	implementation of Build_Body_For_Renaming.
      	* exp_ch3.ads (Build_Variant_Record_Equality): New library level
      	function that factorizes the functionality needed by
      	Build_Body_For_Renaming and Expand_Freeze_Record_Type to build the body
      	of a variant record equality subprogram.
      	* exp_ch3.adb (Build_Variant_Record_Equality): New subprogram.
      	(Build_Variant_Record_Equality): New local procedure of
      	Expand_Freeze_Record_Type containing all the code specific for freezing
      	the record type that cannot be place in the new library level function.
      
      From-SVN: r260667
      Javier Miranda committed
    • [Ada] Add a new Is_Activation_Record flag on IN parameters · 7037d2bb
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads, einfo.adb (Is_Activation_Record): New flag on
      	in_parameters, used when unesting subprograms for LLVM, to indicate
      	that a generated parameter carries the activation record from the
      	enclosing subprogram.
      	* exp_unst.adb (Check_Static_Type): Handle array attributes of types
      	whose bounds may contain up-level references that need to be added to
      	an activation recoord.
      	(Add_Extra_Formal): Set Is_Activation_Record on new formal.
      
      From-SVN: r260666
      Ed Schonberg committed
    • [Ada] Improve GNATprove messages on unproved checks · d72ba19f
      GNATprove messages may point out to part of an assertion as not being proved,
      and in such a case it displays the sub-expression. This code relies on
      Pprint.Expression_Image, which is improved here to display better some kinds of
      expressions.
      
      There is no impact on compilation.
      
      2018-05-24  Yannick Moy  <moy@adacore.com>
      
      gcc/ada/
      
      	* pprint.adb (Expression_Image): Improve the printing of expressions,
      	by taking more cases into account, in particular qualified expressions
      	and aggregates.  Also count more the number of parentheses to close
      	after the expression.
      
      From-SVN: r260665
      Yannick Moy committed
    • [Ada] Missing error on illegal access to discriminant · 24e95966
      The compiler does not report an error on the illegal access to a renamed
      discriminant when the actual object is a parameter of a subprogram.
      
      2018-05-24  Javier Miranda  <miranda@adacore.com>
      
      gcc/ada/
      
      	* sem_ch3.adb (Is_Visible_Component): For untagged types add missing
      	check for renamed discriminants.
      	* sem_ch4.adb (Analyze_Overloaded_Selected_Component,
      	Analyze_Selected_Component, Check_Misspelled_Selector): For calls to
      	Is_Visible_Component pass the associated selector node to allow
      	checking renamed discriminants on untagged types.
      
      gcc/testsuite/
      
      	* gnat.dg/discr52.adb: New testcase.
      
      From-SVN: r260664
      Javier Miranda committed
    • [Ada] Infinite loop in the compiler when warning on redundant constructs · 5a5925ee
      This patch fixes an infinite loop in the compiler when warnings on redundant
      constructs are enabled (-gnatwr) and the constructs are use_type clauses
      that appear (redundantly) in a parent unit and a child unit.
      
      The following command:
      
         gcc -c -gnatwr root-child.ads
      
      must yield:
      
         root-child.ads:2:01: warning: "Pack.Typ" is already use-visible through
         previous use_type_clause at root.ads:2
      
      The following must compile quietly:
      
         gcc -c -gnatwr root-child-grand.ads
      
      ----
      package Pack is
        type Typ is new Integer;
      end Pack;
      ----
      with Pack;
      use type Pack.Typ;
      package Root is
        Thing1 : Pack.Typ;
      end Root;
      ----
      with pack;
      use type pack.typ;
      package Root.Child is
        Thing2 : Pack.Typ := Root.Thing1 * 3;
      end;
      ----
      with Pack;
      use type Pack.Typ;
      package Root.Child.Grand is
        Thing3 : Pack.Typ := Thing1 + Thing2;
      end;
      
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* sem_ch8.adb (Analyze_Use_Type): Do not assign the Prev_Use_Clause
      	link to a use_type clause if this would cause an infinite loop in the
      	machinery that detects redundant use clauses. This may happen when the
      	redundant clauses appear in the context of a child unit and the context
      	of its parent.
      
      From-SVN: r260663
      Ed Schonberg committed
    • [Ada] Minor fix grammar in comment of N_Defining_Identifier · e15bbd5f
      2018-05-24  Piotr Trojanek  <trojanek@adacore.com>
      
      gcc/ada/
      
      	* sinfo.ads: Fix grammar in comment.
      
      From-SVN: r260662
      Piotr Trojanek committed
    • [Ada] Quadratic compile time with tagged types · 3f6d1daa
      This patch is an incremental commit which focuses on the optimization of entity
      chain navigation by adding an additional field (Prev_Entity) to all nodes in
      order to greaty speed up compilation of sources making heavy use of tagged
      derivations by effectly making the entity chain from a singly-linked list into
      a doubly-linked one.
      
      This is only a performance improvement: no compilation result change
      expected.
      
      2018-05-24  Justin Squirek  <squirek@adacore.com>
      
      gcc/ada/
      
      	* einfo.ads, einfo.adb (Append_Entity): Modified to use Link_Entities
      	and manage doubly-linked entity chain.
      	(Nested_Scenarios): Removed entity field used for optimization during
      	 elaboration to make room for the new field Prev_Entity.
      	(Link_Entities): Added to replace redundant calls to Set_Next_Entity
      	and Set_Prev_Entity as well as centralize changes to the entity chain.
      	(Predicated_Parent): Modified to use Node38.
      	(Prev_Entity): Added to fetch new node field Prev_Entity in all entity
      	types.
      	(Remove_Entity): Moved from sem_util.
      	(Set_Nested_Scenarios): Deleted.
      	(Set_Predicated_Parent): Modified to use Node38.
      	(Set_Prev_Entity): Added to set Prev_Entity field.
      	(Set_Validated_Object): Modified to use Node38.
      	(Unlink_Next_Entity): Added to process Prev_Entity when an unlinking
      	action is required.
      	(Validated_Object): Modified to use Node38.
      	(Write_Field36_Name): Remove Nested_Scenarios, Validated_Object, and
      	predicated parent cases.
      	(Write_Field38_Name): Add predicated parent and Validated_Object cases.
      	* sem_ch3.adb (Process_Subtype): Add guard to protect against
      	inappropriate marking of Predicated_Parent to non-itype subtypes.
      	(Make_Class_Wide_Type): Preserve Prev_Entity field and set in new type.
      	(Copy_And_Swap): Add setting of Prev_Entity.
      	(Build_derived_Record_Type): Replace Set_Next_Entity w/ Link_Entities.
      	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Replace Set_Next_Entity
      	w/ Link_Entities.
      	(New_Overloaded_Entity): Remove block created to search for previous
      	entities in the entity chain with relevant calls to Prev_Entity as well
      	as replace duplicated code from Remove_Entity_And_Homonym with a call
      	to that subprogram.
      	* sem_ch7.adb (Exchange_Declarations): Replace Set_Next_Entity w/
      	Link_Entities.
      	* sem_elab.adb (Find_And_Process_Nested_Scenarios): Remove global and
      	initial subprogram declarations related to Nested_Scenarios.
      	(Process_Nested_Scenarios): Deleted.
      	(Save_Scenario): Deleted.
      	(Traverse_Body): Remove optimization for Nested_Scenarios so as to free
      	node space in the entity tree.
      	* sem_util.adb, sem_util.ads (Remove_Entity): Moved to einfo.
      	(Remove_Entity_And_Homonym): Added to separate functionality of
      	Remove_Entity from the homonym chain directly.
      	* exp_attr.adb (Expand_N_Attribute_Reference): Replace Set_Next_Entity
      	w/ Link_Entities and Unlink_Next_Entity.
      	* exp_ch3.adb (Expand_N_Object_Declaration): Replace Set_Next_Entity w/
      	Link_Entities.
      	* exp_ch6.adb (Replace_Renaming_Declaration_Id): Replace
      	Set_Next_Entity w/ Link_Entities.
      	* exp_disp.adb (Expand_Dispatching_Call): Replace Set_Next_Entity w/
      	Link_Entities and Unlink_Next_Entity.
      	* exp_spark.adb (Expand_SPARK_N_Object_Renaming_Declaration): Replace
      	call to Remove_Entity with its new incarnation.
      	* exp_util.adb (New_Class_Wide_Subtype): Add setting of Prev_Entity.
      	* freeze.adb (Freeze_Record_Type): Replace Set_Next_Entity w/
      	Link_Entities.
      
      From-SVN: r260661
      Justin Squirek committed
    • [Ada] Spurious error due to lingering limited view · dc59bed2
      This patch modifies the mechanism which manages [private] with clauses to
      uninstall a limited with clause if a non-limited with clause is given for
      the same package.
      
      The management of with clauses already prevents the installation of a limited
      with clause if the related package is already withed though a non-limited with
      clause. The timing of parent unit with clause processing is such that the non-
      limited clauses of the child unit are first installed, followed by the clauses
      of the parent. This order prevents a limited with clause from "overriding" a
      non-limited with clause.
      
      Private with clauses however break this model because they are processed when
      the private part of a package is entered. Since private with clauses are non-
      limited with clauses, they must "override" the effects of any limited clauses
      which import the same packages. This effect is now correctly achieved by
      uninstalling the limited with clauses when private with clauses are activated.
      
      ------------
      -- Source --
      ------------
      
      --  server.ads
      
      package Server is
         type Root is tagged private;
      private
         type Root is tagged null record;
      end Server;
      
      --  parent.ads
      
      limited with Server;
      
      package Parent is end Parent;
      
      --  parent-client.ads
      
      private with Server;
      
      package Parent.Client is
         type Deriv is tagged private;
      private
         type Deriv is new Server.Root with null record;
      end Parent.Client;
      
      -----------------
      -- Compilation --
      -----------------
      
      $ gcc -c parent-client.ads
      
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* sem_ch10.adb (Expand_Limited_With_Clause): Update the call to
      	Install_Limited_Withed_Unit.
      	(Expand_With_Clause): Update the call to Install_Withed_Unit.
      	(Implicit_With_On_Parent): Update the call to Install_Withed_Unit.
      	(Install_Context_Clauses): Update the call to Install_Withed_Unit.
      	(Install_Limited_Context_Clauses): Update the calls to
      	 Install_Limited_Withed_Unit.
      	(Install_Limited_Withed_Unit): Renamed to better illustrate its
      	purpose.
      	(Install_Private_With_Clauses): Update the calls to Install_Withed_Unit
      	and Install_Limited_Withed_Unit.
      	(Install_With_Clause): Uninstall a limited with clause if a [private]
      	with clause is given for the same package.
      	(Install_Withed_Unit): Renamed to better illustrate its purpose.
      	(Remove_Limited_With_Unit): New routine.
      
      From-SVN: r260660
      Hristian Kirtchev committed
    • [Ada] Handle version 2 of Windows unwinding information structures · 45c6d784
      2018-05-24  Eric Botcazou  <ebotcazou@adacore.com>
      
      gcc/ada/
      
      	* raise-gcc.c (__gnat_SEH_error_handler): Remove prototype.
      	(__gnat_personality_seh0): Adjust and beef up comments, and
      	fix formatting throughout.
      	(__gnat_adjust_context): Deal minimally with version 2.
      	* seh_init.c (__gnat_map_SEH): Fix formatting.
      	(_gnat_SEH_error_handler): Adjust comments.
      	(__gnat_install_SEH_handler): Fix formatting.
      
      From-SVN: r260659
      Eric Botcazou committed
    • [Ada] Minor reformatting · b6784d90
      2018-05-24  Hristian Kirtchev  <kirtchev@adacore.com>
      
      gcc/ada/
      
      	* exp_ch7.adb, sem_ch3.adb, sem_res.adb: Minor reformatting.
      
      From-SVN: r260658
      Hristian Kirtchev committed
    • [Ada] Add warning on redundant others_clause in array aggregate · 861e589e
      This patch adds a warning on a redundant others_clause in an array aggregate
      when all index positions are already specified in previous positional or named
      associations. The warning is emitted when Warn_On_Redundant_Constructs is
      enabled.
      
      2018-05-24  Ed Schonberg  <schonberg@adacore.com>
      
      gcc/ada/
      
      	* exp_aggr.adb (Flatten): Add a warning on an others clause in an array
      	aggregate with static bounds when named associations cover all index
      	positions and the others clause is redundant.
      
      gcc/testsuite/
      
      	* gnat.dg/others1.adb: New testcase.
      
      From-SVN: r260657
      Ed Schonberg committed
    • [Ada] Update Ada.Containers.Hashed_Maps documentation with Ada RM doc. · 0347c01b
      2018-05-24  Raphael Amiard  <amiard@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-cohama.ads: Add documentation.
      
      From-SVN: r260656
      Raphael Amiard committed
    • [Ada] Add documentation from the Ada RM to Ada.Containers.Vector · 8f1b88f8
      2018-05-24  Raphael Amiard  <amiard@adacore.com>
      
      gcc/ada/
      
      	* libgnat/a-convec.ads: Add documentation.
      
      From-SVN: r260655
      Raphael Amiard committed