Commit Graph

163467 Commits

Author SHA1 Message Date
Iain Sandoe
a49c064e40 Move Darwin10 unwinder fix to a crt shim.
gcc/
	* config/darwin10.h (LINK_GCC_C_SEQUENCE_SPEC): Adjust to use the
	Darwin10-specific unwinder-shim.
	* config/darwin12.h (LINK_GCC_C_SEQUENCE_SPEC): Remove.
	* config/rs6000/darwin.h (DARWIN_CRT1_SPEC, DARWIN_DYLIB1_SPEC): 
	New to cater for Darwin10 Rosetta.

libgcc/
	* config/unwind-dw2-fde-darwin.c
	(_darwin10_Unwind_FindEnclosingFunction): move from here ...
	* config/darwin10-unwind-find-enc-func.c: … to here.
	* config/t-darwin: Build Darwin10 unwinder shim crt.
	* libgcc/config.host: Add the Darwin10 unwinder shim.

From-SVN: r263765
2018-08-22 11:58:43 +00:00
Iain Sandoe
36bd86fa51 Allw for Darwin to operate with an assembler supporting gotoff in data.
gcc/

	* config/i386/i386.c (ix86_output_addr_diff_elt): Move the MACH-O
	specific test before the one for HAVE_AS_GOTOFF_IN_DATA.

From-SVN: r263764
2018-08-22 11:42:53 +00:00
Iain Sandoe
333a29f9e8 Fix FDE labels for Darwin
gcc/

	PR bootstrap/81033
	PR target/81733
	PR target/52795
	* gcc/dwarf2out.c (FUNC_SECOND_SECT_LABEL): New.
	(dwarf2out_switch_text_section): Generate a local label for the second
	function sub-section and apply it as the second FDE start label.
	* gcc/final.c (final_scan_insn_1): Emit second FDE label after the second
	sub-section start.

From-SVN: r263763
2018-08-22 11:37:02 +00:00
Richard Biener
acc2580750 re PR tree-optimization/86988 (ICE: tree check: expected integer_cst, have var_decl in get_len, at tree.h:5563)
2018-08-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86988
	* tree-vrp.c (vrp_prop::check_mem_ref): Bail out on VLAs.

	* g++.dg/pr86988.C: New testcase.

From-SVN: r263762
2018-08-22 11:01:58 +00:00
Richard Biener
66c4f4d8c4 re PR tree-optimization/86945 (BUG with optimisation of select case statement in gfortran)
2018-08-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86945
	* tree-cfg.c (generate_range_test): Use unsigned arithmetic.

	* gcc.dg/torture/pr86945.c: New testcase.

From-SVN: r263761
2018-08-22 08:07:36 +00:00
Alexandre Oliva
30379cbf93 rs6000 small data: add note on sdata2/r2
for  gcc/ChangeLog

	* config/rs6000/rs6000.c (SMALL_DATA_RELOC, SMALL_DATA_REG): Add
	a comment about how uses of r2 for .sdata2 come about.

From-SVN: r263760
2018-08-22 03:48:00 +00:00
Alexandre Oliva
141f2b50ce fix reassoc cut&pasto
for  gcc/ChangeLog

	* tree-ssa-reassoc.c (is_reassociable_op): Fix cut&pasto.

