This patch adds an inchash hasher for wide_int-based types.
It means that hash_tree no longer hashes TREE_INT_CST_EXT_NUNITS,
but that was redundant with hashing the type.
2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* inchash.h (inchash:#️⃣:add_wide_int): New function.
* lto-streamer-out.c (hash_tree): Use it.
From-SVN: r253988
The name inchash::add_wide_int is a bit misleading, since it sounds
like it's hashing a wide_int. This patch renames it to add_hwi instead.
2017-10-22 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* inchash.h (inchash:#️⃣:add_wide_int): Rename to...
(inchash:#️⃣:add_hwi): ...this.
* ipa-devirt.c (hash_odr_vtable): Update accordingly.
(polymorphic_call_target_hasher::hash): Likewise.
* ipa-icf.c (sem_function::get_hash, sem_function::init): Likewise.
(sem_item::add_expr, sem_item::add_type, sem_variable::get_hash)
(sem_item_optimizer::update_hash_by_addr_refs): Likewise.
* lto-streamer-out.c (hash_tree): Likewise.
* optc-save-gen.awk: Likewise.
* tree.c (add_expr): Likewise.
From-SVN: r253987
gcc/doc/
* extend.texi: Add x86 specific to 'nocf_check' attribute.
List CET intrinsics.
* invoke.texi: Add -mcet, -mibt, -mshstk options. Add x86
specific to -fcf-protection option.
From-SVN: r253978
All platforms except i386 will report the error and do no
instrumentation with -finstrument-control-flow option. i386
will provide the implementation based on a specification
published by Intel for a new technology called Control-flow
Enforcement Technology (CET). The spec is available at
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf
The implementation in this patch:
1) enables Control-flow Enforcement Technology (CET), published by
Intel. This part introduces i386 specific options -mcet, -mibt and
-mshstk, new instructions and intrinsics;
2) provides support for -fcf-protection option and 'nocf_check'
attribute by doing needed code instrumentation, which is based on
CET features.
gcc/
* common/config/i386/i386-common.c (OPTION_MASK_ISA_IBT_SET): New.
(OPTION_MASK_ISA_SHSTK_SET): Likewise.
(OPTION_MASK_ISA_IBT_UNSET): Likewise.
(OPTION_MASK_ISA_SHSTK_UNSET): Likewise.
(ix86_handle_option): Add -mibt, -mshstk, -mcet handling.
* config.gcc (extra_headers): Add cetintrin.h for x86 targets.
(extra_objs): Add cet.o for Linux/x86 targets.
(tmake_file): Add i386/t-cet for Linux/x86 targets.
* config/i386/cet.c: New file.
* config/i386/cetintrin.h: Likewise.
* config/i386/t-cet: Likewise.
* config/i386/cpuid.h (bit_SHSTK): New.
(bit_IBT): Likewise.
* config/i386/driver-i386.c (host_detect_local_cpu): Detect and
pass IBT and SHSTK bits.
* config/i386/i386-builtin-types.def
(VOID_FTYPE_UNSIGNED_PVOID): New.
(VOID_FTYPE_UINT64_PVOID): Likewise.
* config/i386/i386-builtin.def: Add CET intrinsics.
* config/i386/i386-c.c (ix86_target_macros_internal): Add
OPTION_MASK_ISA_IBT, OPTION_MASK_ISA_SHSTK handling.
* config/i386/i386-passes.def: Add pass_insert_endbranch pass.
* config/i386/i386-protos.h (make_pass_insert_endbranch): New
prototype.
* config/i386/i386.c (rest_of_insert_endbranch): New.
(pass_data_insert_endbranch): Likewise.
(pass_insert_endbranch): Likewise.
(make_pass_insert_endbranch): Likewise.
(ix86_notrack_prefixed_insn_p): Likewise.
(ix86_target_string): Add -mibt, -mshstk flags.
(ix86_option_override_internal): Add flag_cf_protection
processing.
(ix86_valid_target_attribute_inner_p): Set OPT_mibt, OPT_mshstk.
(ix86_print_operand): Add 'notrack' prefix output.
(ix86_init_mmx_sse_builtins): Add CET intrinsics.
(ix86_expand_builtin): Expand CET intrinsics.
(x86_output_mi_thunk): Add 'endbranch' instruction.
* config/i386/i386.h (TARGET_IBT): New.
(TARGET_IBT_P): Likewise.
(TARGET_SHSTK): Likewise.
(TARGET_SHSTK_P): Likewise.
* config/i386/i386.md (unspecv): Add UNSPECV_NOP_RDSSP,
UNSPECV_INCSSP, UNSPECV_SAVEPREVSSP, UNSPECV_RSTORSSP,
UNSPECV_WRSS, UNSPECV_WRUSS, UNSPECV_SETSSBSY, UNSPECV_CLRSSBSY.
(builtin_setjmp_setup): New pattern.
(builtin_longjmp): Likewise.
(rdssp<mode>): Likewise.
(incssp<mode>): Likewise.
(saveprevssp): Likewise.
(rstorssp): Likewise.
(wrss<mode>): Likewise.
(wruss<mode>): Likewise.
(setssbsy): Likewise.
(clrssbsy): Likewise.
(nop_endbr): Likewise.
* config/i386/i386.opt: Add -mcet, -mibt, -mshstk and -mcet-switch
options.
* config/i386/immintrin.h: Include <cetintrin.h>.
* config/i386/linux-common.h
(file_end_indicate_exec_stack_and_cet): New prototype.
(TARGET_ASM_FILE_END): New.
From-SVN: r253977
* gcc-interface/utils.c (pad_type_hash): Use hashval_t for hash value.
(convert): Do not use an unchecked conversion for converting from a
type to another type padding it.
From-SVN: r253971
2017-10-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82586
* decl.c (gfc_get_pdt_instance): Remove the error message that
the parameter does not have a corresponding component since
this is now taken care of when the derived type is resolved. Go
straight to error return instead.
(gfc_match_formal_arglist): Make the PDT relevant errors
immediate so that parsing of the derived type can continue.
(gfc_match_derived_decl): Do not check the match status on
return from gfc_match_formal_arglist for the same reason.
* resolve.c (resolve_fl_derived0): Check that each type
parameter has a corresponding component.
PR fortran/82587
* resolve.c (resolve_generic_f): Check that the derived type
can be used before resolving the struture constructor.
PR fortran/82589
* symbol.c (check_conflict): Add the conflicts involving PDT
KIND and LEN attributes.
2017-10-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82586
* gfortran.dg/pdt_16.f03 : New test.
* gfortran.dg/pdt_4.f03 : Catch the changed messages.
* gfortran.dg/pdt_8.f03 : Ditto.
PR fortran/82587
* gfortran.dg/pdt_17.f03 : New test.
PR fortran/82589
* gfortran.dg/pdt_18.f03 : New test.
From-SVN: r253970
* include/std/chrono (__cpp_lib_chrono): Update macro value to
indicate support for P0505R0.
* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: Check
for updated macro.
From-SVN: r253959
Also fix 64-bit DWARF to read a 64-bit abbrev offset in the
compilation unit.
This is a backport of https://golang.org/cl/71171, which will be in
the Go 1.10 release, to the gofrontend copy. Doing it now because AIX
is pretty much the only system that uses 64-bit DWARF.
Reviewed-on: https://go-review.googlesource.com/72250
From-SVN: r253955
gcc/ada/
2017-10-20 Doug Rupp <rupp@adacore.com>
* libgnarl/s-osinte__linux.ads (Relative_Timed_Wait): Add variable
needed for using monotonic clock.
* libgnarl/s-taprop__linux.adb: Revert previous monotonic clock
changes.
* libgnarl/s-taprop__linux.adb, s-taprop__posix.adb: Unify and factor
out monotonic clock related functions body.
(Timed_Sleep, Timed_Delay, Montonic_Clock, RT_Resolution,
Compute_Deadline): Move to...
* libgnarl/s-tpopmo.adb: ... here. New separate package body.
2017-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Is_Controlling_Limited_Procedure): Handle properly the
case where the controlling formal is an anonymous access to interface
type.
* exp_ch9.adb (Extract_Dispatching_Call): If controlling actual is an
access type, handle properly the the constructed dereference that
designates the object used in the rewritten synchronized call.
(Parameter_Block_Pack): If the type of the actual is by-copy, its
generated declaration in the parameter block does not need an
initialization even if the type is a null-excluding access type,
because it will be initialized with the value of the actual later on.
(Parameter_Block_Pack): Do not add controlling actual to parameter
block when its type is by-copy.
2017-10-20 Justin Squirek <squirek@adacore.com>
* sem_ch8.adb (Update_Use_Clause_Chain): Add sanity check to verify
scope stack traversal into the context clause.
gcc/testsuite/
2017-10-20 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/sync_iface_call.adb, gnat.dg/sync_iface_call_pkg.ads,
gnat.dg/sync_iface_call_pkg2.adb, gnat.dg/sync_iface_call_pkg2.ads:
New testcase.
From-SVN: r253948
gcc/ada/
2017-10-20 Yannick Moy <moy@adacore.com>
* sem_dim.adb (Analyze_Dimension_Binary_Op): Accept with a warning to
compare a dimensioned expression with a literal.
(Dim_Warning_For_Numeric_Literal): Do not issue a warning for the
special value zero.
* doc/gnat_ugn/gnat_and_program_execution.rst: Update description of
dimensionality system in GNAT.
* gnat_ugn.texi: Regenerate.
2017-10-20 Yannick Moy <moy@adacore.com>
* sem_ch6.adb (Analyze_Expression_Function.Freeze_Expr_Types): Remove
inadequate silencing of errors.
* sem_util.adb (Check_Part_Of_Reference): Do not issue an error when
checking the subprogram body generated from an expression function,
when this is done as part of the preanalysis done on expression
functions, as the subprogram body may not yet be attached in the AST.
The error if any will be issued later during the analysis of the body.
(Is_Aliased_View): Trivial rewrite with Is_Formal_Object.
2017-10-20 Arnaud Charlet <charlet@adacore.com>
* sem_ch8.adb (Update_Chain_In_Scope): Add missing [-gnatwu] marker for
warning on ineffective use clause.
2017-10-20 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch11.ads (Warn_If_No_Local_Raise): Declare.
* exp_ch11.adb (Expand_Exception_Handlers): Use Warn_If_No_Local_Raise
to issue the warning on the absence of local raise.
(Possible_Local_Raise): Do not issue the warning for Call_Markers.
(Warn_If_No_Local_Raise): New procedure to issue the warning on the
absence of local raise.
* sem_elab.adb: Add with and use clauses for Exp_Ch11.
(Record_Elaboration_Scenario): Call Possible_Local_Raise in the cases
where a scenario could give rise to raising Program_Error.
* sem_elab.adb: Typo fixes.
* fe.h (Warn_If_No_Local_Raise): Declare.
* gcc-interface/gigi.h (get_exception_label): Change return type.
* gcc-interface/trans.c (gnu_constraint_error_label_stack): Change to
simple vector of Entity_Id.
(gnu_storage_error_label_stack): Likewise.
(gnu_program_error_label_stack): Likewise.
(gigi): Adjust to above changes.
(Raise_Error_to_gnu): Likewise.
(gnat_to_gnu) <N_Goto_Statement>: Set TREE_USED on the label.
(N_Push_Constraint_Error_Label): Push the label onto the stack.
(N_Push_Storage_Error_Label): Likewise.
(N_Push_Program_Error_Label): Likewise.
(N_Pop_Constraint_Error_Label): Pop the label from the stack and issue
a warning on the absence of local raise.
(N_Pop_Storage_Error_Label): Likewise.
(N_Pop_Program_Error_Label): Likewise.
(push_exception_label_stack): Delete.
(get_exception_label): Change return type to Entity_Id and adjust.
* gcc-interface/utils2.c (build_goto_raise): Change type of first
parameter to Entity_Id and adjust. Set TREE_USED on the label.
(build_call_raise): Adjust calls to get_exception_label and also
build_goto_raise.
(build_call_raise_column): Likewise.
(build_call_raise_range): Likewise.
* doc/gnat_ugn/building_executable_programs_with_gnat.rst (-gnatw.x):
Document actual default behavior.
2017-10-20 Piotr Trojanek <trojanek@adacore.com>
* einfo.ads: Minor consistent punctuation in comment. All numbered
items in the comment of Is_Internal are now terminated with a period.
2017-10-20 Piotr Trojanek <trojanek@adacore.com>
* exp_util.adb (Build_Temporary): Mark created temporary entity as
internal.
2017-10-20 Piotr Trojanek <trojanek@adacore.com>
* sem_type.adb (In_Generic_Actual): Simplified.
2017-10-20 Justin Squirek <squirek@adacore.com>
* sem_ch12.adb (Check_Formal_Package_Instance): Add sanity check to
verify a renaming exists for a generic formal before comparing it to
the actual as defaulted formals will not have a renamed_object.
2017-10-20 Javier Miranda <miranda@adacore.com>
* exp_ch6.adb (Replace_Returns): Fix wrong management of
N_Block_Statement nodes.
gcc/testsuite/
2017-10-20 Justin Squirek <squirek@adacore.com>
* gnat.dg/default_pkg_actual.adb, gnat.dg/default_pkg_actual2.adb: New
testcases.
From-SVN: r253945
gcc/ada/
2017-10-20 Bob Duff <duff@adacore.com>
* exp_aggr.adb (Initialize_Array_Component): Avoid adjusting a
component of an array aggregate if it is initialized by a
build-in-place function call.
* exp_ch6.adb (Is_Build_In_Place_Result_Type): Use -gnatd.9 to disable
bip for nonlimited types.
* debug.adb: Document -gnatd.9.
2017-10-20 Bob Duff <duff@adacore.com>
* sem_ch12.adb: Remove redundant setting of Parent.
2017-10-20 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch4.adb (Find_Concatenation_Types): Filter out operators if one
of the operands is a string literal.
2017-10-20 Bob Duff <duff@adacore.com>
* einfo.ads: Comment fix.
2017-10-20 Clement Fumex <fumex@adacore.com>
* switch-c.adb: Remove -gnatwm from the switches triggered by -gnateC.
2017-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_dim.adb (Extract_Power): Accept dimension values that are not
non-negative integers when the dimensioned base type is an Integer
type.
gcc/testsuite/
2017-10-20 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/dimensions.adb, gnat.dg/dimensions.ads: New testcase.
From-SVN: r253941
2017-10-20 Bob Duff <duff@adacore.com>
* sinfo.ads, sinfo.adb (Alloc_For_BIP_Return): New flag to indicate
that an allocator came from a b-i-p return statement.
* exp_ch4.adb (Expand_Allocator_Expression): Avoid adjusting the return
object of a nonlimited build-in-place function call.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Set the
Alloc_For_BIP_Return flag on generated allocators.
* sem_ch5.adb (Analyze_Assignment): Move Assert to where it can't fail.
If the N_Assignment_Statement has been transformed into something else,
then Should_Transform_BIP_Assignment won't work.
* exp_ch3.adb (Expand_N_Object_Declaration): A previous revision said,
"Remove Adjust if we're building the return object of an extended
return statement in place." Back out that part of the change, because
the Alloc_For_BIP_Return flag is now used for that.
From-SVN: r253940
2017-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/82473
* tree-vect-loop.c (vectorizable_reduction): Properly get at
the largest input type.
* gcc.dg/torture/pr82473.c: New testcase.
From-SVN: r253937
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf
A proposal is to introduce a target independent flag
-fcf-protection=[none|branch|return|full] with a semantic to
instrument a code to control validness or integrity of control-flow
transfers using jump and call instructions. The main goal is to detect
and block a possible malware execution through transfer the execution
to unknown target address. Implementation could be either software or
target based. Any target platforms can provide their implementation
for instrumentation under this option.
The compiler should instrument any control-flow transfer points in a
program (ex. call/jmp/ret) as well as any landing pads, which are
targets of control-flow transfers.
A new 'nocf_check' attribute is introduced to provide hand tuning
support. The attribute directs the compiler to skip a call to a
function and a function's landing pad from instrumentation. The
attribute can be used for function and pointer to function types,
otherwise it will be ignored.
Currently all platforms except i386 will report the error and do no
instrumentation. i386 will provide the implementation based on a
specification published by Intel for a new technology called
Control-flow Enforcement Technology (CET).
gcc/c-family/
* c-attribs.c (handle_nocf_check_attribute): New function.
(c_common_attribute_table): Add 'nocf_check' handling.
gcc/c/
* gimple-parser.c: Add second argument NULL to
gimple_build_call_from_tree.
gcc/
* attrib.c (comp_type_attributes): Check nocf_check attribute.
* cfgexpand.c (expand_call_stmt): Set REG_CALL_NOCF_CHECK for
call insn.
* combine.c (distribute_notes): Add REG_CALL_NOCF_CHECK handling.
* common.opt: Add fcf-protection flag.
* emit-rtl.c (try_split): Add REG_CALL_NOCF_CHECK handling.
* flag-types.h: Add enum cf_protection_level.
* gimple.c (gimple_build_call_from_tree): Add second parameter.
Add 'nocf_check' attribute propagation to gimple call.
* gimple.h (gf_mask): Add GF_CALL_NOCF_CHECK.
(gimple_build_call_from_tree): Update prototype.
(gimple_call_nocf_check_p): New function.
(gimple_call_set_nocf_check): Likewise.
* gimplify.c: Add second argument to gimple_build_call_from_tree.
* ipa-icf.c: Add nocf_check attribute in statement hash.
* recog.c (peep2_attempt): Add REG_CALL_NOCF_CHECK handling.
* reg-notes.def: Add REG_NOTE (CALL_NOCF_CHECK).
* toplev.c (process_options): Add flag_cf_protection handling.
From-SVN: r253936
Libatomic builds a few functions for Arm with an explicit -march
option. This option does not specify an FPU, which can lead to
problems when targeting a hard-float or softfp environment since the
architecture appears to be incompatible with the selected ABI.
The fix is simple enough, just add +fp (the minimum floating point
option) to the architecture. We don't use anything from the FP
architecture, so it shouldn't really change anything; and if we are
building for -mfloat-abi=soft the canonicalization process will remove
the unnecessary fp attributes anyway.
* Makefile.am: (IFUNC_OPTIONS): Set the architecture to
-march=armv7-a+fp on Linux/Arm.
* Makefile.in: Regenerated.
From-SVN: r253935
2017-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/82603
* tree-if-conv.c (predicate_mem_writes): Make sure to only
remove false predicated stores.
* gcc.dg/torture/pr82603.c: New testcase.
From-SVN: r253933
PR target/82158
* tree-cfg.c (pass_warn_function_return::execute): In noreturn
functions when optimizing replace GIMPLE_RETURN stmts with
calls to __builtin_unreachable ().
* gcc.dg/tree-ssa/noreturn-1.c: New test.
From-SVN: r253926
PR target/82370
* config/i386/sse.md (VI248_AVX2, VI248_AVX512BW, VI248_AVX512BW_2):
New mode iterators.
(<shift_insn><mode>3<mask_name>): Change the last of the 3
define_insns for logical vector shifts to use VI248_AVX512BW
iterator instead of VI48_AVX512, remove <mask_mode512bit_condition>
condition, useless isa and prefix attributes. Change the first
2 of these define_insns to ...
(<mask_codefor><shift_insn><mode>3<mask_name>): ... this, new
define_insn for avx512vl.
(<shift_insn><mode>3): ... and this, new define_insn without
masking for non-avx512vl.
* gcc.target/i386/avx-pr82370.c: New test.
* gcc.target/i386/avx2-pr82370.c: New test.
* gcc.target/i386/avx512f-pr82370.c: New test.
* gcc.target/i386/avx512bw-pr82370.c: New test.
* gcc.target/i386/avx512vl-pr82370.c: New test.
* gcc.target/i386/avx512vlbw-pr82370.c: New test.
From-SVN: r253924
PR target/82370
* config/i386/sse.md (*andnot<mode>3,
<mask_codefor><code><mode>3<mask_name>, *<code><mode>3): Split
(=v,v,vm) alternative into (=x,x,xm) and (=v,v,vm), for 128-bit
and 256-bit vectors, the (=x,x,xm) alternative and when mask is
not applied use empty suffix even for TARGET_AVX512VL.
* config/i386/subst.md (mask_prefix3, mask_prefix4): When mask
is applied, supply evex,evex or evex,evex,evex instead of just
evex.
From-SVN: r253923
2017-10-19 Bob Duff <duff@adacore.com>
* exp_ch6.adb (Is_Build_In_Place_Result_Type): Fix silly bug -- "Typ"
should be "T". Handle case of a subtype of a class-wide type.
From-SVN: r253916
2017-10-19 Bob Duff <duff@adacore.com>
* exp_util.adb: (Process_Statements_For_Controlled_Objects): Clarify
which node kinds can legitimately be ignored, and raise Program_Error
for others.
2017-10-19 Hristian Kirtchev <kirtchev@adacore.com>
* sem_elab.adb (Compilation_Unit): Handle the case of a subprogram
instantiation that acts as a compilation unit.
(Find_Code_Unit): Reimplemented.
(Find_Top_Unit): Reimplemented.
(Find_Unit_Entity): New routine.
(Process_Instantiation_SPARK): Correct the elaboration requirement a
package instantiation imposes on a unit.
2017-10-19 Bob Duff <duff@adacore.com>
* exp_ch6.adb (Is_Build_In_Place_Result_Type): Enable build-in-place
for a narrow set of controlled types.
2017-10-19 Eric Botcazou <ebotcazou@adacore.com>
* sinput.ads (Line_Start): Add pragma Inline.
* widechar.ads (Is_Start_Of_Wide_Char): Likewise.
2017-10-19 Bob Duff <duff@adacore.com>
* exp_attr.adb (Expand_N_Attribute_Reference): Disable
Make_Build_In_Place_Call_... for F(...)'Old, where F(...) is a
build-in-place function call so that the temp is declared in the right
place.
From-SVN: r253915
If __gnu_lto_slim is global, undefined, default visibility in the
early debug object, then it finds its way into .dynsym when creating
shared libraries. __gnu_lto_slim in a symbol table (.dynsym or
.symtab) signals nm and other binutils that the object is an LTO
object needing a plugin, but that isn't the case for the ld liblti-17
tests. So, make __gnu_lto_slim hidden to prevent it becoming
dynamic. Further, make it weak because some linkers may warn on
finding an undefined global non-default visibility symbol.
PR lto/82575
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Make discarded non-local symbols weak and hidden.
From-SVN: r253914