aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2019-10-11decl.c (gnat_to_gnu_field): Adjust again the packing for a field without ↵Eric Botcazou2-0/+12
strict alignment and with an... * gcc-interface/decl.c (gnat_to_gnu_field): Adjust again the packing for a field without strict alignment and with an oversized clause. From-SVN: r276873
2019-10-11decl.c (annotate_value): Really test the sign of the value when deciding to ↵Eric Botcazou2-9/+14
build a NEGATE_EXPR. * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Really test the sign of the value when deciding to build a NEGATE_EXPR. <PLUS_EXPR>: Remove redundant line. <BIT_AND_EXPR>: Do the negation here. From-SVN: r276866
2019-10-11decl.c (Gigi_Equivalent_Type): New case.Eric Botcazou2-0/+10
* gcc-interface/decl.c (Gigi_Equivalent_Type) <E_Array_Subtype>: New case. Return the base type if the subtype is not constrained. From-SVN: r276865
2019-10-11decl.c (gnat_to_gnu_entity): New case to deal with the definition of named ↵Eric Botcazou4-20/+72
numbers. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Named_{Integer|Real}>: New case to deal with the definition of named numbers. <E_Variable>: Minor tweaks. Set DECL_IGNORED_P on the CONST_DECL if a corresponding variable is built. * gcc-interface/trans.c (gnat_to_gnu) <N_Integer_Literal>: Return error_mark_node instead of aborting on overflow for named numbers. <N_Number_Declaration>: Reuse the <N_Object_Declaration> case and deal with error_mark_node specifically. * gcc-interface/utils.c (create_var_decl): Do not set DECL_IGNORED_P on CONST_DECLs. (gnat_write_global_declarations): Output global constants. From-SVN: r276864
2019-10-11[Ada] Repair ChangeLog entriesPierre-Marie de Rodat1-1/+5659
My scripts and I unexpectedly erased gcc/ada/ChangeLog yesterday. This commit restores the ChangeLog file to its previous state and adds the entries for my commits yesterday. From-SVN: r276861
2019-10-10[Ada] Handling up-level references in loops within library-level declarationsGary Dismukes2-3/+97
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * exp_ch7.adb (Check_Unnesting_In_Decls_Or_Stmts): When encountering a loop at the top level of a package declaration list (that is, within the declarations of a package spec or body) that has nested subprograms, call Unnest_Loop to create a new library-level procedure that will contain the loop, to allow for proper handling of up-level references from within nested subprograms, such as to loop parameters. (Unnest_Loop): New procedure that takes a loop statement and creates a new procedure body to enclose the loop statement, along with generating a call to the procedure. From-SVN: r276836
2019-10-10[Ada] Ensure constructor is a C++ constructorArnaud Charlet2-3/+4
2019-10-10 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * freeze.adb (Freeze_Subprogram): Ensure constructor is a C++ constructor. From-SVN: r276835
2019-10-10[Ada] Add pragma Preelaborable_Initialization to Stream_IO.File_TypeGary Dismukes2-3/+4
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * libgnat/a-ststio.ads (File_Type): Apply pragma Preelaborable_Initialization to the type. From-SVN: r276834
2019-10-10[Ada] Fix inlining of subprograms with deep param/result in GNATproveYannick Moy2-4/+17
2019-10-10 Yannick Moy <moy@adacore.com> gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Do not peek under private types whose completion is SPARK_Mode Off. From-SVN: r276833
2019-10-10[Ada] Various minor typo fixesGary Dismukes9-21/+22
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * exp_ch4.adb, sem_cat.adb, sem_ch12.adb, sem_ch3.adb, sem_ch6.adb, sem_prag.adb, sem_util.adb, sem_util.ads: Minor typo fixes. From-SVN: r276832
2019-10-10[Ada] Spurious warning on call with out parameter in expression functionEd Schonberg2-7/+9
2019-10-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_warn.adb (Warn_On_Useless_Assignment): Do not warn if the second assignment is at the same source position as the first. From-SVN: r276831
2019-10-10[Ada] Unnesting issues with entry families and accept statementsGary Dismukes3-11/+20
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * sem_util.adb (Enclosing_Subprogram): Handle the case of E_Entry_Family, returning the entry family's associated Protected_Body_Subprogram (as was already done for E_Entry). * exp_ch9.adb (Expand_N_Accept_Statement): Call Reset_Scopes_To on the block created for an accept statement to reset the scopes of any local entities to the block scope. From-SVN: r276830
2019-10-10[Ada] Spurious visibility error on formal package with Abstract_StateEd Schonberg2-4/+43
2019-10-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch12.adb (Analyze_Formal_Package_Declaration): Propagate an aspect specification for Abstract_State from generic package to formal package, so that it is available when analyzing the constructed formal. From-SVN: r276829
2019-10-10[Ada] Fix awkward placement of freeze node for actual subtypeEric Botcazou2-11/+4
2019-10-10 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch6.adb (Set_Actual_Subtypes): Put the freeze node of the actual subtype after its declaration when the type of the formal has a predicate. From-SVN: r276828
2019-10-10[Ada] Get rid of spurious error for _Tag on extension with reverse bit orderEric Botcazou2-25/+44
2019-10-10 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Do not use the Esize of the component to compute its layout, but only the Component_Clause. Do not issue a warning for the _Tag component. Also set the Esize of the component at the end of the layout. (Analyze_Record_Representation_Clause): Remove Hbit local variable. Lay out the Original_Record_Component only if it's distinct from the component. (Check_Record_Representation_Clause): Fix off-by-one bug for the Last_Bit of the artificial clause built for the _Tag component. From-SVN: r276827
2019-10-10[Ada] Debug procedure for printing ancestorsBob Duff3-5/+13
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * treepr.ads, treepr.adb (ppar): New procedure. From-SVN: r276826
2019-10-10[Ada] 'others' in conditional_expressionsBob Duff6-28/+135
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * sem_aggr.adb (Resolve_Aggregate): Add missing cases in the Others_Allowed => True case -- N_Case_Expression_Alternative and N_If_Expression. Use Nkind_In. * atree.adb, atree.ads, sinfo.adb, sinfo.ads (Nkind_In): New 16-parameter version. From-SVN: r276824
2019-10-10[Ada] Missing Predicated_Parent link on array ItypeEd Schonberg2-5/+13
2019-10-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Set properly the Predicated_Parent link of an itype created for an aggregate, so that the predicate_function of the parent can support proofs on the object that it initializes. From-SVN: r276823
2019-10-10[Ada] Plug minor loophole for integer named numberEric Botcazou2-4/+6
2019-10-10 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch3.adb (Analyze_Number_Declaration): Set Debug_Info_Needed in the case where the expression is an integer literal. From-SVN: r276822
2019-10-10[Ada] Do not inline subprograms with deep parameter/result in GNATproveYannick Moy2-3/+116
2019-10-10 Yannick Moy <moy@adacore.com> gcc/ada/ * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add subprograms with deep parameter or result type as not candidates for inlining. From-SVN: r276821
2019-10-10[Ada] Define default value for Process fieldVadim Godunko2-5/+4
2019-10-10 Vadim Godunko <godunko@adacore.com> gcc/ada/ * libgnat/g-exptty.ads (TTY_Process_Descriptor): Set default value for Process. From-SVN: r276820
2019-10-10[Ada] T'Size in pragma Compile_Time_ErrorBob Duff2-4/+12
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * sem_prag.adb (Defer_Compile_Time_Warning_Error_To_BE): In addition to saving the pragma for further processing, copy the pragma into the main unit if necessary. From-SVN: r276819
2019-10-10[Ada] Assertion_Policy (Ignore) ignores invariantsBob Duff5-10/+49
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * einfo.ads, einfo.adb (Invariants_Ignored): New flag on types. This leaves just one unused flag. * sem_prag.adb (Invariant): Set the flag if appropriate. * exp_util.adb (Make_Invariant_Call): Check the flag. From-SVN: r276818
2019-10-10[Ada] Fix handling of -gnatceg on incomplete unitArnaud Charlet2-43/+19
2019-10-10 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * gnat1drv.adb (Gnat1drv): Skip code generation when handling an incomplete unit with -gnatceg. From-SVN: r276817
2019-10-10[Ada] Generation of procedures for blocks occurring in elaboration code for LLVMGary Dismukes2-161/+269
2019-10-10 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * exp_ch7.adb (Check_Unnesting_Elaboration_Code): Various cleanups. (Set_Elab_Proc): New procedure to create the defining identifier for a procedure created to encapsulate top-level blocks occurring as a part of library package elaboration. (First_Local_Scope): Function replaced by Reset_Scopes_To_Elab_Proc. (Reset_Scopes_To_Elab_Proc): New recursive procedure based on First_Local_Scope, which it replaces, that is called to traverse the statements of a library package body to locate top-level blocks and determine whether they contain nested subprograms that might address library-level objects of the package. Such blocks (and loops) and certain top-level subprograms within the statements will have their Scope reset here to match an encapsulating procedure created by Check_Unnesting_Elaboration_Code that will contain the statements. (Check_Unnesting_In_Decls_Or_Stmts): Code for handling blocks factored out into Unnest_Block. Add handling for package declarations and bodies, making recursive calls for visible/private declarations, body declarations, statements, and exception handlers. Also remove test for Is_Compilation_Unit: caller tests for Is_Library_Level_Entity instead. Also, this proc's name was changed from Check_Unnesting_In_Declarations. (Check_Unnesting_In_Handlers): New procedure to traverse a sequence of exception handlers, calling Check_Unnesting_In_Decls_Or_Stmts on the statements of each handler. (Expand_N_Package_Body): Call Check_Unnesting_* routines only when Unnest_Subprogram_Mode is set and the current scope is a library-level entity (which includes packages and instantiations nested directly within a library unit). (Expand_N_Package_Declaration): Call Check_Unnesting_* routines only when Unnest_Subprogram_Mode is set and the current scope is a library-level entity (which includes packages and instantiations nested directly within a library unit). (Unnest_Block): New procedure factored out of Check_Unnesting_In_Decls_Or_Stmts, for creating a new procedure to replace a block statement and resetting the Scope fields of the block's top-level entities. From-SVN: r276816
2019-10-10[Ada] Mention GNAT Studio instead of GPSAnthony Leonardo Gracio17-45/+54
2019-10-10 Anthony Leonardo Gracio <leonardo@adacore.com> gcc/ada/ * doc/gnat_ugn/about_this_guide.rst, doc/gnat_ugn/building_executable_programs_with_gnat.rst, doc/gnat_ugn/getting_started_with_gnat.rst, doc/gnat_ugn/gnat_and_program_execution.rst, errout.ads, exp_ch3.adb, gnatls.adb, impunit.adb, lib-writ.ads, opt.ads, sem_ch7.adb, sem_prag.adb, sem_res.adb, sem_warn.adb, terminals.c: Replace GPS by GNAT Studio. * gnat_ugn.texi: Regenerate. From-SVN: r276815
2019-10-10[Ada] Spurious restriction violation on Ghost codeEd Schonberg2-15/+11
2019-10-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return_Statement): If the function to which the return statement applies is an Ignored_Ghost_Function, do not indicate that it uses the secondary stack when the return type is unconstrained. From-SVN: r276814
2019-10-10[Ada] Replace in Ordered_Maps gets tampering failureBob Duff23-100/+109
2019-10-10 Bob Duff <duff@adacore.com> gcc/ada/ * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb, libgnat/a-cborma.adb, libgnat/a-cborse.adb, libgnat/a-cdlili.adb, libgnat/a-cidlli.adb, libgnat/a-cihama.adb, libgnat/a-cihase.adb, libgnat/a-cimutr.adb, libgnat/a-ciorma.adb, libgnat/a-ciorse.adb, libgnat/a-cobove.adb, libgnat/a-cohama.adb, libgnat/a-cohase.adb, libgnat/a-coinve.adb, libgnat/a-comutr.adb, libgnat/a-conhel.adb, libgnat/a-convec.adb, libgnat/a-coorma.adb, libgnat/a-coorse.adb (Reference, Constant_Reference): Use Busy instead of Lock, so we forbid tampering with cursors, rather than tampering with elements. From-SVN: r276813
2019-10-10[Ada] Spurious visibility error in predicate in generic instanceEd Schonberg2-12/+14
2019-10-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_cat.adb (Set_Categorization_From_Pragma): Do not modify any visibility settings if there are no compilation_unit pragmas following the package declaration. Add comments for future cleanup. From-SVN: r276812
2019-10-10[Ada] Flag Sec_Stack_Used incorrectly set by ghost codePatrick Bernardi3-82/+97
2019-10-10 Patrick Bernardi <bernardi@adacore.com> gcc/ada/ * bindgen.adb (System_Secondary_Stack_Package_In_Closure): Renamed flag System_Secondary_Stack_Used to be clearer of what it represents. (Gen_Adainit): Refactor secondary stack related code to make it clearer. * rtsfind.adb (Load_RTU): Don't set Sec_Stack_Used flag here (RTE): Set Sec_Stack_Used if the System.Secondary_Stack is referenced, but not if we're ignoring ghost code. From-SVN: r276811
2019-10-10[Ada] Use declared type for deciding on SPARK pointer rulesPiotr Trojanek2-5442/+5
2019-10-10 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Global_In_Decl_Part): Simplify previous test, just like in a recent commit we simplified a similar test for Depends contract. From-SVN: r276810
2019-10-04Mark C2x built-in functions as such.Joseph Myers2-0/+5
Various built-in functions that GCC has as extensions are now standard functions in C2x. This patch adds DEF_C2X_BUILTIN and uses it to mark them as such. Some of the so-marked functions were previously DEF_EXT_LIB_BUILTIN, while some DFP ones were DEF_GCC_BUILTIN (i.e. __builtin_* only); both sets become DEF_C2X_BUILTIN. This in turn requires flag_isoc2x to be defined in various front ends using builtins.def. As the semantics of the built-in functions should already be tested, the tests added only verify that they are declared in C2x mode but not in C11 mode. The test of DFP built-in functions being declared for C2x goes in gcc.dg/dfp/, as while such built-in functions currently don't depend on whether DFP is supported, that looks like a bug to me (see bug 91985), so it seems best for the tests not to depend on exactly how that bug might be fixed. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc: * builtins.def (DEF_C2X_BUILTIN): New macro. (exp10, exp10f, exp10l, fabsd32, fabsd64, fabsd128, nand32) (nand64, nand128, roundeven, roundevenf, roundevenl, strdup) (strndup): Use DEF_C2X_BUILTIN. * coretypes.h (enum function_class): Add function_c2x_misc. gcc/ada: * gcc-interface/utils.c (flag_isoc2x): New variable. gcc/brig: * brig-lang.c (flag_isoc2x): New variable. gcc/lto: * lto-lang.c (flag_isoc2x): New variable. gcc/testsuite: * gcc.dg/c11-builtins-1.c, gcc.dg/c2x-builtins-1.c, gcc.dg/dfp/c2x-builtins-dfp-1.c: New tests. From-SVN: r276588
2019-10-01libada: Respect `--enable-version-specific-runtime-libs'Maciej W. Rozycki2-3/+10
Respect the `--enable-version-specific-runtime-libs' configuration option in libada/, so that shared gnatlib libraries will be installed in non-version-specific $(toolexeclibdir) if requested. In a cross-compilation environment this helps setting up a consistent sysroot, which can then be shared between the host and the target system. This lets one have `libgnarl-10.so' and `libgnat-10.so' installed in say /usr/lib and /usr/$(target_alias)/lib for a native and a cross-build respectively, rather than in /usr/lib/gcc/$(target_alias)/10.0.0/adalib. Update the settings of $(toolexecdir) and $(toolexeclibdir), unused till now, to keep the current arrangement in the version-specific case and make the new option to be enabled by default, unlike with the other target libraries, so as to keep existing people's build infrastructure unaffected. Of course if someone does use `--disable-version-specific-runtime-libs' already, then the installation location of shared gnatlib libraries will change, but presumably this is what they do want anyway as the current situation where the option is ignored in libada/ only is an anomaly really rather than one that is expected or desired. gcc/ada/ * gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable. (install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared library installation. libada/ * Makefile.in (toolexecdir, toolexeclibdir): New variables. (LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'. * configure.ac: Add `--enable-version-specific-runtime-libs'. Update version-specific `toolexecdir' and `toolexeclibdir' from ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in. * configure: Regenerate. From-SVN: r276424
2019-10-01libada: Remove racy duplicate gnatlib installationMaciej W. Rozycki2-1/+9
For some reason, presumably historical, the `install-gnatlib' target for the default multilib is invoked twice, once via the `ada.install-common' target in `gcc/ada/gcc-interface/Make-lang.in' invoked from gcc/ and again via the `install-libada' target in libada/. Apart from doing the same twice this is actually harmful in sufficiently parallelized `make' invocation, as the removal of old files performed within the `install-gnatlib' recipe in the former case actually races with the installation of new files done in the latter case, causing the recipe to fail and abort, however non-fatally, having not completed the installation of all the built files needed for the newly-built compiler to work correctly. This can be observed with a native `x86_64-linux-gnu' bootstrap: make[4]: Entering directory '.../gcc/ada' rm -rf .../lib/gcc/x86_64-linux-gnu/10.0.0/adalib rm: cannot remove '.../lib/gcc/x86_64-linux-gnu/10.0.0/adalib': Directory not empty make[4]: *** [gcc-interface/Makefile:512: install-gnatlib] Error 1 make[4]: Leaving directory '.../gcc/ada' make[3]: *** [.../gcc/ada/gcc-interface/Make-lang.in:853: install-gnatlib] Error 2 make[2]: [.../gcc/ada/gcc-interface/Make-lang.in:829: ada.install-common] Error 2 (ignored) which then causes missing files to be reported when an attempt is made to use the newly-installed non-functional compiler to build a `riscv-linux-gnu' cross-compiler: (cd ada/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h ) error: "ada.ali" not found, "ada.ads" must be compiled error: "s-memory.ali" not found, "s-memory.adb" must be compiled gnatmake: *** bind failed. /bin/sh: ./xsinfo: No such file or directory make[2]: *** [.../gcc/ada/Make-generated.in:45: ada/sinfo.h] Error 127 make[2]: Leaving directory '.../gcc' make[1]: *** [Makefile:4369: all-gcc] Error 2 make[1]: Leaving directory '...' make: *** [Makefile:965: all] Error 2 Depending on timing `.../lib/gcc/x86_64-linux-gnu/10.0.0/adainclude' may cause an installation failure instead and the resulting compiler may be non-functional in a different way. Only invoke `install-gnatlib' from within gcc/ then if a legacy build process is being used with libada disabled and gnatlib built manually with `make -C gcc gnatlib'. gcc/ * Makefile.in (gnat_install_lib): New variable. * configure.ac: Substitute it. * configure: Regenerate. gcc/ada/ * gcc-interface/Make-lang.in (ada.install-common): Split into... (gnat-install-tools, gnat-install-lib): ... these. From-SVN: r276422
2019-09-27set DECL_SIZE_UNIT for zero-sized fieldsAlexandre Oliva2-0/+6
Zero-sized fields do not get processed by finish_record_type: they're removed from the field list before and reinserted after, so their DECL_SIZE_UNIT remains unset, causing the translation of assignment statements with use_memset_p, in quite unusual circumstances, to use a NULL_TREE as the memset length. This patch sets DECL_SIZE_UNIT for the zero-sized fields, that don't go through language-independent layout, in language-specific layout. for gcc/ada/ChangeLog * gcc-interface/decl.c (components_to_record): Set DECL_SIZE_UNIT for zero-sized fields. From-SVN: r276173
2019-09-26* osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_AdaArnaud Charlet2-2/+18
From-SVN: r276151
2019-09-23Provide Task_Info.Number_Of_Processors on SolarisRainer Orth4-0/+35
gcc/ada: * libgnarl/s-osinte__solaris.ads (sysconf): Declare. (SC_NPROCESSORS_ONLN): Define. * libgnarl/s-tasinf__solaris.ads (Number_Of_Processors): Declare. * libgnarl/s-tasinf__solaris.adb (N_CPU): New variable. (Number_Of_Processors): New function. gcc/testsuite: * gnat.dg/system_info1.adb: Sort dg-do target list. Add *-*-solaris2.*. From-SVN: r276049
2019-09-23trans.c (Regular_Loop_to_gnu): Do not rotate the loop if -Og is enabled.Eric Botcazou3-5/+20
* gcc-interface/trans.c (Regular_Loop_to_gnu): Do not rotate the loop if -Og is enabled. (build_return_expr): Do not perform NRV if -Og is enabled. (Subprogram_Body_to_gnu): Likewise. (gnat_to_gnu) <N_Simple_Return_Statement>: Likewise. (Handled_Sequence_Of_Statements_to_gnu): Do not inline finalizers if -Og is enabled. * gcc-interface/utils.c (convert_to_index_type): Return early if -Og is enabled. From-SVN: r276047
2019-09-23trans.c (gnat_compile_time_expr_list): New variable.Eric Botcazou2-12/+39
* gcc-interface/trans.c (gnat_compile_time_expr_list): New variable. (Pragma_to_gnu): Rename local variable. Save the (first) expression of pragma Compile_Time_{Error|Warning} for later processing. (Compilation_Unit_to_gnu): Process the expressions saved above. From-SVN: r276045
2019-09-23trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type ↵Eric Botcazou2-25/+29
of the node. * gcc-interface/trans.c (Attribute_to_gnu): Test Can_Use_Internal_Rep on the underlying type of the node. (Call_to_gnu): Likewise with the type of the prefix. From-SVN: r276041
2019-09-23decl.c (components_to_record): Do not reorder fields in packed record types ↵Eric Botcazou2-4/+17
if... * gcc-interface/decl.c (components_to_record): Do not reorder fields in packed record types if they contain fixed-size fields that cannot be laid out in a packed manner. From-SVN: r276036
2019-09-19[Ada] Emit DW_AT_GNU_bias with -fgnat-encodings=gdbTom Tromey2-1/+6
Emit DW_AT_GNU_bias with -fgnat-encodings=gdb. gdb implements this, but not the encoded variant. 2019-09-19 Tom Tromey <tromey@adacore.com> gcc/ada/ * gcc-interface/misc.c (gnat_get_type_bias): Return the bias when -fgnat-encodings=gdb. gcc/testsuite/ * gnat.dg/bias1.adb: New testcase. From-SVN: r275958
2019-09-19[Ada] Accept concatentation arguments to pragma AnnotateSteve Baird4-14/+76
In cases where pragma Annotate accepts a string literal as an argument, we now also accept a concatenation of string literals. 2019-09-19 Steve Baird <baird@adacore.com> gcc/ada/ * sem_prag.adb (Preferred_String_Type): A new function. Given an expression, determines whether the preference rules defined for the third-and-later arguments of pragma Annotate suffice to determine the type of the expression. If so, then the preferred type is returned; if not then Empty is returned. Handles concatenations. (Analyze_Pragma): Replace previous code, which dealt only with string literals, with calls to the new Preferred_String_Type function, which also handles concatenations. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation for pragma Annotate. * gnat_rm.texi: Regenerate. gcc/testsuite/ * gnat.dg/annotation1.adb: New testcase. From-SVN: r275957
2019-09-19[Ada] Get rid of useless temporary for slice in overaligned record typeEric Botcazou2-2/+10
This fixes a recent code quality regression for targets that do not require the strict alignment of memory accesses: the compiler would generate a useless temporary for a slice of an array component in an overaligned record type. Running these commands: gcc -c p.adb -gnatws -gnatD grep loop p.adb.dg On the following sources: procedure P (N : Positive) is type Rec1 is record I : Integer; end record; type Arr is array (Positive range <>) of Rec1; type Rec2 is record A : Arr (1 .. 128); end record; for Rec2'Alignment use 8; procedure Proc (A : Arr) is begin null; end; R : Rec2; begin Proc (R.A (1 .. N)); end; Should execute silently. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_util.adb (Is_Possibly_Unaligned_Slice): Do not return true on pure alignment considerations if the target does not require the strict alignment of memory accesses. From-SVN: r275956
2019-09-19[Ada] Sem_Ch12: add a comment to indicate future workEric Botcazou2-0/+10
2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch12.adb (Check_Private_View): Add a comment to indicate future work. From-SVN: r275955
2019-09-19[Ada] Fix copy operation with private discriminated record typeEric Botcazou2-3/+10
This prevents the object code from reading too many bytes from the source for a copy operation involving a private discriminated record type with default discriminants and generated for the assignment of an aggregate to a variable or the initialization of a constant. The front-end already knows that it needs to convert the operation involving the aggregate into individual assignments if the type of the aggregate has mutable components, but it would not do so if this type is private, which does not change anything for code generation. Running these commands: gnatmake -q p -g -fsanitize=address p On the following sources: with Q; use Q; procedure P is type Rec is record A : T; end record; C : constant Rec := Rec'(A => Default_T); begin null; end; package Q is type T is private; Default_T : constant T; private A : constant := 170; B : constant := 8192; type A_Index is range 1 .. A; type B_Index is range 1 .. B; type A_Array is array (A_Index) of Boolean; type B_Array is array (B_Index) of Boolean; type Data_Type is (A_Type, B_Type); type T (Discriminant : Data_Type := A_Type) is record case Discriminant is when A_Type => Field_A : A_Array; when B_Type => Field_B : B_Array; end case; end record; Default_T : constant T := T'(Discriminant => A_Type, Field_A => (others => True)); end Q; Should execute silently. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_aggr.adb (Has_Mutable_Components): Look at the underlying type of components to find out whether they are mutable. From-SVN: r275954
2019-09-19[Ada] Fix bogus "too late" error with nested generics and inliningEric Botcazou2-0/+68
This prevents the compiler from issuing a bogus error about a constant whose full declaration appears too late, if it is declared in a nested generic package and instantiated in another nested instantiation, when the instantiations are done in a unit withed from the main unit and containing an inlined subprogram, and cross-unit inlining is enabled. It turns out that, under these very peculiar conditions, the compiler ends up instantiating the body of the generic package twice, which leads to various semantic errors, in particular for declarations of constants. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Check that the body has not already been instantiated when the body of the parent was being loaded. gcc/testsuite/ * gnat.dg/inline21.adb, gnat.dg/inline21_g.ads, gnat.dg/inline21_h.adb, gnat.dg/inline21_h.ads, gnat.dg/inline21_q.ads: New testcase. From-SVN: r275953
2019-09-19[Ada] Fix bogus visibility error with nested generics and inliningEric Botcazou2-3/+10
This prevents the compiler from issuing a bogus error about the visibility of an operator in an instantiation of a nested generic package which is itself used as an actual of an instantiation of another generic package, when the instantiations are done in a unit withed from the main unit and containing an inlined subprogram, and cross-unit inlining is enabled. In most cases, the compiler does not check the visibility of operators in an instantiation context because this has already been done when the generic package has been analyzed. However, there are exceptions like the actuals of an instantiation of a generic child unit which is done as a compilation unit and the In_Instance predicate has a special check for these cases. This check would incorrectly trigger here and needs to be tightened. 2019-09-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_util.adb (In_Instance): Test whether the current unit has been analyzed instead of being on the scope stack to detect the case of actuals of an instantiation of a generic child unit done as a compilation unit. gcc/testsuite/ * gnat.dg/inline20.adb, gnat.dg/inline20_g.adb, gnat.dg/inline20_g.ads, gnat.dg/inline20_h.ads, gnat.dg/inline20_i.ads, gnat.dg/inline20_q-io.ads, gnat.dg/inline20_q.ads, gnat.dg/inline20_r.ads: New testcase. From-SVN: r275952
2019-09-19[Ada] New routine GNAT.Sockets.Create_Socket_PairDmitriy Anisimkov10-146/+330
New routine to create 2 connected sockets. This routine is analog of the UNIX system call socketpair. On UNIX platforms it is implemented on the base of socketpair. On other platforms it is implemented by conecting network sockets over loopback interface. 2019-09-19 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * libgnat/g-socket.ads, libgnat/g-socket.adb (Create_Socket_Pair): New routine. * libgnat/g-socthi.ads (OS_Has_Socketpair): Boolean constant. (C_Socketpair): New imported routine. * libgnat/g-socthi__mingw.ads, libgnat/g-socthi__vxworks.ads (Default_Socket_Pair_Family): New constant. (C_Socketpair): New routine. * libgnat/g-socthi__mingw.adb, libgnat/g-socthi__vxworks.adb (C_Socketpair): Is separated in anouther file. * libgnat/g-sthcso.adb (C_Socketpair): Non UNIX implementation. * libgnat/g-stsifd__sockets.adb: Reuse C_Socketpair. From-SVN: r275951
2019-09-19[Ada] Use declared type for deciding on SPARK pointer rulesYannick Moy2-7/+6
A constant of pointer type is considered as mutable in SPARK, according to SPARK RM 3.10, but this should be based on the declared type of the constant instead of its underlying type. There is no impact on compilation hence no test. 2019-09-19 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Depends_In_Decl_Part): Simplify previous test. From-SVN: r275950