From-SVN: r263759
2018-08-22 03:47:48 +00:00
GCC Administrator
ecd0638398 Daily bump.
From-SVN: r263758
2018-08-22 00:16:29 +00:00
François Dumont
f7191a37ee P0646R1 Improving the Return Value of Erase-Like Algorithms I
2018-08-21  François Dumont  <fdumont@gcc.gnu.org>

	P0646R1 Improving the Return Value of Erase-Like Algorithms I
	* include/debug/forward_list (forward_list::__remove_return_type):
	Define typedef as size_type or void, according to __cplusplus value.
	(_GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(_GLIBCXX20_ONLY): Define macro.
	(forward_list::remove, forward_list::unique): Use typedef and macro
	to change return type and add abi-tag for C++2a. Return number of
	removed elements for C++2a.
	(forward_list::remove_if<Pred>, forward_list::unique<BinPred>): Use
	typedef to change return type for C++2a. Return number of removed
	elements for C++2a.
	* include/debug/list (list::__remove_return_type): Define typedef as
	size_type or void, according to __cplusplus value.
	(_GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG): Define macro as abi-tag or
	empty, according to __cplusplus value.
	(_GLIBCXX20_ONLY): Define macro.
	(list::remove, list::unique): Use typedef and macro to change return
	type and add abi-tag for C++2a. Return number of removed elements for
	C++2a.
	(list::remove_if<Predicate>, list::unique<BinaryPredicate>): Use typedef
	to change return type for C++2a. Return number of removed elements for
	C++2a.

From-SVN: r263752
2018-08-21 19:44:41 +00:00
Janne Blomqvist
fa3d2d3810 Unconditionally use MAX_EXPR/MIN_EXPR for MAX/MIN intrinsics
For floating point types, the question is what MAX(a, NaN) or MIN(a,
NaN) should return (where "a" is a normal number).  There are valid
usecases for returning either one, but the Fortran standard doesn't
specify which one should be chosen.  Also, there is no consensus among
other tested compilers.  In short, it's a mess.  So lets just do
whatever is fastest, which is using MAX_EXPR/MIN_EXPR which are not
defined to do anything in particular if one of the operands is a NaN.

gcc/fortran/ChangeLog:

2018-08-21  Janne Blomqvist  <jb@gcc.gnu.org>

	* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use
	MAX_EXPR/MIN_EXPR unconditionally for real arguments.
	* gfortran.texi (Compiler Characteristics): Document MAX/MIN
	behavior wrt NaN.

gcc/testsuite/ChangeLog:

2018-08-21  Janne Blomqvist  <jb@gcc.gnu.org>

	* gfortran.dg/nan_1.f90: Remove tests that test MAX/MIN with NaNs.

From-SVN: r263751
2018-08-21 22:36:13 +03:00
Nicolas Koenig
2b4c906561 re PR fortran/25829 ([F03] Asynchronous IO support)
2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* gfortran.texi: Add description of asynchronous I/O.
	* trans-decl.c (gfc_finish_var_decl): Treat asynchronous variables
	as volatile.
	* trans-io.c (gfc_build_io_library_fndecls): Rename st_wait to
	st_wait_async and change argument spec from ".X" to ".w".
	(gfc_trans_wait): Pass ID argument via reference.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* gfortran.dg/f2003_inquire_1.f03: Add write statement.
	* gfortran.dg/f2003_io_1.f03: Add wait statement.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* Makefile.am: Add async.c to gfor_io_src.
	Add async.h to gfor_io_headers.
	* Makefile.in: Regenerated.
	* gfortran.map: Add _gfortran_st_wait_async.
	* io/async.c: New file.
	* io/async.h: New file.
	* io/close.c: Include async.h.
	(st_close): Call async_wait for an asynchronous unit.
	* io/file_pos.c (st_backspace): Likewise.
	(st_endfile): Likewise.
	(st_rewind): Likewise.
	(st_flush): Likewise.
	* io/inquire.c: Add handling for asynchronous PENDING
	and ID arguments.
	* io/io.h (st_parameter_dt): Add async bit.
	(st_parameter_wait): Correct.
	(gfc_unit): Add au pointer.
	(st_wait_async): Add prototype.
	(transfer_array_inner): Likewise.
	(st_write_done_worker): Likewise.
	* io/open.c: Include async.h.
	(new_unit): Initialize asynchronous unit.
	* io/transfer.c (async_opt): New struct.
	(wrap_scalar_transfer): New function.
	(transfer_integer): Call wrap_scalar_transfer to do the work.
	(transfer_real): Likewise.
	(transfer_real_write): Likewise.
	(transfer_character): Likewise.
	(transfer_character_wide): Likewise.
	(transfer_complex): Likewise.
	(transfer_array_inner): New function.
	(transfer_array): Call transfer_array_inner.
	(transfer_derived): Call wrap_scalar_transfer.
	(data_transfer_init): Check for asynchronous I/O.
	Perform a wait operation on any pending asynchronous I/O
	if the data transfer is synchronous. Copy PDT and enqueue
	thread for data transfer.
	(st_read_done_worker): New function.
	(st_read_done): Enqueue transfer or call st_read_done_worker.
	(st_write_done_worker): New function.
	(st_write_done): Enqueue transfer or call st_read_done_worker.
	(st_wait): Document as no-op for compatibility reasons.
	(st_wait_async): New function.
	* io/unit.c (insert_unit): Use macros LOCK, UNLOCK and TRYLOCK;
	add NOTE where necessary.
	(get_gfc_unit): Likewise.
	(init_units): Likewise.
	(close_unit_1): Likewise. Call async_close if asynchronous.
	(close_unit): Use macros LOCK and UNLOCK.
	(finish_last_advance_record): Likewise.
	(newunit_alloc): Likewise.
	* io/unix.c (find_file): Likewise.
	(flush_all_units_1): Likewise.
	(flush_all_units): Likewise.
	* libgfortran.h (generate_error_common): Add prototype.
	* runtime/error.c: Include io.h and async.h.
	(generate_error_common): New function.

2018-08-21  Nicolas Koenig  <koenigni@gcc.gnu.org>
	Thomas Koenig <tkoenig@gcc.gnu.org>

	PR fortran/25829
	* testsuite/libgomp.fortran/async_io_1.f90: New test.
	* testsuite/libgomp.fortran/async_io_2.f90: New test.
	* testsuite/libgomp.fortran/async_io_3.f90: New test.
	* testsuite/libgomp.fortran/async_io_4.f90: New test.
	* testsuite/libgomp.fortran/async_io_5.f90: New test.
	* testsuite/libgomp.fortran/async_io_6.f90: New test.
	* testsuite/libgomp.fortran/async_io_7.f90: New test.


Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>

From-SVN: r263750
2018-08-21 18:48:59 +00:00
Marek Polacek
774fb6c4eb re PR c++/86499 (lambda-expressions with capture-default are allowed at namespace scope)
PR c++/86499
	* parser.c (cp_parser_lambda_introducer): Give error if a non-local
	lambda has a capture-default.

	* g++.dg/cpp0x/lambda/lambda-non-local.C: New test.
	* g++.dg/cpp0x/lambda/lambda-this10.C: Adjust dg-error.

From-SVN: r263749
2018-08-21 18:37:23 +00:00
Paolo Carlini
55082d81a0 decl.c (check_static_variable_definition): Change to return void.
2018-08-21  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (check_static_variable_definition): Change to return void.

From-SVN: r263742
2018-08-21 15:49:58 +00:00
Marek Polacek
79ca9c3596 PR c++/86981, Implement -Wpessimizing-move.
* c.opt (Wpessimizing-move): New option.

	* typeck.c (decl_in_std_namespace_p): New.
	(is_std_move_p): New.
	(maybe_warn_pessimizing_move): New.
	(can_do_nrvo_p): New, factored out of ...
	(check_return_expr): ... here.  Warn about potentially harmful
	std::move in a return statement.

	* doc/invoke.texi: Document -Wpessimizing-move.

	* g++.dg/cpp0x/Wpessimizing-move1.C: New test.
	* g++.dg/cpp0x/Wpessimizing-move2.C: New test.
	* g++.dg/cpp0x/Wpessimizing-move3.C: New test.
	* g++.dg/cpp0x/Wpessimizing-move4.C: New test.
	* g++.dg/cpp1z/Wpessimizing-move1.C: New test.

From-SVN: r263741
2018-08-21 15:38:36 +00:00
Marek Polacek
992931ba3d re PR c++/65043 (Expected narrowing conversion during list initialization of bool from double)
PR c++/65043
	* call.c (standard_conversion): Set check_narrowing.
	* typeck2.c (check_narrowing): Use CP_INTEGRAL_TYPE_P rather
	than comparing with INTEGER_TYPE.

	* g++.dg/concepts/pr67595.C: Add dg-warning.
	* g++.dg/cpp0x/Wnarrowing11.C: New test.
	* g++.dg/cpp0x/Wnarrowing12.C: New test.
	* g++.dg/cpp0x/rv-cast5.C: Add static_cast.

From-SVN: r263739
2018-08-21 15:25:17 +00:00
Marek Polacek
d3e993e9b0 * cp-tree.h: Fix typo.
From-SVN: r263738
2018-08-21 15:10:51 +00:00
Hristian Kirtchev
92a68a0464 [Ada] Minor reformattings
2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* checks.adb, contracts.adb, exp_aggr.adb, exp_attr.adb,
	exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_unst.adb,
	exp_util.adb, freeze.adb, gnatlink.adb, layout.adb,
	lib-writ.adb, lib-xref-spark_specific.adb, sem_ch13.adb,
	sem_ch3.adb, sem_ch6.adb, sem_res.adb, sem_util.adb, sinfo.ads,
	sprint.adb: Minor reformatting.

From-SVN: r263737
2018-08-21 14:50:03 +00:00
Jerome Lambourg
5ec8edb56e [Ada] Add a new gnat tool vxlink
VxLink is a helper tool used as a wrapper around g++/gcc to build
VxWorks DKM (Downloadable Kernel Modules).

Such DKM is a partially linked object that includes entry points for
constructors and destructors.

This tool thus uses g++ to generate an intermediate partially linked
object, retrieves the list of constructors and destructors in it and
produces a C file that lists those ctors/dtors in a way that is
understood be VxWorks kernel. It then links this file with the
intermediate object to produce a valid DKM.

2018-08-21  Jerome Lambourg  <lambourg@adacore.com>

gcc/ada/

	* vxlink-bind.adb, vxlink-bind.ads, vxlink-link.adb,
	vxlink-link.ads, vxlink-main.adb, vxlink.adb, vxlink.ads: Add a
	new tool vxlink to handle VxWorks constructors in DKMs.
	* gcc-interface/Makefile.in: add rules to build vxlink

From-SVN: r263736
2018-08-21 14:49:49 +00:00
Ed Schonberg
084e3bd183 [Ada] Crash on expression function and tagged types
This patch fixes a compiler abort on an expression function whose
expression includes tagged types that have not been frozen before the
generated body of the function is analyzed, even though that body is
inserted at the end of the current declarative part.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper, Mask_Type):
	Refine the handling of freezing types for expression functions
	that are not completions, when analyzing the generated body for
	the function: the body is inserted at the end of the enclosing
	declarative part, and its analysis may freeze types declared in
	the same scope that have not been frozen yet.

