2017-05-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/80549
* tree-cfgcleanup.c (mfb_keep_latches): New helper.
(cleanup_tree_cfg_noloop): Create forwarders to known loop
headers if they do not have a preheader.
* gcc.dg/torture/pr80549.c: New testcase.
From-SVN: r247486
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (assoc_to_constructor): Make sure
Corresponding_Discriminant is only called on discriminants.
Skip the saving of the result only for them.
(gnat_to_gnu) <N_Selected_Component>: Likewise.
<N_Unchecked_Type_Conversion>: Translate the result type first.
(gigi): Set TREE_NOTHROW on Begin_Handler.
(stmt_list_cannot_raise_p): New predicate.
(Exception_Handler_to_gnu_gcc): Emit a simple final call instead of
a cleanup if the statements of the handler cannot raise.
(process_freeze_entity): Use Is_Record_Type.
(process_type): Likewise.
From-SVN: r247484
The declaration for memcpy had the size parameter declared as
unsigned long. For avr, __SIZE_TYPE__ is unsigned int, and
this caused a builtin-declaration-mismatch warning, resulting
in a couple of FAILs.
Fixed by typedef'ing __SIZE_TYPE__ to size_t and using size_t as the
type for memcpy's third parameter.
From-SVN: r247483
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* einfo.ads (Corresponding_Record_Component): New alias
for Node21 used for E_Component and E_Discriminant.
* einfo.adb (Corresponding_Record_Component): New function.
(Set_Corresponding_Record_Component): New procedure.
(Write_Field21_Name): Handle Corresponding_Record_Component.
* sem_ch3.adb (Inherit_Component): Set
Corresponding_Record_Component for every component in
the untagged case. Clear it afterwards for non-girder
discriminants.
* gcc-interface/decl.c (gnat_to_gnu_entity)
<E_Record_Type>: For a derived untagged type with discriminants
and constraints, apply the constraints to the layout of the
parent type to deduce the layout.
(field_is_aliased): Delete.
(components_to_record): Test DECL_ALIASED_P directly.
(annotate_rep): Check that fields are present except for
an extension.
(create_field_decl_from): Add DEBUG_INFO_P
parameter and pass it in recursive and other calls. Add guard
for the manual CSE on the size.
(is_stored_discriminant): New predicate.
(copy_and_substitute_in_layout): Consider only
stored discriminants and check that original fields are present
in the old type. Deal with derived types. Adjust call to
create_variant_part_from.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch6.adb (Expand_Call_Helper): When locating the
accessibility entity created for an access parameter, handle
properly a reference to a formal of an enclosing subprogram. if
the reference appears in an inherited class-wide condition, it
is the rewriting of the reference in the ancestor expression,
but the accessibility entity must be that of the current formal.
2017-05-02 Javier Miranda <miranda@adacore.com>
* exp_ch4.adb (Expand_Non_Binary_Modular_Op): New subprogram.
(Expand_N_Op_Add, Expand_N_Op_Divide, Expand_N_Op_Minus,
Expand_N_Op_Multiply, Expand_N_Op_Or, Expand_N_Op_Subtract):
Call Expand_Non_Binary_Modular_Op.
From-SVN: r247482
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb (Build_Derived_Private_Type): If the parent type
has discriminants, do not override the Stored_Constraint list of
the full view of the derived type with that of the derived type.
From-SVN: r247481
2017-05-02 Bob Duff <duff@adacore.com>
* sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep.
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
* s-os_lib.ads: Minor typo fix.
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
* gnatls.adb: Merge and refactor code from Prj.Env and remove
this deprecated dependency.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_util.ads: minor comment addition.
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and
pastos in part #3 of the head comment.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Freeze_Type): Do not generate an invariant
procedure body for a local (sub)type declaration within a
predicate function. Invariant checks do not apply to these, and
the expansion of the procedure will happen in the wrong scope,
leading to misplaced freeze nodes.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Insert_Library_Level_Action): Use proper scope
to analyze generated actions. If the main unit is a body,
the required scope is that of the corresponding unit declaration.
2017-05-02 Arnaud Charlet <charlet@adacore.com>
* einfo.adb (Declaration_Node): flip branches of
an IF statement to avoid repeated negations in its condition;
no change in semantics, only to improve readability.
From-SVN: r247480
2017-05-02 Justin Squirek <squirek@adacore.com>
* sem_ch4.adb (Analyze_Case_Expression): Add check for valid
alternative expression.
* sem_res.adb (Resolve_Case_Expression): Ditto.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_disp.adb (Set_All_DT_Position, In_Predef_Prim_DT):
Refine predicate for the case where the primitive operation
is a renaming of equality. An overriding operation that is
a user-defined renaming of predefined equality inherits its
slot from the overridden operation. Otherwise it is treated
as a predefined op and occupies the same predefined slot as
equality. A call to it is transformed into a call to its alias,
which is the predefined equality. A dispatching call thus uses
the proper slot if operation is further inherited and called
with class-wide arguments.
2017-05-02 Justin Squirek <squirek@adacore.com>
* errout.adb (Set_Msg_Text): Add a case to switch the message
type when the character '[' is detected signifying a warning
about a run-time exception.
* opt.ads Add a new Warning_Mode value for new switch
* switch-b.adb (Scan_Binder_Switches): Add case for the binder
to handle new warning mode
* usage.adb (Usage): Add usage entry for -gnatwE
* warnsw.adb (Set_Warning_Switch): Add case for the new switch
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Process_Conversion): Reject an intrinsic operator
declaration that operates on some fixed point type.
2017-05-02 Justin Squirek <squirek@adacore.com>
* a-crbtgo.adb, s-taasde.adb: Remove unused use-type clauses.
From-SVN: r247478
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Build_Initialization_Call): Generate a null
statement if the initialization call is a null procedure, as
can happen with a controlled type with no explicit Initialize
procedure, or an array of such.
* exp_ch7.adb (Process_Object_Declaration): For a type with
controlled components that has a trivial Initialize procedure,
insert declaration for finalization counter after object
declaration itself.
(Make_Deep_Array_Body, Build_Initialize_statements): Do not create
finalization block and attendant declarations if component has
a trivial Initialize procedure.
(Make_Init_Call): Do not generate a call if controlled type has
a trivial Initialize procedure.
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* g-forstr.ads (Data): Move Format component last.
* g-forstr.adb ("+"): Adjust for above change.
* g-rewdat.ads (Buffer): Move Buffer, Current, Pattern and Value last.
* g-sechas.ads (Context): Move Key last.
* g-socket.ads (Service_Entry_Type): Move Aliases last.
* s-fileio.adb (Temp_File_Record): Move Name last.
* s-regexp.adb (Regexp_Value): Move Case_Sensitive last.
* xr_tabls.ads (Project_File): Move Src_Dir and Obj_Dir last.
2017-05-02 Jerome Lambourg <lambourg@adacore.com>
* bindusg.adb, bindgen.adb, gnatbind.adb, opt.ads: Remove the -nognarl
switch introduced recently. finally not needed.
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch6.adb (Analyze_Null_Procedure): Set the
Corresponding_Body link for a null procedure declaration.
From-SVN: r247475
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* atree.h (Flag290): Add missing terminating parenthesis.
* einfo.adb (Is_Class_Wide_Clone): Use Flag290.
(Set_Is_Class_Wide_Clone): Likewise.
* einfo.ads (Is_Class_Wide_Clone): Likewise.
2017-05-02 Gary Dismukes <dismukes@adacore.com>
* checks.ads (Null_Exclusion_Static_Checks): Add Boolean
parameter Array_Comp to indicate the case of an array object
with null-excluding components.
* checks.adb (Null_Exclusion_Static_Checks):
Call Compile_Time_Constraint_Error instead of
Apply_Compile_Time_Constraint_Error in the component case. Also
call that when Array_Comp is True, with an appropriate warning for
the array component case. Only create an explicit initialization
by null in the case of an object of a null-excluding access type
(and no longer do that in the component case).
* sem_ch3.adb (Check_Component): Add a Boolean parameter
Array_Comp defaulted to False. Pass Empty for the Comp
actual when calling Null_Exclusion_Static_Checks in the case
where Comp_Decl matches Object_Decl, because we don't have a
component in that case. In the case of an object or component
of an array type, pass True for Array_Comp on the recursive call
to Check_Component.
From-SVN: r247474
2017-05-02 Bob Duff <duff@adacore.com>
* s-taprop-linux.adb (Prio_To_Linux_Prio): New function to correctly
compute the linux priority from the Ada priority. Call this everywhere
required. In particular, the previous version was not doing this
computation when setting the ceiling priority in various places. It
was just converting to C.int, which results in a ceiling that is off
by 1.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb: Comment predicate inheritance.
From-SVN: r247473
2017-05-02 Tristan Gingold <gingold@adacore.com>
* s-trasym.ads: Add comment.
2017-05-02 Bob Duff <duff@adacore.com>
* sem_elab.adb, sem_elab.ads: Minor comment fixes.
* sem_ch4.adb: Minor reformatting.
* s-taprop-linux.adb, s-taspri-posix.ads: Code refactoring.
* s-taspri-posix-noaltstack.ads: Minor refactoring.
* sinput.ads: Minor typo fix.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch9.adb (Discriminated_Size): Moved to sem_util.
* sem_util.ads, sem_util.adb (Discriminated_Size): Predicate moved
here from exp_ch9, to recognize objects whose creation requires
dynamic allocation, so that the proper warning can be emitted
when restriction No_Implicit_Heap_Allocation is in effect.
* sem_ch3.adb (Analyze_Object_Declaration): Use Discriminated_Size
to emit proper warning when an object that requires dynamic
allocation is declared.
From-SVN: r247472
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Find_Equality_Types, Try_One_Interp): The same relaxed
visibility rules for equality operators that apply within an
instantiation apply within an inlined body.
* sem_type.adb (Add_One_Interp): ditto.
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Analyze_Pragma): Forbid pragma Contract_Cases on null
procedures.
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* snames.ads-tmpl
(Name_Assume, Name_Attribute_Definition, Name_Loop_Optimize,
Name_No_Tagged_Streams): Move to regular pragmas. Add
placeholders for Default_Scalar_Storage_Order, Dispatching_Domain,
and Secondary_Stack_Size.
(Pragma_Id): Move Pragma_Assume,
Pragma_Attribute_Definition, Pragma_Loop_Optimize and
Pragma_No_Tagged_Streams to second part.
From-SVN: r247470
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* exp_attr.adb: Minor reformatting.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Selected_Component): Improve error
detection for illegal references to private components or
operations of a protected type in the body of the type.
From-SVN: r247469
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* opt.ads: Add missing GNAT markers in comments.
* opt.adb (Set_Opt_Config_Switches): Do not override earlier
settings of Optimize_Alignment at the end.
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb (Apply_Constraint_Check): Do not apply
a discriminant check when the associated type is a constrained
subtype created for an unconstrained nominal type.
* exp_attr.adb: Minor reformatting.
2017-05-02 Bob Duff <duff@adacore.com>
* sem_ch3.adb (OK_For_Limited_Init_In_05): Handle correctly
the N_Raise_Expression case.
* sem_ch6.adb (Check_Limited_Return): Minor: clarify comment,
and add assertions.
2017-05-02 Yannick Moy <moy@adacore.com>
* exp_ch4.adb (Expand_N_Op_Ne): Do not bump parenthese level and
optimize length comparison in GNATprove mode.
* exp_spark.adb (Expand_SPARK_Op_Ne): New function to rewrite
operator /= into negation of operator = when needed.
(Expand_SPARK): Call new
function to expand operator /=.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* exp_fixd.adb (Expand_Divide_Fixed_By_Fixed_Giving_Fixed):
Simplify the expression for a fixed-fixed division to remove
divisions by constants whenever possible, as an optimization
for restricted targets.
From-SVN: r247468
2017-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb, sem_ch3.adb, sem_ch6.adb: Minor reformatting.
2017-05-02 Bob Duff <duff@adacore.com>
* exp_attr.adb (Callable, Identity, Terminated): Use Find_Prim_Op
to find primitive ops, instead of using an Identifier that will
later be looked up. This is necessary because these ops are not
necessarily visible at all places where we need to call them.
* exp_util.ads: Minor comment fix.
From-SVN: r247466
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Fully_Conformant_Expressions): Two entity
references are fully conformant if they are both expansions
of the discriminant of a protected type, within one of the
protected operations. One occurrence may be expanded into a
constant declaration while the other is an input parameter to
the corresponding generated subprogram.
2017-05-02 Justin Squirek <squirek@adacore.com>
* sem_ch3.adb (Check_For_Null_Excluding_Components): Created for
recursivly searching composite-types for null-excluding access
types and verifying them.
(Analyze_Object_Declaration): Add a
call to Check_Null_Excluding_Components for static verification
of non-initialized objects.
* checks.adb, checks.ads (Null_Exclusion_Static_Checks): Added
a parameter for a composite-type's component and an extra case
for printing component information.
2017-05-02 Yannick Moy <moy@adacore.com>
* sem_ch10.adb (Analyze_Subunit): Take
configuration pragma into account when restoring appropriate
pragma for analysis of subunit.
2017-05-02 Justin Squirek <squirek@adacore.com>
* s-tasren.adb, s-tasini.adb, s-taprop-linux.adb,
s-mudido-affinity.adb,, a-exetim-posix.adb, a-direio.adb,
g-socket.adb, s-taenca.adb, s-fileio.adb: Remove unused use-type
clauses from the runtime.
From-SVN: r247465
While either of the last two operands can be in memory, they can't be
swapped.
gcc/
2017-05-01 Jan Beulich <jbeulich@suse.com>
* config/i386/sse.md (xop_vpermil2<mode>3): Do not allow operand
swapping, add (x,x,m,x,n) alternative.
From-SVN: r247464
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
* freeze.adb (Check_Component_Storage_Order): Do not treat bit-packed
array components specially.
2017-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Premature_Usage): If the premature usage of
an entity is as the expression in its own object decaration,
rewrite the reference as Any_Id to prevent cascaded errors or
compiler loops when such an entity is used in an address clause.
From-SVN: r247462
libiberty/ChangeLog:
* d-demangle.c (strtol): Remove declaration.
Updated all callers to use dlang_number.
(dlang_number): New function.
(dlang_value): Moved check for ISDIGIT into dlang_parse_integer.
* testsuite/d-demangle-expected: Add tests.
From-SVN: r247453
The original implementation of fix-it hints (r230674) had an abstract
base class "fixit_hint" and three subclasses, representing
each of insertions, replacements, and deletions.
Having multiple classes for fix-it hints was a nuisance, as it required
per-class logic everywhere that the hints were handled.
In r239632 I eliminated the deletion subclass in favor of replacement
with the empty string (two subclasses are easier than three).
This patch eliminates the class hierarchy altogether by implementing
insertion in terms of replacement, by representing replacements via
a half-open interval (so that for an insertion, start == next location,
and we're effectively replacing an empty range at the insertion point
with the new string).
This greatly simplifies the code for handling fix-it hints; for example
it allows removal of a parallel class hierarchy of line_event within
edit-context.c.
It also improves consolidation of hints: we can now consolidate
insertions at the same location, affecting a couple of tests
(selftest::test_one_liner_many_fixits and
gcc.dg/Wmissing-braces-fixits.c).
gcc/ChangeLog:
* diagnostic-show-locus.c (layout::get_expanded_location): Rewrite
to use new fixit_hint representation, using the "replace" logic.
(get_line_span_for_fixit_hint): Likewise.
(layout::print_any_fixits): Likewise.
(selftest::test_one_liner_many_fixits): Rename to...
(selftest::test_one_liner_many_fixits_1): ...this, and update
comment and expected output to reflect that the multiple fix-it
hints are now consolidated into one insertion.
(selftest::test_one_liner_many_fixits_2): New test.
(selftest::test_diagnostic_show_locus_one_liner): Update for
above.
(selftest::test_fixit_consolidation): Update for fix-it API
change.
* diagnostic.c (print_parseable_fixits): Likewise.
* edit-context.c (edited_line::m_line_events): Convert from
auto_vec <line_event *> to auto_vec <line_event>.
(class line_event): Convert from abstract base class to a concrete
class, taking over the role of replace_event.
(class insert_event): Delete.
(class replace_event): Rename to class line_event. Convert to
half-open range.
(edit_context::add_fixits): Reimplement.
(edit_context::apply_insert): Delete.
(edit_context::apply_replace): Rename to...
(edit_context::apply_fixit): ...this. Convert to half-open range.
(edited_file::apply_insert): Delete.
(edited_file::apply_replace): Rename to...
(edited_file::apply_fixit): ...this.
(edited_line::~edited_line): Drop deletion of events.
(edited_line::apply_insert): Delete.
(edited_line::apply_replace): Rename to...
(edited_line::apply_fixit): ...this. Convert to half-open range.
Update for change to type of m_line_events.
* edit-context.h (edit_context::apply_insert): Delete.
(edit_context::apply_replace): Rename to...
(edit_context::apply_fixit): ...this.
gcc/testsuite/ChangeLog:
* gcc.dg/Wmissing-braces-fixits.c: Update expected output to
reflect insertion fix-it hints at the same location now being
consolidated.
libcpp/ChangeLog:
* include/line-map.h (source_range::intersects_line_p): Delete.
(rich_location::add_fixit): Delete.
(rich_location::maybe_add_fixit): New method.
(class fixit_hint): Reimplement in terms of...
(class fixit_replace): ...this.
(class fixit_insert): Delete.
* line-map.c (linemap_position_for_loc_and_offset): Drop overzealous
linemap_assert_fails.
(source_range::intersects_line_p): Rename to...
(fixit_hint::affects_line_p): New function.
(rich_location::add_fixit_insert_before): Reimplement in terms of
maybe_add_fixit, moving validation there.
(rich_location::add_fixit_insert_after): Likewise.
(column_before_p): Delete.
(rich_location::add_fixit_replace): Reimplement in terms of
maybe_add_fixit, moving validation there. Convert closed input range
to half-open range.
(rich_location::add_fixit): Delete.
(rich_location::maybe_add_fixit): New function.
(fixit_insert::fixit_insert): Delete.
(fixit_insert::~fixit_insert): Delete.
(fixit_insert::affects_line_p): Delete.
(fixit_insert::maybe_append_replace): Delete.
(fixit_replace::fixit_replace): Rename to...
(fixit_hint::fixit_hint): ...this, rewriting as necessary.
(fixit_replace::~fixit_replace): Delete.
(fixit_replace::affects_line_p): Delete.
(fixit_replace::maybe_append_replace): Rename to...
(fixit_hint::maybe_append): ...this, rewriting as necessary.
From-SVN: r247445
The test-case has an xfail-ed line. For linkers without plugin support, that
line happens to xpass. Require linker with plugin support, such that the line
is no longer xpass-ing, but unsupported.
2017-05-01 Tom de Vries <tom@codesourcery.com>
* gcc.dg/pr78768.c: Require linker plugin.
From-SVN: r247443
2017-05-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/37131
* frontend-passes.c (inline_matmul_assign): Also check bounds
for allocatable lhs and matrix-vector-multiplication.
2017-05-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/37131
* gfortran.dg/matmul_bounds_11.f90: New test.
From-SVN: r247441
2017-05-01 Tom de Vries <tom@codesourcery.com>
PR testsuite/65941
* lib/target-supports.exp (check_effective_target_rdrand): New proc.
* g++.dg/other/pr59492.C: Require effective target rdrand.
From-SVN: r247438
libiberty/ChangeLog:
* d-demangle.c (dlang_identifier): Handle template constraint symbols.
(dlang_parse_template): Only advance if template symbol prefix is
followed by a digit.
* testsuite/d-demangle-expected: Add tests.
From-SVN: r247433
* tree.c (substitute_in_expr) <tcc_vl_exp>: Also inline a call if the
replacement expression is another instance of one of its arguments.
From-SVN: r247431
PR target/79430
* rtlanal.c (reg_set_p): If reg is a stack_pointer_rtx, also
check for stack push/pop autoinc.
* config/i386/i386.c (ix86_agi_dependent): Return false
if the only reason why modified_in_p returned true is that
addr is SP based and set_insn is a push or pop.
From-SVN: r247429
* gcc-interface/decl.c (components_to_record): Add more comments.
Put back pending fields onto the regular list if the misalignment
happens to cancel itself.
From-SVN: r247426