aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-10-25toplevel: Error out if using --disable-libstdcxx with bootstrap [PR105474]Andrew Pinski2-0/+18
Bootstrapping and using --disable-libstdcxx will cause a build failure deep in compiling stage2 so instead error out early in the toplevel configure so it is more user friendly. Bootstrapped and tested on x86_64-linux-gnu. Also made sure --disable-libstdcxx without --disable-bootstrap failed. PR bootstrap/105474 ChangeLog: * configure: Regenerate. * configure.ac: Error out if libstdc++ is not enabled with bootstrapping. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-10-25aarch64: Support multiple variants including up to 3Andrew Pinski5-5/+74
On some of the Qualcomm's SoC that includes oryon-1 core, the variant will be different on the cores due to big.little config. Though the difference between big and little is not significant enough to have seperate cost/scheduling models for them and the feature set is the same across all variants. Also on some SoCs, there are 3 variants of the core, big.middle.little so this increases the support there for up to 3 cores and 3 variants in the original parsing loop but it does not change the support for max of 2 different cores. After this patch and the patch that adds oryon-1, -mcpu=native works on the SoCs I am working with. Bootstrapped and tested on aarch64-linux-gnu with no regressions. gcc/ChangeLog: * config/aarch64/driver-aarch64.cc (host_detect_local_cpu): Support 3 cores and 3 variants. If there is one core but multiple variant, then treat the variant as being all. gcc/testsuite/ChangeLog: * gcc.target/aarch64/cpunative/info_25: New file. * gcc.target/aarch64/cpunative/info_26: New file. * gcc.target/aarch64/cpunative/native_cpu_25.c: New test. * gcc.target/aarch64/cpunative/native_cpu_26.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-10-25AArch64: Add more accurate constraint [PR117292]Wilco Dijkstra4-3/+50
As shown in the PR, reload may only check the constraint in some cases and and not check the predicate is still valid for the resulting instruction. To fix the issue, add a new constraint which matches the predicate exactly. gcc/ChangeLog: PR target/117292 * config/aarch64/aarch64-simd.md (xor<mode>3<vczle><vczbe>): Use 'De' constraint. * config/aarch64/constraints.md (De): Add new constraint. gcc/testsuite/ChangeLog: PR target/117292 * gcc.target/aarch64/sve/single_5.c: Remove xfails. * gcc.target/aarch64/pr117292.c: New test.
2024-10-25Fortran: Fix ICE with structure constructor in data statement [PR79685]Paul Thomas4-8/+46
2024-10-25 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/79685 * decl.cc (match_data_constant): Find the symtree instead of the symbol so the use renamed symbols are found. Pass this and the derived type to gfc_match_structure_constructor. * match.h: Update prototype of gfc_match_structure_contructor. * primary.cc (gfc_match_structure_constructor): Remove call to gfc_get_ha_sym_tree and use caller supplied symtree instead. gcc/testsuite/ PR fortran/79685 * gfortran.dg/use_rename_13.f90: New test.
2024-10-25testsuite: add testcase for fixed PR115933Sam James1-0/+19
gcc/testsuite/ChangeLog: PR rtl-optimization/115933 * gcc.dg/pr115933.c: New test.
2024-10-25aarch64: Add mfloat vreinterpret intrinsicsAndrew Carlotti2-1/+57
gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (MODE_d_mf8): New. (MODE_q_mf8): New. (QUAL_mf8): New. (VREINTERPRET_BUILTINS1): Add mf8 entry. (VREINTERPRET_BUILTINS): Ditto. (VREINTERPRETQ_BUILTINS1): Ditto. (VREINTERPRETQ_BUILTINS): Ditto. (aarch64_lookup_simd_type_in_table): Match modal_float bit gcc/testsuite/ChangeLog: * gcc.target/aarch64/advsimd-intrinsics/mf8-reinterpret.c: New test.
2024-10-25aarch64: Add support for mfloat8x{8|16}_t typesAndrew Carlotti12-0/+23
gcc/ChangeLog: * config/aarch64/aarch64-builtins.cc (aarch64_init_simd_builtin_types): Initialise FP8 simd types. * config/aarch64/aarch64-builtins.h (enum aarch64_type_qualifiers): Add qualifier_modal_float bit. * config/aarch64/aarch64-simd-builtin-types.def: Add Mfloat8x{8|16}_t types. * config/aarch64/arm_neon.h: Add mfloat8x{8|16}_t typedefs. gcc/testsuite/ChangeLog: * gcc.target/aarch64/movv16qi_2.c: Test mfloat as well. * gcc.target/aarch64/movv16qi_3.c: Ditto. * gcc.target/aarch64/movv2x16qi_1.c: Ditto. * gcc.target/aarch64/movv3x16qi_1.c: Ditto. * gcc.target/aarch64/movv4x16qi_1.c: Ditto. * gcc.target/aarch64/movv8qi_2.c: Ditto. * gcc.target/aarch64/movv8qi_3.c: Ditto. * gcc.target/aarch64/mfloat-init-1.c: New test.
2024-10-25match.pd: Add std::pow folding optimizations.Jennifer Schmitz2-0/+70
This patch adds the following two simplifications in match.pd for POW_ALL and POWI: - pow (1.0/x, y) to pow (x, -y), avoiding the division - pow (0.0, x) to 0.0, avoiding the call to pow. The patterns are guarded by flag_unsafe_math_optimizations, !flag_trapping_math, and !HONOR_INFINITIES. The POW_ALL patterns are also gated under !flag_errno_math. The second pattern is also guarded by !HONOR_NANS and !HONOR_SIGNED_ZEROS. Tests were added to confirm the application of the transform for builtins pow, powf, powl, powi, powif, powil, and powf16. The patch was bootstrapped and regtested on aarch64-linux-gnu and x86_64-linux-gnu, no regression. OK for mainline? Signed-off-by: Jennifer Schmitz <jschmitz@nvidia.com> gcc/ * match.pd: Fold pow (1.0/x, y) -> pow (x, -y) and pow (0.0, x) -> 0.0. gcc/testsuite/ * gcc.dg/tree-ssa/pow_fold_1.c: New test.
2024-10-25Match: Simplify branch form 3 of unsigned SAT_ADD into branchlessPan Li5-4/+67
There are sorts of forms for the unsigned SAT_ADD. Some of them are complicated while others are cheap. This patch would like to simplify the complicated form into the cheap ones. For example as below: From the form 3 (branch): SAT_U_ADD = (X + Y) >= x ? (X + Y) : -1. To (branchless): SAT_U_ADD = (X + Y) | - ((X + Y) < X). #define T uint8_t T sat_add_u_1 (T x, T y) { return (T)(x + y) >= x ? (x + y) : -1; } Before this patch: 1 │ uint8_t sat_add_u_1 (uint8_t x, uint8_t y) 2 │ { 3 │ uint8_t D.2809; 4 │ 5 │ _1 = x + y; 6 │ if (x <= _1) goto <D.2810>; else goto <D.2811>; 7 │ <D.2810>: 8 │ D.2809 = x + y; 9 │ goto <D.2812>; 10 │ <D.2811>: 11 │ D.2809 = 255; 12 │ <D.2812>: 13 │ return D.2809; 14 │ } After this patch: 1 │ uint8_t sat_add_u_1 (uint8_t x, uint8_t y) 2 │ { 3 │ uint8_t D.2809; 4 │ 5 │ _1 = x + y; 6 │ _2 = x + y; 7 │ _3 = x > _2; 8 │ _4 = (unsigned char) _3; 9 │ _5 = -_4; 10 │ D.2809 = _1 | _5; 11 │ return D.2809; 12 │ } The simplify doesn't need to check if target support the SAT_ADD, it is somehow the optimization in gimple level. The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * match.pd: Remove unsigned branch form 3 for SAT_ADD, and add simplify to branchless instead. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/sat_u_add-simplify-1-u16.c: New test. * gcc.dg/tree-ssa/sat_u_add-simplify-1-u32.c: New test. * gcc.dg/tree-ssa/sat_u_add-simplify-1-u64.c: New test. * gcc.dg/tree-ssa/sat_u_add-simplify-1-u8.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
2024-10-25Assorted --disable-checking fixes [PR117249]Jakub Jelinek11-14/+26
We have currently 3 different definitions of gcc_assert macro, one used most of the time (unless --disable-checking) which evaluates the condition at runtime and also checks it at runtime, then one for --disable-checking GCC 4.5+ which looks like ((void)(UNLIKELY (!(EXPR)) ? __builtin_unreachable (), 0 : 0)) and a fallback one ((void)(0 && (EXPR))) Now, the last one actually doesn't evaluate any of the side-effects in the argument, just quiets up unused var/parameter warnings. I've tried to replace the middle definition with ({ [[assume (EXPR)]]; (void) 0; }) for compilers which support assume attribute and statement expressions (surprisingly quite a few spots use gcc_assert inside of comma expressions), but ran into PR117287, so for now such a change isn't being proposed. The following patch attempts to move important side-effects from gcc_assert arguments. Bootstrapped/regtested on x86_64-linux and i686-linux with normal --enable-checking=yes,rtl,extra, plus additionally I've attempted to do x86_64-linux bootstrap with --disable-checking and gcc_assert changed to the ((void)(0 && (EXPR))) version when --disable-checking. That version ran into spurious middle-end warnings ../../gcc/../include/libiberty.h:733:36: error: argument to ‘alloca’ is too large [-Werror=alloca-larger-than=] ../../gcc/tree-ssa-reassoc.cc:5659:20: note: in expansion of macro ‘XALLOCAVEC’ int op_num = ops.length (); int op_normal_num = op_num; gcc_assert (op_num > 0); int stmt_num = op_num - 1; gimple **stmts = XALLOCAVEC (gimple *, stmt_num); where we have gcc_assert exactly to work-around middle-end warnings. Guess I'd need to also disable -Werror for this experiment, which actually isn't a problem with unmodified system.h, because even for --disable-checking we use the __builtin_unreachable at least in stage2/stage3 and so the warnings aren't emitted, and even if it used [[assume ()]]; it would work too because in stage2/stage3 we could again rely on assume and statement expression support. 2024-10-25 Jakub Jelinek <jakub@redhat.com> PR middle-end/117249 * tree-ssa-structalias.cc (insert_vi_for_tree): Move put calls out of gcc_assert. * lto-cgraph.cc (lto_symtab_encoder_delete_node): Likewise. * gimple-ssa-strength-reduction.cc (get_alternative_base, add_cand_for_stmt): Likewise. * tree-eh.cc (add_stmt_to_eh_lp_fn): Likewise. * except.cc (duplicate_eh_regions_1): Likewise. * tree-ssa-reassoc.cc (insert_operand_rank): Likewise. * config/nvptx/nvptx.cc (nvptx_expand_call): Use == rather than = in gcc_assert. * opts-common.cc (jobserver_info::disconnect): Call close outside of gcc_assert and only check result in it. (jobserver_info::return_token): Call write outside of gcc_assert and only check result in it. * genautomata.cc (output_default_latencies): Move j++ side-effect outside of gcc_assert. * tree-ssa-loop-ivopts.cc (get_alias_ptr_type_for_ptr_address): Use == rather than = in gcc_assert. * cgraph.cc (symbol_table::create_edge): Move ++edges_max_uid side-effect outside of gcc_assert.
2024-10-25lto: Handle RAW_DATA_CST in compare_tree_sccs_1 [PR117201]Jakub Jelinek3-0/+108
I've missed I need to add RAW_DATA_CST support in compare_tree_sccs_1, because without that it considers all RAW_DATA_CSTs to be equivalent, regardless of their length or content. 2024-10-24 Jakub Jelinek <jakub@redhat.com> PR lto/117201 PR lto/117288 * lto-common.cc (compare_tree_sccs_1): Handle RAW_DATA_CST. * gcc.dg/lto/pr117201_0.c: New test. * gcc.dg/lto/pr117288_0.c: New test.
2024-10-25Default expand_vec_cond_expr_p code to ERROR_MARKRichard Biener5-18/+13
As we want to transition to only vcond_mask expanders the following makes it possible to easier distinguish queries that rely on vcond queries for expand_vec_cond_expr_p from those of vcond_mask by for the latter having the comparison code defaulted to ERROR_MARK. * optabs-tree.h (expand_vec_cond_expr_p): Default the comparison code to ERROR_MARK. * match.pd: Remove unneded expand_vec_cond_expr_p args. * tree-vect-generic.cc (expand_vector_condition): Likewise. * tree-vect-loop.cc (vect_reduction_update_partial_vector_usage): Likewise. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Likewise. (scan_store_can_perm_p): Likewise. (vectorizable_condition): Likewise.
2024-10-25testsuite: Generalise tree-ssa/shifts-3.c regexpRichard Sandiford1-1/+1
My recent gcc.dg/tree-ssa/shifts-3.c test failed on arm-linux-gnu because it used widen_mult_expr to do a multiplication on chars. This patch generalises the regexp in the same way as for f3. gcc/testsuite/ * gcc.dg/tree-ssa/shifts-3.c: Accept widen_mult for f2 too.
2024-10-25Add regression testEric Botcazou1-0/+25
gcc/testsuite PR ada/116551 * gnat.dg/specs/vfa3.ads: New test.
2024-10-25libstdc++: Disable parts of new test that depend on constexpr std::stringJonathan Wakely1-0/+2
The compile-time assertions don't work with -D_GLIBCXX_USE_CXX11_ABI=0. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/operators/char/op_plus_string_view.cc: Check __cpp_lib_constexpr_string.
2024-10-25libstdc++: implement concatenation of strings and string_viewsGiuseppe D'Angelo6-1/+304
This adds support for P2591R5, merged for C++26. libstdc++-v3/ChangeLog: * include/bits/basic_string.h: Implement the four operator+ overloads between basic_string and (types convertible to) basic_string_view. * include/bits/version.def: Bump the feature-testing macro. * include/bits/version.h: Regenerate. * testsuite/21_strings/basic_string/operators/char/op_plus_fspath_neg.cc: New test. * testsuite/21_strings/basic_string/operators/char/op_plus_string_view.cc: New test. * testsuite/21_strings/basic_string/operators/char/op_plus_string_view_compat.cc: New test. Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-10-25Restrict :c to commutative ops as intendedRichard Biener2-26/+16
genmatch was supposed to restrict :c to verifiable commutative operations while leaving :C to the "I know what I'm doing" case. The following enforces this, cleaning up parsing and amending the commutative_op helper. There's one pattern that needs adjustment, the pattern optimizing fmax (x, NaN) or fmax (NaN, x) to x since fmax isn't commutative. * genmatch.cc (commutative_op): Add paramter to indicate whether all compares should be considered commutative. Handle hypot, add_overflow and mul_overflow. (parser::parse_expr): Simplify 'c' handling by using commutative_op and error out when the operation is not. * match.pd ((minmax:c @0 NaN@1) -> @0): Use :C, we know what we are doing.
2024-10-25tree-optimization/117277 - remove CLOBBERs before SLP code generationRichard Biener1-51/+59
We have to remove CLOBBERs before SLP is code generated since for store-lanes we are inserting our own CLOBBERs that we want to survive. So the following refactors vect_transform_loop to remove unwanted stmts first. This resolves the gcc.target/aarch64/sve/store_lane_spill_1.c FAIL. PR tree-optimization/117277 * tree-vect-loop.cc (vect_transform_loop): Remove CLOBBERs and prefetches before doing any code generation.
2024-10-25tree-optimization/116575 - SLP masked load-lanes discoveryRichard Biener1-3/+138
The following implements masked load-lane discovery for SLP. The challenge here is that a masked load has a full-width mask with group-size number of elements when this becomes a masked load-lanes instruction one mask element gates all group members. We already have some discovery hints in place, namely STMT_VINFO_SLP_VECT_ONLY to guard non-uniform masks, but we need to choose a way for SLP discovery to handle possible masked load-lanes SLP trees. I have this time chosen to handle load-lanes discovery where we have performed permute optimization already and conveniently got the graph with predecessor edges built. This is because unlike non-masked loads masked loads with a load_permutation are never produced by SLP discovery (because load permutation handling doesn't handle un-permuting the mask) and thus the load-permutation lowering which handles non-masked load-lanes discovery doesn't trigger. With this SLP discovery for a possible masked load-lanes, thus a masked load with uniform mask, produces a splat of a single-lane sub-graph as the mask SLP operand. This is a representation that shouldn't pessimize the mask load case and allows the masked load-lanes transform to simply elide this splat. This fixes the aarch64-sve.exp mask_struct_load*.c testcases with --param vect-force-slp=1 PR tree-optimization/116575 * tree-vect-slp.cc (vect_get_and_check_slp_defs): Handle gaps, aka NULL scalar stmt. (vect_build_slp_tree_2): Allow gaps in the middle of a grouped mask load. When the mask of a grouped mask load is uniform do single-lane discovery for the mask and insert a splat VEC_PERM_EXPR node. (vect_optimize_slp_pass::decide_masked_load_lanes): New function. (vect_optimize_slp_pass::run): Call it.
2024-10-25Relax vect_check_scalar_mask checkRichard Biener1-1/+2
When the mask is not a constant or external def there's no need to check the scalar type, in particular with SLP and the mask being a VEC_PERM_EXPR there isn't a scalar operand ready to check (not one vect_is_simple_use will get you). We later check the vector type and reject non-mask types there. * tree-vect-stmts.cc (vect_check_scalar_mask): Only check the scalar type for constant or extern defs.
2024-10-25ada: Change scope of XUB typeTom Tromey1-1/+1
An earlier patch in the "nameless" series caused a regression with -fgnat-encodings=all. Previously, all artificial types were emitted in the CU scope in the DWARF, but with the patch, an "XUB" type is emitted in the function scope. This causes gdb lookups to erroneously find the XUB type rather than the type that gdb expects to find. Note that I don't know why the earlier code worked, because decl.cc clearly sets the XUB type's context to be the current function. This patch changes the type's context so that it is nested in a type that is conveniently available. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Use gnu_fat_type as the type context for a XUB type.
2024-10-25ada: Set DECL_NAMELESS in create_type_declTom Tromey3-7/+15
When using minimal encodings, most artificial types do not need to have their names emitted in the DWARF. This patch changes the compiler to generally omit these names. However, a subset of names are needed: when the compiler creates an artificial type for certain kinds of arrays, the name is needed by gdb. So, a new parameter is added to create_type_decl to allow this omission to be disabled. Note that simply passing 'false' as the artificial_p argument to create_type_decl doesn't work properly -- other parts of the compiler seem to rely on this flag being set, and so making this change causes ICEs. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Update some calls to create_type_decl. * gcc-interface/gigi.h (create_type_decl): Add can_be_nameless parameter. * gcc-interface/utils.cc (create_type_decl): Add can_be_nameless parameter. Set DECL_NAMELESS on type decl.
2024-10-25ada: Mark some type decls as namelessTom Tromey1-0/+3
The types created by record_builtin_type and create_type_stub_decl can be marked as nameless when using minimal encodings. In this situation, gdb does not need these type names. gcc/ada/ChangeLog: * gcc-interface/utils.cc (record_builtin_type, create_type_stub_decl): Set DECL_NAMELESS on type decls.
2024-10-25ada: Mark XUA types as artificialTom Tromey1-1/+1
gdb does not need the name of XUA types. This patch changes the compiler to unconditionally mark these as artificial; a subsequent patch will arrange for the name to be omitted. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Pass 'true' to create_type_decl when creating XUA type.
2024-10-25ada: Mark XUB types as namelessTom Tromey1-0/+2
gdb does not need the name of XUB types. This patch changes the compiler to omit these names from the DWARF when minimal encodings are in use. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Set TYPE_NAMELESS on XUB types.
2024-10-25ada: Add 'artificial_p' parameter to build_unc_object_typeTom Tromey3-9/+15
This adds an 'artificial_p' parameter to build_unc_object_type, so that the artificiality of the type can be propagated to create_type_decl. This will affect the namelessness of the type in a subsequent patch. gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Pass artificial_p to build_unc_object_type. * gcc-interface/gigi.h (build_unc_object_type): Update. * gcc-interface/utils.cc (build_unc_object_type) Add artificial_p parameter. (build_unc_object_type_from_ptr): Update.
2024-10-25ada: Standard types are not artificialTom Tromey1-2/+14
This changes gigi so that standard types are no longer marked artificial. This change is needed to prevent subsequent patches from causing standard types to have their names elided. Also, although DWARF says that DW_AT_artificial is used for "the declaration of an object or type artificially generated by a compiler and not explicitly declared by the source program", it seems to me that types provided by the language should not be marked as such; and this is what the C and C++ compilers do. gcc/ada/ChangeLog: * gcc-interface/decl.cc (is_artificial): New function. (gnat_to_gnu_entity): Use it.
2024-10-25ada: Fix fallout of change in parameter passing out of aliasing considerationsEric Botcazou1-2/+5
If an actual parameter that is a type conversion is passed by reference but not addressable, the temporary that is created and whose address is passed instead may need to be in the target type of the conversion to fulfill the requirements of strict aliasing. gcc/ada/ChangeLog: * gcc-interface/trans.cc (Call_to_gnu): If the formal is passed by reference and the actual is a type conversion but not addressable, create the temporary in the target type of the conversion if this is needed to enforce strict aliasing.
2024-10-25ada: Fix internal error on bit-packed array type with Volatile_Full_AccessEric Botcazou1-0/+6
The problem occurs when the component type is a record type with default values for the initialization procedure of the (base) array type, because the compiler is trying to generate a full access for a parameter of the base array type, which does not make sense. gcc/ada/ChangeLog: PR ada/116551 * gcc-interface/trans.cc (node_is_atomic) <N_Identifier>: Return false if the type of the entity is an unconstrained array type. (node_is_volatile_full_access) <N_Identifier>: Likewise.
2024-10-25ada: Back out part of previous change -- disable warningBob Duff1-1/+2
Temporarily disable the warning, because it breaks SPARK continuous builder gcc/ada/ChangeLog: * sem_ch10.adb (Analyze_With_Clause): Temporarily disable warning.
2024-10-25ada: Disable self-referential with_clausesBob Duff19-132/+152
Self-referential with_clauses (as in package body X says "with X;") cause trouble, such as duplicate nested instantiations when using container packages. This patch disables most of the processing by setting the Is_Implicit_With flag. It's not really implicit, but the subsequent processing behaves as if it is, and coming up with a more accurate (and much longer) name for the flag doesn't seem beneficial for such an obscure case. Note that the spec of X will be processed later, rather than upon seeing "with X;". Other cleanups, such as renaming Implicit_With to be Is_Implicit_With. gcc/ada/ChangeLog: * sem_ch10.adb: (Analyze_With_Clause): Check for self-referential with clause. Give a warning, and set Is_Implicit_With, which we are reusing in this obscure case even though it's not really implicit. (Analyze_Context): Remove check for self-referential with clause. It wasn't correct -- it only triggered for Acts_As_Spec subprograms. Corrected check is now in Analyze_With_Clause. (Implicit_With): Rename to be Is_Implicit_With. Misc cleanup, comment fixes. (Process_Spec_Clauses): Remove default for Exit_On_Self parameter. Use "exit when" instead of if statement. * sinfo.ads (Implicit_With): Rename to be Is_Implicit_With. Document new use for self-referential withs. * ali.adb (Scan_ALI): Use an aggregate to initialize Withs entry. * exp_put_image.adb (Preload_Root_Buffer_Type): Make this a once-only procedure. * sem_util.ads (Is_Ancestor_Package): Fix comment -- a libraryunit is an ancestor of itself, but this doesn't return True in that case. * sem_util.adb (Is_Ancestor_Package): Better to initialize things on their declaration. * lib-load.adb: Minor comment fix. * sem_prag.adb: Implicit_With --> Is_Implicit_With. Minor comment fix. * gen_il-fields.ads: Implicit_With --> Is_Implicit_With. * gen_il-gen-gen_nodes.adb: Likewise * lib.adb: Likewise * lib-writ.adb: Likewise * rtsfind.adb: Likewise * sem_cat.adb: Likewise * sem_ch12.adb: Likewise * sem_ch8.adb: Likewise * sem_elab.adb: Likewise * sem_warn.adb: Likewise * gcc-interface/trans.cc: (Implicit_With): Rename to be Is_Implicit_With.
2024-10-25ada: Emit DWARF for Ada 'with' and 'use' clausesTom Tromey1-5/+136
This changes the Ada compiler to emit DWARF information for Ada 'with' and 'use' clauses. In particular, code like: with Pck; use Pck; will be emitted as: <1><146a>: Abbrev Number: 23 (DW_TAG_module) <146b> DW_AT_name : pck <146f> DW_AT_decl_file : 1 <1470> DW_AT_decl_line : 16 <1471> DW_AT_decl_column : 6 <1><1472>: Abbrev Number: 24 (DW_TAG_imported_module) <1473> DW_AT_decl_file : 1 <1474> DW_AT_decl_line : 16 <1475> DW_AT_decl_column : 11 <1476> DW_AT_import : <0x146a> That is, DW_TAG_module is used to represent a 'with' clause, and DW_TAG_imported_module is used to represent 'use'. gcc/ada/ChangeLog: * gcc-interface/trans.cc (namespace_map): New global. (Compilation_Unit_to_gnu): Also handle N_With_Clause and N_Use_Package_Clause. (get_or_create_namespace, get_namespace): New functions. (gnat_to_gnu) <N_Package_Renaming_Declaration>: Call get_namespace. <N_Use_Package_Clause, N_With_Clause>: Likewise.
2024-10-25ada: Small adjustments to commentary after latest changeEric Botcazou1-6/+5
This removes the enumeration of the various cases in the comment associated with the declaration of In_Expanded_Body to prevent synchronization issues. gcc/ada/ChangeLog: * freeze.adb (Freeze_Expression.In_Expanded_Body): Tweak comments.
2024-10-25ada: Pragma Pre_Class and Post_Class have no effect at runtimeJavier Miranda4-86/+240
The pragmas Pre_Class and Post_Class are accepted by the compiler but have no effect at runtime. gcc/ada/ChangeLog: * freeze.adb (Freeze_Entity): If the entity is an access-to-subprogram type declaration that pre/postcondition contracts, build the wrapper (if not previously done as part of processing aspects). * sem_ch3.adb (Build_Access_Subprogram_Wrapper): Add missing support for building the wrapper when the access type has pragmas Pre_Class/Post_Class. (Build_Access_Subprogram_Wrapper_Declaration): New subprogram. * sem_ch3.ads (Build_Access_Subprogram_Wrapper): Spec moved to the public part of the package. * sem_prag.adb (Analyze_Pre_Post_Condition): Store in the tree copy of class-wide pre/postcondition expression; required to merge it with inherited conditions. (Is_Valid_Assertion_Kind): Added Pre_Class and Post_Class.
2024-10-25ada: Update GNAT UGRichard Kenner10-4714/+4787
Also add some LLVM-specific information. gcc/ada/ChangeLog: * doc/gnat_ugn/about_this_guide.rst: Numerous changes to language and style and add some LLVM-specific information. * doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Likewise. * doc/gnat_ugn/example_of_binder_output.rst: Likewise. * doc/gnat_ugn/getting_started_with_gnat.rst: Likewise. * doc/gnat_ugn/gnat_and_program_execution.rst: Likewise. * doc/gnat_ugn/gnat_utility_programs.rst: Likewise. * doc/gnat_ugn/inline_assembler.rst: Likewise. * doc/gnat_ugn/platform_specific_information.rst: Likewise. * doc/gnat_ugn/the_gnat_compilation_model.rst: Likewise. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Fix ATC with timed delay from Ada.Real_TimeEric Botcazou1-0/+4
An Asynchronous Transfer of Control blocks with a timed delay that is computed by means of the Ada.Real_Time unit (instead of the default Ada.Calendar unit) because of a missing abort deferral in the unit. gcc/ada/ChangeLog: PR ada/43485 * libgnarl/a-retide.adb: Add with clause for System.Soft_Links. (Delay_Until): Defer and undefer abort around the call to the Timed_Delay routine of System.Task_Primitives.Operations.
2024-10-25ada: Fix internal error on function call in class-wide preconditionEric Botcazou1-0/+8
This occurs when the call is to a function that is declared in a package that is nested in the scope where the type declaration is located. gcc/ada/ChangeLog: * freeze.adb (Freeze_Expression.In_Expanded_Body): Also return True for the body of a helper/wrapper built for class-wide preconditions.
2024-10-25ada: Pragmas Pre_Class/Post_Class rejected for abstract subprogramsJavier Miranda1-9/+9
The Pre_Class/Post_Class pragmas are rejected at compile time for abstract subprograms. gcc/ada/ChangeLog: * sem_prag.adb (Analyze_Pre_Post_Condition): Allow the use of pragma Pre_Class/Post_Class with abstract subprograms.
2024-10-25ada: Spurious error when compiling in Syntax and Semantics Only modeJavier Miranda1-0/+17
Compiling under switch -gnatc, the frontend reports spurious errors accessing components of class-wide tagged types. gcc/ada/ChangeLog: * sem_ch3.adb (Record_Type_Definition): For tagged types, add the missing decoration to the First_Entity in the corresponding class-wide type entity.
2024-10-25ada: Adjust documentation of External_InitializationRonan Desplanques3-15/+3
The parameters Maximum_Size and If_Empty were mentioned during the request for comments phase but are not implemented, at least for now. This patch changes the GNAT reference manual accordingly. It also makes a minor punctuation change. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Adjust documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Update Compiler_Error documentationRichard Kenner1-1/+1
Since we usually build without assertions, we force a bugbox by raising Program_Error, not an always-false assertion. gcc/ada/ChangeLog: * comperr.ads (Compiler_Error): Update documentation.
2024-10-25ada: Add Type_Size_For function to Uintp packageEric Botcazou3-5/+20
It computes the size of an integer type that can accommodate the input. gcc/ada/ChangeLog: * uintp.ads (Type_Size_For): New function declaration. * uintp.adb (Type_Size_For): New function body. * exp_imgv.adb (Rewrite_Object_Image): Call Type_Size_For to get the size of a narrower integer type.
2024-10-25ada: Update simpler accessibility model docTonu Naks3-300/+271
gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: update simpler accessibility model * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Misc improvements to gnat RMBob Duff3-73/+101
...in the "GNAT language extensions" section. gcc/ada/ChangeLog: * doc/gnat_rm/gnat_language_extensions.rst: Minor wording improvments. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-10-25ada: Increase stack size for Windows tasking programssquirek1-5/+5
This patch increases the default tasking stack size for Windows tasking program to 8 mb to avoid use of pragma Linker_Options in the general case. gcc/ada/ChangeLog: * libgnarl/s-taprop__mingw.adb: Modify stack size and update documentation.
2024-10-25ada: Constraint error not raised in ACATS test c413007Javier Miranda6-41/+79
The Constraint_Error exception is not raised when a subprogram is called using prefix notation, and the prefix of the call is an access-to-subprogram type with a null value. This new check is enabled by switch -gnatd_P gcc/ada/ChangeLog: * gen_il-fields.ads: New node field (Is_Expanded_Prefixed_Call). * gen_il-gen-gen_nodes.adb: New semantic field for N_Function_Call and N_Procedure_Call_Statement nodes. * sem_ch4.adb (Complete_Object_Operation): Mark the rewritten node with the Is_Expanded_Prefixed_Call flag. * sem_res.adb (Check_Prefixed_Call): Code cleanup and addition of documentation. (Resolve_Actuals): Add a null-exclusion check on the prefix of the call when it is an access-type. * sinfo.ads: Adding new semantic flag (Is_Expanded_Prefixed_Call) to N_Function_Call and N_Procedure_Call_Statement nodes. * debug.adb: Adding documentation for switch d_P.
2024-10-25ada: Put Finalizable aspect in -gnatXRaphaël AMIARD2-3/+4
gcc/ada/ChangeLog: * sem_ch13.adb (Analyze_One_Aspect): change the call to `Error_Msg_GNAT_Extension` to allow this aspect in core extensions. Put the code path in core extensions. * exp_util.adb (Name_Of_Controlled_Prim_Op): Put the code path in core extensions
2024-10-25ada: Fix internal error on ambiguous operands of comparison operatorEric Botcazou3-20/+58
This is a regression introduced when the diagnosis of ambiguous operands for comparison and equality operators was moved from the analysis to the resolution phase in order to avoid spurious ambiguities in specific cases. When an ambiguity is detected for the operands of predefined comparison and equality operators during analysis, it needs to be recorded so that later calls to the disambiguation routine know about this ambiguity for the case where the context has been resolved to boolean. gcc/ada/ChangeLog: * sem_type.ads (Interp ): Add Opnd_Typ component and remove default value for Abstract_Op component. (Add_One_Interp): Rename Opnd_Type parameter to Opnd_Typ. * sem_type.adb (Add_One_Interp): Likewise. (Add_One_Interp.Add_Entry): Record the operand type as well. (Collect_Interp): Record Empty for the operand type. (Disambiguate.Is_Ambiguous_Boolean_Operator): New predicate. (Disambiguate): Use it to detect recorded ambiguity cases. * sem_ch4.adb (Find_Comparison_Equality_Types): Add commentary.
2024-10-25ada: Spurious error compiling CC51011Javier Miranda1-0/+5
Adjust the check of 13.14(10.2/3) to avoid reporting an error on unfrozen incomplete types, as they are never frozen (AI12-0155-1). gcc/ada/ChangeLog: * sem_ch8.adb (Freeze_Actual_Profile): Do not report error on incomplete types, since they do not cause freezing.
2024-10-25ada: Fix wrong handling of wide wide characters in Append_Decoded_With_BracketsEric Botcazou1-1/+5
This only shows up at link time when the name of a compilation unit contains a wide wide character. gcc/ada/ChangeLog: * namet.adb (Append_Decoded_With_Brackets): Fix condition for the cheap test at the beginning of the loop.