gcc/testsuite/

	* gnat.dg/expr_func7.adb, gnat.dg/expr_func7.ads: New testcase.

From-SVN: r263735
2018-08-21 14:49:42 +00:00
Ed Schonberg
0db1c3863d [Ada] Spurious crash on expression function as completion with contracts
This patch fixes a compiler abort on an expression function that is a
completion of a subprogram with preconditions. The problem is caused by
the presence of types in the precondition that are not frozen when the
subprogram body constructed for the expression function receives the
code that enforces the precondition. These types must be frozen before
the contract is expanded, so the freeze nodes for these types appear in
the proper scope. This is analogous to what is done with type references
that appear in the original expression of the expression function.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch6.adb: Remove Freeze_Expr_Types.
	* freeze.ads, freeze.adb (Freeze_Expr_Types): Moved from
	sem_ch6.adb, and extended to handle other expressions that may
	contain unfrozen types that must be frozen in their proper
	scopes.
	* contracts.adb (Analyze_Entry_Or_Subprogram_Contract): If the
	contract is for the generated body of an expression function
	that is a completion, traverse the expressions for pre- and
	postconditions to freeze all types before adding the contract
	code within the subprogram body.

gcc/testsuite/

	* gnat.dg/expr_func6.adb, gnat.dg/expr_func6.ads: New testcase.

