2015-10-26 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Analyze_Formal_Package_Declaration): Code clean up.
* sem_ch13.adb (Check_Inherited_Indexing): New inner procedure
of Check_Indexing_Functions, to verify that a derived type with an
Indexing aspect is not inheriting such an aspect from an ancestor.
(Check_Indexing_Functions): Call Check_Inherited_Indexing within
an instance.
From-SVN: r229316
* gfortran.dg/streamio_4.f90, gfortran.dg/streamio_5.f90,
* gfortran.dg/streamio_6.f90, gfortran.dg/streamio_7.f90,
* gfortran.dg/streamio_10.f90, gfortran.dg/streamio_12.f90: Add
suffix to the temporary filename to make it unique per testcase.
From-SVN: r229315
2015-10-26 Gary Dismukes <dismukes@adacore.com>
* a-reatim.adb, contracts.adb, contracts.ads: Minor reformatting and
typo corrections.
2015-10-26 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Do not
recheck the consistency betwen the freeze point and the end of
declarations for the expression in an aspect specification,
because it was done already in the analysis of the generic.
Furthermore, the delayed analysis of an aspect of the instance
may produce spurious errors when the generic is a child unit
that references entities in the parent (which might not be in
scope at the freeze point of the instance).
2015-10-26 Yannick Moy <moy@adacore.com>
* sem_res.adb (Resolve_Call): Issue info message
instead of warning when call cannot be inlined in GNATprove mode.
2015-10-26 Arnaud Charlet <charlet@adacore.com>
* exp_ch6.adb (Build_Procedure_Form): Use _result as the
name of the extra parameter, cleaner than a random temp name.
* gnat1drv.adb (Gnat1drv): Code clean up.
From-SVN: r229314
No functional change. This should be a slight readability improvement
on its own, but becomes more important with the next patch.
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
gcc/
* match.pd: Use macros to define built-in operator lists.
From-SVN: r229310
This required reinstating support for captures in the result
of a simplification. That part (genmatch.c) is by Richard B.
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.
gcc/
2015-10-20 Richard Sandiford <richard.sandiford@arm.com>
Richard Biener <rguenther@suse.de>
* genmatch.c (dt_simplify::gen): Skip captures that are
part of the result.
(parser::parse_expr): Allow captures in results too.
* builtins.c (fold_builtin_cexp): Delete.
(fold_builtin_1): Handle constant cexp arguments here.
* match.pd: Fold cexp(x+yi) to exp(x) * cexpi(y).
Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r229308
2015-01-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67171
* trans-array.c (structure_alloc_comps): On deallocation of
class components, reset the vptr to the declared type vtable
and reset the _len field of unlimited polymorphic components.
*trans-expr.c (gfc_find_and_cut_at_last_class_ref): Bail out on
allocatable component references to the right of part reference
with non-zero rank and return NULL.
(gfc_reset_vptr): Simplify this function by using the function
gfc_get_vptr_from_expr. Return if the vptr is NULL_TREE.
(gfc_reset_len): If gfc_find_and_cut_at_last_class_ref returns
NULL return.
* trans-stmt.c (gfc_trans_allocate): Rely on the use of
gfc_trans_assignment if expr3 is a variable expression since
this deals correctly with array sections.
2015-01-25 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67171
* gfortran.dg/allocate_with_source_12.f03: New test
PR fortran/61819
* gfortran.dg/allocate_with_source_13.f03: New test
PR fortran/61830
* gfortran.dg/allocate_with_source_14.f03: New test
From-SVN: r229303
gcc/fortran/ChangeLog:
2015-10-25 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/66927
PR fortran/67044
* trans-array.c (build_array_ref): Modified call to
gfc_get_class_array_ref to adhere to new interface.
(gfc_conv_expr_descriptor): For one-based arrays that
are filled by a loop starting at one the start index of the
source array has to be mangled into the offset.
* trans-expr.c (gfc_get_class_array_ref): When the tree to get
the _data component is present already, add a way to supply it.
(gfc_copy_class_to_class): Allow to copy to a derived type also.
* trans-stmt.c (gfc_trans_allocate): Do not conv_expr_descriptor
for functions returning a class or derived object. Get the
reference instead.
* trans.h: Interface change of gfc_get_class_array_ref.
gcc/testsuite/ChangeLog:
2015-10-25 Andre Vehreschild <vehre@gmx.de>
PR fortran/66927
PR fortran/67044
* gfortran.dg/allocate_with_source_10.f08: New test.
* gfortran.dg/allocate_with_source_11.f08: New test.
* gfortran.dg/class_array_15.f03: Changed count of expected
_builtin_frees to 11. One step of temporaries is spared, therefore
the allocatable component of that temporary is not to be freeed.
From-SVN: r229294
* include/std/functional (__invoke_impl): New overloads.
(__invoke): Replace with a single function calling __invoke_impl.
(invoke): Add C++17 std::invoke.
(reference_wrapper::operator()): Qualify call to __invoke.
(_Mem_fn_traits_base, _Mem_fn_traits): Remove unused typedefs.
(_Mem_fn_base): Remove unused typedefs and implement call operator in
terms of __invoke.
* include/std/future (__future_base::_Async_state_commonV2): Do not
pass reference_wrapper as object argument to call_once.
* include/std/type_traits (result_of): Define nested __invoke_type.
Handle reference_wrapper as per LWG 2219.
* testsuite/20_util/bind/ref_neg.cc: Adjust dg-error directives.
* testsuite/20_util/function_objects/mem_fn/55463.cc: Remove tests
using member functions of reference_wrapper.
From-SVN: r229290
2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68055
* decl.c (gfc_match_decl_type_spec): Check for valid kind in old-style
declarations.
2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68055
* gfortran.dg/pr68055.f90: New case.
From-SVN: r229288
2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67805
* array.c (gfc_match_array_constructor): Check for error from type
spec matching.
* decl.c (char_len_param_value): Check for valid of charlen parameter.
Reap dead code dating to 2008.
match.c (gfc_match_type_spec): Special case the keyword use in REAL.
2015-10-24 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67805
* gfortran.dg/pr67805.f90: New testcase.
* gfortran.dg/array_constructor_26.f03: Update testcase.
* gfortran.dg/array_constructor_27.f03: Ditto.
* gfortran.dg/char_type_len_2.f90: Ditto.
* gfortran.dg/pr67802.f90: Ditto.
* gfortran.dg/used_before_typed_3.f90: Ditto.
From-SVN: r229287
DR 1518
DR 1630
PR c++/54835
PR c++/60417
* call.c (convert_like_real): Value-initialization can't use
explicit constructors in C++11 and up.
From-SVN: r229283
PR ipa/pr67600
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::get_dynamic_type): Do not confuse
instance offset with offset of outer type.
* g++.dg/torture/pr67600.C: New testcase.
From-SVN: r229279
This patch fixes a compile-time regression that was originally
introduced by the fix for PR64111, in GCC 4.9.3.
gcc/ChangeLog:
2015-10-23 Caroline Tice <cmtice@google.com>
(from Richard Biener)
* tree.c (int_cst_hasher::hash): Replace XOR with more efficient
call to iterative_hash_host_wide_int.
From-SVN: r229277
gcc/
* tree-vect-generic.c (expand_vector_operations_1): Check
optab exists before use it.
gcc/testsuite/
* g++.dg/pr68062.C: New test.
From-SVN: r229275
[PATCH] Call flush_ssaname_freelist more often
* passes.c (execute_function_todo): Do not call flush_ssaname_freelist
here. Instead...
(execute_todo): Call it here.
* tree-ssanames.c (make_ssa_name_fn): Unconditionally gather reuse
statistics
(pass_release_ssa_names::execute): Do not call flusH_ssaname_freelist.
From-SVN: r229272
PR tree-optimization/67830
* match.pd ((bit_and (plus/minus (convert @0) (convert @1)) mask)):
Explicitly verify the mask has no bits outside the type of
the innermost operands.
PR tree-optimization/67830
* gcc.dg/pr67830.c: New test.
From-SVN: r229267
2015-10-23 Steve Ellcey <sellcey@imgtec.com>
Andrew Pinski <apinski@cavium.com>
PR rtl-optimization/67736
* gcc.dg/torture/pr67736.c: New test.
* gcc.dg/combine-subregs.c: New test.
Co-Authored-By: Andrew Pinski <apinski@cavium.com>
From-SVN: r229260
2015-10-23 Steve Ellcey <sellcey@imgtec.com>
Andrew Pinski <apinski@cavium.com>
PR rtl-optimization/67736
* combine.c (simplify_comparison): Use gen_lowpart_or_truncate instead
of gen_lowpart.
Co-Authored-By: Andrew Pinski <apinski@cavium.com>
From-SVN: r229259
2015-10-23 Hristian Kirtchev <kirtchev@adacore.com>
* contracts.ads, contracts.adb: New unit.
* exp_ch6.adb Add with and use clauses for Contracts.
(Expand_Subprogram_Contract): Moved to Contracts.
* exp_ch6.ads (Expand_Subprogram_Contract): Moved to Contracts.
* sem_ch3.adb Add with and use clauses for Contracts.
(Analyze_Object_Contract): Moved to Contracts.
(Analyze_Declarations): Remove local variable Pack_Decl. Do not
capture global references in contracts. Check the hidden states
of a package body.
* sem_ch6.adb Add with and use clauses in Contracts.
(Analyze_Generic_Subprogram_Body): Do not capture global
references in contracts.
(Analyze_Subprogram_Body_Contract):
Moved to Contracts.
(Analyze_Subprogram_Body_Helper): Freeze the
contract of the nearest enclosing package body. Always analyze
the subprogram body contract. Do not expand the subprogram
body contract.
(Analyze_Subprogram_Contract): Moved to Contracts.
* sem_ch6.ads (Analyze_Subprogram_Body_Contract): Moved to Contracts.
(Analyze_Subprogram_Contract): Moved to Contracts.
* sem_ch7.adb Add with and use clauses for Contracts.
(Analyze_Package_Body_Contract): Moved to Contracts.
(Analyze_Package_Body_Helper): Freeze the contract of the
nearest enclosing package body.
(Analyze_Package_Contract): Moved to Contracts.
* sem_ch7.ads (Analyze_Package_Body_Contract): Moved to Contracts.
(Analyze_Package_Contract): Moved to Contracts.
* sem_ch10.adb Add with and use clauses for Contracts.
(Analyze_Compilation_Unit): Do not capture global references
in contracts.
(Analyze_Subprogram_Body_Stub_Contract): Moved to Contracts.
* sem_ch10.ads (Analyze_Subprogram_Body_Stub_Contract): Moved
to Contracts.
* sem_ch12.adb Add with and use clauses for Contracts.
(Analyze_Subprogram_Instantiation): Update the call to
Instantiate_Subprogram_Contract.
(Instantiate_Package_Body):
Do not copy the entity of the spec when creating an entity
for the body. Construct a brand new defining identifier for
the body and inherit the Comes_From_Source flag from the spec.
(Instantiate_Subprogram_Body): Remove Anon_Id to Act_Decl_Id
and update all occurrences. Construct a brand new defining
identifier for the body and inherit the Comes_From_Source
flag from the spec.
(Instantiate_Subprogram_Contract): Moved
to Contracts.
(Save_Global_References_In_Aspects): Moved to
the spec of Sem_Ch12.
(Save_Global_References_In_Contract):
Moved to Contracts.
* sem_ch12.ads (Save_Global_References_In_Aspects): Moved from
the body of Sem_Ch12.
(Save_Global_References_In_Contract):
Moved to Contracts.
* sem_prag.adb Add with and use clauses for Contracts.
(Add_Item): Removed. All references to this routine have been
replaced with calls to Append_New_Elmt.
(Analyze_Constituent):
Add special diagnostics for errors caused by freezing of
contracts.
(Analyze_Refined_State_In_Decl_Part): Add formal
parameter Freeze_Id. Add new global variable Freeze_Posted.
(Collect_Body_States): Removed.
(Report_Unused_States): Removed.
* sem_prag.ads (Analyze_Defined_State_In_Decl_Part): Add formal
parameter Freeze_Id and update comment on usage.
* sem_util.adb Remove with and use clauses for
Sem_Ch12.
(Add_Contract_Item): Moved to Contracts.
(Check_Unused_Body_States): New routine.
(Collect_Body_States):
New routine.
(Create_Generic_Contract): Moved to Contracts.
(Inherit_Subprogram_Contract): Moved to Contracts.
(Report_Unused_Body_States): New routine.
* sem_util.ads (Add_Contract_Item): Moved to Contracts.
(Check_Unused_Body_States): New routine.
(Collect_Body_States): New routine.
(Create_Generic_Contract): Moved to Contracts.
(Inherit_Subprogram_Contract): Moved to Contracts.
(Report_Unused_Body_States): New routine.
* sinfo.adb (Is_Expanded_Contract): New routine.
(Set_Is_Expanded_Contract): New routine.
* sinfo.ads New attribute Is_Expanded_Contract along with
placement in nodes.
(Is_Expanded_Contract): New routine along
with pragma Inline.
(Set_Is_Expanded_Contract): New routine
along with pragma Inline.
* gcc-interface/Make-lang.in: Add entry for contracts.o
2015-10-23 Bob Duff <duff@adacore.com>
* bindgen.adb, init.c, opt.ads, switch-b.adb: Implement new -Ea and
-Es switches.
* switch-b.ads: Minor comment fix.
* bindusg.adb: Document new -Ea and -Es switches.
* s-exctra.ads: Use -Es instead of -E.
From-SVN: r229253