aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2021-05-10Daily bump.GCC Administrator1-1/+1
2021-05-09Daily bump.GCC Administrator2-1/+10
2021-05-08Correct ChangeLob entries for PR46991Paul Thomas2-2/+2
2021-05-08Fortran: Correct PR number from 46691 [PR46991].Paul Thomas1-1/+1
2021-05-07 Paul Thomas <pault@gcc.gnu.org> gcc/testsuite/ChangeLog PR fortran/46991 * gfortran.dg/class_dummy_7.f90: Correct PR number.
2021-05-08Remove obsolete gcc.dg/sso-9.cEric Botcazou1-27/+0
gcc/testsuite/ * gcc.dg/sso-9.c: Delete.
2021-05-08Daily bump.GCC Administrator6-1/+707
2021-05-07Revert "amdgcn: disable TImode"Andrew Stubbs1-1/+1
This reverts commit 7af392687952608b988bd5a476583106b3f51740.
2021-05-07Ensure emit_move_insn operands are validAndrew Stubbs1-4/+6
Some architectures are fine with PLUS in move instructions, but others are not (amdgcn is the motivating example). 2021-05-07 Jakub Jelinek <jakub@redhat.com> Andrew Stubbs <amd@codesourcery.com> gcc/ChangeLog: PR target/100418 * builtins.c (try_store_by_multiple_pieces): Use force_operand for emit_move_insn operands.
2021-05-07Fix incorrect array bounds with -fgnat-encodings=minimal in DWARFEric Botcazou3-22/+50
This makes add_subscript_info query the get_array_descr_info hook for the actual information when it is defined. gcc/ * cfgexpand.c (expand_gimple_basic_block): Do not inherit a current location for the outgoing edges of an empty block. * dwarf2out.c (add_subscript_info): Retrieve the bounds and index type by means of the get_array_descr_info langhook, if it is set and returns true. Remove obsolete code dealing with unnamed subtypes. gcc/testsuite/ * gnat.dg/debug18.adb: New test.
2021-05-07Clean up and virtualize the on-entry cache interface.Andrew MacLeod3-95/+80
Cleanup/Virtualize the ssa_block_range class, and implement the current vector approach as a derived class. Allow memory allocation from the irange allocator obstack for easy freeing. * gimple-range-cache.cc (ssa_block_ranges): Virtualize. (sbr_vector): Renamed from ssa_block_cache. (sbr_vector::sbr_vector): Allocate from obstack abd initialize. (ssa_block_ranges::~ssa_block_ranges): Remove. (sbr_vector::set_bb_range): Use varying and undefined cached values. (ssa_block_ranges::set_bb_varying): Remove. (sbr_vector::get_bb_range): Adjust assert. (sbr_vector::bb_range_p): Adjust assert. (~block_range_cache): No freeing loop required. (block_range_cache::get_block_ranges): Remove. (block_range_cache::set_bb_range): Inline get_block_ranges. (block_range_cache::set_bb_varying): Remove. * gimple-range-cache.h (set_bb_varying): Remove prototype. * value-range.h (irange_allocator::get_memory): New.
2021-05-07When searching for non-null, check the dominator tree.Andrew MacLeod2-5/+24
The non-null bitmap only indicates which blocks non-null setting occurs. Generalized queries need to search the dom tree, whereas propagation engines only need to know the current block. Add a flag for this purpose. * gimple-range-cache.cc (non_null_ref::non_null_deref_p): Search dominator tree is available and requested. (ranger_cache::ssa_range_in_bb): Don't search dom tree here. (ranger_cache::fill_block_cache): Don't search dom tree here either. * gimple-range-cache.h (non_null_deref_p): Add dom_search param.
2021-05-07Fix range_on_exit for PHI stmts when there are no other stmts in the block.Andrew MacLeod1-7/+16
last_stmt(bb) returns NULL for blocks which only have PHI stmts, and range_on_exit would trigger a cache fill all the way to the top of the program for the SSA_NAME. * gimple-range.cc (gimple_ranger::range_on_exit): Handle block with only PHI nodes better.
2021-05-07Make TRUE/FALSE edge calculation available without the outgoing edge class.Andrew MacLeod3-17/+28
Rename class to gimple_outoging_edge and provide a non-class routine for the outgoing edge of a gcond. * gimple-range-edge.h (gimple_outgoing_range): Rename from outgoing_range. (gcond_edge_range): Export prototype. * gimple-range-edge.cc (gcond_edge_range): New. (gimple_outgoing_range::edge_range_p): Use gcond_edge_range. * gimple-range-gori.h (gori_compute): Use gimple_outgoing_range.
2021-05-07Don't over-allocate switch default range object.Andrew MacLeod1-4/+4
We were always allocating the 255 max ranges for the default condition. Instead, use int_range_max to build the default range, then allocate and store only what is needed. * gimple-range-edge.cc (outgoing_range::calc_switch_ranges): Compute default range into a temp and allocate only what is needed.
2021-05-07Change x mod 0 to produce UNDEFINED rather than VARYING.Andrew MacLeod1-1/+1
* range-op.cc (operator_trunc_mod::wi_fold): x % 0 is UNDEFINED.
2021-05-07Enhance initial global value setting.Andrew MacLeod1-15/+32
Incorporate code from vr_values to get safe initial parameter values. If this is a local automatic which is used before defined, use UNDEFINED. * gimple-range.h (gimple_range_global): Pick up parameter initial values, and use-before defined locals are UNDEFINED.
2021-05-07Do not apply scalar storage order to pointer fieldsEric Botcazou4-1/+34
Pointer fields (and vector fields originally) were not really considered when the scalar_storage_order attribute, so they are swapped as well. As pointed out, this is problematic to describe in DWARF and probably not very useful in any case, so this pulls them out. gcc/ * doc/extend.texi (scalar_storage_order): Mention effect on pointer and vector fields. * tree.h (reverse_storage_order_for_component_p): Return false if the type is a pointer. gcc/c/ * c-typeck.c (build_unary_op) <ADDR_EXPR>: Do not issue an error on the address of a pointer field in a record with reverse SSO. gcc/testsuite/ * gcc.dg/sso-12.c: New test.
2021-05-07amdgcn: disable TImodeAndrew Stubbs1-1/+1
The TImode support works for moves only, which has worked in most case up to now, but no longer. We still need TImode to exist for the instructions that take two DImode values packed together, but we don't need to advertise this to the middle-end. gcc/ChangeLog: * config/gcn/gcn.c (gcn_scalar_mode_supported_p): Disable TImode.
2021-05-07c++: reject class lvalues in 'rvalue'Jason Merrill1-1/+6
Wrapping a class lvalue in NON_LVALUE_EXPR is not sufficient to make it a usable prvalue; callers must use force_rvalue instead. gcc/cp/ChangeLog: * tree.c (rvalue): Assert expr is not a class lvalue.
2021-05-07c++: avoid non-TARGET_EXPR class prvaluesJason Merrill5-3/+7
Around PR98469 I asked Jakub to wrap a class BIT_CAST_EXPR in TARGET_EXPR; SPACESHIP_EXPR needs the same thing. The dummy CAST_EXPR created in can_convert is another instance of a non-TARGET_EXPR prvalue, so let's use the declval-like build_stub_object there instead. gcc/cp/ChangeLog: * cp-tree.h (build_stub_object): Declare. * method.c (build_stub_object): No longer static. * call.c (can_convert): Use it. * tree.c (build_dummy_object): Adjust comment. * typeck.c (cp_build_binary_op): Wrap SPACESHIP_EXPR in a TARGET_EXPR.
2021-05-07c++: don't call 'rvalue' in coroutines codeJason Merrill2-88/+31
A change to check glvalue_p rather than specifically for TARGET_EXPR revealed issues with the coroutines code's use of the 'rvalue' function, which shouldn't be used on class glvalues, so I've removed those calls. In build_co_await I just dropped them, because I don't see anything in the co_await specification that indicates that we would want to move from an lvalue result of operator co_await. And simplified that code while I was touching it; cp_build_modify_expr (...INIT_EXPR...) will call the constructor. In morph_fn_to_coro I changed the handling of the rvalue reference coroutine frame field to use move, to treat the rval ref as an xvalue. I used forward_parm to pass the function parms to the constructor for the field. And I simplified the return handling so we get the desired rvalue semantics from the normal implicit move on return. I question default-initializing the non-void return value of the function if get_return_object returns void; I'm not messing with it here, but I've filed PR100476 about it. gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Don't call 'rvalue'. (flatten_await_stmt): Simplify initialization. (morph_fn_to_coro): Change 'rvalue' to 'move'. Simplify. gcc/testsuite/ChangeLog: * g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C: Adjust diagnostic.
2021-05-07tree-optimization/79333 - fold stmts following SSA edges in VNChristophe Lyon1-0/+1
copysign is only available with c99_runtime, skip ssa-fre-94.c otherwise. 2021-05-07 Christophe Lyon <christophe.lyon@linaro.org> PR tree-optimization/79333 gcc/testsuite/ * gcc.dg/tree-ssa/ssa-fre-94.c: Require c99_runtime.
2021-05-07libcpp: Fix up pragma preprocessing [PR100450]Jakub Jelinek1-0/+20
Since the r0-85991-ga25a8f3be322fe0f838947b679f73d6efc2a412c https://gcc.gnu.org/legacy-ml/gcc-patches/2008-02/msg01329.html changes, so that we handle macros inside of pragmas that should expand macros, during preprocessing we print those pragmas token by token, with CPP_PRAGMA printed as fputs ("#pragma ", print.outf); if (space) fprintf (print.outf, "%s %s", space, name); else fprintf (print.outf, "%s", name); where name is some identifier (so e.g. print #pragma omp parallel or #pragma omp for etc.). Because it ends in an identifier, we need to handle it like an identifier (i.e. CPP_NAME) for the decision whether a space needs to be emitted in between that #pragma whatever or #pragma whatever whatever and following token, otherwise the attached testcase is preprocessed as #pragma omp forreduction(+:red) rather than #pragma omp for reduction(+:red) The cpp_avoid_paste function is only called for this purpose. 2021-05-07 Jakub Jelinek <jakub@redhat.com> PR c/100450 * lex.c (cpp_avoid_paste): Handle token1 CPP_PRAGMA like CPP_NAME. * c-c++-common/gomp/pr100450.c: New test.
2021-05-07i386: Implement mmx_pblendv to optimize SSE conditional moves [PR98218]Uros Bizjak4-1/+34
Implement mmx_pblendv to optimize V8HI, V4HI and V2SI mode conditional moves for SSE4.1 targets. 2021-05-07 Uroš Bizjak <ubizjak@gmail.com> gcc/ PR target/98218 * config/i386/i386-expand.c (ix86_expand_sse_movcc): Handle V8QI, V4HI and V2SI modes. * config/i386/mmx.md (mmx_pblendvb): New insn pattern. * config/i386/sse.md (unspec): Move UNSPEC_BLENDV ... * config/i386/i386.md (unspec): ... here.
2021-05-07OpenMP: Fix SIMT for complex/float reduction with && and ||Tobias Burnus1-7/+21
2021-05-07 Tobias Burnus <tobias@codesourcery.com> Tom de Vries <tdevries@suse.de> gcc/ChangeLog: * omp-low.c (lower_rec_simd_input_clauses): Set max_vf = 1 if a truth_value_p reduction variable is nonintegral. libgomp/ChangeLog: * testsuite/libgomp.c-c++-common/reduction-5.c: New test, testing complex/floating-point || + && reduction with 'omp target'. * testsuite/libgomp.c-c++-common/reduction-6.c: Likewise.
2021-05-07[Ada] Robust detection of access-to-subprogram and access-to-object typesPiotr Trojanek3-6/+10
gcc/ada/ * einfo-utils.adb (Is_Access_Object_Type): Use Directly_Designated_Type. (Is_Access_Subprogram_Type): Use Directly_Designated_Type. (Set_Convention): Use plain Ekind. * gen_il-gen-gen_entities.adb (Type_Kind): Use plain Ekind. * sem_ch3.adb (Access_Type_Declaration): When seeing an illegal completion with an access type don't attempt to decorate the completion entity; previously the entity had its Ekind set to E_General_Access_Type or E_Access_Type, but its Designated_Type was empty, which caused a crash in freezing. (Actually, the error recovery in the surrounding context is still incomplete, e.g. we will crash when the illegal completion is an access to an unknown identifier).
2021-05-07[Ada] Minor reformattingsBob Duff119-2969/+2969
gcc/ada/ * par_sco.adb: Align with/use clauses. (Traverse_Declarations_Or_Statements): Minor comment fix. * aspects.adb, atree.adb, atree.ads, checks.adb, comperr.adb, contracts.adb, cstand.adb, debug_a.adb, einfo-utils.adb, errout.adb, eval_fat.adb, exp_aggr.adb, expander.adb, exp_atag.adb, exp_attr.adb, exp_cg.adb, exp_ch11.adb, exp_ch12.adb, exp_ch13.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch8.adb, exp_ch9.adb, exp_code.adb, exp_dbug.adb, exp_disp.adb, exp_dist.adb, exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb, exp_put_image.adb, exp_sel.adb, exp_smem.adb, exp_spark.adb, exp_strm.adb, exp_tss.adb, exp_unst.adb, exp_util.adb, exp_util.ads, freeze.adb, frontend.adb, ghost.adb, gnat1drv.adb, gnat_cuda.adb, impunit.adb, inline.adb, itypes.adb, itypes.ads, layout.adb, lib.adb, lib-load.adb, lib-writ.adb, lib-xref.adb, lib-xref-spark_specific.adb, live.adb, nlists.adb, par.adb, par-ch11.adb, par-ch3.adb, par-ch5.adb, par-ch6.adb, pprint.adb, repinfo.adb, restrict.adb, rtsfind.adb, scil_ll.adb, scn.adb, sem.adb, sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_case.adb, sem_cat.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch13.adb, sem_ch2.adb, sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_dim.adb, sem_disp.adb, sem_dist.adb, sem_elab.adb, sem_elim.adb, sem_eval.adb, sem_intr.adb, sem_mech.adb, sem_prag.adb, sem_res.adb, sem_scil.adb, sem_smem.adb, sem_type.adb, sem_util.adb, sem_util.ads, sem_warn.adb, sinfo-cn.adb, sinfo-utils.ads, sinput.adb, sinput-l.adb, sprint.adb, style.adb, styleg.adb, tbuild.adb, tbuild.ads, treepr.adb, uname.adb: Align with/use clauses.
2021-05-07[Ada] Variable-sized node types -- cleanupBob Duff42-638/+517
gcc/ada/ * atree.ads, atree.adb, gen_il-gen.ads: Fix comments and clean up ??? marks. Rename Set_Ekind to be Mutate_Ekind. * einfo.ads, sinfo.ads: Likewise. Change "definitive definition" to "official definition", because the former sounds redundant. Rename Set_Ekind to be Mutate_Ekind. * checks.adb, contracts.adb, cstand.adb, exp_aggr.adb, exp_attr.adb, exp_ch11.adb, exp_ch3.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, exp_disp.adb, exp_dist.adb, exp_imgv.adb, exp_intr.adb, exp_prag.adb, exp_unst.adb, exp_util.adb, gen_il-gen.adb, inline.adb, lib-writ.adb, lib-xref-spark_specific.adb, sem_aggr.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_dist.adb, sem_elab.adb, sem_prag.adb, sem_util.adb: Rename Set_Ekind to be Mutate_Ekind.
2021-05-07[Ada] Restore nnd capabilityBob Duff3-118/+142
gcc/ada/ * atree.adb: Move nnd-related code from here, and leave a comment pointing to sinfo-utils.adb. * sinfo-utils.ads, sinfo-utils.adb: Move nnd-related code to here.
2021-05-07[Ada] Fix link from body protected entry implementation to source codePiotr Trojanek7-25/+11
gcc/ada/ * einfo.ads: Move Corresponding_Protected_Entry... * sinfo.ads: ... here. * exp_ch9.adb (Build_Entry_Body): Link procedure and entry bodies. * gen_il-fields.ads (Opt_Field_Enum): Add Corresponding_Entry_Body field to nodes; remove Corresponding_Protected_Entry field from entities. * gen_il-gen-gen_entities.adb (Gen_Entities): Remove Corresponding_Protected_Entry field from E_Void and E_Subprogram_Body. * gen_il-gen-gen_nodes.adb (Gen_Nodes): Add Corresponding_Entry_Body field to N_Subprogram_Body. * sem_ch6.adb (Analyze_Subprogram_Specification): Remove manipulation of Ekind and Corresponding_Protected_Entry added as part of the support for varsize-nodes.
2021-05-07[Ada] Reinitialize Private_Dependents when it is vanishingBob Duff2-6/+15
gcc/ada/ * sem_ch3.adb (Process_Incomplete_Dependents): Reset Private_Dependents field to zero before calling Set_Ekind. Also move Set_Etype to after Set_Ekind, because it's always best to set the Ekind as early as possible. * atree.adb: Improve debugging facilities for vanishing fields.
2021-05-07[Ada] Replace packed records with integers in low-level implementationEric Botcazou4-413/+77
gcc/ada/ * atree.ads (Slot): Change to modular type. (Slot_1_Bit): Delete. (Slot_2_Bit): Likewise. (Slot_4_Bit): Likewise. (Slot_8_Bit): Likewise. (Slot_32_Bit): Likewise. * atree.adb (Get_1_Bit_Val): Adjust to above change. (Get_2_Bit_Val): Likewise. (Get_4_Bit_Val): Likewise. (Get_8_Bit_Val): Likewise. (Get_32_Bit_Val): Likewise. (Set_1_Bit_Val): Likewise. (Set_2_Bit_Val): Likewise. (Set_4_Bit_Val): Likewise. (Set_8_Bit_Val): Likewise. (Set_32_Bit_Val): Likewise. (Print_Atree_Info): Likewise. (Zero): Likewise. * atree.h (Get_1_Bit_Field): Likewise. (Get_2_Bit_Field): Likewise. (Get_4_Bit_Field): Likewise. (Get_8_Bit_Field): Likewise. (Get_32_Bit_Field): Likewise. (Get_32_Bit_Field_With_Default): Likewise. * types.h (slot_1_bit): Delete. (slot_2_bit): Likewise. (slot_4_bit): Likewise. (slot_8_bit): Likewise. (slot_32_bit): Likewise. (any_slot): Change to unsigned int. (Slot_Size): New macro.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #6Eric Botcazou4-43/+26
gcc/ada/ * gcc-interface/gigi.h (enum standard_datatype): Remove ADT_exception_data_name_id and add ADT_not_handled_by_others_name_id. (exception_data_name_id): Delete. (not_handled_by_others_name_id): New macro. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Exception>: Remove old kludge for exceptions. <E_Record_Type>: Likewise. (gnat_to_gnu_field): Force character type on Not_Handled_By_Others. * gcc-interface/misc.c (gnat_argv): Change type to char **. (gnat_init_options): Adjust accordingly. * gcc-interface/trans.c (gigi): Set not_handled_by_others_name_id and use it to set not_handled_by_others_decl. (Exception_Handler_to_gnu_fe_sjlj): Fix indentation.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #5Eric Botcazou2-37/+30
gcc/ada/ * raise-gcc.c (__gnat_others_value): Remove const qualifier. (__gnat_all_others_value): Likewise. (__gnat_unhandled_others_value): Likewise. (GNAT_OTHERS): Cast to Exception_Id instead of _Unwind_Ptr. (GNAT_ALL_OTHERS): Likewise. (GNAT_UNHANDLED_OTHERS): Likewise. (Is_Handled_By_Others): Change parameter type to Exception_Id. (Language_For): Likewise. (Foreign_Data_For): Likewise. (is_handled_by): Likewise. Adjust throughout, remove redundant line and fix indentation. * libgnat/a-exexpr.adb (Is_Handled_By_Others): Remove pragma and useless qualification from parameter type. (Foreign_Data_For): Likewise. (Language_For): Likewise.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #4Eric Botcazou6-75/+76
gcc/ada/ * libgnat/s-stalib.ads (Exception_Data): Mark components as aliased. * stand.ads (Standard_Entity_Type): Enhance comments. * cstand.adb (Make_Component): Rename into... (Make_Aliased_Component): ...this; set Is_Aliased and Is_Independent flags on the component. (Create_Standard): Adjust the types of the component of the record Standard_Exception_Type and mark them as aliased. * exp_ch11.adb (Expand_N_Exception_Declaration): Use OK conversion to Standard_Address for Full_Name component, except in CodePeer_Mode (set it to 0). * exp_prag.adb (Expand_Pragma_Import_Or_Interface): Likewise. * raise.h (struct Exception_Data): Change the type of Full_Name, HTable_Ptr and Foreign_Data.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #3Eric Botcazou12-176/+189
gcc/ada/ * atree.h (Slots_Ptr): Change pointed-to type to any_slot. * fe.h (Get_RT_Exception_Name): Change type of parameter. * namet.ads (Name_Entry): Mark non-boolean components as aliased, reorder the boolean components and add an explicit Spare component. * namet.adb (Name_Enter): Adjust aggregate accordingly. (Name_Find): Likewise. (Reinitialize): Likewise. * namet.h (struct Name_Entry): Adjust accordingly. (Names_Ptr): Use correct type. (Name_Chars_Ptr): Likewise. (Get_Name_String): Fix declaration and adjust to above changes. * types.ads (RT_Exception_Code): Add pragma Convention C. * types.h (Column_Number_Type): Fix original type. (slot): Rename union type to... (any_slot): ...this and adjust assertion accordingly. (RT_Exception_Code): New enumeration type. * uintp.ads (Uint_Entry): Mark components as aliased. * uintp.h (Uints_Ptr): Use correct type. (Udigits_Ptr): Likewise. * gcc-interface/gigi.h (gigi): Adjust name and type of parameter. * gcc-interface/cuintp.c (UI_To_gnu): Adjust references to Uints_Ptr and Udigits_Ptr. * gcc-interface/trans.c (Slots_Ptr): Adjust pointed-to type. (gigi): Adjust type of parameter. (build_raise_check): Add cast in call to Get_RT_Exception_Name.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #2Eric Botcazou6-43/+41
gcc/ada/ * init.c (__gnat_raise_program_error): Fix parameter type. (Raise_From_Signal_Handler): Likewise and mark as no-return. * raise-gcc.c (__gnat_others_value): Fix type. (__gnat_all_others_value): Likewise. (__gnat_unhandled_others_value): Likewise. * seh_init.c (Raise_From_Signal_Handler): Fix parameter type. * libgnat/a-except.ads (Raise_From_Signal_Handler): Use convention C and new symbol name, move declaration to... (Raise_From_Controlled_Operation): Minor tweak. * libgnat/a-except.adb (Raise_From_Signal_Handler): ...here. * libgnat/a-exexpr.adb (bool): New C compatible boolean type. (Is_Handled_By_Others): Use it as return type for the function.
2021-05-07[Ada] Fix type mismatch warnings during LTO bootstrap #1Eric Botcazou5-5/+9
gcc/ada/ * errout.ads (Set_Identifier_Casing): Add pragma Convention C. * eval_fat.ads (Rounding_Mode): Likewise. (Machine): Add WARNING comment line. * exp_code.ads (Clobber_Get_Next): Add pragma Convention C. * fe.h (Compiler_Abort): Fix return type. (Set_Identifier_Casing): Change type of parameters. (Clobber_Get_Next): Change return type. * gcc-interface/trans.c (gnat_to_gnu) <N_Code_Statement>: Add cast.
2021-05-07[Ada] Small cleanup in C header fileEric Botcazou1-48/+49
gcc/ada/ * atree.h (Parent): Remove duplicate declaration. (Get_1_Bit_Field): Also use INLINE specifier in the declaration, fix formatting and use gcc_unreachable for the default case. (Get_2_Bit_Field): Likewise. (Get_4_Bit_Field): Likewise. (Get_8_Bit_Field): Likewise. (Get_32_Bit_Field): Likewise. (Get_32_Bit_Field_With_Default): Likewise.
2021-05-07[Ada] Variable-sized node typesBob Duff166-43311/+17800
gcc/ada/ * atree.ads, atree.adb: Major rewrite to support variable-sized node types. Add pragmas Suppress and Assertion_Policy. We now have an extra level of indirection: Node_Offsets is a table mapping Node_Ids to the offset of the start of each node in Slots. Slots is a table containing one or more contiguous slots for each node. Each slot is a 32-bit unchecked union that can contain any mixture of 1, 2, 4, 8, and 32-bit fields that fits. The old low-level getters and setters (e.g. Flag123) are removed. * gen_il-fields.ads, gen_il-gen-gen_entities.adb, gen_il-gen-gen_nodes.adb, gen_il-gen.adb, gen_il-gen.ads, gen_il-main.adb, gen_il-types.ads, gen_il-utils.adb, gen_il-utils.ads, gen_il.adb, gen_il.ads: New gen_il program that generates various Ada and C++ files. In particular, the following files are generated by gen_il: einfo-entities.adb einfo-entities.ads, gnatvsn.ads, nmake.adb, nmake.ads, seinfo.ads, seinfo_tables.adb, seinfo_tables.ads, sinfo-nodes.adb, sinfo-nodes.ads, einfo.h, and sinfo.h. * sinfo-utils.adb, sinfo-utils.ads, einfo-utils.adb, einfo-utils.ads: New files containing code that needs to refer to Sinfo.Nodes and Einfo.Entities. This code is mostly moved here from Sinfo and Einfo to break cycles. * back_end.adb: Pass node_offsets_ptr and slots_ptr to gigi, instead of nodes_ptr and flags_ptr. The Nodes and Flags tables no longer exist. (Note that gigi never used the Flags table.) * sinfo-cn.ads (Change_Identifier_To_Defining_Identifier, Change_Character_Literal_To_Defining_Character_Literal, Change_Operator_Symbol_To_Defining_Operator_Symbol): Turn N into an IN formal. * sinfo-cn.adb: Update. Add assertions, which can be removed at some point. Rewrite to use higher-level facilities. Make sure vanishing fields are zeroed out. Add with/use for new packages. * sem_util.adb: Remove "Assert(False)" immediately followed by "raise Program_Error". Use higher-level facilities such as Walk_Sinfo_Fields instead of depending on low-level Set_FieldN routines that no longer exist. Use Get_Comes_From_Source_Default instead of Default_Node.Comes_From_Source (Default_Node no longer exists). Use Set_Basic_Convention instead of Basic_Set_Convention. Add with/use for new packages. * sem_util.ads: The Convention field had getter Convention and setter Basic_Set_Convention. Make that more uniform: there is now a field called Basic_Convention, with Basic_Convention and Set_Basic_Convention as getter/setter, and write Convention and Set_Convention here. * nlists.adb: Rewrite to use abstractions, rather then depending on low-level implementation details of Atree. Necessary because those details have changed. Add with/use for new packages. * sem_ch12.adb: Use higher-level facilities such as Walk_Sinfo_Fields instead of depending on low-level Set_FieldN routines that no longer exist. Add with/use for new packages. * exp_cg.adb, sem_ch10.adb, sem_ch4.adb, sem_eval.adb, sem_prag.adb, sem_warn.adb: Change expanded names to refer to the new packages for things that moved. Add with/use for new packages. * sem_ch3.adb: Likewise. Reinitialize vanishing fields. * exp_disp.adb: Likewise. Remove failing assertion. * sinfo.ads, einfo.ads: Remove code that is now generated into Sinfo.Nodes and Einfo.Entities. * sinfo.adb, einfo.adb: Replace bodies with "pragma No_Body;". We should delete these at some point, but No_Body makes make files easier. Some code is moved to Sinfo.Nodes, Einfo.Entities, Sinfo.Utils, and Einfo.Utils. Some is no longer necessary. * treepr.adb: Rewrite to use new tables. We no longer need treeprs.ads. * treepr.ads: Add comment. * types.ads: Move types Component_Alignment_Kind and Float_Rep_Kind here. * atree.h: Major update to match atree.ads changes. Add slot types, for use by getters/setters. * types.h: Move types Component_Alignment_Kind and Float_Rep_Kind here. * fe.h: Rewrite to deal with code that has changed or moved from Atree, Sinfo, Einfo. * nlists.h: Move some code to fe.h. * alloc.ads: Split Nodes_* constants into Node_Offsets and Slots, because Atree has two separate tables. Increase values. Remove Nodes_Release_Threshold. Improve comment. * debug.adb, gnat1drv.adb: Remove obsolete gnatd.A and gnatd.N switches. Add with/use for new packages. * opt.ads: Minor comment fix. * aspects.adb, checks.adb, comperr.adb, contracts.adb, cstand.adb, debug_a.adb, errout.adb, eval_fat.adb, exp_aggr.adb, exp_atag.adb, exp_attr.adb, exp_ch11.adb, exp_ch12.adb, exp_ch13.adb, exp_ch2.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch8.adb, exp_ch9.adb, exp_code.adb, exp_dbug.adb, exp_dist.adb, exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb, exp_put_image.adb, exp_sel.adb, exp_smem.adb, exp_spark.adb, exp_strm.adb, exp_tss.adb, exp_unst.adb, exp_util.adb, exp_util.ads, expander.adb, freeze.adb, frontend.adb, get_targ.ads, ghost.adb, gnat_cuda.adb, impunit.adb, inline.adb, itypes.adb, itypes.ads, layout.adb, lib.adb, lib-load.adb, lib-writ.adb, lib-xref.adb, lib-xref.ads, lib-xref-spark_specific.adb, live.adb, par.adb, par_sco.adb, pprint.adb, repinfo.adb, restrict.adb, rtsfind.adb, scil_ll.adb, scn.adb, sem.adb, sem.ads, sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_case.adb, sem_cat.adb, sem_ch11.adb, sem_ch13.adb, sem_ch2.adb, sem_ch5.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_dim.adb, sem_disp.adb, sem_dist.adb, sem_elab.adb, sem_elim.adb, sem_intr.adb, sem_mech.adb, sem_res.adb, sem_scil.adb, sem_smem.adb, sem_type.adb, set_targ.ads, sinput.adb, sinput-l.adb, sprint.adb, style.adb, styleg.adb, tbuild.adb, tbuild.ads, uname.adb: Add with/use for new packages. * libgnat/a-stoubu.adb, libgnat/a-stouut.adb: Simplify to ease bootstrap. * libgnat/a-stobfi.adb, libgnat/a-stoufi.adb (Create_File, Create_New_File): Create file in binary format, to avoid introducing unwanted text conversions on Windows. Simplify to ease bootstrap. * libgnat/a-stteou__bootstrap.ads: New. * ceinfo.adb, csinfo.adb, nmake.adt, treeprs.adt, xeinfo.adb, xnmake.adb, xsinfo.adb, xtreeprs.adb: Delete. * Make-generated.in: Build and run the gen_il program to generate files. The files are generated in the ada/gen_il subdirectory, and then moved up to ada. We rely on gnatmake (as opposed to make) to build the gen_il program efficiently (i.e. don't do anything if the sources didn't change). * gcc-interface/Makefile.in (ADAFLAGS): Add -gnatU. (GNATMAKE_OBJS): Add new object files. (GENERATED_FILES_FOR_TOOLS): New variable. (../stamp-tools): Create a link for all GENERATED_FILES_FOR_TOOLS. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add new object files. Remove ada/treeprs.o. (GNATBIND_OBJS): Add new object files. (ada.mostlyclean): Remove ada/sdefault.adb and add ada/stamp-gen_il. (ada.maintainer-clean): Remove ada/treeprs.ads. (update-sources): Remove obsolete target. (ada_generated_files): Rename to... (ADA_GENERATED_FILES): ... this. Add new source files. Add comment. * gcc-interface/trans.c: Remove obsolete Nodes_Ptr and Flags_ptr. Add Node_Offsets_Ptr and Slots_Ptr, which point to the corresponding tables in Atree. * gcc-interface/gigi.h (gigi): New parameters for initializing Node_Offsets_Ptr and Slots_Ptr. * gcc-interface/decl.c: Numeric_Kind, Discrete_Or_Fixed_Point_Kind, and Record_Kind were nonhierarchical, and were therefore removed for simplicity. Replace uses with calls to Is_In_... functions. gnattools/ * Makefile.in (GENERATED_FILES_FOR_TOOLS): New variable. ($(GCC_DIR)/stamp-tools): Walk it for the first copy operation.
2021-05-07[Ada] Spurious error with component of unchecked_union typeEd Schonberg1-3/+8
gcc/ada/ * exp_ch4.adb (Unconstrained_UU_In_Component_Declaration): A component declaration whose subtype indication is an entity name without an explicit constraint is an Unchecked_Union type only if the entity has an unconstrained nominal subtype (record type or private type) whose parent type is an Unchecked_Union.
2021-05-07[Ada] Attribute Address is not an interfering context in SPARKPiotr Trojanek1-0/+13
gcc/ada/ * sem_res.adb (Flag_Object): Ignore prefixes of attribute Address.
2021-05-07[Ada] Generate warning for negative literal of a modular typeYannick Moy5-6/+36
gcc/ada/ * opt.ads: Update comment for Warn_On_Suspicious_Modulus_Value. * sem_res.adb (Resolve_Unary_Op): Generate warning. * usage.adb: Refine doc for -gnatw.m/M switch. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update doc on -gnatw.m switch. * gnat_ugn.texi: Regenerate.
2021-05-07[Ada] Cleanup code for flagging object references in interfering contextsPiotr Trojanek1-14/+20
gcc/ada/ * sem_res.adb (Flag_Object): Replace chained IF with a CASE; remove repeated calls to Entity; do not traverse into N_Identifier and N_Expanded_Name, because only need to examine their Entity field anyway.
2021-05-07[Ada] Remove End_Interp_List from the overloaded resolution APIPiotr Trojanek4-27/+8
gcc/ada/ * sem_ch4.adb (Analyze_Call): Remove call to End_Interp_List. (Process_Overloaded_Indexed_Component): Remove call to End_Interp_List. * sem_util.adb (Insert_Explicit_Dereference): Remove call to End_Interp_List. * sem_type.ads (End_Interp_List): Remove. * sem_type.adb (Add_Entry): The guard against duplicate entries is now checked before other conditions, so that EXIT statements do not bypass this guard. (End_Interp_List): Remove.
2021-05-07[Ada] Crash on imported object with deep initialization and No_AbortsEd Schonberg1-0/+20
gcc/ada/ * exp_util.adb (Remove_Init_Call): If a simple initialization call is present, and the next statement is an initialization block (that contains a call to a Deep_ Initialize routine), remove the block as well, and insert the first initialization call in it, in case it is needed for later relocation.
2021-05-07[Ada] Remove some ??? commentsGary Dismukes4-25/+31
gcc/ada/ * errout.ads (Size_Too_Small_Message): Remove low-value ??? comment. * exp_util.ads: Remove ??? in part of overall package comments and restructure comment to clarify. (Duplicate_Subexpr): Remove ??? comment that seems unnecessary. * sem_ch3.ads (Analyze_Declarations): Remove two parenthesized ??? comments and add more description of the procedure's actions. (Get_Discriminant_Value): Remove ??? comment requesting more documentation, expanding description of the function's actions. * sem_disp.ads (Check_Operation_From_Incomplete_Type): Add more semantic description of the procedure and remove ??? comment requesting such. (Propagate_Tag): Refine comment to indicate meaning of formal parameters and generally improve the spec comment (and remove ??? comment asking about the parameters).
2021-05-07[Ada] Computation of Shift_Left and large signed valuesArnaud Charlet1-17/+19
gcc/ada/ * sem_eval.adb (Fold_Shift): Fix computation of Shift_Left resulting in negative signed values.
2021-05-07[Ada] Fix signature mismatch for Defining_EntityEric Botcazou2-35/+31
gcc/ada/ * sem_util.ads (Defining_Entity): Remove Empty_On_Errors parameter. (Defining_Entity_Or_Empty): New function. * sem_util.adb (Defining_Entity): Move bulk of implementation to... (Defining_Entity_Or_Empty): ...here. Do not raise Program_Error. (Innermost_Master_Scope_Depth): Call Defining_Entity_Or_Empty.
2021-05-07[Ada] Implement aspect No_Controlled_PartsJustin Squirek6-1/+568
gcc/ada/ * aspects.ads: Add entries to register Aspect_No_Controlled_Parts. * freeze.adb (Check_No_Controlled_Parts_Violations): Added to check requirements of aspect No_Controlled_Parts after a type has been frozen. (Freeze_Entity): Add call to Check_No_Controlled_Parts_Violations. (Find_Aspect_No_Controlled_Parts): Created to obtain the aspect specification for No_Controlled_Parts on a given type when present. (Find_Aspect_No_Controlled_Parts_Value): Protect against invalid value. (Has_Aspect_No_Controlled_Parts): Created as a prediate function to check if No_Controlled_Parts has been specified on a type for Get_Anacestor_Types_With_Specification. (Get_Aspect_No_Controlled_Parts_Value): Created to obtain the value of the aspect No_Controlled_Parts when specified on a given type. (Get_Generic_Formal_Types_In_Hierarchy): Created to collect formal types in a given type's hierarchy. (Get_Types_With_Aspect_In_Hierarchy): Created to collect types in a given type's hierarchy with No_Controlled_Parts specified. * sem_ch13.adb (Analyze_One_Aspect): Add processing for No_Controlled_Parts, and fix error in check for allowed pragmas for formal types. (Check_Expr_Is_OK_Static_Expression): Created to enforce checking of static expressions in the same vein as Analyze_Pragma.Check_Expr_OK_Static_Expression. * sem_util.adb (Collect_Types_In_Hierarchy): Created to collect types in a given type's hierarchy that match a given predicate function. * sem_util.ads: Fix typo. * snames.ads-tmpl: Add entry for No_Controlled_Parts.