From-SVN: r263734
2018-08-21 14:49:34 +00:00
Hristian Kirtchev
5b1c45479a [Ada] Retention of with clauses for ignored Ghost units
This patch ensures that with clauses that mention ignored Ghost units are
retained in the tree. The retention is necessary for several reasons:

   * The with clauses allow the new elaboration order mechanism to
     produce the same library edges regardless of whether the Ghost unit
     is checked or ignored. This ensures that the elaboration order
     remains consistent.

   * The with clauses allow the unnesting mechanism to properly
     recognize that all units have been examined for unnesing purposes.

No observable impact, no test needed.

2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* sem_ch10.adb: Remove the with and use clause for unit Ghost.
	(Analyze_With_Clause): Do not mark a with clause which mentions
	an ignored Ghost code for elimination.

From-SVN: r263733
2018-08-21 14:49:26 +00:00
Javier Miranda
322d87a9b1 [Ada] Crash processing SPARK annotate aspect
The compiler blows up writing the ALI file of a package that has a ghost
subprogram with an annotate contract.

2018-08-21  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* lib-writ.adb (Write_Unit_Information): Handle pragmas removed
	by the expander.

gcc/testsuite/

	* gnat.dg/spark2.adb, gnat.dg/spark2.ads: New testcase.

From-SVN: r263732
2018-08-21 14:48:35 +00:00
Ed Schonberg
24241bd038 [Ada] Spurious error on overriding protected function in instance
The conformance between an overriding protected operation with
progenitors and the overridden interface operation requires subtype
conformance; requiring equality of return types in the case of a
function is too restrictive and leads to spurious errors when the return
type is a generic actual.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch6.adb (Check_Synchronized_Overriding): The conformance
	between an overriding protected operation and the overridden
	abstract progenitor operation requires subtype conformance;
	requiring equality of return types in the case of a function is
	too restrictive and leads to spurious errors when the return
	type is a generic actual.

