2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Normalize_Actuals): Take into account extra
actuals that may have been introduced previously. Normally extra
actuals are introduced when a call is expanded, but a validity
check may copy and reanalyze a call that carries an extra actual
(e.g. an accessibility parameter) before the call itself is
marked Analzyed, and the analysis of the copy has to be able to
cope with the added actual.
From-SVN: r235723
While looking at the use of cst_and_fits_in_hwi in tree-ssa-loop-ivopts.c,
I had difficulty working out what the function actually tests. The
final NUNITS check seems redundant, since it asks about the number of
HWIs in the _unextended_ constant. We've already checked that the
unextended constant has no more than HOST_BITS_PER_WIDE_INT bits, so the
length must be 1.
I think this was my fault, sorry.
Tested on x86_64-linux-gnu and aarch64-linux-gnu.
gcc/
* tree.c (cst_and_fits_in_hwi): Simplify.
From-SVN: r235722
As Richard says, we ought to have a convenient way of converting
an INTEGER_CST to a wide_int of a particular precision without
having to extract the sign of the INTEGER_CST's type each time.
This patch adds a wi::to_wide helper for that, alongside the
existing wi::to_offset and wi::to_widest.
Tested on x86_64-linux-gnu and aarch64-linux-gnu.
gcc/
* tree.h (wi::to_wide): New function.
* expr.c (expand_expr_real_1): Use wi::to_wide.
* fold-const.c (int_const_binop_1): Likewise.
(extract_muldiv_1): Likewise.
gcc/c-family/
* c-common.c (shorten_compare): Use wi::to_wide.
From-SVN: r235721
Following on from the comparison patch, I think it makes sense to
support << and >> for offset_int (int128_t) and widest_int (intNNN_t),
with >> being arithmetic shift. It doesn't make sense to use
logical right shift on a potentially negative offset_int, since
the precision of 128 bits has no meaning on the target.
Tested on x86_64-linux-gnu and aarch64-linux-gnu.
gcc/
* wide-int.h: Update offset_int and widest_int documentation.
(WI_SIGNED_SHIFT_RESULT): New macro.
(wi::binary_shift): Define signed_shift_result_type for
shifts on offset_int- and widest_int-like types.
(generic_wide_int): Support <<= and >>= if << and >> are supported.
* tree.h (int_bit_position): Use shift operators instead of wi::
shifts.
* alias.c (adjust_offset_for_component_ref): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (fold_comparison): Likewise.
* gimple-fold.c (fold_nonarray_ctor_reference): Likewise.
* gimple-ssa-strength-reduction.c (restructure_reference): Likewise.
* tree-dfa.c (get_ref_base_and_extent): Likewise.
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Likewise.
(stmt_kills_ref_p): Likewise.
* tree-ssa-ccp.c (bit_value_binop_1): Likewise.
* tree-ssa-math-opts.c (find_bswap_or_nop_load): Likewise.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise.
(ao_ref_init_from_vn_reference): Likewise.
gcc/cp/
* init.c (build_new_1): Use shift operators instead of wi:: shifts.
From-SVN: r235720
offset_int and widest_int are supposed to be at least one bit wider
than all the values they need to represent, with the extra bits
being signs. Thus offset_int is effectively int128_t and widest_int
is effectively intNNN_t, for target-dependent NNN.
Because the types are signed, there's not really any need to specify
a sign for operations like comparison. I think things would be clearer
if we supported <, <=, > and >= for them (but not for wide_int, which
doesn't have a sign).
Tested on x86_64-linux-gnu and aarch64-linux-gnu.
gcc/
* wide-int.h: Update offset_int and widest_int documentation.
(WI_SIGNED_BINARY_PREDICATE_RESULT): New macro.
(wi::binary_traits): Allow ordered comparisons between offset_int and
offset_int, between widest_int and widest_int, and between either
of these types and basic C types.
(operator <, <=, >, >=): Define for the same combinations.
* tree.h (tree_int_cst_lt): Use comparison operators instead
of wi:: comparisons.
(tree_int_cst_le): Likewise.
* gimple-fold.c (fold_array_ctor_reference): Likewise.
(fold_nonarray_ctor_reference): Likewise.
* gimple-ssa-strength-reduction.c (record_increment): Likewise.
* tree-affine.c (aff_comb_cannot_overlap_p): Likewise.
* tree-parloops.c (try_transform_to_exit_first_loop_alt): Likewise.
* tree-sra.c (completely_scalarize): Likewise.
* tree-ssa-alias.c (stmt_kills_ref_p): Likewise.
* tree-ssa-reassoc.c (extract_bit_test_mask): Likewise.
* tree-vrp.c (extract_range_from_binary_expr_1): Likewise.
(check_for_binary_op_overflow): Likewise.
(search_for_addr_array): Likewise.
* ubsan.c (ubsan_expand_objsize_ifn): Likewise.
From-SVN: r235719
2016-05-02 Bob Duff <duff@adacore.com>
* sem_ch10.adb (Analyze_Compilation_Unit): Preserve
treeishness. Previous version had Context_Items shared between
the spec and body.
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_aggr.adb (Resolve_Aggr_Expression): For both array and
record cases, apply predicate check on component for expression
only if expression has been analyzed already. For expressions
that need to be duplicated when they cover multiple components,
resolution and predicate checking take place later.
2016-05-02 Olivier Hainque <hainque@adacore.com>
* a-direct.adb (Delete_Tree): Use full names to designate subdirs
and files therein, instead of local names after a change of
current directory.
From-SVN: r235717
2016-05-02 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch4.adb (Find_Indexing_Operations): Use the underlying type
of the container base type in case the container is a subtype.
* sem_ch5.adb (Analyze_Iterator_Specification): Ensure that
the selector has an entity when checking for a component of a
mutable object.
2016-05-02 Arnaud Charlet <charlet@adacore.com>
Remove dead code.
* opt.ads (Latest_Ada_Only): New flag.
* sem_prag.adb, par-prag.adb: Ignore pragma Ada_xx under this flag.
* usage.adb, switch-c.adb: Disable support for -gnatxx under this flag.
* einfo.ads (Has_Predicates, Predicate_Function):
Clarify that Has_Predicates does not imply that Predicate_Function
will return a non-empty entity.
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb (Resolve_Qualified_Expression): Generate a predicate
check if type requires it.
* checks.adb (Apply_Predicate_Check): Disable checks in the
object declaration created for an expression with side-effects
that requires a predicate check to prevent infinite recursion
during expansion.
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Process_Formals): Check properly the type of a
formal to determine whether a given convention applies to it.
2016-05-02 Doug Rupp <rupp@adacore.com>
* tracebak.c: Add incantations for arm-vxworks[67] traceback.
2016-05-02 Thomas Quinot <quinot@adacore.com>
* freeze.adb (Check_Component_Storage_Order): Make it a warning, not an
error, to have a component with implicit SSO within a composite type
that has explicit SSO.
2016-05-02 Bob Duff <duff@adacore.com>
* s-stposu.adb (Allocate_Any_Controlled): Don't lock/unlock twice.
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* repinfo.adb (List_Entities): Make procedure recursive, to
provide representation information for subprograms declared
within subprogram bodies.
From-SVN: r235713
2016-05-02 Arnaud Charlet <charlet@adacore.com>
* exp_ch5.adb, layout.adb, gnatcmd.adb exp_attr.adb, make.adb,
bindgen.adb, debug.adb, exp_pakd.adb, freeze.adb, sem_util.adb,
gnatlink.adb, switch-m.adb, exp_ch4.adb, repinfo.adb, adabkend.adb,
osint.adb: Remove dead code.
2016-05-02 Yannick Moy <moy@adacore.com>
* a-tigeli.adb (Get_Line): Fix bound for test to
decide when to compensate for character 0 added by call to fgets.
From-SVN: r235710
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Allocator): If the expression does not
have a subtype indication and the type is an unconstrained tagged
type with defaulted discriminants, create an explicit constraint
for it during analysis to prevent out-of-order freezing actions
on generated classwide types.
2016-05-02 Javier Miranda <miranda@adacore.com>
* exp_ch5.adb (Expand_N_Assignment_Statement):
In the runtime check that ensures that the tags of source an
target match, add missing displacement of the pointer to the
objects if they cover interface types.
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Analyze_Attribute, case 'Old): Do not use
base type for attribute when type is discrete: transformation
is not needed for such types, and leads to spurious errors if
the context is a case construct.
From-SVN: r235709
2016-05-02 Richard Biener <rguenther@suse.de>
fortran/
* trans-array.c (gfc_trans_create_temp_array): Properly
create a DECL_EXPR for the anonymous VLA array type.
From-SVN: r235705
* gcc-interface/decl.c (elaborate_reference_1): Do not bother about
operand #2 for COMPONENT_REF.
* gcc-interface/utils2.c (gnat_save_expr): Likewise.
(gnat_protect_expr): Likewise.
(gnat_stabilize_reference_1): Likewise.
(gnat_rewrite_reference): Do not bother about operand #3 for ARRAY_REF.
(get_inner_constant_reference): Likewise.
(gnat_invariant_expr): Likewise.
* gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise.
From-SVN: r235701
2016-05-02 Marek Polacek <polacek@redhat.com>
Tom de Vries <tom@codesourcery.com>
PR tree-optimization/70700
* tree-ssa-structalias.c (dump_pred_graph): Fix getting varinfo for ids
bigger than FIRST_REF_NODE.
* gcc.dg/pr70700.c: New test.
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r235700
* gcc-interface/trans.c (Range_to_gnu): New static function.
(Raise_Error_to_gnu) <N_In>: Call it to translate the range.
(gnat_to_gnu) <N_In>: Likewise.
From-SVN: r235699
gcc/
PR target/52898
* config/sh/sh.c (sh_option_override): Remove TARGET_CBRANCHDI4,
TARGET_CMPEQDI_T.
(prepare_cbranch_operands): Don't use scratch register. Assume that
function is used when pseudos can be created.
(expand_cbranchdi4): Likewise. Remove unused TARGET_CMPEQDI_T paths.
* config/sh/sh.md (cbranchsi4): Allow only when pseudos can be created.
(cbranchdi4, cbranchdi4_i): Simplify to single cbranchdi4
define_expand. Allow it only when pseudos can be created.
* config/sh/sh.opt (mcbranchdi, mcmpeqdi): Delete.
From-SVN: r235698
* config/rs6000/rs6000.c (altivec_expand_lv_builtin): Do not use switch
statement on instruction code. Remove trailing spaces.
(altivec_expand_stv_builtin): Likewise.
From-SVN: r235690
ada/
* gcc-interface/Make-lang.in (ACATSCMD): New variable.
(check-acats): Use it.
(check_acats_targets): Likewise.
testsuite/
* ada/acats/run_acats: Rename into...
* ada/acats/run_acats.sh: ...this. Only export BASE variable.
* ada/acats/run_all.sh: Remove redundant test.
(target_run): Move around.
(target_gnatchop): Use newly built executable.
(target_gnatmake): Likewise.
Check that the compilation of impbit succeeds.
From-SVN: r235678
As I noted a long time ago in the comment on fixed_reg_p, the real
problem with saving fixed/global regs is that exception frame
unwinding might restore them. So don't emit eh_frame info for any
such reg, and the unwinder won't restore them.
Also, tidy rs6000_savres_strategy. Delaying some checks means we
won't iterate over regs quite so often.
* config/rs6000/rs6000.c (rs6000_savres_strategy): Force inline
restoring when fixed_reg_p, but allow out-of-line or stmw save.
Check for user regs later to avoid unnecessary looping over regs.
Merge user reg check with non-saved reg check. Don't force
inline VR restore when static chain used.
(rs6000_frame_related): Omit eh_frame info for user regs when
saving.
(fixed_regs_p): Delete.
From-SVN: r235672
No functional change here. A single bit becomes two bits, which
always have the same value at the moment.
* config/rs6000/rs6000.c (SAVRES_MULTIPLE): Replace with..
(SAVE_STRATEGY, REST_STRATEGY): ..this. Renumber and sort enum.
Update all uses.
From-SVN: r235671
Treat -ffixed-reg as we do for global asm regs.
PR target/69645
* config/rs6000/rs6000.c (fixed_reg_p): New function.
(fixed_regs_p): Rename from global_regs_p. Call fixed_reg_p.
Update all uses.
From-SVN: r235670
This makes the conditions look the same as other places that deal with
RS6000_PIC_OFFSET_TABLE_REGNUM, eg. first_reg_to_save. No functional
changes.
* config/rs6000/rs6000.c (rs6000_conditional_register_usage):
Remove redundant PIC_OFFSET_TABLE_REGNUM test. Replace with
flag_pic test for Darwin.
From-SVN: r235669
* regs.h (struct reg_info_t): Delete live_length.
(REG_LIVE_LENGTH): Delete macro.
* regstat.c (regstat_bb_compute_ri): Delete artificial_uses,
local_live, local_processed and local_live_last_luid params.
Replace bb_index param with bb. Don't set REG_LIVE_LENGTH.
Formatting fixes.
(regstat_compute_ri): Adjust for above. Don't set
REG_LIVE_LENGTH.
(dump_reg_info): Don't print live length.
* ira.c (update_equiv_regs): Replace test of REG_LIVE_LENGTH
with test of setjmp_crosses. Don't set REG_LIVE_LENGTH.
Localize loop_depth var.
From-SVN: r235663
/cp
2016-04-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/66644
* class.c (check_field_decl): Remove final int* parameter, change
the return type to bool; fix logic in order not to reject multiple
initialized fields in anonymous struct.
(check_field_decls): Adjust call.
/testsuite
2016-04-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/66644
* g++.dg/cpp0x/nsdmi-anon-struct1.C: New.
From-SVN: r235662
This function is used to validate REG_EQUIV notes generated by ira,
and to validate potential insn combines performed by ira. The two
conditions are not exactly the same, with reload being more
restrictive. Separate them so more combines/moves can occur.
For example, this sequence from cfgexpand.c:expand_gimple_cond
callq _Z18update_bb_for_insnP15basic_block_def
mov 0x10(%rbx),%rdi
mov 0x0(%rip),%rbp # x_rtl+0x34
callq _Z9safe_as_aIP8rtx_insn7rtx_defET_PT0_
mov %r13,%rdx
mov %rbp,%rsi
mov %rax,%rdi
callq _Z18create_basic_blockP7rtx_defS0_P15basic_block_def
becomes
callq _Z18update_bb_for_insnP15basic_block_def
mov 0x10(%rbx),%rdi
callq _Z9safe_as_aIP8rtx_insn7rtx_defET_PT0_
mov 0x0(%rip),%rsi # x_rtl+0x34
mov %r13,%rdx
mov %rax,%rdi
callq _Z18create_basic_blockP7rtx_defS0_P15basic_block_def
* ira.c (enum valid_equiv): New.
(validate_equiv_mem): Return enum.
(update_equiv_mem): Create replacement in more cases.
(add_store_equivs): Update validate_equiv_mem call.
From-SVN: r235661
This patch actually improves generated code, because REG_DEAD notes
used by the old insn scan are not always present. On x86_64, see
gcc/wide-int-print.o:print_hex for an example of a function that is
smaller and uses one less callee saved reg.
* ira.c (combine_and_move_insns): Rather than scanning insns,
use DF infrastucture to find use and def insns.
From-SVN: r235660
Notes added by add_store_equivs are not used directly or indirectly by
combine_and_move_insns. add_store_equivs can therefore run later
without affecting the output of combine_and_move_insns, and thus
add_store_equivs need not take into account potentially moved insns.
Since not all potentially combined/moved insns are in fact combined or
moved, this may allow add_store_equivs to add more REG_EQUIV notes.
grow_reg_equivs isn't needed until the reload reg_equivs array is
changed.
ira.c (combine_and_move_insns): Move invariant conditions..
(ira.c): ..to here. Call combine_and_move_insns before
add_store_equivs. Call grow_reg_equivs later. Allocate
req_equiv later using max_reg_num() rather than global max_regno.
(contains_replace_regs): Delete.
(add_store_equivs): Remove contains_replace_regs test.
From-SVN: r235659