The only preexisting use of GIMPLE_EH_ELSE, for transactional memory
commits, did not allow exceptions to escape from the ELSE path. The
trick it uses to allow the ELSE path to see the propagating exception
does not work very well if the exception cleanup raises further
exceptions: the ELSE block is configured to handle exceptions in
itself. This confuses the heck out of CFG and EH cleanups.
Basing the lowering context for the ELSE block on outer_state, rather
than this_state, gets us the expected enclosing handler.
for gcc/ChangeLog
* tree-eh.c (honor_protect_cleanup_actions): Use outer_
rather than this_state as the lowering context for the ELSE
seq in a GIMPLE_EH_ELSE.
for gcc/testsuite/ChangeLog
* gcc.dg/gimplefe-44.c: New.
From-SVN: r273444
This defines the equivalent of C++2a's std::type_identity_t alias but
for use in C++11 and later. This can be used to replace __detail::__idt
in the string_view headers, which previously used common_type_t because
the one argument specialization of common_type_t was simply the identity
transform (which is no longer true).
* include/experimental/string_view (__detail::__idt): Remove.
(operator==, operator!=, operator<, operator>, operator<=, operator>=):
Use __type_identity_t instead of __detail::__idt;
* include/std/string_view (__detail::__idt): Remove.
(operator==, operator!=, operator<, operator>, operator<=, operator>=):
Use __type_identity_t instead of __detail::__idt;
* include/std/type_traits (__type_identity_t): New alias template.
From-SVN: r273442
I'd made it a precondition of vector_builder::elt that the encoding
must have been fully populated and that all implicit elements are
therefore defined. But for one of the AArch64 patches I'm working on,
it'd be convenient to be able to look back at previous elements while
building up the encoding. This patch therefore makes the assert
specific to implicit elements only.
2019-07-12 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* vector-builder.h (vector_builder::elt): Allow already-supplied
elements to be read back before building is complete.
From-SVN: r273440
PR rtl-optimization/91136
* df-core.c (ACCESSING REFS): Fix typos in comment.
* resource.c (mark_target_live_reg): Add artificial defs that occur at
the beginning of the block to the initial set of live registers.
From-SVN: r273436
2019-07-12 Richard Biener <rguenther@suse.de>
* fold-const.h (get_array_ctor_element_at_index): Adjust.
* fold-const.c (get_array_ctor_element_at_index): Add
ctor_idx output parameter informing the caller where in
the constructor the element was (not) found. Add early exit
for when the ctor is sorted.
* gimple-fold.c (fold_array_ctor_reference): Support constant
folding across multiple array elements.
* gcc.dg/tree-ssa/vector-7.c: New testcase.
From-SVN: r273435
* cfgexpand.c (expand_gimple_stmt_1) <GIMPLE_RETURN>: If the statement
doesn't have location, set the current location to the function's end
From-SVN: r273434
This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.
No behavioural change except for dropping the unused SVE
divide permutations.
2019-07-12 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64.md (*compare_condjump<mode>)
(loadwb_pair<GPI:mode>_<P:mode>, loadwb_pair<GPF:mode>_<P:mode>)
(storewb_pair<GPI:mode>_<P:mode>, storewb_pair<GPF:mode>_<P:mode>)
(*ands<mode>_compare0): Fix ambiguous uses of .md attributes.
* config/aarch64/aarch64-simd.md
(*aarch64_get_lane_extend<GPI:mode><VDQQH:mode>): Likewise.
(*aarch64_get_lane_zero_extend<GPI:mode><VDQQH:mode>): Likewise.
* config/aarch64/aarch64-sve.md
(while_ult<GPI:mode><PRED_ALL:mode>): Likewise.
(*cond_<optab><mode>_any): Fix SVE_I/SVE_SDI typo.
From-SVN: r273433
This patch extends the support for "@..." pattern names so that
the patterns can have different numbers of operands. This allows
things like binary and ternary operations to be handled in a
consistent way, a bit like optabs. The generators assert that
the number of operands passed is correct for the underlying
instruction.
Also, replace_operands_with_dups iterated over the old rtx format
even after having decided to do a replacement, which broke with
match_operator.
2019-07-12 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* doc/md.texi: Document that @ patterns can have different
numbers of operands.
* genemit.c (handle_overloaded_gen): Handle this case.
* genopinit.c (handle_overloaded_gen): Likewise.
* gensupport.c (replace_operands_with_dups): Iterate over
the new rtx's format rather than the old one's.
From-SVN: r273432
placed closely next.
2019-07-12 Kewen Lin <linkw@gcc.gnu.org>
* gcc/cfgrtl.c (print_rtl_with_bb): Emit a hint if the
fallthrough target of current basic block isn't the placed
right next.
From-SVN: r273430
The type hash and equality functions are generated after the
order_evaluations pass. They may contain shortcut operators and
Set_and_use_temporary_expressions (e.g. from lowering a
Binary_exprssion) that need to be ordered. Run order_evaluations
and remove_shortcuts on these functions. (The hash functions
may be fine, but to be on the safe side we run on them anyway.
We do need to run on the equality functions.)
A Set_and_use_temporary_expression is effectively an assignment,
so it needs to be ordered. Otherwise if we insert a temporary
statement before it, we may get wrong evaluation order.
A test case is CL 185818.
Fixesgolang/go#33062.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185817
From-SVN: r273425
This adds the new atomic types from C++2a, as proposed by P0019 and
P0020. To reduce duplication the calls to the compiler's atomic
built-ins are wrapped in new functions in the __atomic_impl namespace.
These functions are currently only used by std::atomic<floating-point>
and std::atomic_ref but could also be used for all other specializations
of std::atomic.
* include/bits/atomic_base.h (__atomic_impl): New namespace for
wrappers around atomic built-ins.
(__atomic_float, __atomic_ref): New class templates for use as base
classes.
* include/std/atomic (atomic<float>, atomic<double>)
(atomic<long double>): New explicit specializations.
(atomic_ref): New class template.
(__cpp_lib_atomic_ref): Define.
* include/std/version (__cpp_lib_atomic_ref): Define.
* testsuite/29_atomics/atomic/60695.cc: Adjust dg-error.
* testsuite/29_atomics/atomic_float/1.cc: New test.
* testsuite/29_atomics/atomic_float/requirements.cc: New test.
* testsuite/29_atomics/atomic_ref/deduction.cc: New test.
* testsuite/29_atomics/atomic_ref/float.cc: New test.
* testsuite/29_atomics/atomic_ref/generic.cc: New test.
* testsuite/29_atomics/atomic_ref/integral.cc: New test.
* testsuite/29_atomics/atomic_ref/pointer.cc: New test.
* testsuite/29_atomics/atomic_ref/requirements.cc: New test.
From-SVN: r273420
This patch recognises Modula-2 as language for the traceback table,
fixing the problem shown in
https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00848.html .
* config/rs6000/rs6000-logue.c (rs6000_output_function_epilogue):
Handle Modula-2.
From-SVN: r273411
In the special GNATprove mode of the frontend, automatic inlining is
performed, which may lead to spurious errors on dimensionality checking.
Avoid performing this checking on inlined code, which has already been
checked for dimensionality errors.
There is no impact on compilation.
2019-07-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Call): Do not perform dimensionality
checking on inlined bodies.
From-SVN: r273405
When the Loop_Entry attribute is used inside a loop invariant or another
assertion where it is allowed, it may lead to spurious warnings on
conditions that are detected to be always valid. Now fixed.
2019-07-11 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_eval.adb (Is_Same_Value): Add special case for rewritten
Loop_Entry attribute.
gcc/testsuite/
* gnat.dg/loop_entry1.adb: New testcase.
From-SVN: r273403
Ownership checking as done in SPARK should be applied only to SPARK
code, which requires GNATprove knowledge of the SPARK_Mode boundary.
Transform the checking unit into a generic to allow passing in the
knowledge from GNATprove to that unit in GNAT sources.
Keeping the code in GNAT sources makes it possible in the future to
adapt it further (or simply instantiate it differently) to be used on
Ada code, independently of GNATprove.
There is no impact on compilation.
2019-07-11 Claire Dross <dross@adacore.com>
gcc/ada/
* gnat1drv.adb: SPARK checking rules for pointer aliasing are
moved to GNATprove backend.
* sem_spark.ads, sem_spark.adb (Sem_SPARK): Is now a generic
unit. Takes as parameters:
- Retysp which is used to query the most underlying type
visible in SPARK. We do not introduce aliasing checks for
types which are not visibly deep.
- Component_Is_Visible_In_SPARK is used to avoid doing pointer
aliasing checks on components which are not visible in SPARK.
- Emit_Messages returns True in the second phase of SPARK
analysis. Error messages for failed aliasing checks are only
output in this case.
Additionally, errors on constructs not supported in SPARK are
removed as duplicates of marking errors. Components are stored
in the permission map using their original component to avoid
inconsistencies between components of different views of the
same type.
(Check_Expression): Handle delta constraints.
(Is_Deep): Exported so that we can check for SPARK restrictions
on deep types inside SPARK semantic checkings.
(Is_Traversal_Function): Exported so that we can check for SPARK
restrictions on traversal functions inside SPARK semantic
checkings.
(Check_Call_Statement, Read_Indexes): Check wether we are
dealing with a subprogram pointer type before querying called
entity.
(Is_Subpath_Expression): Image attribute can appear inside a
path.
(Check_Loop_Statement): Correct order of statements in the loop.
(Check_Node): Ignore raise nodes.
(Check_Statement): Use Last_Non_Pragma to get the object
declaration in an extended return statement.
From-SVN: r273402
The new minimal binder option ("-minimal") suppresses the generation of
binder objects that are not strictly required for program operation.
This option is suitable for space constrained applications and comes
with the restriction that programs can no longer be debugged using GDB.
2019-07-11 Patrick Bernardi <bernardi@adacore.com>
gcc/ada/
* bindgen.adb (Gen_Main): Do not generate a reference to
Ada_Main_Program_Name when the Minimal_Binder flag is set.
(Gen_Output_File_Ada): Do not output GNAT_Version and
Ada_Main_Program_Name info if Minimal_Binder flag is set.
* bindusg.adb: Add documentation for new -minimal switch.
* gnatbind.adb (Scan_Bind_Arg): Scan -minimal switch.
* opt.ads: Add new global flag Minimal_Binder to indicate if the
binder should not produce global variables.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Update documentation with new binder -minimal switch.
* gnat_ugn.texi: Regenerate.
From-SVN: r273401
This patch fixes a compiler abort on a declarastion for a protected type
PT when one of its private component is of type access PT.
2019-07-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch9.adb (Expand_N_Protected_Type_Declaaration): New
subsidiary routine Replace_Access_Definition, to handle properly
a protected type PT one of whose private components is of type
access PT.
gcc/testsuite/
* gnat.dg/prot8.adb, gnat.dg/prot8.ads: New testcase.
From-SVN: r273399
Add a check to avoid causing a buffer overflow when the map is empty
2019-07-11 Claire Dross <dross@adacore.com>
gcc/ada/
* libgnat/a-cfhama.adb, libgnat/a-cfhase.adb (Free): Do not
reset the Has_Element flag if no element is freed.
From-SVN: r273397
This patch removes redundant dynamic predicate checks generated by type
conversions in various contexts. The patch also recognizes additional
such checks that can be evaluated statically when applied to constant
values.
No simple test available.
2019-07-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_N_Type_Conversion): If a predicate check
is generated, analyze it with range check suppressed, because
that check has been previously applied.
* exp_ch5.adb (Expand_N_Assignment_Statement): If the RHS is a
type conversion to the type of the LHS, do not apply a predicate
check to the RHS because it will have been generated already
during its expansion.
* exp_ch6.adb (Can_Fold_Predicate_Call): Extend processing to
handle a predicate check on a constant entity whose value is
static.
From-SVN: r273395
This patch adds a missing case to the mechanism that outputs the
elaboration order dependencies of units.
------------
-- Source --
------------
-- pack.ads
package Pack is
procedure Force_Body;
end Pack;
-- pack.adb
package body Pack is
procedure Force_Body is null;
end Pack;
-- main.adb
with Pack;
procedure Main is begin null; end Main;
----------------------------
-- Compilation and output --
----------------------------
$ gnatmake -q main.adb -bargs -e
ELABORATION ORDER DEPENDENCIES
unit "pack (spec)" must be elaborated before unit "main (body)"
reason: unit "main (body)" has with clause for unit "pack (spec)"
unit "pack (spec)" must be elaborated before unit "pack (body)"
reason: spec must be elaborated before body
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* bindo.adb: Remove the documentation of switch -d_N because it
is no longer in use.
* bindo-graphs.ads, bindo-graphs.adb (Is_Spec_Before_Body_Edge):
New routine.
* bindo-writers.adb (Write_Dependency_Edge): Add the missing
case of a spec-before-body edge.
From-SVN: r273394
This patch corrects the generation of protected body declarations so
that instances of pragma Unreferenced applied to formals don't falsly
trigger undefined references.
2019-07-11 Justin Squirek <squirek@adacore.com>
gcc/ada/
* exp_ch9.adb (Build_Private_Protected_Declaration): Add
exception for the moving of pragmas to internally generated
specs for pragma Unreferenced.
gcc/testsuite/
* gnat.dg/unreferenced2.adb: New testcase.
From-SVN: r273392
One part said all metrics are enabled by default (which is now true),
and another part said the coupling metrics are disabled by default
(which is no longer true).
2019-07-11 Bob Duff <duff@adacore.com>
gcc/ada/
* doc/gnat_ugn/gnat_utility_programs.rst: Fix inconsistent
documentation for gnatmetric.
* gnat_ugn.texi: Regenerate.
From-SVN: r273391
This patch updates predicate Null_Status to prevent an infinite
recursion when the argument is an illegal object declaration of an
access type.
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_util.adb (Null_Status): Assume that an erroneous construct
has an undefined null status.
gcc/testsuite/
* gnat.dg/self_ref1.adb: New testcase.
From-SVN: r273389
This patch updates the retrieval of the renamed object name of an object
renaming declaration to handle various name forms.
No need for a test because one already exists, and reproducing requires
a compiler built with assertions.
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_ch8.adb (Analyze_Object_Renaming): Obtain the object being
renamed using routine Get_Object_Name which takes care of
various name forms.
(Get_Object_Name): New routine.
From-SVN: r273387
This patch recognizes case of dynamic predicates on integer subtypes
that are simple enough to be evaluated statically when the argument is
itself a literal. Even though in many cases such predicate checks will
be removed by the back-end with any level of optimization, it is
preferable to perform this constant folding in the front-end, wich also
cleans up the output of CCG, as well as producing explicit warnings when
the test will fail.
2019-07-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_ch6.adb (Can_Fold_Predicate_Call): New function,
subsidiary of Expand_Call_Helper, to compute statically a
predicate check when the argument is a static integer.
gcc/testsuite/
* gnat.dg/predicate11.adb: New testcase.
From-SVN: r273386
This patch corrects the resolution of operator "not" when the expression
being negated is an equality operator to prevent the transformation of
an intrinsic equality operator into a function call.
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Op_Not): Do not rewrite an equality
operator into a function call when the operator is intrinsic.
gcc/testsuite/
* gnat.dg/equal9.adb: New testcase.
From-SVN: r273385
A pragma Check for Dynamic_Predicate does not correspond to any source
construct that has a provisionally-disabled SCO.
2019-07-11 Thomas Quinot <quinot@adacore.com>
gcc/ada/
* sem_prag.adb (Analyze_Pragma, case pragma Check): Do not call
Set_SCO_Pragma_Enabled for the dynamic predicate case.
gcc/testsuite/
* gnat.dg/scos1.adb: New testcase.
From-SVN: r273384
This patch updates the analysis of protected types to properly mark the
type as having controlled components when it contains at least one such
component. This in turn marks a potential partial view as requiring
finalization actions.
------------
-- Source --
------------
-- types.ads
with Ada.Finalization; use Ada.Finalization;
package Types is
type Ctrl_Typ is new Controlled with null record;
procedure Finalize (Obj : in out Ctrl_Typ);
type Prot_Typ is limited private;
private
protected type Prot_Typ is
private
Comp : Ctrl_Typ;
end Prot_Typ;
end Types;
-- types.adb
with Ada.Text_IO; use Ada.Text_IO;
package body Types is
procedure Finalize (Obj : in out Ctrl_Typ) is
begin
Put_Line ("finalize");
end Finalize;
protected body Prot_Typ is
end Prot_Typ;
end Types;
-- main.adb
with Types; use Types;
procedure Main is
Obj : Prot_Typ;
begin
null;
end Main;
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_util.ads, exp_util.adb (Needs_Finalization): Move to
Sem_Util.
* sem_ch9.adb (Analyze_Protected_Definition): Code cleanup. Mark
the protected type as having controlled components when it
contains at least one such component.
* sem_util.ads, sem_util.adb (Needs_Finalization): New
function.
From-SVN: r273383
For some time the Repinfo unit has been able to output the
representation information in the JSON data interchange format in
addition to the usual text and binary formats.
The new Repinfo.Input unit makes it possible to read back this
information under this format and make it available to clients, the main
one being ASIS.
The big advantage of using this approach over manipulating a binary blob
is that the writer and the reader of the JSON representation need not be
binary compatible, i.e. in practice need not be the same version of the
compiler or ASIS for the same target.
The patch also adds a -gnatd_j switch to read back the information in
the compiler itself, which makes it easy to keep the writer and the
reader in sync using only one tool, namely the compiler. The typical
usage is:
gcc -c p.ads -gnatR4js
gcc -c p.ads -gnatd_j
to exercise respectively the writer and the reader from the compiler.
2019-07-11 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* alloc.ads (Rep_JSON_Table_Initial): New constant.
(Rep_JSON_Table_Increment): Likewise.
* debug.adb: Document -gnatd_j switch.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add
repinfo-input.o.
* gnat1drv.adb: Add with clause for Repinfo.Input.
Add with and use clauses for Sinput.
(Read_JSON_Files_For_Repinfo): New procedure.
(Gnat1drv1): Deal with -gnatd_j switch.
* repinfo-input.ad[sb]: New unit.
* snames.ads-tmpl (Name_Discriminant): New constant.
(Name_Operands): Likewise.
From-SVN: r273382
This patch corrects the generation of dynamic accessibility checks which
are guaranteed to trigger errors during run time so as to give the user
proper warning during unit compiliation.
2019-07-11 Justin Squirek <squirek@adacore.com>
gcc/ada/
* checks.adb (Apply_Accessibility_Check): Add check for constant
folded conditions on accessibility checks.
gcc/testsuite/
* gnat.dg/access7.adb: New testcase.
From-SVN: r273381