gcc/testsuite/

	* gnat.dg/prot6.adb, gnat.dg/prot6.ads: New testcase.

From-SVN: r263731
2018-08-21 14:48:03 +00:00
Ed Schonberg
5bb9ebcbc8 [Ada] Properly set scope of artificial entities in blocks
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_ch9.adb (Expand_N_Timed_Entry_Call,
	Expand_Conditional_Entry_Call): Use Reset_Scopes_Of to set
	properly the scope of all entities created in blocks generated
	by the expansion of these constructs.

From-SVN: r263730
2018-08-21 14:47:56 +00:00
Ed Schonberg
6989a2bbfa [Ada] Fix scope computation for loop statements
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch13.adb (Build_Predicate_Functioss): Apply
	Reset_Quantified_Variables_Scope after predicate function has
	been analyzed, so that the scope can be reset on the generated
	loop statements that have replaced the quantified expressions.

From-SVN: r263729
2018-08-21 14:47:50 +00:00
Bob Duff
09825f923f [Ada] Einfo: remove obsolete code
2018-08-21  Bob Duff  <duff@adacore.com>

gcc/ada

	* einfo.ads, einfo.adb (Private_View, Shadow_Entities): Remove
	obsolete code.

From-SVN: r263728
2018-08-21 14:47:44 +00:00
Maroua Maalej
7d8cc2b6d1 [Ada] Update for Ownership rules for access types according to AI12-0240
The implementation of these Ownership rules for safe pointers and
automatic memory management is still a prototype at an experimental
stage.

To activate the checks, the code should be compiled with the debug flag
-gnatdF and the flag -gnatd.F for setting the context for formal
verification of SPARK.

These changes do not affect compilation.

2018-08-21  Maroua Maalej  <maalej@adacore.com>

gcc/ada/

	* sem_spark.adb (Check_Call_Statement): Check global and formal
	parameter permissions at call sites.
	(Check_Callable_Body): Assume permissions on globals and
	parameters depending on their modes then analyse the body
	operations.
	(Check_Declaration): Consider both deep (including elementary
	access) object declarations and normal variables. First check
	whether the deep object is of Ownership Aspec True or not, then,
	depending on its initialization, assign the appropriate state.
	Check related to non access type variables deal with
	initialization value permissions.
	(Check_Expression): Check nodes used in the expression being
	analyzed.
	(Check_Globals): Call by Check_Call_Statement to perform the
	check on globals.
	(Check_List): Call Check_Node on each element of the list.
	(Check_Loop_Statement): Check the Iteration_Scheme and loop
	statements.
	(Check_Node): Main traversal procedure to check safe pointer usage.
	(Check_Package_Body): Check subprogram's body.
	(Check_Param_In): Take a formal and an actual parameter and
	Check the permission of every in-mode parameter.
	(Check_Param_Out): Take a formal and an actual parameter and
	check the state of out-mode and in out-mode parameters.
	(Check_Statement): Check statements other than procedure call.
	(Get_Perm, Get_Perm_Or_Tree, Get_Perm_Tree): Find out the state
	related to the given name.
	(Is_Deep): Return True if an object is of access type or has
	subfields of access type.
	(Perm_Error, Perm_Error_Subprogram_End): Add an error message
	whenever the found state on the given name is different from the
	one expected (in the statement being analyzed).
	(Process_Path): Given an operation and a current state, call
	Perm_Error if there is any mismatch.
	(Return_Declarations, Return_Globals, Return_The_Global): Check
	the state of a given name at the end of the subprogram. These
	procedures may change depending on how we shall finally deal
	with globals and the rhs state in a move operation.
	(Set_Perm_Extensions, Set_Perm_Prefixes_Borrow,
	Set_Perm_Prefixes, Setup_Globals, Setup_Parameter_Or_Global,
	Setup_Parameters): Set up the new states to the given node and
	up and down the tree after an operation.
	(Has_Ownership_Aspect_True): This function may disappear later
	when the Ownership Aspect will be implemented in the FE.

