aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
AgeCommit message (Collapse)AuthorFilesLines
2021-10-11[Ada] Fix for atomic wrongly rejected on object of discriminated typeEric Botcazou1-12/+16
gcc/ada/ * gcc-interface/decl.c (promote_object_alignment): Add GNU_SIZE parameter and use it for the size of the object if not null. (gnat_to_gnu_entity) <E_Variable>: Perform the automatic alignment promotion for objects whose nominal subtype is of variable size. (gnat_to_gnu_field): Adjust call to promote_object_alignment.
2021-10-11[Ada] Fix incorrect size for pathological pass-by-copy parametersEric Botcazou1-8/+10
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_param): Strip padding types only if the size does not change in the process. Rename local variable and add bypass for initialization procedures.
2021-10-08Come up with OPTION_SET_P macro.Martin Liska1-5/+5
gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_post_options): Use new macro OPTION_SET_P. (gnat_init_gcc_eh): Likewise. (gnat_init_gcc_fp): Likewise. gcc/c-family/ChangeLog: * c-opts.c (c_common_post_options): Use new macro OPTION_SET_P. gcc/ChangeLog: * config/alpha/alpha.c (alpha_option_override): Use new macro OPTION_SET_P. * config/arc/arc.c (arc_override_options): Likewise. * config/arm/arm.c (arm_option_override): Likewise. * config/bfin/bfin.c (bfin_load_pic_reg): Likewise. * config/c6x/c6x.c (c6x_option_override): Likewise. * config/csky/csky.c: Likewise. * config/darwin.c (darwin_override_options): Likewise. * config/frv/frv.c (frv_option_override): Likewise. * config/i386/djgpp.h: Likewise. * config/i386/i386.c (ix86_stack_protect_guard): Likewise. (ix86_max_noce_ifcvt_seq_cost): Likewise. * config/ia64/ia64.c (ia64_option_override): Likewise. (ia64_override_options_after_change): Likewise. * config/m32c/m32c.c (m32c_option_override): Likewise. * config/m32r/m32r.c (m32r_init): Likewise. * config/m68k/m68k.c (m68k_option_override): Likewise. * config/microblaze/microblaze.c (microblaze_option_override): Likewise. * config/mips/mips.c (mips_option_override): Likewise. * config/nios2/nios2.c (nios2_option_override): Likewise. * config/nvptx/nvptx.c (nvptx_option_override): Likewise. * config/pa/pa.c (pa_option_override): Likewise. * config/riscv/riscv.c (riscv_option_override): Likewise. * config/rs6000/aix71.h: Likewise. * config/rs6000/aix72.h: Likewise. * config/rs6000/aix73.h: Likewise. * config/rs6000/rs6000.c (darwin_rs6000_override_options): Likewise. (rs6000_override_options_after_change): Likewise. (rs6000_linux64_override_options): Likewise. (glibc_supports_ieee_128bit): Likewise. (rs6000_option_override_internal): Likewise. (rs6000_file_start): Likewise. (rs6000_darwin_file_start): Likewise. * config/rs6000/rtems.h: Likewise. * config/rs6000/sysv4.h: Likewise. * config/rs6000/vxworks.h (SUB3TARGET_OVERRIDE_OPTIONS): Likewise. * config/s390/s390.c (s390_option_override): Likewise. * config/sh/linux.h: Likewise. * config/sh/netbsd-elf.h (while): Likewise. * config/sh/sh.c (sh_option_override): Likewise. * config/sol2.c (solaris_override_options): Likewise. * config/sparc/sparc.c (sparc_option_override): Likewise. * config/tilegx/tilegx.c (tilegx_option_override): Likewise. * config/visium/visium.c (visium_option_override): Likewise. * config/vxworks.c (vxworks_override_options): Likewise. * lto-opts.c (lto_write_options): Likewise. * omp-expand.c (expand_omp_simd): Likewise. * omp-general.c (omp_max_vf): Likewise. * omp-offload.c (oacc_xform_loop): Likewise. * opts.h (OPTION_SET_P): Likewise. * targhooks.c (default_max_noce_ifcvt_seq_cost): Likewise. * toplev.c (process_options): Likewise. * tree-predcom.c: Likewise. * tree-sra.c (analyze_all_variable_accesses): Likewise. gcc/cp/ChangeLog: * constexpr.c (maybe_warn_about_constant_value): Use new macro OPTION_SET_P. * decl.c (redeclaration_error_message): Likewise. (cxx_init_decl_processing): Likewise. gcc/d/ChangeLog: * d-lang.cc (d_post_options): Use new macro OPTION_SET_P. gcc/fortran/ChangeLog: * options.c (gfc_post_options): Use new macro OPTION_SET_P. gcc/objc/ChangeLog: * objc-next-runtime-abi-01.c: Use new macro OPTION_SET_P. * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Likewise.
2021-10-05[Ada] Plug small loophole with boolean valuesEric Botcazou1-0/+1
gcc/ada/ * gcc-interface/trans.c (gnat_to_gnu): Do not wrap boolean values referenced in pragmas.
2021-10-05[Ada] Do not unconditionally inline expression functions with -gnatd.8Eric Botcazou1-1/+1
gcc/ada/ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Do not set the DECL_DISREGARD_INLINE_LIMITS flag if -gnatd.8 is specified.
2021-10-05[Ada] Fix latent bug in set_end_locus_from_nodeBob Duff1-1/+6
gcc/ada/ * gcc-interface/trans.c (set_end_locus_from_node): Check that Handled_Statement_Sequence is not Empty before calling End_Label, because the Empty node has no End_Label, and depending on the exact node layout chosen by gen_il, calling End_Label might crash, or might work OK by accident.
2021-10-05[Ada] Minor include directives placement adjustmentEric Botcazou2-2/+2
gcc/ada/ * gcc-interface/cuintp.c: Adjust placement of include directive. * gcc-interface/targtyps.c: Likewise.
2021-10-05[Ada] introduce stack scrub (strub) featureAlexandre Oliva1-0/+12
gcc/ada/ * doc/gnat_rm.rst: Add... * doc/gnat_rm/security_hardening_features.rst: New. * doc/gnat_rm/about_this_guide.rst: Link to new chapter. * gnat_rm.texi: Regenerate. * gcc-interface/utils.c (handle_strub_attribute): New. (gnat_internal_attribute_table): Add strub. * libgnat/a-except.adb: Make Rcheck_CE_* strub-callable. * libgnat/a-except.ads (Raise_Exception): Likewise. (Raise_Exception_Always): Likewise. * libgnat/s-arit128.ads (Multiply_With_Ovflo_Check128): Likewise. * libgnat/s-arit64.ads (Multiply_With_Ovflo_Check64): Likewise. * libgnat/s-secsta.ads (SS_Allocate, SS_Mark, SS_Release): Likewise.
2021-09-23[Ada] Fix obsolete comment mentioning girder discriminantsEric Botcazou1-1/+1
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Fix comment.
2021-09-23[Ada] Cleanup and efficiency improvementsBob Duff4-3/+5
gcc/ada/ * gen_il-gen.adb: Generate getters and setters with much of the code inlined. Generate code for storing a few fields in the node header, to avoid the extra level of indirection for those fields. We generate the header type, so we don't have to duplicate hand-written Ada and C code to depend on the number of header fields. Declare constants for slot size. Use short names because these are used all over. Remove Put_Low_Level_Accessor_Instantiations, Put_Low_Level_C_Getter, which are no longer needed. Rename Put_High_Level_C_Getter-->Put_C_Getter. * atree.ads, atree.adb: Take into account the header slots. Take into account the single Node_Or_Entity_Field type. Remove "pragma Assertion_Policy (Ignore);", because the routines in this package are no longer efficiency critical. * atree.h: Remove low-level getters, which are no longer used by sinfo.h and einfo.h. * einfo-utils.adb: Avoid crash in Known_Alignment. * live.adb, sem_eval.adb: Remove code that prevents Node_Id from having a predicate. We don't actually add a predicate to Node_Id, but we want to be able to for temporary debugging. * sinfo-utils.adb: Remove code that prevents Node_Id from having a predicate. Take into account the single Node_Or_Entity_Field type. * sinfo-utils.ads: Minor. * table.ads (Table_Type): Make the components aliased, because low-level setters in Atree need to take 'Access. * treepr.adb: Take into account the single Node_Or_Entity_Field type. Make some code more robust, so we can print out half-baked nodes. * types.ads: Move types here for visibility purposes. * gcc-interface/gigi.h, gcc-interface/trans.c: Take into account the Node_Header change in the GNAT front end. * gcc-interface/cuintp.c, gcc-interface/targtyps.c: Add because gigi.h now refers to type Node_Header, which is in sinfo.h.
2021-09-22[Ada] Remove System.Img_Enum_New unitEric Botcazou1-2/+0
gcc/ada/ * libgnat/s-imenne.ads, libgnat/s-imenne.adb: Delete. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Remove s-imenne.o. (GNATBIND_OBJS): Likewise.
2021-09-22Small tweak to comments in range_cannot_be_superflatEric Botcazou1-2/+4
gcc/ada/ * gcc-interface/decl.c (range_cannot_be_superflat): Tweak comments.
2021-09-21[Ada] Clean up uses of Esize and RM_SizeBob Duff2-19/+24
gcc/ada/ * einfo-utils.adb: Add support (currently disabled) for using "initial zero" instead of "Uint_0" to represent "unknown". Call Known_ functions, instead of evilly duplicating their code inline. * fe.h (No_Uint_To_0): New function to convert No_Uint to Uint_0, in order to preserve existing behavior. (Copy_Esize, Copy_RM_Size): New imports from Einfo.Utils. * cstand.adb: Set size fields of Standard_Debug_Renaming_Type and Standard_Exception_Type. * checks.adb, exp_attr.adb, exp_ch3.adb, exp_ch5.adb, exp_ch6.adb, exp_pakd.adb, exp_util.adb, freeze.adb, itypes.adb, layout.adb, repinfo.adb, sem_attr.adb, sem_ch12.adb, sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch7.adb, sem_util.adb: Protect calls with Known_..., use Copy_... Remove assumption that Uint_0 represents "unknown". * types.ads (Nonzero_Int): New subtype. * gcc-interface/decl.c, gcc-interface/trans.c: Protect calls with Known_... and use Copy_... as appropriate, to avoid blowing up in unknown cases. Similarly, call No_Uint_To_0 to preserve existing behavior.
2021-09-20[Ada] Refactor scan_backend_switch to share logic across backendsGhjuvan Lacambre1-0/+1
gcc/ada/ * adabkend.adb (Scan_Back_End_Switches): Replace switch-scanning logic with call to Backend_Utils.Scan_Common_Back_End_Switches. * back_end.adb (Scan_Back_End_Switches): Replace switch-scanning logic with call to Backend_Utils.Scan_Common_Back_End_Switches. * backend_utils.adb: New file. * backend_utils.ads: New file. * gcc-interface/Make-lang.in: Add ada/backend_utils.o.
2021-09-15zero-call-used-regs attr for adaAlexandre Oliva1-0/+59
Make the zero_call_used_regs attribute usable as a Machine_Attribute pragma. for gcc/ada/ChangeLog * gcc-interface/utils.c: Include opts.h. (handle_zero_call_used_regs_attribute): New. (gnat_internal_attribute_table): Add zero_call_used_regs. for gcc/testsuite/ChangeLog * gnat.dg/zcur_attr.adb, gnat.dg/zcur_attr.ads: New.
2021-09-14Do not issue size error for too large array typeEric Botcazou1-2/+1
The error is to be issued when objects of the type are declared instead. gcc/ada/ * gcc-interface/decl.c (validate_size): Do not issue an error if the old size has overflowed.
2021-09-14Fix inaccurate bounds in debug info for vector array typesEric Botcazou1-0/+8
They should not be 0-based, unless the array type itself is. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): For vector types, make the representative array the debug type.
2021-09-14Fix internal error on broken import of vector intrinsicsEric Botcazou1-19/+27
The change also makes small adjustments to warning messages for intrinsics. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_subprog_type): Turn variable into constant. Capitalize GCC in warning message. (intrin_arglists_compatible_p): Change parameter to pointer-to-const Adjust warning messages. Turn warning into error for vector types. (intrin_return_compatible_p): Likewise. (intrin_profiles_compatible_p): Change parameter to pointer-to-const
2021-09-14Strengthen compatibility warning for GCC builtinsEric Botcazou1-43/+4
This is necessary for vector builtins, which are picky about the signedness of the element type. gcc/ada/ * libgnat/s-atopri.ads (bool): Delete. (Atomic_Test_And_Set): Replace bool with Boolean. (Atomic_Always_Lock_Free): Likewise. * libgnat/s-aoinar.adb (Is_Lock_Free): Adjust. * libgnat/s-aomoar.adb (Is_Lock_Free): Likewise. * libgnat/s-aotase.adb (Atomic_Test_And_Set): Likewise. * libgnat/s-atopex.adb (Atomic_Compare_And_Exchange): Likewise. * gcc-interface/decl.c: Include gimple-expr.h. (intrin_types_incompatible_p): Delete. (intrin_arglists_compatible_p): Call types_compatible_p. (intrin_return_compatible_p): Likewise.
2021-09-14Fix internal error on pointer-to-pointer binding in LTO modeEric Botcazou1-1/+5
gcc/ada/ * gcc-interface/utils.c (update_pointer_to): Set TYPE_CANONICAL on pointer and reference types.
2021-09-14Implement PR ada/101385Eric Botcazou1-3/+4
For consistency's sake with -Wall & -w, this makes -Werror imply -gnatwe. gcc/ada/ PR ada/101385 * doc/gnat_ugn/building_executable_programs_with_gnat.rst (-Wall): Minor fixes. (-w): Likewise. (-Werror): Document that it also sets -gnatwe by default. * gcc-interface/lang-specs.h (ada): Expand -gnatwe if -Werror is passed and move expansion of -gnatw switches to before -gnatez.
2021-09-14Remove superfluous call to UI_Is_In_Int_RangeEric Botcazou1-2/+1
gcc/ada/ * gcc-interface/utils.c (can_materialize_object_renaming_p): Do not call UI_Is_In_Int_Range on the result of Normalized_First_Bit.
2021-09-14Give more informative error message for by-reference typesEric Botcazou1-4/+10
Recent compilers enforce more strictly the RM C.6(18) clause, which says that volatile record types are by-reference types. This changes the typical error message now given in these cases. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <is_type>: Declare new constant. Adjust error message issued by validate_size in the case of by-reference types. (validate_size): Always use the error strings passed by the caller.
2021-09-08Support -fexcess-precision=16 which will enable ↵liuhongt1-0/+3
FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 when backend supports _Float16. gcc/ada/ChangeLog: * gcc-interface/misc.c (gnat_post_options): Issue an error for -fexcess-precision=16. gcc/c-family/ChangeLog: * c-common.c (excess_precision_mode_join): Update below comments. (c_ts18661_flt_eval_method): Set excess_precision_type to EXCESS_PRECISION_TYPE_FLOAT16 when -fexcess-precision=16. * c-cppbuiltin.c (cpp_atomic_builtins): Update below comments. (c_cpp_flt_eval_method_iec_559): Set excess_precision_type to EXCESS_PRECISION_TYPE_FLOAT16 when -fexcess-precision=16. gcc/ChangeLog: * common.opt: Support -fexcess-precision=16. * config/aarch64/aarch64.c (aarch64_excess_precision): Return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 when EXCESS_PRECISION_TYPE_FLOAT16. * config/arm/arm.c (arm_excess_precision): Ditto. * config/i386/i386.c (ix86_get_excess_precision): Ditto. * config/m68k/m68k.c (m68k_excess_precision): Issue an error when EXCESS_PRECISION_TYPE_FLOAT16. * config/s390/s390.c (s390_excess_precision): Ditto. * coretypes.h (enum excess_precision_type): Add EXCESS_PRECISION_TYPE_FLOAT16. * doc/tm.texi (TARGET_C_EXCESS_PRECISION): Update documents. * doc/tm.texi.in (TARGET_C_EXCESS_PRECISION): Ditto. * doc/extend.texi (Half-Precision): Document -fexcess-precision=16. * flag-types.h (enum excess_precision): Add EXCESS_PRECISION_FLOAT16. * target.def (excess_precision): Update document. * tree.c (excess_precision_type): Set excess_precision_type to EXCESS_PRECISION_FLOAT16 when -fexcess-precision=16. gcc/fortran/ChangeLog: * options.c (gfc_post_options): Issue an error for -fexcess-precision=16. gcc/testsuite/ChangeLog: * gcc.target/i386/float16-6.c: New test. * gcc.target/i386/float16-7.c: New test.
2021-08-19Define STAGE1_LIBS to link against libcl.a in stage1 on hpux.John David Anglin1-0/+4
2021-08-19 Arnaud Charlet <charlet@adacore.com> PR ada/101924 gcc/ada/ChangeLog: * gcc-interface/Make-lang.in (STAGE1_LIBS): Define on hpux.
2021-08-18Fix thinko in latest change for GNAT encodingsEric Botcazou1-3/+3
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Fix thinko in latest change.
2021-08-11Ada: Remove debug line number for DECL_IGNORED_P functionsBernd Edlinger1-1/+3
It was pointed out in PR101598 to be inappropriate, that ignored Ada decls receive the source line number which was recorded in the function decl's DECL_SOURCE_LOCATION. Therefore set all front-end-generated Ada decls with DECL_IGNORED_P to UNKNOWN_LOCATION. 2021-08-11 Bernd Edlinger <bernd.edlinger@hotmail.de> PR debug/101598 * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the DECL_SOURCE_LOCATION of DECL_IGNORED_P gnu_subprog_decl to UNKNOWN_LOCATION.
2021-07-12[Ada] Use GNAT encodings only when -fgnat-encodings=all is specifiedEric Botcazou3-35/+33
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Add a parallel type only when -fgnat-encodings=all is specified. <E_Array_Type>: Use the PAT name and special suffixes only when -fgnat-encodings=all is specified. <E_Array_Subtype>: Build a special type for debugging purposes only when -fgnat-encodings=all is specified. Add a parallel type or use the PAT name only when -fgnat-encodings=all is specified. <E_Record_Type>: Generate debug info for the inner record types only when -fgnat-encodings=all is specified. <E_Record_Subtype>: Use a debug type for an artificial subtype only except when -fgnat-encodings=all is specified. (elaborate_expression_1): Reset need_for_debug when possible only except when -fgnat-encodings=all is specified. (components_to_record): Use XV encodings for variable size only when -fgnat-encodings=all is specified. (associate_original_type_to_packed_array): Add a parallel type only when -fgnat-encodings=all is specified. * gcc-interface/misc.c (gnat_get_array_descr_info): Do not return full information only when -fgnat-encodings=all is specified. * gcc-interface/utils.c (make_packable_type): Add a parallel type only when -fgnat-encodings=all is specified. (maybe_pad_type): Make the inner type a debug type only except when -fgnat-encodings=all is specified. Create an XVS type for variable size only when -fgnat-encodings=all is specified. (rest_of_record_type_compilation): Add a parallel type only when -fgnat-encodings=all is specified.
2021-07-12[Ada] Implement support for unconstrained array types with FLBEric Botcazou1-24/+88
gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Use a fixed lower bound if the index subtype is marked so, as well as a more efficient formula for the upper bound if the array cannot be superflat. (flb_cannot_be_superflat): New predicate. (cannot_be_superflat): Rename into... (range_cannot_be_superfla): ...this. Minor tweak.
2021-07-12[Ada] Clean up Uint fieldsBob Duff2-3/+7
gcc/ada/ * uintp.ads, types.h: New subtypes of Uint: Valid_Uint, Unat, Upos, Nonzero_Uint with predicates. These correspond to new field types in Gen_IL. * gen_il-types.ads (Valid_Uint, Unat, Upos, Nonzero_Uint): New field types. * einfo-utils.ads, einfo-utils.adb, fe.h (Known_Alignment, Init_Alignment): Use the initial zero value to represent "unknown". This will ensure that if Alignment is called before Set_Alignment, the compiler will blow up (if assertions are enabled). * atree.ads, atree.adb, atree.h, gen_il-gen.adb (Get_Valid_32_Bit_Field): New generic low-level getter for subtypes of Uint. (Copy_Alignment): New procedure to copy Alignment field even when Unknown. (Init_Object_Size_Align, Init_Size_Align): Do not bypass the Init_ procedures. * exp_pakd.adb, freeze.adb, layout.adb, repinfo.adb, sem_util.adb: Protect calls to Alignment with Known_Alignment. Use Copy_Alignment when it might be unknown. * gen_il-gen-gen_entities.adb (Alignment, String_Literal_Length): Use type Unat instead of Uint, to ensure that the field is always Set_ before we get it, and that it is set to a nonnegative value. (Enumeration_Pos): Unat. (Enumeration_Rep): Valid_Uint. Can be negative, but must be valid before fetching. (Discriminant_Number): Upos. (Renaming_Map): Remove. * gen_il-gen-gen_nodes.adb (Char_Literal_Value, Reason): Unat. (Intval, Corresponding_Integer_Value): Valid_Uint. * gen_il-internals.ads: New functions for dealing with special defaults and new subtypes of Uint. * scans.ads: Correct comments. * scn.adb (Post_Scan): Do not set Intval to No_Uint; that is no longer allowed. * sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Do not set Enumeration_Rep to No_Uint; that is no longer allowed. (Offset_Value): Protect calls to Alignment with Known_Alignment. * sem_prag.adb (Set_Atomic_VFA): Do not use Uint_0 to mean "unknown"; call Init_Alignment instead. * sinfo.ads: Minor comment fix. * treepr.adb: Deal with printing of new field types. * einfo.ads, gen_il-fields.ads (Renaming_Map): Remove. * gcc-interface/decl.c (gnat_to_gnu_entity): Use Known_Alignment before calling Alignment. This preserve some probably buggy behavior: if the alignment is not set, it previously defaulted to Uint_0; we now make that explicit. Use Copy_Alignment, because "Set_Alignment (Y, Alignment (X));" no longer works when the Alignment of X has not yet been set. * gcc-interface/trans.c (process_freeze_entity): Use Copy_Alignment.
2021-07-09Missing piece in earlier changeEric Botcazou1-3/+0
gcc/ada/ * gcc-interface/utils.c (finish_subprog_decl): Remove obsolete line.
2021-07-08[Ada] Remove Unknown_ functionsBob Duff2-15/+15
gcc/ada/ * einfo-utils.ads, einfo-utils.adb (Unknown_Alignment, Unknown_Component_Bit_Offset, Unknown_Component_Size, Unknown_Esize, Unknown_Normalized_First_Bit, Unknown_Normalized_Position, Unknown_Normalized_Position_Max, Unknown_RM_Size): Remove these functions. * exp_pakd.adb, exp_util.adb, fe.h, freeze.adb, layout.adb, repinfo.adb, sem_ch13.adb, sem_ch3.adb, sem_util.adb: Remove calls to these functions; do "not Known_..." instead. * gcc-interface/decl.c, gcc-interface/trans.c (Unknown_Alignment, Unknown_Component_Size, Unknown_Esize, Unknown_RM_Size): Remove calls to these functions; do "!Known_..." instead.
2021-07-08[Ada] Add No_Tasking restriction is system.ads for bootstrapArnaud Charlet1-0/+4
gcc/ada/ * gcc-interface/system.ads: Add No_Tasking restriction.
2021-06-28ada: Add support for per-location warning groups.Martin Sebor2-3/+4
gcc/ada/ChangeLog: * gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): Replace TREE_NO_WARNING with suppress_warning. (gnat_gimplify_expr): Same. * gcc-interface/utils.c (gnat_pushdecl): Same.
2021-06-17[Ada] Use runtime from base compiler during stage1 (continued)Arnaud Charlet1-1/+2
gcc/ada/ * gcc-interface/Make-lang.in: Use libgnat.so if libgnat.a cannot be found.
2021-06-15[Ada] Use runtime from base compiler during stage1Arnaud Charlet2-171/+219
gcc/ada/ * Make-generated.in: Add rule to copy runtime files needed during stage1. * raise.c: Remove obsolete symbols used during bootstrap. * gcc-interface/Make-lang.in: Do not use libgnat sources during stage1. (GNAT_ADA_OBJS, GNATBIND_OBJS): Split in two parts, the common part and the part only used outside of stage1. (ADA_GENERATED_FILES): Add runtime files needed during bootstrap when recent APIs are needed. (ada/b_gnatb.adb): Remove prerequisite. * gcc-interface/system.ads: Remove obsolete entries.
2021-06-15[Ada] Rename Ada 202* to Ada 2022Arnaud Charlet1-4/+4
gcc/ada/ * einfo.ads, errout.adb, errout.ads, exp_aggr.adb, exp_ch5.adb, exp_ch6.adb, exp_ch8.adb, exp_ch9.adb, exp_imgv.adb, exp_put_image.adb, fe.h, impunit.adb, impunit.ads, libgnat/a-cobove.ads, libgnat/a-convec.ads, opt.ads, par-ch12.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb, par-prag.adb, par-util.adb, scans.ads, scng.adb, sem_aggr.adb, sem_attr.adb, sem_ch10.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb, sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_elab.adb, sem_eval.adb, sem_prag.adb, sem_res.adb, sem_type.adb, sem_util.adb, sem_util.ads, sinfo.ads, snames.ads-tmpl, sprint.adb, switch-c.adb, usage.adb, doc/gnat_ugn/building_executable_programs_with_gnat.rst, doc/gnat_rm/implementation_defined_aspects.rst, gcc-interface/trans.c: Update all references to Ada 2020 to Ada 2022. Rename pragma Ada_2020 to Ada_2022. Update documentation accordingly. * gnat_ugn.texi, gnat_rm.texi: Regenerate.
2021-06-03Fix miscompilation of predicate on bit-packed array typesEric Botcazou1-15/+22
This is a regression present on the mainline and 11 branch in the form of a miscompilation by the new mod/ref IPA pass of code that passes constrained bit-packed array objets in a call to a subprograms taking unconstrained bit-packed array parameters, which occurs for predicate on bit-packed array types for example. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Add PAT local constant and use it throughout. If it is set, use a ref-all pointer type for the pointer-to-array field of the fat pointer type. <E_Array_Subtype>: Add PAT local constant and use it throughout. gcc/testsuite/ * gnat.dg/bit_packed_array6.adb: New test. * gnat.dg/bit_packed_array6_pkg.ads: New helper.
2021-05-21Detect illegal conditions in Raise_xxx_Error nodesPiotr Trojanek1-1/+6
Enforce comment from sinfo.ads about the Condition field in N_Raise_xxx_Error nodes. Only an extra sanity check; the behaviour is not affected. gcc/ada/ * gcc-interface/trans.c (Raise_Error_to_gnu): Add an assertion.
2021-05-21Remove discriminant checks in gigiEric Botcazou2-6/+11
gcc/ada/ * gcc-interface/utils.c (gnat_pushdecl): Fix typo in comment. * gcc-interface/utils2.c (build_simple_component_ref): Build NULL_EXPR if the offset of the field has overflowed. (build_component_ref): Add gigi checking assertion that the reference has been built and replace the discriminant check by a Program_Error.
2021-05-21Consistently generate debug info for elaboration variablesEric Botcazou2-36/+40
This makes sure that debug info is generated for elaboration variables, even if the variables are not generated exclusively for this purpose. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Named_Integer>: Do not pass default value in call to create_var_decl. <E_Variable>: Likewise. <E_Record_Subtype>: Both pass true for const_flag and false for const_decl_allowed_p in call to create_var_decl. Small tweaks in the generic record type case. (elaborate_expression): Rename need_debug into need_for_debug and adjust throughout. (elaborate_expression_1): Likewise. Pass Needs_Debug_Info instead of need_for_debug in call to create_var_decl. (elaborate_expression_2): Likewise. * gcc-interface/utils.c (maybe_pad_type): Pass false for const_decl_allowed_p in call to create_var_decl.
2021-05-21Replace ? with ?? in warning messagesGhjuvan Lacambre3-30/+30
The former has been deprecated in favor of the latter. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Replace ? with ??. (gnat_to_gnu_param): Likewise. (gnat_to_gnu_subprog_type): Likewise. (warn_on_field_placement): Likewise. (intrin_arglists_compatible_p): Likewise. * gcc-interface/trans.c (Pragma_to_gnu): Likewise. (gnat_to_gnu): Likewise. (validate_unchecked_conversion): Likewise. * gcc-interface/utils.c (maybe_pad_type): Likewise.
2021-05-21Fix internal error on locally derived bit-packed array typeEric Botcazou1-5/+9
This is a regression present on the mainline, 11 and 10 branches, in the form of an ICE on a locally derived bit-packed array type. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Process the implementation type of a packed type implemented specially. gcc/testsuite/ * gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test.
2021-05-21Always translate Is_Pure flag into pure in C senseEric Botcazou1-25/+19
Gigi has historically translated the Is_Pure flag of the front-end into the "const" attribute of GNU C. That's correct for subprograms of pure Ada units, but not fully exact according to the semantics of the flag. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_subprog_type): Always translate the Is_Pure flag into the "pure" attribute of GNU C.
2021-05-21Fix segfault at run time on strict-alignment platformsEric Botcazou1-1/+5
This fixes a regression present on the mainline and 11 branch by restricting the problematic change dealing with bitfields whose nomimal subtype is self-referential to the cases where the size is really lower. gcc/ada/ * gcc-interface/trans.c (Call_to_gnu): Restrict previous change to bitfields whose size is not equal to the type size. (gnat_to_gnu): Likewise.
2021-05-21Fix spurious No_Elaboration violation for Size attributeEric Botcazou1-28/+30
We optimize the associated range check but nevertheless flag a violation. gcc/ada/ * gcc-interface/trans.c (Call_to_gnu): Minor tweaks. (gnat_to_gnu_external): Likewise. (Raise_Error_to_gnu): Return an empty statement list if there is a condition and it is always false. (gnat_to_gnu): Do not check for elaboration code a priori during the translation but a posteriori instead.
2021-05-21Fix incorrect SLOC on instructionEric Botcazou1-2/+4
This puts the missing SLOC on a statement generated by a return. gcc/ada/ * gcc-interface/trans.c (gnat_to_gnu) <N_Simple_Return_Statement>: Put a SLOC on the assignment from the return value to the return object in the copy-in/copy-out case.
2021-05-21Use EXACT_DIV_EXPR as much as possibleEric Botcazou3-15/+14
...when the division is exact, typically dividing TYPE_SIZE by BITS_PER_UNIT. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Replace CEIL_DIV_EXPR with EXACT_DIV_EXPR. * gcc-interface/misc.c (gnat_type_max_size): Likewise. * gcc-interface/utils.c (maybe_pad_type): Likewise. (finish_record_type): Likewise. And always compute the unit size.
2021-05-11Remove BRIG front-end.Martin Liska1-3/+3
gcc/ada/ChangeLog: * gcc-interface/ada-tree.h (BUILT_IN_LIKELY): Use builtins from COROUTINES. (BUILT_IN_UNLIKELY): Likewise. gcc/ChangeLog: * builtins.def (DEF_HSAIL_BUILTIN): Remove. (DEF_HSAIL_ATOMIC_BUILTIN): Likewise. (DEF_HSAIL_SAT_BUILTIN): Likewise. (DEF_HSAIL_INTR_BUILTIN): Likewise. (DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN): Likewise. * doc/frontends.texi: Remove BRIG. * doc/install.texi: Likewise. * doc/invoke.texi: Likewise. * doc/standards.texi: Likewise. * brig-builtins.def: Removed. * brig/ChangeLog: Removed. * brig/Make-lang.in: Removed. * brig/brig-builtins.h: Removed. * brig/brig-c.h: Removed. * brig/brig-lang.c: Removed. * brig/brigfrontend/brig-arg-block-handler.cc: Removed. * brig/brigfrontend/brig-atomic-inst-handler.cc: Removed. * brig/brigfrontend/brig-basic-inst-handler.cc: Removed. * brig/brigfrontend/brig-branch-inst-handler.cc: Removed. * brig/brigfrontend/brig-cmp-inst-handler.cc: Removed. * brig/brigfrontend/brig-code-entry-handler.cc: Removed. * brig/brigfrontend/brig-code-entry-handler.h: Removed. * brig/brigfrontend/brig-comment-handler.cc: Removed. * brig/brigfrontend/brig-control-handler.cc: Removed. * brig/brigfrontend/brig-copy-move-inst-handler.cc: Removed. * brig/brigfrontend/brig-cvt-inst-handler.cc: Removed. * brig/brigfrontend/brig-fbarrier-handler.cc: Removed. * brig/brigfrontend/brig-function-handler.cc: Removed. * brig/brigfrontend/brig-function.cc: Removed. * brig/brigfrontend/brig-function.h: Removed. * brig/brigfrontend/brig-inst-mod-handler.cc: Removed. * brig/brigfrontend/brig-label-handler.cc: Removed. * brig/brigfrontend/brig-lane-inst-handler.cc: Removed. * brig/brigfrontend/brig-machine.c: Removed. * brig/brigfrontend/brig-machine.h: Removed. * brig/brigfrontend/brig-mem-inst-handler.cc: Removed. * brig/brigfrontend/brig-module-handler.cc: Removed. * brig/brigfrontend/brig-queue-inst-handler.cc: Removed. * brig/brigfrontend/brig-seg-inst-handler.cc: Removed. * brig/brigfrontend/brig-signal-inst-handler.cc: Removed. * brig/brigfrontend/brig-to-generic.cc: Removed. * brig/brigfrontend/brig-to-generic.h: Removed. * brig/brigfrontend/brig-util.cc: Removed. * brig/brigfrontend/brig-util.h: Removed. * brig/brigfrontend/brig-variable-handler.cc: Removed. * brig/brigfrontend/hsa-brig-format.h: Removed. * brig/brigfrontend/phsa.h: Removed. * brig/brigspec.c: Removed. * brig/config-lang.in: Removed. * brig/gccbrig.texi: Removed. * brig/lang-specs.h: Removed. * brig/lang.opt: Removed. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/pr78027.f90: Remove -Wno-hsa option. * brig.dg/README: Removed. * brig.dg/dg.exp: Removed. * brig.dg/test/gimple/alloca.hsail: Removed. * brig.dg/test/gimple/atomics.hsail: Removed. * brig.dg/test/gimple/branches.hsail: Removed. * brig.dg/test/gimple/fbarrier.hsail: Removed. * brig.dg/test/gimple/function_calls.hsail: Removed. * brig.dg/test/gimple/internal-casts.hsail: Removed. * brig.dg/test/gimple/kernarg.hsail: Removed. * brig.dg/test/gimple/mem.hsail: Removed. * brig.dg/test/gimple/mulhi.hsail: Removed. * brig.dg/test/gimple/packed.hsail: Removed. * brig.dg/test/gimple/priv-array-offset-access.hsail: Removed. * brig.dg/test/gimple/smoke_test.hsail: Removed. * brig.dg/test/gimple/variables.hsail: Removed. * brig.dg/test/gimple/vector.hsail: Removed. * lib/brig-dg.exp: Removed. * lib/brig.exp: Removed.
2021-05-11Fix missing version_string in AdaMartin Liska2-5/+8
gcc/ada/ PR bootstrap/100506 * Make-generated.in: Replace version.c with ada/version.c. * gcc-interface/Make-lang.in: Add version.o to GNAT1_C_OBJS. Add version.o to GNAT_ADA_OBJS and GNATBIND_OBJS. * gcc-interface/Makefile.in: Add version.o to TOOLS_LIBS. * gnatvsn.adb: Start using a new C symbol gnat_version_string. * version.c: New file.