Jakub Jelinek [Sat, 26 May 2018 06:40:50 +0000 (08:40 +0200)]
re PR bootstrap/85921 (/gcc/c-family/c-warn.c fails to build)
PR bootstrap/85921
* c-warn.c (diagnose_mismatched_attributes): Remove unnecessary
noinline variable to workaround broken kernel headers.
From-SVN: r260790
GCC Administrator [Sat, 26 May 2018 00:16:48 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r260789
Jim Wilson [Fri, 25 May 2018 22:29:17 +0000 (22:29 +0000)]
RISC-V: Add interrupt attribute support.
gcc/
* config/riscv/riscv-protos.h (riscv_epilogue_uses): New.
* config/riscv/riscv.c (struct machine_function): Add
interrupt_handler_p and attribute_checked_p fields.
(riscv_attribute_table): Add interrupt.
(riscv_interrupt_type_p): New.
(riscv_save_reg_p): Save extra regs for interrupt handler.
(riscv_use_save_libcall): Return false for interrupt handler.
(riscv_first_stack_step): Add forward declaration.
(riscv_compute_frame_info): New local interrupt_save_t1. Set it
for interrupt handler with large frame. Use it for saved reg list.
(riscv_expand_prologue): Move flag_stack_usage_info support to
eliminate duplication.
(riscv_expand_epilogue): Generate mret for interrupt handler.
(riscv_epilogue_uses): New.
(riscv_can_use_return_insn): Return false for interrupt handler.
(riscv_function_ok_for_sibcall): Likewise.
(riscv_set_current_function): Add interrupt handler support.
* config/riscv/riscv.h (EPILOGUE_USES): Call riscv_epilogue_uses.
* config/riscv/riscv.md (UNSPECV_MRET): New.
(GP_REGNUM): New.
(riscv_frflags, riscv_fsflags): Use tab after opcode.
(riscv_mret): New.
* doc/extend.texi (RISC-V Function Attributes) <interrupt>: New.
gcc/testsuite/
* gcc.target/riscv/interrupt-1.c: New.
* gcc.target/riscv/interrupt-2.c: New.
* gcc.target/riscv/interrupt-3.c: New.
* gcc.target/riscv/interrupt-4.c: New.
* gcc.target/riscv/interrupt-5.c: New.
From-SVN: r260785
Steven G. Kargl [Fri, 25 May 2018 21:57:24 +0000 (21:57 +0000)]
re PR fortran/85786 (Segfault in associated intrinsic)
2018-05-25 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/85786
* gfortran.dg/pr85786.f90: New test.
From-SVN: r260783
Jason Merrill [Fri, 25 May 2018 21:03:07 +0000 (17:03 -0400)]
PR c++/85815 - reference to member of enclosing template.
* search.c (lookup_base): Use currently_open_class.
(lookup_member): Use it regardless of -fconcepts.
* parser.c (cp_parser_postfix_dot_deref_expression): Check it.
From-SVN: r260782
Paul Koning [Fri, 25 May 2018 20:59:28 +0000 (16:59 -0400)]
Fix test case failures for pdp11 target.
* gcc.c-torture/compile/
20151204.c: Skip if pdp11.
* gcc.c-torture/compile/pr55921.c: Ditto.
* gcc.c-torture/compile/pr60655-1.c: Ditto.
* gcc.c-torture/compile/vector-align-1.c: Add max alignment if pdp11.
From-SVN: r260781
Jason Merrill [Fri, 25 May 2018 20:55:32 +0000 (16:55 -0400)]
CWG 616, 1213 - value category of subobject references.
* tree.c (lvalue_kind): Fix handling of ARRAY_REF of pointer.
From-SVN: r260780
Bill Schmidt [Fri, 25 May 2018 19:12:16 +0000 (19:12 +0000)]
re PR tree-optimization/85712 (ICE in all_phi_incrs_profitable_1 at gcc/gimple-ssa-strength-reduction.c:3479)
2018-05-25 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/85712
* gimple-ssa-strength-reduction.c (replace_one_candidate): Skip if
this candidate has already been replaced in-situ by a copy.
From-SVN: r260772
Rasmus Villemoes [Fri, 25 May 2018 16:51:58 +0000 (18:51 +0200)]
* inclhack.def (vxworks_iolib_include_unistd): New fix.
From-SVN: r260763
Jason Merrill [Fri, 25 May 2018 16:44:55 +0000 (12:44 -0400)]
PR c++/80485 - inline function non-zero address.
* symtab.c (nonzero_address): Check DECL_COMDAT.
From-SVN: r260762
François Dumont [Fri, 25 May 2018 16:40:55 +0000 (16:40 +0000)]
re PR libstdc++/85768 (FreeBSD bootstrap fails due to undefined reference to 'backtrace')
2018-05-25 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/85768
* src/c++11/debug.cc: Remove backtrace usage.
From-SVN: r260761
Uros Bizjak [Fri, 25 May 2018 13:56:16 +0000 (15:56 +0200)]
re PR rtl-optimization/83628 (performance regression when accessing arrays on alpha)
PR target/83628
* config/alpha/alpha.md (ashlsi3): New insn pattern.
(*ashlsi_se): Rename from *ashldi_se. Define as sign
extension of SImode operation. Use const123_operand predicate.
(*saddsi_1): Remove.
(*saddl_se_1): Ditto.
(*ssubsi_1): Ditto.
(*ssubl_se_1): Ditto.
* config/alpha/predicates.md (const123_operand): New predicate.
* config/alpha/constraints.md (P): Use IN_RANGE.
From-SVN: r260760
Richard Biener [Fri, 25 May 2018 13:08:28 +0000 (13:08 +0000)]
tree-ssa-alias.h (refs_may_alias_p): Add tbaa_p bool parameter, defaulted to true.
2018-05-25 Richard Biener <rguenther@suse.de>
* tree-ssa-alias.h (refs_may_alias_p): Add tbaa_p bool parameter,
defaulted to true.
(ref_maybe_used_by_stmt_p): Likewise.
(stmt_may_clobber_ref_p): Likewise.
(stmt_may_clobber_ref_p_1): Likewise.
* tree-ssa-alias.c (refs_may_alias_p): Add tbaa_p bool parameter
and pass it along.
(ref_maybe_used_by_stmt_p): Likewise.
(stmt_may_clobber_ref_p): Likewise.
(stmt_may_clobber_ref_p_1): Likewise.
* tree-vect-data-refs.c (vect_slp_analyze_node_dependences): Use
the alias oracle to disambiguate DRs with stmts DR analysis
couldn't handle.
(vect_analyze_data_refs): Do not give up on not analyzable
DRs for BB vectorization. Remove code truncating the dataref
vector.
From-SVN: r260757
Jakub Jelinek [Fri, 25 May 2018 12:36:03 +0000 (14:36 +0200)]
re PR target/85832 ([AVX512] possible shorter code when comparing with vector of zeros)
PR target/85832
* config/i386/sse.md (<avx512>_eq<mode>3<mask_scalar_merge_name>_1):
Add (=Yk,v,C) variant using vptestm insn. Use TARGET_AVX512BW
in test instead of TARGET_AVX512F for VI12_AVX512VL iterator.
* gcc.target/i386/avx512f-pr85832.c: New test.
* gcc.target/i386/avx512vl-pr85832.c: New test.
* gcc.target/i386/avx512bw-pr85832.c: New test.
* gcc.target/i386/avx512vlbw-pr85832.c: New test.
From-SVN: r260756
Richard Biener [Fri, 25 May 2018 11:11:12 +0000 (11:11 +0000)]
tree-vect-data-refs.c (vect_find_stmt_data_reference): New function, combining stmt data ref gathering and fatal analysis parts.
2018-05-25 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_find_stmt_data_reference): New
function, combining stmt data ref gathering and fatal analysis
parts.
(vect_analyze_data_refs): Remove now redudnant code and simplify.
* tree-vect-loop.c (vect_get_datarefs_in_loop): Factor out from
vect_analyze_loop_2 and use vect_find_stmt_data_reference.
* tree-vect-slp.c (vect_slp_bb): Use vect_find_stmt_data_reference.
* tree-vectorizer.h (vect_find_stmt_data_reference): Declare.
From-SVN: r260754
Bin Cheng [Fri, 25 May 2018 11:09:42 +0000 (11:09 +0000)]
re PR tree-optimization/85720 (bad codegen for looped assignment of primitives at -O2)
PR tree-optimization/85720
* tree-loop-distribution.c (break_alias_scc_partitions): Don't merge
SCC if all partitions are builtins.
(version_loop_by_alias_check): New parameter. Generate cancelable
runtime alias check if all partitions are builtins.
(distribute_loop): Update call to above function.
gcc/testsuite
* gcc.dg/tree-ssa/pr85720.c: New test.
* gcc.target/i386/avx256-unaligned-store-2.c: Disable loop pattern
distribution.
From-SVN: r260753
Martin Liska [Fri, 25 May 2018 10:39:35 +0000 (12:39 +0200)]
Fix a test-case (PR testsuite/85911).
2018-05-25 Martin Liska <mliska@suse.cz>
PR testsuite/85911
* gcc.dg/tree-prof/update-loopch.c: Do not scan
for 'Removing basic block'.
From-SVN: r260748
Bin Cheng [Fri, 25 May 2018 10:35:44 +0000 (10:35 +0000)]
tree-outof-ssa.c (tree-ssa.h, tree-dfa.h): Include header files.
* tree-outof-ssa.c (tree-ssa.h, tree-dfa.h): Include header files.
(create_default_def, for_all_parms): Moved from tree-ssa-coalesce.c.
(parm_default_def_partition_arg): Ditto.
(set_parm_default_def_partition): Ditto.
(get_parm_default_def_partitions): Ditto and make it static.
(get_undefined_value_partitions): Ditto and make it static.
(remove_ssa_form): Refactor call to init_var_map here.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Support live range
computation for loop region.
(coalesce_partitions, compute_optimized_partition_bases): Ditto.
(register_default_def): Delete.
(for_all_parms, create_default_def): Move to tree-outof-ssa.c.
(parm_default_def_partition_arg): Ditto.
(set_parm_default_def_partition): Ditto.
(get_parm_default_def_partitions): Ditto and make it static.
(get_undefined_value_partitions): Ditto and make it static.
(coalesce_with_default, coalesce_with_default): Update comment.
(create_coalesce_list_for_region): New func factored out from
create_outofssa_var_map.
(populate_coalesce_list_for_outofssa): New func factored out from
create_outofssa_var_map and coalesce_ssa_name.
(create_outofssa_var_map): Delete.
(coalesce_ssa_name): Refactor to support live range computation.
* tree-ssa-coalesce.h (coalesce_ssa_name): Change decl.
(get_parm_default_def_partitions): Delete.
(get_undefined_value_partitions): Ditto.
* tree-ssa-live.c (init_var_map, delete_var_map): Support live range
computation for loop region.
(new_tree_live_info, loe_visit_block): Ditto.
(live_worklist, set_var_live_on_entry): Ditto.
(calculate_live_on_exit, verify_live_on_entry): Ditto.
* tree-ssa-live.h (struct _var_map): New fields.
(init_var_map): Change decl.
(region_contains_p): New.
From-SVN: r260747
Bin Cheng [Fri, 25 May 2018 10:33:14 +0000 (10:33 +0000)]
* tree-ssa-live.h (live_merge_and_clear): Delete.
From-SVN: r260746
Richard Biener [Fri, 25 May 2018 09:40:38 +0000 (09:40 +0000)]
re PR c++/85912 (-fdump-lang-raw ICE on valid code)
2018-05-25 Richard Biener <rguenther@suse.de>
PR c++/85912
* tree-dump.c (dequeue_and_dump): Remove access to removed
operand 2 of a SWITCH_EXPR.
From-SVN: r260744
Nicolas Roche [Fri, 25 May 2018 09:05:34 +0000 (09:05 +0000)]
[Ada] Improve performance of conversion from String to Long_Float
Once it is sure that the result will be infinity, stop computation and return
the result. This ensure that the function call duration is bounded. Before that
change on some cases the computation was taking more than a few seconds.
2018-05-25 Nicolas Roche <roche@adacore.com>
gcc/ada/
* libgnat/s-valrea.adb (Scan_Real): Abort computation once it is sure
that the result will be either -infinite or +infinite.
From-SVN: r260743
Patrick Bernardi [Fri, 25 May 2018 09:05:28 +0000 (09:05 +0000)]
[Ada] Remove 2GB secondary stack limit for 64-bit processors
This patch removes the restriction introduced recently that limited the size
of the secondary stack to 2GB. The size of the secondary stack is now limited
to half of the size of the memory address space for the target.
2018-05-25 Patrick Bernardi <bernardi@adacore.com>
gcc/ada/
* libgnat/s-parame.ads, libgnat/s-parame__vxworks.ads,
libgnat/s-parame__ae653.ads, libgnat/s-parame__hpux.ads (Size_Type):
Expand range of type to match the address space of the target.
(Task_Storage_Size): Remove unused type.
gcc/testsuite/
* gnat.dg/sec_stack1.adb: New testcase.
From-SVN: r260742
Ed Schonberg [Fri, 25 May 2018 09:05:21 +0000 (09:05 +0000)]
[Ada] Spurious error on fixed-point operation whose operands are expressions
This patch fixes a spurious error in a fixed-point operand of a multiplying
operator M when the operand is an adding operation and the context imposes
a different fixed-point type to the result of M.
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_res.adb (Set_Mixed_Mode_Operand): If the operand is an expression
of a fixed point type and the parent is a multiplying operation,
resolve the operand with its own type because the context will impose a
resulting type on the result of the multiplication by means of
approriate conversion.
gcc/testsuite/
* gnat.dg/fixedpnt4.adb: New testcase.
From-SVN: r260741
Hristian Kirtchev [Fri, 25 May 2018 09:05:15 +0000 (09:05 +0000)]
[Ada] Spurious range check with Initialize_Scalars
This patch modifies the expansion of default-initialized array objects when
pragma Initialize_Scalars or Normalize_Scalars is in effect to suppress the
generation of checks on the constructed in-place aggregate. The aggregate
intentionally contains invalid values which may not necessarily fit the
constraints of a particular component type. Check suppression ensures that
no spurious checks are generated, and that the effects of the pragmas are
carried out.
------------
-- Source --
------------
-- gnat.adc
pragma Initialize_Scalars;
-- init_scalar.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Init_Scalar is
type Fixed is delta 0.25 range -12.0 .. 1270.0;
type Fixed_Array is array (1 .. 1) of Fixed;
begin
begin
declare
Obj : Fixed;
pragma Unreferenced (Obj);
begin null; end;
exception
when others => Put_Line ("ERROR: Fixed raised exception");
end;
begin
declare
Obj : Fixed_Array;
pragma Unreferenced (Obj);
begin null; end;
exception
when others => Put_Line ("ERROR: Fixed_Array raised exception");
end;
end Init_Scalar;
-----------------
-- Compilation --
-----------------
$ gnatmake -q init_scalar.adb
$ ./init_scalar
2018-05-25 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_ch3.adb (Default_Initialize_Object): Ensure that the analysis of
the in-place initialization aggregate created for pragmas
Initialize_Scalars or Normalize_Scalars is performed with checks
suppressed.
From-SVN: r260740
Arnaud Charlet [Fri, 25 May 2018 09:05:10 +0000 (09:05 +0000)]
[Ada] Remove "constant" attribute on Osint.Unknown_Attributes
2018-05-25 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* exp_aggr.adb (Convert_To_Positional): Bump default for
Max_Others_Replicate to 32. Update comments.
* osint.ads (Unknown_Attributes): No longer pretend this is a constant.
(No_File_Info_Cache): Initialize separately.
* osint.adb (No_File_Info_Cache): Update initializer.
From-SVN: r260739
Javier Miranda [Fri, 25 May 2018 09:05:04 +0000 (09:05 +0000)]
[Ada] Membership test of class-wide interface
The compiler rejects the use of a membership test when the left operand
is a class-wide interface type object and the right operand is not a
class-wide type.
2018-05-25 Javier Miranda <miranda@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Membership_Op): Allow the use of the membership
test when the left operand is a class-wide interface and the right
operand is not a class-wide type.
* exp_ch4.adb (Tagged_Membership): Adding support for interface as the
left operand.
gcc/testsuite/
* gnat.dg/interface7.adb: New testcase.
From-SVN: r260738
Ed Schonberg [Fri, 25 May 2018 09:04:59 +0000 (09:04 +0000)]
[Ada] Fix expansion of quantified expressions as part of "others" associations
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_aggr.adb (Flatten): A quantified expression cannot be duplicated
in an others clause to prevent visibility issues with the generated
loop variable.
(Component_OK_For_Backend): Return false for a quantified expression.
(Check_Static_Component): Ditto.
From-SVN: r260737
Hristian Kirtchev [Fri, 25 May 2018 09:04:53 +0000 (09:04 +0000)]
[Ada] Spurious secondary stack depletion
This patch reimplements the secondary stack allocation logic to eliminate an
issue which causes the memory index to overflow while the stack itself uses
very little memory, thus causing a spurious Storage_Error.
The issue in details:
The total amount of memory that the secondary stack can accomodate is dictated
by System.Parameters.Size_Type which is really an Integer, giving roughly 2 GB
of storage.
The secondary stack is comprised of multiple frames which logically form a
contiguous array of memory. Each frame maintans a range over which it operates,
where
Low bound = Previous frame's high bound + 1
High bound = Previous frame's high bound + Frame size
The allocation logic starts by first checking whether the current top frame
(which may not be the "last" frame in the secondary stack) has enough memory to
fit an object. If it does, then that frame is used. If it does not, the logic
then examines the subsequent frames, while carrying out the following actions:
* If the frame is too small to fit the object, it is deleted
* If the frame is big enough to fit the object, it is used
If all the frames were too small (and thus deleted), a new frame is added which
is big enough to fit the object.
Due to an issue with the deletion logic, the last frame would never be deleted.
Since any new frame's range is based on the previous frame's range, the new
range would keep growing, even though the secondary stack may have very few
frames in use. Eventually this growth overflows the memory index type.
The overflow of the memory index type happens only when the secondary stack
is full, and thus signals a Storage_Error. Due to the spurious growth of the
ranges, the overflow happens much faster and results in a bogus stack depleton.
The issue manifests only when each new memory request to the secondary stack is
slightly bigger than the previous memory request, thus prompring the secondary
stack to delete all its frames, and create a new one.
2018-05-25 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* libgnat/s-secsta.adb (SS_Allocate): Reimplemented.
(SS_Allocate_Dynamic): New routine. The allocation logic is now split
into three distring cases rather than in one loop which attempts to
handle all three cases. This rewrite eliminates an issue where the last
frame of the stack cannot be freed, thus causing the memory range of a
new frame to approach the overflow point of the memory index type.
Since the overflow is logically treated as a
too-much-memory-on-the-stack scenario, it causes a bogus Storage_Error.
(SS_Allocate_Static): New routine. The routine factorizes the static
secondary stack-related code from the former SS_Allocate.
gcc/testsuite/
* gnat.dg/sec_stack2.adb: New testcase.
From-SVN: r260736
Sergey Rybin [Fri, 25 May 2018 09:04:47 +0000 (09:04 +0000)]
[Ada] Document the '-U' option for gnatelim
2018-05-25 Sergey Rybin <rybin@adacore.com>
gcc/ada/
* doc/gnat_ugn/gnat_and_program_execution.rst: Add description of '-U'
option for gnatelim.
From-SVN: r260735
Ed Schonberg [Fri, 25 May 2018 09:04:42 +0000 (09:04 +0000)]
[Ada] Crash on classwide precondition on subprogram with stub
This patch allows the compiler to handle properly a classwide precondition
on a primitive operation whose body is a stub and a separate subunit.
Executing:
gnatmake -gnata -q check
./check
must yield:
precondition violated
----
with Text_IO;
with Msg_Data_Block_Decoder; use Msg_Data_Block_Decoder;
procedure Check is
Thing : T_Msg_Data_Block_Decoder;
Value : Integer;
begin
begin
Value := Get_Long_Term_Corrections (Thing);
exception
when others => Text_IO.Put_Line ("precondition violated");
end;
end Check;
----
package Msg_Data_Block_Decoder is
pragma Preelaborate;
type T_Msg_Data_Block_Decoder is Tagged Limited null record;
type T_Msg_Data_Block_Decoder_Class_Access is
access all T_Msg_Data_Block_Decoder'Class;
function Get_Decoded_Data (This : in T_Msg_Data_Block_Decoder)
return Integer;
function Get_Long_Term_Corrections
(This : in T_Msg_Data_Block_Decoder) return Integer with
Pre'
Class => Get_Decoded_Data (T_Msg_Data_Block_Decoder'Class (This)) = 2;
end Msg_Data_Block_Decoder;
----
package body Msg_Data_Block_Decoder is
function Get_Long_Term_Corrections (This : in T_Msg_Data_Block_Decoder)
return Integer is separate;
function Get_Decoded_Data (This : in T_Msg_Data_Block_Decoder)
return Integer is
begin
return 0;
end Get_Decoded_Data;
end Msg_Data_Block_Decoder;
----
separate (Msg_Data_Block_Decoder)
function Get_Long_Term_Corrections (This : in T_Msg_Data_Block_Decoder)
return Integer is
begin
return 0;
end Get_Long_Term_Corrections;
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not create
Class_Wide_Clone_Body when analyzing a subprogram_body_stub: the clone
is created when the proper body of the stub is analyzed.
* sem_util.adb (ZBuild_Class_Wide_Clone_Body): If the subprogram body
is the proper body of a subunit, the cloned body must be inserted in
the declarative list that contains the stub.
From-SVN: r260734
Justin Squirek [Fri, 25 May 2018 09:04:37 +0000 (09:04 +0000)]
[Ada] Fix for freezing of expression functions
2018-05-25 Justin Squirek <squirek@adacore.com>
gcc/ada/
* exp_ch6.adb (Expand_Simple_Function_Return): Add guard in check to
generate code for 6.5(8-10) so that we don't get an assertion error
when dealing with an incomplete return type.
From-SVN: r260733
Arnaud Charlet [Fri, 25 May 2018 09:04:32 +0000 (09:04 +0000)]
[Ada] Strip too long expressions in debug routines
2018-05-25 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* pprint.adb (Expression_Name): Strip too long expressions to avoid
carrying very large strings.
From-SVN: r260732
Patrick Bernardi [Fri, 25 May 2018 09:04:27 +0000 (09:04 +0000)]
[Ada] Disable the creation of the main task secondary stack by the binder
Users can now specify that the binder should not create a secondary stack for
the main (environment) task through the binder switch -Q0. This is useful for
ZFP runtime users who allocate secondary stacks for their application
themselves.
2018-05-25 Patrick Bernardi <bernardi@adacore.com>
gcc/ada/
* switch-b.adb (Scan_Binder_Switches): binder switch -Q accepts Natural
numbers.
From-SVN: r260731
Doug Rupp [Fri, 25 May 2018 09:04:20 +0000 (09:04 +0000)]
[Ada] Implement stack unwinding for Linux on AArch64
2018-05-25 Doug Rupp <rupp@adacore.com>
gcc/ada/
* tracebak.c (aarch64-linux): Implement.
From-SVN: r260730
Justin Squirek [Fri, 25 May 2018 09:04:15 +0000 (09:04 +0000)]
[Ada] Minor reformatting
2018-05-25 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_ch8.adb: Minor reformatting.
From-SVN: r260729
Piotr Trojanek [Fri, 25 May 2018 09:04:09 +0000 (09:04 +0000)]
[Ada] Fix convention for iteration with multiple loop variables
Refactoring based on suggestions from GNAT frontend developers. Semantics
unaffected.
2018-05-25 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_util.adb (Iterate_Call_Parameters): Fix code convention and
assertions.
From-SVN: r260728
Hristian Kirtchev [Fri, 25 May 2018 09:04:04 +0000 (09:04 +0000)]
[Ada] Minor reformatting
2018-05-25 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* einfo.adb, einfo.ads, exp_ch3.adb, exp_ch8.adb, exp_unst.adb,
pprint.adb, sem_ch12.adb, sem_ch3.adb, sem_prag.adb, sem_util.adb:
Minor reformatting.
From-SVN: r260727
Ed Schonberg [Fri, 25 May 2018 09:03:59 +0000 (09:03 +0000)]
[Ada] Strengthen checks for instantiation with interface types
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Instance_Exists): New function, subsidiary of
Validate_Derived_Type_Instance, to verify that all interfaces
implemented by the formal type are also implemented by the actual. The
verification is complicated when an interface of the formal is declared
in a generic unit and the actual is declared in an instance of it.
There is currently no mechanism to relate an interface declared within
a generic to the corresponding interface in an instance, so we must
traverse the list of interfaces of the actual, looking for a name
match, and verifying that that interface is declared in an instance.
From-SVN: r260726
Piotr Trojanek [Fri, 25 May 2018 09:03:54 +0000 (09:03 +0000)]
[Ada] Rewrite Iterate_Call_Parameters in more assertive style
The formal and actual parameters in a subprogram call must match each other.
This is now checked with assertion (so that we can detect possible mistakes),
while the production builds have less work to do. Semantics unchanged.
2018-05-25 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_util.adb (Iterate_Call_Parameters): Rewrite with extra
assertions; replace function versions of Next_Formal/Next_Actual with
their procedural versions (which are more concise).
From-SVN: r260725
Doug Rupp [Fri, 25 May 2018 09:03:47 +0000 (09:03 +0000)]
[Ada] Make Max_Sensible_Delay uniform across all Posix targets
For instance: 6 months where Duration is 64bits. Heretofore LynxOS was unique
in having an approximately 12 days max delay. By experimentation the actual
maximum was determined and all relevant delay and sleep procedures rewritten to
incrementally wait if necessary.
2018-05-25 Doug Rupp <rupp@adacore.com>
gcc/ada/
* libgnarl/s-osinte__aix.ads, libgnarl/s-osinte__android.ads,
libgnarl/s-osinte__darwin.ads, libgnarl/s-osinte__freebsd.ads,
libgnarl/s-osinte__hpux.ads, libgnarl/s-osinte__kfreebsd-gnu.ads,
libgnarl/s-osinte__linux.ads, libgnarl/s-osinte__lynxos178e.ads,
libgnarl/s-osinte__qnx.ads, libgnarl/s-osinte__rtems.ads
(Relative_Timed_Wait): Remove.
* libgnarl/s-tpopmo.adb (Timed_Sleep, Timed_Delay): Rewrite to allow
for incremental looping. Remove references to Rel_Time and
Relative_Timed_Wait.
* libgnat/s-osprim__posix.adb, libgnat/s-osprim__posix2008.adb
(Timed_Delay): Make separate.
* libgnat/s-optide.adb: New separate procedure.
* libgnat/s-osprim.ads (Max_System_Delay): New constant.
* libgnat/s-osprim__lynxos.ads (Max_Sensible_Delay): Set to 6 months.
(Max_System_Delay): New constant.
From-SVN: r260724
Ed Schonberg [Fri, 25 May 2018 09:03:41 +0000 (09:03 +0000)]
[Ada] Checks on instantiations with formal derived types with interfaces
This patch implements the rule stated in RM 12.5.5 : the actual shall be
a descendant of very progenitor of the formal type.
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Validate_Derived_Type_Instance): Verify that the actual
for a formal derived type implements all the interfaces declared for
the formal.
gcc/testsuite/
* gnat.dg/interface6.adb: New testcase.
From-SVN: r260723
Yannick Moy [Fri, 25 May 2018 09:03:34 +0000 (09:03 +0000)]
[Ada] Fix handling of Loop_Entry for CodePeer/SPARK
When the applicable Assertion_Policy is Ignore for a pragma containing
an occurrence of attribute Loop_Entry, CodePeer and SPARK should still be
able to analyze the corresponding pragma. GNAT frontend was wrongly
translating X'Loop_Entry as X in the AST, as a side-effect of an
optimization only valid for compilation and not for static analysis.
This has no effect on compilation.
2018-05-25 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_prag.adb (Check_Applicable_Policy): Deal specially with CodePeer
and GNATprove modes when applicable policy is Ignore.
From-SVN: r260722
Eric Botcazou [Fri, 25 May 2018 09:03:29 +0000 (09:03 +0000)]
[Ada] Support for C99 and C++ standard boolean types
This change the type Interfaces.C.Extensions.bool to be fully compatible
with the C99 and C++ standard boolean types by making it a fully-fledged
boolean type with convention C.
The following C+Ada program must compile quietly in LTO mode:
bool b;
struct S {};
bool foo (struct S *s) { return true; }
pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Extensions;
package t_c is
b : aliased Extensions.bool; -- t.c:3
pragma Import (C, b, "b");
type S is record
null;
end record;
pragma Convention (C_Pass_By_Copy, S); -- t.c:5
function foo (the_s : access S) return Extensions.bool; -- t.c:7
pragma Import (C, foo, "foo");
end t_c;
with t_c; use t_c;
procedure P_C is
Dummy : aliased S;
begin
b := foo (Dummy'Access);
end;
2018-05-25 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* freeze.adb (Freeze_Enumeration_Type): Do not give integer size to a
boolean type with convention C.
* libgnat/i-cexten.ads (bool): Change to boolean with convention C.
* gcc-interface/decl.c (gnat_to_gnu_entity): Add new local variable
FOREIGN and use it throughout the function.
<E_Enumeration_Type>: Set precision 1 on boolean types with foreign
convention.
<E_Enumeration_Subtype>: Likewise for subtypes.
<E_Record_Type>: Force the size of a storage unit on empty classes.
* gcc-interface/utils.c (make_type_from_size) <BOOLEAN_TYPE>: Skip
boolean types with precision 1 if the size is the expected one.
From-SVN: r260721
Arnaud Charlet [Fri, 25 May 2018 09:03:24 +0000 (09:03 +0000)]
[Ada] Do not print non ASCII characters in debug routines
2018-05-25 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* pprint.adb (Expression_Name): Do not print non ASCII characters.
From-SVN: r260720
Bob Duff [Fri, 25 May 2018 09:03:19 +0000 (09:03 +0000)]
[Ada] Unbounded strings: inline Initialize and Adjust
Procedures Initialize and Adjust in the Ada.[Wide_[Wide_]]Strings.Unbounded
package are now inlined for nondispatching calls. No test available (efficiency
issue only).
2018-05-25 Bob Duff <duff@adacore.com>
gcc/ada/
* libgnat/a-strunb__shared.ads, libgnat/a-stwiun__shared.ads,
libgnat/a-stzunb__shared.ads: (Initialize, Adjust): Add pragma Inline.
From-SVN: r260719
Bob Duff [Fri, 25 May 2018 09:03:14 +0000 (09:03 +0000)]
[Ada] Minor comment fix
2018-05-25 Bob Duff <duff@adacore.com>
gcc/ada/
* sem_util.ads: Minor comment fix.
From-SVN: r260718
Ed Schonberg [Fri, 25 May 2018 09:03:09 +0000 (09:03 +0000)]
[Ada] Refine checks for uplevel references
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_unst.adb (Visit_Node): Restrict check for uplevel references in
prefixes of array attributes, to prefixes that are entity names whose
type is constrained.
(Note_Uplevel_Bound): Verify that the bound is declared in an enclosing
subprogram, as itype created for loops in pre/postcondition may appear
in loops at the library level.
From-SVN: r260717
Ed Schonberg [Fri, 25 May 2018 09:03:04 +0000 (09:03 +0000)]
[Ada] Compiler loop on expression function and predicate in generic unit
This patch fixes an infinite loop in the compiler when analyzing an
expression function whose expression mentions a subtype with a static
predicate, and the context is a generic unit.
2018-05-25 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch13.adb (Build_Predicate_Functions): The predicate function
declaration is inserted into the tree and analyzed at that point, so
should not be reinserted when the body is constructed. Inside a
generic, ensure that the body is not inserted twice in the tree.
gcc/testsuite/
* gnat.dg/static_pred1.adb, gnat.dg/static_pred1.ads: New testcase.
From-SVN: r260716
Yannick Moy [Fri, 25 May 2018 09:02:58 +0000 (09:02 +0000)]
[Ada] Detect misplaced assertions between loop invariants
Loop invariants and loop variants should all be colocated, as defined in
SPARK RM 5.5.3(8). The code checking that rule was incorrectly accepting
pragma Assert between two loop invariants. Now fixed.
2018-05-25 Yannick Moy <moy@adacore.com>
gcc/ada/
* sem_prag.adb (Check_Grouping): Modify test to ignore statements and
declarations not coming from source.
From-SVN: r260715
Fedor Rybin [Fri, 25 May 2018 09:02:53 +0000 (09:02 +0000)]
[Ada] Document new switch --copy-environment for gnattest
2018-05-25 Fedor Rybin <frybin@adacore.com>
gcc/ada/
* doc/gnat_ugn/gnat_utility_programs.rst: Document new switch
--copy-environment for gnattest.
From-SVN: r260714
Richard Sandiford [Fri, 25 May 2018 08:53:15 +0000 (08:53 +0000)]
Add IFN_COND_{MUL,DIV,MOD,RDIV}
This patch adds support for conditional multiplication and division.
It's mostly mechanical, but a few notes:
* The *_optab name and the .md names are the same as the unconditional
forms, just with "cond_" added to the front. This means we still
have the awkward difference between sdiv and div, etc.
* It was easier to retain the difference between integer and FP
division in the function names, given that they map to different
tree codes (TRUNC_DIV_EXPR and RDIV_EXPR).
* SVE has no direct support for IFN_COND_MOD, but it seemed more
consistent to add it anyway.
* Adding IFN_COND_MUL enables an extra fully-masked reduction
in gcc.dg/vect/pr53773.c.
* In practice we don't actually use the integer division forms without
if-conversion support (added by a later patch).
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* doc/sourcebuild.texi (vect_double_cond_arith): Include
multiplication and division.
* doc/md.texi (cond_mul@var{m}, cond_div@var{m}, cond_mod@var{m})
(cond_udiv@var{m}, cond_umod@var{m}): Document.
* optabs.def (cond_smul_optab, cond_sdiv_optab, cond_smod_optab)
(cond_udiv_optab, cond_umod_optab): New optabs.
* internal-fn.def (IFN_COND_MUL, IFN_COND_DIV, IFN_COND_MOD)
(IFN_COND_RDIV): New internal functions.
* internal-fn.c (get_conditional_internal_fn): Handle TRUNC_DIV_EXPR,
TRUNC_MOD_EXPR and RDIV_EXPR.
* match.pd (UNCOND_BINARY, COND_BINARY): Handle them.
* config/aarch64/iterators.md (UNSPEC_COND_MUL, UNSPEC_COND_DIV):
New unspecs.
(SVE_INT_BINARY): Include mult.
(SVE_COND_FP_BINARY): Include UNSPEC_MUL and UNSPEC_DIV.
(optab, sve_int_op): Handle mult.
(optab, sve_fp_op, commutative): Handle UNSPEC_COND_MUL and
UNSPEC_COND_DIV.
* config/aarch64/aarch64-sve.md (cond_<optab><mode>): New pattern
for SVE_INT_BINARY_SD.
gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_vect_double_cond_arith): Include
multiplication and division.
* gcc.dg/vect/pr53773.c: Do not expect a scalar tail when using
fully-masked loops with a fixed vector length.
* gcc.dg/vect/vect-cond-arith-1.c: Add multiplication and division
tests.
* gcc.target/aarch64/sve/vcond_8.c: Likewise.
* gcc.target/aarch64/sve/vcond_9.c: Likewise.
* gcc.target/aarch64/sve/vcond_12.c: Add multiplication tests.
From-SVN: r260713
Richard Sandiford [Fri, 25 May 2018 08:38:12 +0000 (08:38 +0000)]
[AArch64] Add SVE support for integer division
After the previous patch to prevent pessimisation of divisions
by constants, this patch adds support for the SVE integer division
instructions.
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* config/aarch64/iterators.md (SVE_INT_BINARY_SD): New code iterator.
(optab, sve_int_op): Handle div and udiv.
* config/aarch64/aarch64-sve.md (<optab><mode>3): New expander
for SVE_INT_BINARY_SD.
(*<optab><mode>3): New insn for the same.
gcc/testsuite/
* gcc.target/aarch64/sve/div_1.c: New test.
* gcc.target/aarch64/sve/div_1_run.c: Likewise.
* gcc.target/aarch64/sve/mul_highpart_2.c: Likewise.
* gcc.target/aarch64/sve/mul_highpart_2_run.c: Likewise.
From-SVN: r260712
Richard Sandiford [Fri, 25 May 2018 08:18:42 +0000 (08:18 +0000)]
Prefer open-coding vector integer division
vect_recog_divmod_pattern currently bails out if the target has
native support for integer division, but I think in practice
it's always going to be better to open-code it anyway, just as
we usually open-code scalar divisions by constants.
I think the only currently affected targets are MIPS MSA and
powerpcspe (which is currently marked obsolete). For:
void
foo (int *x)
{
for (int i = 0; i < 100; ++i)
x[i] /= 2;
}
the MSA port previously preferred to use division for powers of 2:
.set noreorder
bnz.w $w1,1f
div_s.w $w0,$w0,$w1
break 7
.set reorder
1:
(or just the div_s.w for -mno-check-zero-division), but after the patch
it open-codes them using shifts:
clt_s.w $w1,$w0,$w2
subv.w $w0,$w0,$w1
srai.w $w0,$w0,1
MSA doesn't define a high-part pattern, so it still uses a division
instruction for the non-power-of-2 case.
Richard B pointed out that this would disable SLP of division by
different amounts, but I think in practice that's a price worth paying,
since the current cost model can't really tell whether using a general
vector division is better than using open-coded scalar divisions.
The fix would be either to support SLP of mixed open-coded divisions
or to improve the cost model and try SLP again without the patterns.
The patch adds an XFAILed test for this.
2018-05-23 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* tree-vect-patterns.c: Include predict.h.
(vect_recog_divmod_pattern): Restrict check for division support
to when optimizing for size.
gcc/testsuite/
* gcc.dg/vect/bb-slp-div-1.c: New XFAILed test.
From-SVN: r260711
Richard Sandiford [Fri, 25 May 2018 08:09:39 +0000 (08:09 +0000)]
Fold VEC_COND_EXPRs to IFN_COND_* where possible
This patch adds the folds:
(vec_cond COND (foo A B) C) -> (IFN_COND_FOO COND A B C)
(vec_cond COND C (foo A B)) -> (IFN_COND_FOO (!COND) A B C)
with the usual implicit restriction that the target must support
the produced IFN_COND_FOO.
The results of these folds don't have identical semantics, since
the reverse transform would be invalid if (FOO A[i] B[i]) faults when
COND[i] is false. But this direction is OK since we're simply dropping
faults for operations whose results aren't needed.
The new gimple_resimplify4 doesn't try to do any constant folding
on the IFN_COND_*s. This is because a later patch will handle it
by folding the associated unconditional operation.
Doing this in gimple is better than doing it in .md patterns,
since the second form (with the inverted condition) is much more
common than the first, and it's better to fold away the inversion
in gimple and optimise the result before entering expand.
2018-05-24 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* doc/sourcebuild.texi (vect_double_cond_arith: Document.
* gimple-match.h (gimple_match_op::MAX_NUM_OPS): Bump to 4.
(gimple_match_op::gimple_match_op): Add an overload for 4 operands.
(gimple_match_op::set_op): Likewise.
(gimple_resimplify4): Declare.
* genmatch.c (get_operand_type): Handle CFN_COND_* functions.
(expr::gen_transform): Likewise.
(decision_tree::gen): Generate a simplification routine for 4 operands.
* gimple-match-head.c (gimple_simplify): Add an overload for
4 operands. In the top-level function, handle up to 4 call
arguments and call gimple_resimplify4.
(gimple_resimplify4): New function.
(build_call_internal): Pass a fourth operand.
(maybe_push_to_seq): Likewise.
* match.pd (UNCOND_BINARY, COND_BINARY): New operator lists.
Fold VEC_COND_EXPRs of an operation and a default value into
an IFN_COND_* function if possible.
* config/aarch64/iterators.md (UNSPEC_COND_MAX, UNSPEC_COND_MIN):
New unspecs.
(SVE_COND_FP_BINARY): Include them.
(optab, sve_fp_op): Handle them.
(SVE_INT_BINARY_REV): New code iterator.
(SVE_COND_FP_BINARY_REV): New int iterator.
(commutative): New int attribute.
* config/aarch64/aarch64-protos.h (aarch64_sve_prepare_conditional_op):
Declare.
* config/aarch64/aarch64.c (aarch64_sve_prepare_conditional_op): New
function.
* config/aarch64/aarch64-sve.md (cond_<optab><mode>): Use it.
(*cond_<optab><mode>): New patterns for reversed operands.
gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_vect_double_cond_arith): New proc.
* gcc.dg/vect/vect-cond-arith-1.c: New test.
* gcc.target/aarch64/sve/vcond_8.c: Likewise.
* gcc.target/aarch64/sve/vcond_8_run.c: Likewise.
* gcc.target/aarch64/sve/vcond_9.c: Likewise.
* gcc.target/aarch64/sve/vcond_9_run.c: Likewise.
* gcc.target/aarch64/sve/vcond_12.c: Likewise.
* gcc.target/aarch64/sve/vcond_12_run.c: Likewise.
From-SVN: r260710
Richard Biener [Fri, 25 May 2018 08:08:21 +0000 (08:08 +0000)]
tree-vectorizer.h (STMT_VINFO_GROUP_*, GROUP_*): Remove.
2018-05-25 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (STMT_VINFO_GROUP_*, GROUP_*): Remove.
(DR_GROUP_*): New, assert we have non-NULL ->data_ref_info.
(REDUC_GROUP_*): New, assert we have NULL ->data_ref_info.
(STMT_VINFO_GROUPED_ACCESS): Adjust.
* tree-vect-data-refs.c (everywhere): Adjust users.
* tree-vect-loop.c (everywhere): Likewise.
* tree-vect-slp.c (everywhere): Likewise.
* tree-vect-stmts.c (everywhere): Likewise.
* tree-vect-patterns.c (vect_reassociating_reduction_p): Likewise.
From-SVN: r260709
Rainer Orth [Fri, 25 May 2018 07:57:10 +0000 (07:57 +0000)]
Support SHF_EXCLUDE on non-x86 and with Solaris as
* 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
Richard Sandiford [Fri, 25 May 2018 06:48:47 +0000 (06:48 +0000)]
Add an "else" argument to IFN_COND_* functions
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 [Fri, 25 May 2018 06:35:30 +0000 (06:35 +0000)]
Try harder to preserve operand ties in maybe_legitimize_operands
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
Janus Weil [Fri, 25 May 2018 06:09:10 +0000 (08:09 +0200)]
re PR fortran/85839 ([F2018] warn for obsolescent features)
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
Steven G. Kargl [Fri, 25 May 2018 00:39:23 +0000 (00:39 +0000)]
re PR fortran/85543 (ICE in update_current_proc_array_outer_dependency, at fortran/resolve.c:3060)
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
GCC Administrator [Fri, 25 May 2018 00:16:30 +0000 (00:16 +0000)]
Daily bump.
From-SVN: r260703
Steven G. Kargl [Thu, 24 May 2018 23:28:35 +0000 (23:28 +0000)]
re PR fortran/85780 (ICE in resolve_fl_procedure, at fortran/resolve.c:12504)
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 [Thu, 24 May 2018 22:31:11 +0000 (22:31 +0000)]
re PR fortran/85779 (ICE in gfc_typename, at fortran/misc.c:156)
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 [Thu, 24 May 2018 22:28:33 +0000 (22:28 +0000)]
re PR fortran/85895 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3518)
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
Tom Rix [Thu, 24 May 2018 22:03:06 +0000 (22:03 +0000)]
* dwarf2.def (DW_FORM_strx*, DW_FORM_addrx*): New.
From-SVN: r260695
Uros Bizjak [Thu, 24 May 2018 21:23:33 +0000 (23:23 +0200)]
sse.md (cvtusi2<ssescalarmodesuffix>64<round_name>): Add {q} suffix to insn mnemonic.
* 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
Jozef Lawrynowicz [Thu, 24 May 2018 20:49:11 +0000 (20:49 +0000)]
msp430.c (TARGET_WARN_FUNC_RETURN): Define.
* config/msp430/msp430.c (TARGET_WARN_FUNC_RETURN): Define.
(msp430_warn_func_return): New.
From-SVN: r260690
Roger Sayle [Thu, 24 May 2018 20:47:03 +0000 (20:47 +0000)]
fold-const.c (tree_nonzero_bits): New function.
* 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
Jason Merrill [Thu, 24 May 2018 20:03:18 +0000 (16:03 -0400)]
PR c++/85842 - -Wreturn-type, constexpr if and generic lambda.
* pt.c (tsubst_lambda_expr): Copy current_function_returns_* to
generic lambda.
From-SVN: r260685
H.J. Lu [Thu, 24 May 2018 19:52:32 +0000 (19:52 +0000)]
libsanitizer: Use pre-computed size of struct ustat for Linux
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 [Thu, 24 May 2018 19:51:09 +0000 (19:51 +0000)]
Check ifunc_resolver only on FUNCTION_DECL
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
Ville Voutilainen [Thu, 24 May 2018 19:05:46 +0000 (22:05 +0300)]
Pedwarn on a non-standard position of a C++ attribute.
From-SVN: r260682
Uros Bizjak [Thu, 24 May 2018 18:16:29 +0000 (20:16 +0200)]
re PR target/85903 (FAIL: gcc.target/i386/avx512dq-vcvtuqq2pd-2.c)
PR target/85903
* config/i386/sse.md (movdi_to_sse): Do not generate pseudo
when memory input operand is handled.
From-SVN: r260681
Maya Rashish [Thu, 24 May 2018 17:31:13 +0000 (17:31 +0000)]
PR target/85904 check for aligned_alloc on netbsd cross-compilation
2018-05-24 Maya Rashish <coypu@sdf.org>
PR target/85904
* crossconfig.m4: Test for aligned_alloc on netbsd.
* configure: Regenerate.
From-SVN: r260678
Paolo Carlini [Thu, 24 May 2018 17:20:01 +0000 (17:20 +0000)]
cp-tree.h (INDIRECT_TYPE_P): New.
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
Jonathan Wakely [Thu, 24 May 2018 15:28:26 +0000 (16:28 +0100)]
Implement P0558R2 changes to std::atomic
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
Luis Machado [Thu, 24 May 2018 14:37:21 +0000 (14:37 +0000)]
[AArch64, Falkor] Falkor address costs tuning
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
Jason Merrill [Thu, 24 May 2018 14:27:10 +0000 (10:27 -0400)]
PR c++/85864 - literal template and default template arg.
* pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
From-SVN: r260672
Marek Polacek [Thu, 24 May 2018 13:36:21 +0000 (13:36 +0000)]
re PR c++/85847 (unexpected expression of kind template_id_expr)
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
Piotr Trojanek [Thu, 24 May 2018 13:07:11 +0000 (13:07 +0000)]
[Ada] Simplify routines with a local Result variable
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
Eric Botcazou [Thu, 24 May 2018 13:07:06 +0000 (13:07 +0000)]
[Ada] Fix irregular output with -gnatR3
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 [Thu, 24 May 2018 13:07:00 +0000 (13:07 +0000)]
[Ada] Minor clean-ups in gigi
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
Javier Miranda [Thu, 24 May 2018 13:06:47 +0000 (13:06 +0000)]
[Ada] Wrong renaming of variant record equality
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
Ed Schonberg [Thu, 24 May 2018 13:06:40 +0000 (13:06 +0000)]
[Ada] Add a new Is_Activation_Record flag on IN parameters
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
Yannick Moy [Thu, 24 May 2018 13:06:34 +0000 (13:06 +0000)]
[Ada] Improve GNATprove messages on unproved checks
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
Javier Miranda [Thu, 24 May 2018 13:06:28 +0000 (13:06 +0000)]
[Ada] Missing error on illegal access to discriminant
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
Ed Schonberg [Thu, 24 May 2018 13:06:21 +0000 (13:06 +0000)]
[Ada] Infinite loop in the compiler when warning on redundant constructs
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
Piotr Trojanek [Thu, 24 May 2018 13:06:16 +0000 (13:06 +0000)]
[Ada] Minor fix grammar in comment of N_Defining_Identifier
2018-05-24 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sinfo.ads: Fix grammar in comment.
From-SVN: r260662
Justin Squirek [Thu, 24 May 2018 13:06:11 +0000 (13:06 +0000)]
[Ada] Quadratic compile time with tagged types
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
Hristian Kirtchev [Thu, 24 May 2018 13:06:05 +0000 (13:06 +0000)]
[Ada] Spurious error due to lingering limited view
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
Eric Botcazou [Thu, 24 May 2018 13:05:59 +0000 (13:05 +0000)]
[Ada] Handle version 2 of Windows unwinding information structures
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
Hristian Kirtchev [Thu, 24 May 2018 13:05:54 +0000 (13:05 +0000)]
[Ada] Minor reformatting
2018-05-24 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_ch7.adb, sem_ch3.adb, sem_res.adb: Minor reformatting.
From-SVN: r260658
Ed Schonberg [Thu, 24 May 2018 13:05:49 +0000 (13:05 +0000)]
[Ada] Add warning on redundant others_clause in array aggregate
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
Raphael Amiard [Thu, 24 May 2018 13:05:43 +0000 (13:05 +0000)]
[Ada] Update Ada.Containers.Hashed_Maps documentation with Ada RM doc.
2018-05-24 Raphael Amiard <amiard@adacore.com>
gcc/ada/
* libgnat/a-cohama.ads: Add documentation.
From-SVN: r260656
Raphael Amiard [Thu, 24 May 2018 13:05:38 +0000 (13:05 +0000)]
[Ada] Add documentation from the Ada RM to Ada.Containers.Vector
2018-05-24 Raphael Amiard <amiard@adacore.com>
gcc/ada/
* libgnat/a-convec.ads: Add documentation.
From-SVN: r260655
Justin Squirek [Thu, 24 May 2018 13:05:32 +0000 (13:05 +0000)]
[Ada] Crash on return of raise expression
This patch fixes an issue whereby the compiler regarded assignments to limited
that consisted of raise expressions to be a compile-time error during
expansion.
2018-05-24 Justin Squirek <squirek@adacore.com>
gcc/ada/
* exp_ch3.adb (Expand_N_Object_Declaration): Ignore raising an error in
expansion for limited tagged types when the node to be expanded is a
raise expression due to it not representing a valid object.
* exp_ch5.adb (Expand_N_Assignment_Statement): Add exception to error
message regarding assignments to limited types to ignore genereated
code.
gcc/testsuite/
* gnat.dg/raise_expr.adb: New testcase.
From-SVN: r260654
Hristian Kirtchev [Thu, 24 May 2018 13:05:26 +0000 (13:05 +0000)]
[Ada] Crash on function in Ghost subunit
This patch modifies the creation of class-wide subtypes to preserve vital
attributes related to Ghost code. The subtype is created by copying the
contents of a class-wide type into a newly created itype. When the itype
is created within a Ghost region, the act of copying destroys Ghost code
related attributes. As a result, if the now living class-wide subtype is
frozen within an ignored Ghost region, its freeze node is hoisted prior
to the start of the region, howeve the subtype is still eliminated from
the tree.
------------
-- Source --
------------
-- pack.ads
with Ada.Finalization; use Ada.Finalization;
package Pack is
type Ctrl is new Controlled with null record;
function Make_Ctrl return Ctrl;
package Nested with Ghost is
procedure Proc;
end Nested;
end Pack;
-- pack.adb
package body Pack is
function Make_Ctrl return Ctrl is
begin
return Result : Ctrl;
end Make_Ctrl;
package body Nested is separate;
end Pack;
-- pack-nested.adb
separate (Pack)
package body Nested is
procedure Proc is
Res : constant Ctrl'Class := Make_Ctrl;
begin null; end Proc;
end Nested;
-----------------
-- Compilation --
-----------------
$ gcc -c pack.adb
2018-05-24 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* exp_util.adb (New_Class_Wide_Subtype): Capture and restore relevant
Ghost-related attributes of the class-wide subtype because the copy
clobbers them.
From-SVN: r260653
Justin Squirek [Thu, 24 May 2018 13:05:20 +0000 (13:05 +0000)]
[Ada] Ineffective use warning is suppressed when performing verification
This patch fixes an issue whereby the compiler incorrectly marked use clauses
as effective due to code generated for verification referencing certain types
leading to missing use clause warnings.
No reasonably small testcase available.
2018-05-24 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_res.adb (Resolve_Entity_Name): Add guard to protect against
marking use clauses as effective when the reference appears within
generated code.
From-SVN: r260652
Cyrille Comar [Thu, 24 May 2018 13:05:14 +0000 (13:05 +0000)]
[Ada] Fix typos in documentation
2018-05-24 Cyrille Comar <comar@adacore.com>
gcc/ada/
* doc/gnat_rm/the_gnat_library.rst: Fix typos.
* gnat_rm.texi: Regenerate.
From-SVN: r260651
Bob Duff [Thu, 24 May 2018 13:05:08 +0000 (13:05 +0000)]
[Ada] Memory leak mixing limited and nonlimited functions
This patch fixes a memory leak. If a build-in-place function with a result
whose size is not known at the call site is called, and that function calls a
non-build-in-place function that allocates on the secondary stack, the
secondary stack was not necessarily cleaned up, which caused a memory leak.
The following program should print:
"Current allocated space : 0 bytes"
(among other things) in the loop.
./bip_leak-main > log
grep 'Current allocated' log
Current allocated space : 0 bytes
Current allocated space : 0 bytes
Current allocated space : 0 bytes
with Ada.Finalization;
package BIP_Leak is
subtype Limited_Controlled is Ada.Finalization.Limited_Controlled;
type Nonlim_Controlled is new Ada.Finalization.Controlled with null record;
type Needs_Fin is record
X : Nonlim_Controlled;
end record;
type Lim_Controlled is new Limited_Controlled with null record;
function Return_Lim_Controlled (Source : Boolean)
return Lim_Controlled;
procedure Dump_SS;
end BIP_Leak;
with Ada.Text_IO;
pragma Warnings (Off);
with System.Secondary_Stack;
pragma Warnings (On);
package body BIP_Leak is
function Transform (X : Needs_Fin) return Lim_Controlled is
begin
return (Limited_Controlled with null record);
end;
function Return_Needs_Fin (I : Boolean) return Needs_Fin is
THR : Needs_Fin;
begin
return THR;
end;
function Return_Lim_Controlled (Source : Boolean)
return Lim_Controlled is
begin
return Transform (Return_Needs_Fin (Source));
end Return_Lim_Controlled;
procedure Dump_SS_Instance is
new System.Secondary_Stack.SS_Info (Ada.Text_IO.Put_Line);
procedure Dump_SS renames Dump_SS_Instance;
end BIP_Leak;
procedure BIP_Leak.Main is
begin
for Count in 1 .. 350_000 loop
declare
Msg : constant Lim_Controlled := Return_Lim_Controlled (True);
begin
if Count mod 100_000 = 0 then
Dump_SS;
end if;
end;
end loop;
end BIP_Leak.Main;
2018-05-24 Bob Duff <duff@adacore.com>
gcc/ada/
* exp_ch7.adb (Expand_Cleanup_Actions): Create a mark unconditionally
for build-in-place functions with a caller-unknown-size result.
(Create_Finalizer): For build-in-place functions with a
caller-unknown-size result, check at run time whether we need to
release the secondary stack.
From-SVN: r260650