From-SVN: r263727
2018-08-21 14:47:38 +00:00
Ed Schonberg
41306c0a89 [Ada] Spurious ambiguity error on call returning an access type
If F is a function with a single defaulted parameter that returns an
access_to_array type, then F (I) may designate either the return type or
an indexing of the result of the call, after implicit dereferencing.  If
the component type C of the array type AR is accces AR this is ambiguous
in a context whose expected type is C. If F is parameterless the call is
not ambiguous.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Call): Resolve correctly a parameterless
	call that returns an access type whose designated type is the
	component type of an array, when the function has no defaulted
	parameters.

gcc/testsuite/

	* gnat.dg/access5.adb, gnat.dg/access5.ads: New testcase.

From-SVN: r263726
2018-08-21 14:47:32 +00:00
Yannick Moy
298e0c6bf7 [Ada] Document entries of the target parametrization file
2018-08-21  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
	Document entries of the target parametrization file.
	* gnat_ugn.texi: Regenerate.

From-SVN: r263725
2018-08-21 14:47:25 +00:00
Ed Schonberg
78645ad8c7 [Ada] Set scope of elaboration flag for 'Access
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_attr.adb: Set scope of elaboration flag for 'Access.

From-SVN: r263724
2018-08-21 14:47:18 +00:00
Ed Schonberg
1bd9b6a576 [Ada] Sprint: add guard on printing aspects
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sprint.adb: Add guard on printing aspects.

From-SVN: r263723
2018-08-21 14:47:12 +00:00
Javier Miranda
dc88759c87 [Ada] Crash compiling SPARK ghost functions with callgraph info
The compiler blows up generating the callgraph output of SPARK ghost
subprograms whose contracts invoke ghost functions.

2018-08-21  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_cg.adb (Generate_CG_Output): Handle calls removed by the
	expander.

From-SVN: r263722
2018-08-21 14:47:05 +00:00
Ed Schonberg
5c0972ba85 [Ada] Unnesting: do not set size of access subprograms
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* layout.adb: Do not set size of access subprogram if unnesting.

From-SVN: r263721
2018-08-21 14:46:59 +00:00
Ed Schonberg
c7fafef974 [Ada] Unnesting: do not emit warnings for access to subprograms
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* freeze.adb: Remove warnings for access to subprograms when
	unnesting is active.

From-SVN: r263720
2018-08-21 14:46:54 +00:00
Ed Schonberg
d2a60e5911 [Ada] Improper copying of limited arrays with default initialization
This patch fixes an improper expansion of aggregates for limited array
types in an object declaration. Prior to this patch, The presence of the
aggregate (which can only consist of box initializations) would create a
temporary that was then assigned to the object in the declaration.
Apart from a violation of the semantics of build-in-place limited
objects, this can also lead to out-of-scope access in LLVM.

Executing the following;

   gcc -c -gnatDG nocopy.adb
   grep quintet nocopy.adb.dg | wc -l

must yield:

   5

----
procedure NoCopy is

  --  Task used in this example to test that the limited component
  --  is properly initialized.

  task type T_Task (Disc : Natural);

  task body T_Task is
  begin
     null;
  end T_Task;

  type My_Rec (D : Natural := 9999) is record

     --  Components initialized by means of the current value
     --  of the record discriminant

     T : T_Task (D);
  end record;

  type TR is array (1 .. 5) of My_Rec;
  Quintet : TR := (others => (others => <>));
begin
   null;
end NoCopy;

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_aggr.adb (Expand_Array_Aggregate): If the component type
	is limited, the array must be constructed in place, so set flag
	In_Place_Assign_OK_For_Declaration accordingly. This prevents
	improper copying of an array of tasks during initialization.

From-SVN: r263719
2018-08-21 14:46:49 +00:00
Eric Botcazou
1ab1c4ee18 [Ada] Fix spurious error on unchecked conversion on VFA record type
2018-08-21  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* gcc-interface/trans.c (Call_to_gnu): Always suppress an
	unchecked conversion around the actual for an In parameter
	passed by copy.

From-SVN: r263718
2018-08-21 14:46:45 +00:00
Eric Botcazou
294e7bbb9e [Ada] Fix internal error on extension of record with representation clause
This fixes a long-standing issue present for extensions of tagged record
types with a representation clause: the clause is correctly inherited
for components inherited in the extension but the position and size are
not, which fools the logic of Is_Possibly_Unaligned_Object.

This can result in an attempt to take the address of a component not
aligned on a byte boundary, which is then flagged as an internal error.

2018-08-21  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_util.adb (Is_Possibly_Unaligned_Object): For the case of a
	selected component inherited in a record extension and subject
	to a representation clause, retrieve the position and size from
	the original record component.

gcc/testsuite/

	* gnat.dg/rep_clause7.adb: New testcase.

From-SVN: r263717
2018-08-21 14:46:40 +00:00
Ed Schonberg
2e5df2955f [Ada] Spurious "Duplicated symbol" error with discriminated tasks
This patch fixes a spurious error in a program that contains a
discriminated task type and several of its subtype in the same
declarative part, when the corresponding discriminant constraints are
expressions.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_util.ads, sem_util.adb (New_External_Entity): Type of
	Suffix_Index must be Int, not Nat, so that a negative value can
	be used to generate a unique name for an external object, as
	specified in Tbuild.New_External_Name.
	(Scope_Within): Handle private type whose completion is a
	synchronized type (For unnesting).
	* itypes.ads, itypes.adb (Create_Itype): Ditto
	* sem_ch3.adb (Constrain_Corresponding_Record): Generate a
	unique name for the created subtype, because there may be
	several discriminated tasks present in the same scope, and each
	needs its distinct corresponding record subtype.

gcc/testsuite/

	* gnat.dg/task1.adb, gnat.dg/task1.ads, gnat.dg/task1_pkg.adb,
	gnat.dg/task1_pkg.ads: New testcase.

From-SVN: r263716
2018-08-21 14:46:34 +00:00
Yannick Moy
c4b9b2916c [Ada] Define versions of dimension system for Float and Long_Float
The dimension system in System.Dim.Mks is based on Long_Long_Float,
which may not be convenient to people who want to use Float or
Long_Float as basis. These new files provide units that define the
dimension system based on Float in System.Dim.Float_Mks and on
Long_Float in System.Dim.Long_Mks.

Child packages Other_Prefixes and Mks_IO are also defined appropriately,
with new instantiations for the various sizes of floating-point types.

2018-08-21  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* doc/gnat_ugn/gnat_and_program_execution.rst: Update
	documentation of dimensionality analysis.
	* gnat_ugn.texi: Regenerate.
	* Makefile.rtl, impunit.adb: Consider the new units.
	* libgnat/s-dfmkio.ads, libgnat/s-dfmopr.ads,
	libgnat/s-diflmk.ads: New units based on Float.
	* libgnat/s-dilomk.ads, libgnat/s-dlmkio.ads,
	libgnat/s-dlmopr.ads: New units based on Long_Float.
	* libgnat/s-dmotpr.ads: Rename to libgnat/s-dgmgop.ads and turn
	into an instance of
	System.Dim.Generic_Mks.Generic_Other_Prefixes.
	* libgnat/s-dimmks.ads: Rename to libgnat/s-digemk.ads and turn
	into an instance of System.Dim.Generic_Mks.

From-SVN: r263715
2018-08-21 14:46:07 +00:00
Hristian Kirtchev
2201fa7bd3 [Ada] General purpose doubly linked list for compiler and tool use
This patch adds unit GNAT.Lists which currently contains the
implementation of a general purpose doubly linked list intended for use
by the compiler and the tools around it.

2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* impunit.adb: Add g-lists to the set of non-implementation
	units.
	* libgnat/g-lists.adb, libgnat/g-lists.ads: New unit.
	* Makefile.rtl: Add g-lists to the set of non-tasking units.
	* gcc-interface/Make-lang.in: Add g-lists to the set of files
	used by gnat1.

gcc/testsuite/

	* gnat.dg/linkedlist.adb: New testcase.

From-SVN: r263714
2018-08-21 14:45:49 +00:00
Ed Schonberg
c36d21ee42 [Ada] Fix scope computation for entry bodies and accept alternatives
2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_ch9.adb (Reset_Scopes): Do not recurse into type
	declarations when resetting the scope of entities declared the
	procedures generated for entry bodies and accept alternatives.
	Use the entity of the procedure declaration, not its body, as
	the new scope.

From-SVN: r263713
2018-08-21 14:45:04 +00:00
Hristian Kirtchev
3f99a611ca [Ada] Crash on entry in generic with dynamic elaboration checks
This patch modifies the set of attributes that applies to entries and
entry families to include elaboration entities used by the
access-before-elaboration mechanism.

2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* einfo.adb (Elaboration_Entity): Include entries and entry
	families in the set of legal entities.
	(Elaboration_Entity_Required): Include entries and entry
	families in the set of legal entities.
	(Set_Elaboration_Entity): Include entries and entry families in
	the set of legal entities.
	(Set_Elaboration_Entity_Required): Include entries and entry
	families in the set of legal entities.
	(Write_Field13_Name): Update the output of attribute
	Elaboration_Entity.
	* einfo.ads: Attributes Elaboration_Entity and
	Elaboration_Entity_Required now apply to entries and entry
	families.

gcc/testsuite/

	* gnat.dg/elab6.adb, gnat.dg/elab6.ads, gnat.dg/elab6_pkg.adb,
	gnat.dg/elab6_pkg.ads: New testcase.

From-SVN: r263712
2018-08-21 14:44:56 +00:00
Arnaud Charlet
83fadfd9ab [Ada] Set_Targ: add a CodePeer annotation
2018-08-21  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

	* set_targ.adb: Mark some CodePeer message as Intentional.

From-SVN: r263711
2018-08-21 14:44:51 +00:00
Ed Schonberg
8a2f6bbe45 [Ada] Compiler abort on call to expr. function for default discriminant
If a discriminant specification has a default that is a call to an
expression function, that function has to be frozen at the point of a
call to the initialization procedure for an object of the record type,
even though the call does not appear to come from source.

2018-08-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Call): Force the freezing of an
	expression function that is called to provide a default value
	for a defaulted discriminant in an object initialization.

gcc/testsuite/

	* gnat.dg/expr_func5.adb: New testcase.

From-SVN: r263710
2018-08-21 14:44:46 +00:00
Hristian Kirtchev
d8251d001b [Ada] Dynamically resizable, load factor-based hash table
This patch introduces a dynamically resizable, load factor-based hash
table in unit GNAT.Dynamic_HTables.

2018-08-21  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* libgnat/g-dynhta.adb, libgnat/g-dynhta.ads: New package
	Dynamic_HTable.

gcc/testsuite/

	* gnat.dg/dynhash.adb: New testcase.

From-SVN: r263709
2018-08-21 14:44:41 +00:00
Javier Miranda
f20b5ef46d [Ada] Enumeration types with non-standard representation
The compiler may report errors on enumeration types with non-standard
representation (i.e. at least one literal has a representation value
different from its 'Pos value) processing attribute 'Enum_Rep.

It may also generate wrong code for the evaluation of 'Enum_Rep raising
Constraint_Error at runtime.

2018-08-21  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* checks.ads (Determine_Range): Adding documentation.
	* checks.adb (Determine_Range): Don't deal with enumerated types
	with non-standard representation.
	(Convert_And_Check_Range): For conversion of enumeration types
	with non standard representation to an integer type perform a
	direct conversion to the target integer type.

gcc/testsuite/

	* gnat.dg/enum4.adb: New testcase.

From-SVN: r263708
2018-08-21 14:44:35 +00:00
Piotr Trojanek
b7e875ce96 [Ada] Handle pragmas that come from aspects for GNATprove
In GNATprove we appear to abuse a routine related to cross-references and
expect it to deliver exact results, which is not what it was designed for.

This patch is a temporary solution to avoid crashes in GNATprove; it doesn't
affect the frontend or other backends, because this code is used exclusively
by GNATprove (it is located in the frontend for technical reasons). No tests
provided.

2018-08-21  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* lib-xref.ads, lib-xref-spark_specific.adb
	(Enclosing_Subprogram_Or_Library_Package): Now roughtly works
	for pragmas that come from aspect specifications.

From-SVN: r263707
2018-08-21 14:44:30 +00:00
Pierre-Marie de Rodat
d40800cfe5 [Ada] Add sa_messages.ad[sb] for SPARK 2014
These new source files will make it possible to build SPARK 2014 from
a snapshot of GCC FSF sources.

2018-08-21  Pierre-Marie de Rodat  <derodat@adacore.com>

gcc/ada/

	* sa_messages.ads, sa_messages.adb: New source files.

From-SVN: r263706
2018-08-21 14:44:25 +00:00
David Edelsohn
bce17c392a * testsuite/18_support/new_nothrow.cc: XFAIL on AIX.
From-SVN: r263703
2018-08-21 10:03:16 -04:00
Richard Sandiford
3d20537c5e Update global reviewers list
2018-08-21  Richard Sandiford  <richard.sandiford@arm.com>

	* MAINTAINERS: Add self to global reviewers list.

From-SVN: r263702
2018-08-21 13:49:30 +00:00