aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2023-05-17Fortran/OpenMP: Fix mapping of array descriptors and deferred-length stringsTobias Burnus8-139/+326
Previously, array descriptors might have been mapped as 'alloc' instead of 'to' for 'alloc', not updating the array bounds. The 'alloc' could also appear for 'data exit', failing with a libgomp assert. In some cases, either array descriptors or deferred-length string's length variable was not mapped. And, finally, some offset calculations with array-sections mappings went wrong. Additionally, the patch now unmaps for scalar allocatables/pointers the GOMP_MAP_POINTER, avoiding stale mappings. The testcases contain some comment-out tests which require follow-up work and for which PR exist. Those mostly relate to deferred-length strings which have several issues beyong OpenMP support. gcc/fortran/ChangeLog: * trans-decl.cc (gfc_get_symbol_decl): Add attributes such as 'declare target' also to hidden artificial variable for deferred-length character variables. * trans-openmp.cc (gfc_trans_omp_array_section, gfc_trans_omp_clauses, gfc_trans_omp_target_exit_data): Improve mapping of array descriptors and deferred-length string variables. gcc/ChangeLog: * gimplify.cc (gimplify_scan_omp_clauses): Remove Fortran special case. libgomp/ChangeLog: * testsuite/libgomp.fortran/target-enter-data-3.f90: Uncomment 'target exit data'. * testsuite/libgomp.fortran/target-enter-data-4.f90: New test. * testsuite/libgomp.fortran/target-enter-data-5.f90: New test. * testsuite/libgomp.fortran/target-enter-data-6.f90: New test. * testsuite/libgomp.fortran/target-enter-data-7.f90: New test. gcc/testsuite/ * gfortran.dg/goacc/finalize-1.f: Update dg-tree; shows a fix for 'finalize' as a ptr is now 'delete' instead of 'release'. * gfortran.dg/gomp/pr78260-2.f90: Likewise as elem-size calc moved to if (allocated) block * gfortran.dg/gomp/target-exit-data.f90: Likewise as a var is now a replaced by a MEM< _25 > expression. * gfortran.dg/gomp/map-9.f90: Update dg-scan-tree-dump. * gfortran.dg/gomp/map-10.f90: New test.
2023-05-17s390: Implement TARGET_ATOMIC_ALIGN_FOR_MODEStefan Schulze Frielinghaus4-0/+74
So far atomic objects are aligned according to their default alignment. For 128 bit scalar types like int128 or long double this results in an 8 byte alignment which is wrong and must be 16 byte. libstdc++ already computes a correct alignment, though, still adding a test case in order to make sure that both implementations are compatible. gcc/ChangeLog: * config/s390/s390.cc (TARGET_ATOMIC_ALIGN_FOR_MODE): New. (s390_atomic_align_for_mode): New. gcc/testsuite/ChangeLog: * g++.target/s390/atomic-align-1.C: New test. * gcc.target/s390/atomic-align-1.c: New test. * gcc.target/s390/atomic-align-2.c: New test.
2023-05-17wide-int: Fix up function commentJakub Jelinek1-1/+1
When looking into _BitInt support, I've noticed unterminated parens in a function comment. Fixing thusly. 2023-05-17 Jakub Jelinek <jakub@redhat.com> * wide-int.cc (wi::from_array): Add missing closing paren in function comment.
2023-05-17c++: Don't try to initialize zero width bitfields in zero initialization ↵Jakub Jelinek2-6/+26
[PR109868] My GCC 12 change to avoid removing zero-sized bitfields as they are important for ABI and are needed for layout compatibility traits apparently causes zero sized bitfields to be initialized in the IL, which at least in 13+ results in ICEs in the ranger which is upset about zero precision types. I think we could even avoid initializing other unnamed bitfields, but unfortunately !CONSTRUCTOR_NO_CLEARING doesn't mean in the middle-end clearing of padding bits and until we have some new flag that represents the request to clear padding bits, I think it is better to keep zeroing non-zero sized unnamed bitfields. In addition to skipping those fields, I have changed the logic how UNION_TYPEs are handled, the current code was a little bit weird in that e.g. if first non-static data member had error_mark_node type, we'd happily zero initialize the second non-static data member, etc. 2023-05-17 Jakub Jelinek <jakub@redhat.com> PR c++/109868 * init.cc (build_zero_init_1): Don't initialize zero-width bitfields. For unions only initialize the first FIELD_DECL. * g++.dg/init/pr109868.C: New test.
2023-05-17vect: Don't retry if the previous analysis failsKewen Lin1-1/+1
When working on a cost tweaking patch, I found that a newly added test case has different dumpings with stage-1 and bootstrapped gcc. By looking into it, the apparent reason is vect_analyze_loop_2 doesn't get slp_done_for_suggested_uf set expectedly, the following retrying will use the garbage slp_done_for_suggested_uf instead. In fact, the setting of slp_done_for_suggested_uf only happens when the previous analysis succeeds, for the mentioned test case, its previous analysis does fail, it's unexpected to use the value of slp_done_for_suggested_uf any more. In function vect_analyze_loop_1, we only return success when res is true, which is the result of 1st analysis. It means we never try to vectorize with unroll_vinfo if the previous analysis fails. So this patch shouldn't break anything, and just stop some useless analysis early. gcc/ChangeLog: * tree-vect-loop.cc (vect_analyze_loop_1): Don't retry analysis with suggested unroll factor once the previous analysis fails.
2023-05-17RISC-V: Support RVV VREINTERPRET from v{u}int*_t to vbool1_tPan Li7-0/+105
This patch support the RVV VREINTERPRET from the int to the vbool1_t. Aka: vbool1_t __riscv_vreinterpret_xx_xx(v{u}int[8|16|32|64]_t); These APIs help the users to convert vector LMUL=1 integer to vbool1_t. According to the RVV intrinsic SPEC as below, the reinterpret intrinsics only change the types of the underlying contents. https://github.com/riscv-non-isa/rvv-intrinsic-doc/blob/master/rvv-intrinsic-rfc.md#reinterpret-vbool-o-vintm1 For example, given below code. vbool1_t test_vreinterpret_v_i8m1_b1(vint8m1_t src) { return __riscv_vreinterpret_v_i8m1_b1(src); } It will generate the assembly code similar as below: vsetvli a5,zero,e8,m8,ta,ma vlm.v v1,0(a1) vsm.v v1,0(a0) ret The rest intrinsic bool size APIs will be prepared in other PATCH. Signed-off-by: Pan Li <pan2.li@intel.com> gcc/ChangeLog: * config/riscv/genrvv-type-indexer.cc (BOOL_SIZE_LIST): New macro. (main): Add bool1 to the type indexer. * config/riscv/riscv-vector-builtins-functions.def (vreinterpret): Register vbool1 interpret function. * config/riscv/riscv-vector-builtins-types.def (DEF_RVV_BOOL1_INTERPRET_OPS): New macro. (vint8m1_t): Add the type to bool1_interpret_ops. (vint16m1_t): Ditto. (vint32m1_t): Ditto. (vint64m1_t): Ditto. (vuint8m1_t): Ditto. (vuint16m1_t): Ditto. (vuint32m1_t): Ditto. (vuint64m1_t): Ditto. * config/riscv/riscv-vector-builtins.cc (DEF_RVV_BOOL1_INTERPRET_OPS): New macro. (required_extensions_p): Add bool1 interpret case. * config/riscv/riscv-vector-builtins.def (bool1_interpret): Add bool1 interpret to base type. * config/riscv/vector.md (@vreinterpret<mode>): Add new expand with VB dest for vreinterpret. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/misc_vreinterpret_vbool_vint.c: New test.
2023-05-17rs6000: use lis;xoris to build constantJiufu Guo2-1/+16
For constant C: If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say: 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build. Here N(M) means N continuous bit M, x for M means it is ok for either 1 or 0; '||' means concatenation. This patch update rs6000_emit_set_long_const to support those constants. Compare with previous version: https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html This patch updates test function names only. Bootstrap and regtest pass on ppc64{,le}. PR target/106708 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Support building constants through "lis; xoris". gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr106708.c: Add test function.
2023-05-17Daily bump.GCC Administrator8-1/+453
2023-05-16c: Remove restrictions on declarations in 'for' loops for C2XJoseph Myers13-30/+142
C2X removes a restriction that the only declarations in the declaration part of a 'for' loop are declarations of objects with storage class auto or register. Implement this change, making the diagnostics into pedwarn_c11 calls instead of errors (as usual for features added in a new standard version that were invalid code in a previous version), so now pedwarn-if-pedantic for older standards and diagnosed also with -Wc11-c2x-compat. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-decl.cc (check_for_loop_decls): Use pedwarn_c11 for diagnostics. gcc/testsuite/ * gcc.dg/c11-fordecl-1.c, gcc.dg/c11-fordecl-2.c, gcc.dg/c11-fordecl-3.c, gcc.dg/c11-fordecl-4.c, gcc.dg/c2x-fordecl-1.c, gcc.dg/c2x-fordecl-2.c, gcc.dg/c2x-fordecl-3.c, gcc.dg/c2x-fordecl-4.c: New tests. * gcc.dg/c99-fordecl-2.c: Test diagnostic for typedef declaration in for loop here. * gcc.dg/pr67784-2.c, gcc.dg/pr68320.c, objc.dg/foreach-7.m: Do not expect errors for typedef declaration in for loop.
2023-05-17PR modula2/109879 WholeIO.ReadCard and ReadInt should consume leading spaceGaius Mulley9-38/+202
The Read{TYPE} procedures in LongIO, LongWholeIO, RealIO, ShortWholeIO and WholeIO all require skip space functionality. A new module TextUtil is supplied with this functionality and the previous modules have been changed to call SkipSpaces. gcc/m2/ChangeLog: PR modula2/109879 * gm2-libs-iso/LongIO.mod (ReadReal): Call SkipSpaces. * gm2-libs-iso/LongWholeIO.mod (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/RealIO.mod (ReadReal): Call SkipSpaces. * gm2-libs-iso/ShortWholeIO.mod: (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/TextIO.mod: Import SkipSpaces. * gm2-libs-iso/WholeIO.mod (ReadInt): Call SkipSpaces. (ReadCard): Call SkipSpaces. * gm2-libs-iso/TextUtil.def: New file. * gm2-libs-iso/TextUtil.mod: New file. libgm2/ChangeLog: PR modula2/109879 * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am (M2DEFS): Add TextUtil.def. (M2MODS): Add TextUtil.mod. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.in: Regenerate. gcc/testsuite/ChangeLog: PR modula2/109879 * gm2/isolib/run/pass/testreadint.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-05-16c++: -Wdangling-reference not suppressed in template [PR109774]Marek Polacek2-3/+26
In check_return_expr, we suppress the -Wdangling-reference warning when we're sure it would be a false positive. It wasn't working in a template, though, because the suppress_warning call was never reached. PR c++/109774 gcc/cp/ChangeLog: * typeck.cc (check_return_expr): In a template, return only after suppressing -Wdangling-reference. gcc/testsuite/ChangeLog: * g++.dg/warn/Wdangling-reference13.C: New test.
2023-05-16c++: desig init in presence of list ctor [PR109871]Patrick Palka2-8/+24
add_list_candidates has logic to reject designated initialization of a non-aggregate type, but this is inadvertently being suppressed if the type has a list constructor due to the order of case analysis, which in the below testcase leads to us incorrectly treating the initializer list as if it's non-designated. This patch fixes this by making us check for invalid designated initialization sooner. PR c++/109871 gcc/cp/ChangeLog: * call.cc (add_list_candidates): Check for invalid designated initialization sooner and even for types that have a list constructor. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/desig27.C: New test.
2023-05-16rs6000: Enable REE pass by default“Ajit Kumar Agarwal”2-2/+4
Add ree pass as a default pass for rs6000 target for O2 and above. 2023-05-16 Ajit Kumar Agarwal <aagarwa1@linux.ibm.com> gcc/ChangeLog: * common/config/rs6000/rs6000-common.cc: Add REE pass as a default rs6000 target pass for O2 and above. * doc/invoke.texi: Document -free
2023-05-16RISC-V: Fix wrong select_kind in riscv_compute_multilibKito Cheng1-3/+3
Seems like I screw up bare-metal toolchian multi lib selection during finxing linux multi-lib selction... gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_compute_multilib): Fix wrong select_kind...
2023-05-16rs6000: Fix test int_128bit-runnable.c instruction countsCarl Love1-2/+2
The test reports two failures on Power 10LE: FAIL: .../int_128bit-runnable.c scan-assembler-times \\\\mvdivsq\\\\M 1 FAIL: .../int_128bit-runnable.c scan-assembler-times \\\\mvextsd2q\\\\M 6 The current counts are : vdivsq 3 vextsd2q 4 The counts changed with commit: commit 852b11da11a181df517c0348df044354ff0656d6 Author: Michael Meissner <meissner@linux.ibm.com> Date: Wed Jul 7 21:55:38 2021 -0400 Generate 128-bit int divide/modulus on power10. This patch adds support for the VDIVSQ, VDIVUQ, VMODSQ, and VMODUQ instructions to do 128-bit arithmetic. 2021-07-07 Michael Meissner <meissner@linux.ibm.com> The code generation changed significantly. There are two places where the vextsd2q is "replaced" by a vdivsq instruction thus increasing the vdivsq count from 1 to 3. The first case is: expected_result = vec_arg1[0]/4; 10000af8: 60 01 df e8 ld r6,352(r31) 10000afc: 68 01 ff e8 ld r7,360(r31) 10000b00: 76 fe e9 7c sradi r9,r7,63 10000b04: 67 4b 00 7c mtvsrdd vs32,0,r9 10000b08: 02 06 1b 10 vextsd2q v0,v0 <---- 10000b0c: 03 00 40 39 li r10,3 10000b10: 00 00 60 39 li r11,0 10000b14: 67 00 09 7c mfvrd r9,v0 10000b18: 67 02 08 7c mfvsrld r8,vs32 10000b1c: 38 50 08 7d and r8,r8,r10 10000b20: 38 58 29 7d and r9,r9,r11 10000b24: 78 4b 2b 7d mr r11,r9 10000b28: 78 43 0a 7d mr r10,r8 10000b2c: 14 30 4a 7f addc r26,r10,r6 10000b30: 14 39 6b 7f adde r27,r11,r7 10000b34: 46 f0 69 7b sldi r9,r27,62 10000b38: 82 f0 58 7b srdi r24,r26,2 10000b3c: 78 c3 38 7d or r24,r9,r24 10000b40: 74 16 79 7f sradi r25,r27,2 10000b44: 30 00 1f fb std r24,48(r31) 10000b48: 38 00 3f fb std r25,56(r31) To: expected_result = vec_arg1[0]/4; 10000af8: 69 01 1f f4 lxv vs32,352(r31) 10000afc: 04 00 20 39 li r9,4 10000b00: 00 00 40 39 li r10,0 10000b04: 67 4b 2a 7c mtvsrdd vs33,r10,r9 10000b08: 0b 09 00 10 vdivsq v0,v0,v1 <---- 10000b0c: 3d 00 1f f4 stxv vs32,48(r31) The second case were a vexts2q instruction is replaced with vdivsq: From: expected_result = arg1/16; 10000c24: 40 00 df e8 ld r6,64(r31) 10000c28: 48 00 ff e8 ld r7,72(r31) 10000c2c: 76 fe e9 7c sradi r9,r7,63 10000c30: 67 4b 00 7c mtvsrdd vs32,0,r9 10000c34: 02 06 1b 10 vextsd2q v0,v0 <--- 10000c38: 0f 00 40 39 li r10,15 10000c3c: 00 00 60 39 li r11,0 10000c40: 67 00 09 7c mfvrd r9,v0 10000c44: 67 02 08 7c mfvsrld r8,vs32 10000c48: 38 50 08 7d and r8,r8,r10 10000c4c: 38 58 29 7d and r9,r9,r11 10000c50: 78 4b 2b 7d mr r11,r9 10000c54: 78 43 0a 7d mr r10,r8 10000c58: 14 30 ca 7e addc r22,r10,r6 10000c5c: 14 39 eb 7e adde r23,r11,r7 10000c60: c6 e0 e9 7a sldi r9,r23,60 10000c64: 02 e1 d4 7a srdi r20,r22,4 10000c68: 78 a3 34 7d or r20,r9,r20 10000c6c: 74 26 f5 7e sradi r21,r23,4 10000c70: 30 00 9f fa std r20,48(r31) 10000c74: 38 00 bf fa std r21,56(r31) To: expected_result = arg1/16; 10000be8: 49 00 1f f4 lxv vs32,64(r31) 10000bec: 10 00 20 39 li r9,16 10000bf0: 00 00 40 39 li r10,0 10000bf4: 67 4b 2a 7c mtvsrdd vs33,r10,r9 10000bf8: 0b 09 00 10 vdivsq v0,v0,v1 <--- 10000bfc: 3d 00 1f f4 stxv vs32,48(r31) The patch has been tested on Power10LE with no regressions. gcc/testsuite/ * gcc.target/powerpc/int_128bit-runnable.c: Update expected instruction counts.
2023-05-16rs6000: Fix test gc.target/powerpc/rs600-fpint.c test optionsCarl Love1-2/+1
The test compile option rs6000-*-* is outdated and no longer supported. The powerpc*-*-* is the defualt, so it doesn't need to be specified. The dg-options needs to specify an older processor to get the desired behavior on recent processors, since gfxopt is only off for very old CPUs, we don't guard stfiwx under it for recent processors and don't want to. This patch updates the test specifications so the test will run properly on Power10LE. Tested on Power10 LE system with no regression test failures. gcc/testsuite/: * gcc.target/powerpc/rs6000-fpint.c: Update dg-options, drop dg-do compile specifier.
2023-05-16PR modula2/108344 disable default opening of /dev/ttyGaius Mulley1-17/+20
This patch changes removes the static initialisation code for KeyBoardLEDs.cc. The module is only initialised if one of the exported functions is called. This is useful as the module will access /dev/tty which might not be available. TimerHandler.mod has also been changed to disable the scroll lock LED as a sign of life. gcc/m2/ChangeLog: PR modula2/108344 * gm2-libs-coroutines/TimerHandler.mod (EnableLED): New constant. (Timer): Test EnableLED before switching on the scroll LED. libgm2/ChangeLog: PR modula2/108344 * libm2cor/KeyBoardLEDs.cc (initialize_module): New function. (SwitchScroll): Call initialize_module. (SwitchNum): Call initialize_module. (SwitchCaps): Call initialize_module. (SwitchLEDs): Call initialize_module. (M2EXPORT): Remove initialization code. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-05-16aarch64: Allow moves after tied-register intrinsics (2nd edition)Richard Sandiford2-0/+20
I missed these two in g:4ff89f10ca0d41f9cfa76 because I was testing on a system that didn't support big-endian compilation. Testing on aarch64_be-elf shows no other related failures (although the overall results are worse than for little-endian). gcc/testsuite/ * gcc.target/aarch64/advsimd-intrinsics/bfdot-2.c: Allow mves to occur after the intrinsic instruction, rather than requiring them to happen before. * gcc.target/aarch64/advsimd-intrinsics/vdot-3-2.c: Likewise.
2023-05-16ada: Add "gnat --help-ada" text for new switches.Steve Baird1-0/+4
The output generated by "gnat --help-ada" should include descriptions for the newly added -gnatw_s and -gnatw_S switches". gcc/ada/ * usage.adb: Generate output text describing the -gnatw_s switch (and the corresponding -gnatw_S switch).
2023-05-16ada: Use accumulator type in expansion of 'Reduce attributeEric Botcazou1-10/+62
The current expansion of the 'Reduce attribute uses the resolution type of the expression for the accumulator. Now this type can be unresolved or set to a universal type, for example if it is itself the prefix of the 'Image attribute, and this may yield a spurious type mismatch error in that case. This changes the expansion to use the accumulator type instead as defined by the RM 4.5.10 clause, albeit only in the prefixed case for now. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Reduce>: Use the canonical accumulator type as the type of the accumulator in the prefixed case.
2023-05-16ada: Fix missing warning on aggregate with iterated componentEric Botcazou1-1/+0
This happens when the iterated component does not really iterate. gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate): Do not set Warnings_Off on the temporary created when in-place expansion is not possible.
2023-05-16ada: Fix crash on iterated component in expression functionEric Botcazou1-6/+8
The problem is that the freeze node generated for the type of a static subexpression present in the expression function is incorrectly placed inside instead of outside the function. gcc/ada/ * freeze.adb (Freeze_Expression): When the freezing is to be done outside the current scope, skip any scope that is an internal loop.
2023-05-16ada: Fix internal error on 'Image applied to array componentEric Botcazou1-2/+21
This happens because the array component depends on a discriminant. gcc/ada/ * exp_imgv.adb (Rewrite_Object_Image): If the prefix is a component that depends on a discriminant, create an actual subtype for it.
2023-05-16ada: Fix internal error on chain of predicated record typesEric Botcazou1-6/+21
The preanalysis of a predicate set on one of the record types was causing premature freezing of another record type. gcc/ada/ * sem_ch13.adb: Add with and use clauses for Expander. (Resolve_Aspect_Expressions) <Aspect_Predicate>: Emulate a bona-fide preanalysis setup before calling Resolve_Aspect_Expression.
2023-05-16ada: Update proof of runtime unitsYannick Moy6-45/+31
Following changes in GNATprove, proofs need to be amended. gcc/ada/ * libgnat/s-aridou.adb (Lemma_Div_Pow2): Add assertion. * libgnat/s-arit32.adb (Lemma_Abs_Div_Commutation): Simplify. * libgnat/s-expmod.adb (Lemma_Exp_Mod): Add assertions. (Lemma_Euclidean_Mod): Add body to lemma. (Lemma_Mult_Mod): Add assertion. * libgnat/s-valueu.adb (Scan_Raw_Unsigned): Modify assertion. * libgnat/s-vauspe.ads (Raw_Unsigned_Last_Ghost): Add postcondition. * libgnat/s-widthi.adb: Use more precise types.
2023-05-16ada: Implement inheritance of user-defined literal aspects for untagged typesEric Botcazou3-8/+38
In Ada 2022, user-defined literal aspects are nonoverridable but the named subprograms present in them can be overridden, including for untagged types. gcc/ada/ * sem_res.adb (Has_Applicable_User_Defined_Literal): Apply the same processing for derived untagged types as for tagged types. * sem_util.ads (Corresponding_Primitive_Op): Adjust description. * sem_util.adb (Corresponding_Primitive_Op): Handle untagged types.
2023-05-16ada: Spurious error analyzing 'old or 'result in class-wide conditionsJavier Miranda1-2/+21
gcc/ada/ * sem_attr.adb (Analyze_Attribute_Old_Result): When preanalyzing a class-wide condition, search in the scopes stack for the subprogram that has the condition. This is required because returning the current scope causes reporting spurious errors when the occurrence of the attribute is found, for example, in a quantified expression.
2023-05-16ada: Spurious error on function returning CPP typeJavier Miranda1-1/+6
gcc/ada/ * exp_ch6.adb (Needs_BIP_Alloc_Form): Return False for functions with foreign convention since we never use build-in-place for such functions.
2023-05-16ada: Apply range checks to preanalyzed aggregate expressionsPiotr Trojanek1-1/+1
When preanalyzing expressions in GNATprove mode, e.g. Pre/Post contracts, we apply checks, because these expressions will never be expanded. This didn't happen for aggregate expressions, most likely because of an oversight. gcc/ada/ * sem_util.adb (Aggregate_Constraint_Checks): Don't exit early when preanalysing in GNATprove mode. Now the condition is consistent with other similar conditions in other code.
2023-05-16ada: usage.adb: document -gnatyD switchGhjuvan Lacambre1-0/+1
-gnatyD was documented in the user guide but not in `gnat --help-ada`. gcc/ada/ * usage.adb (Usage): Document -gnatyD.
2023-05-16ada: Fix Ada representation of r_debug and link_map typesMarc Poulhiès1-6/+13
Both record types need to have their components 'aliased' to match their C version. The mismatch could be observed when using LTO: warning: type of 'r_debug' does not match original declaration [-Wlto-type-mismatch] /usr/include/link.h:66:23: note: type 'struct r_debug' should match type 'struct system__traceback__symbolic__module_name__build_... ...cache_for_all_modules__r_debug_type' gcc/ada/ * libgnat/s-tsmona__linux.adb (link_map, r_debug_type): Add 'aliased' on all components.
2023-05-16ada: Enable Support_Atomic_Primitives on PPC LinuxJohannes Kliemann3-0/+151
gcc/ada/ * libgnat/system-linux-ppc.ads: Add Support_Atomic_Primitives. * libgnat/s-atopri__32.ads: Add 32 bit version of s-atopri.ads. * Makefile.rtl: Use s-atopro__32.ads for ppc-linux.
2023-05-16ada: Follow-up improvement to implementation of storage modelsEric Botcazou1-0/+16
It avoids to recreate an actual subtype for an explicit dereference. gcc/ada/ * sem_util.adb (Get_Actual_Subtype): For an explicit dereference, return the Actual_Designated_Subtype if it is present. (Get_Actual_Subtype_If_Available): Likewise.
2023-05-16ada: Add tags on style messagesArnaud Charlet10-62/+75
Similar to tags on warnings [-gnatwx], we add tags on style messages [-gnatyx] when -gnatw.d is enabled. gcc/ada/ * errout.ads: Update comment. * errout.adb (Skip_Msg_Insertion_Warning): Update to take e.g. -gnatyM into account. * erroutc.adb (Get_Warning_Option, Get_Warning_Tag) (Prescan_Message): Add support for Style tags. * par-ch5.adb, par-ch6.adb, par-ch7.adb, par-endh.adb, par-util.adb, style.adb, styleg.adb: Set tag on all style messages.
2023-05-16ada: Fix typo in "pattern"Tom Tromey3-4/+4
I found a couple of spots using the typo "patterm" rather than the correct "pattern". gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Switches_for_gnatbind): Fix typo. * libgnat/g-spipat.ads: Fix typo. * gnat_ugn.texi: Regenerate.
2023-05-16ada: Adjust semantics and implementation of storage modelsEric Botcazou8-82/+274
This makes the following adjustments to the semantics and implementation of storage models in the compiler: 1. By-copy semantics in subprogram calls: when an object accessed with a nonnative storage model is passed as an actual parameter in a call to a subprogram, an intermediate copy made on the host is passed instead. 2. More generally, any additional temporary required on the host by the semantics of nonnative storage models is now created by the front-end instead of the code generator. 3. All the temporaries created on the host for nonnative storage models are allocated on the secondary stack instead of the primary stack. As a result, this should simplify the implementation in code generators. gcc/ada/ * exp_aggr.adb (Build_Assignment_With_Temporary): Adjust comment and fix type of second parameter. Create the temporary on the secondary stack by calling Build_Temporary_On_Secondary_Stack. (Convert_Array_Aggr_In_Allocator): Adjust formatting. (Expand_Array_Aggregate): Likewise. * exp_ch4.adb (Expand_N_Allocator): Set Actual_Designated_Subtype on the dereference in the initialization for all composite types. * exp_ch5.adb (Expand_N_Assignment_Statement): Create a temporary on the host for an assignment between nonnative storage models. Suppress more checks when Suppress_Assignment_Checks is set. * exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Deal with actuals that are dereferences with an Actual_Designated_Subtype. Add support for nonnative storage models. (Expand_Actuals): Create a copy if the actual is a dereference with a nonnative storage model. * exp_util.ads (Build_Temporary_On_Secondary_Stack): Declare. * exp_util.adb (Build_Temporary_On_Secondary_Stack): New function. * sem_ch5.adb (Analyze_Assignment.Set_Assignment_Type): Do not build an actual subtype for dereferences with an Actual_Designated_Subtype * sinfo.ads (Actual_Designated_Subtype): Adjust documentation. (Suppress_Assignment_Checks): Likewise.
2023-05-16ada: Build invariant procedure while freezing in GNATprove modePiotr Trojanek1-8/+46
Invariant procedure bodies are created either by expansion of freezing nodes (but only in ordinary compilation mode) or at the end of package private declarations (but not for with private types in the type derivation chain). In GNATprove mode we didn't create invariant procedure bodies in lightweight expansion, so we didn't create them at all when there were private types in the type derivation chain. This patch copies the relevant freezing part from ordinary to lightweight expansion. This obviously involves code duplication, but it seems better to duplicate whole sections that work properly instead of small pieces that are incomplete. There are other pieces of freezing that are similarly duplicated, so this patch doesn't make the code substantially worse. gcc/ada/ * exp_spark.adb (SPARK_Freeze_Type): Copy whole handling of DIC and Type_Invariant from Freeze_Type.
2023-05-16ada: Get name from entity if that's what's passed to Subprogram_NameRichard Kenner1-0/+3
gcc/ada/ * sem_util.adb (Subprogram_Name): If what's passed is already an entity, use that for the name.
2023-05-16ada: Document examples of No_Dependence restriction for code generationEric Botcazou2-2/+43
gcc/ada/ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst (No_Dependence): Give examples of new No_Dependence restrictions. * gnat_rm.texi: Regenerate.
2023-05-16ada: Bad handling of ASCII with -gnatynArnaud Charlet2-3/+3
ASCII is special cased but this wasn't taking into account all cases such as Standard.ASCII. gcc/ada/ * snames.ads-tmpl (Name_ASCII): New. * style.adb (Check_Identifier): Fix handling of ASCII.
2023-05-16ada: Introduce Cannot_Be_Superflat flag on N_Range nodesEric Botcazou4-9/+22
The support of superflat arrays in the language generates an overhead that the code generator attempts to minimize, but it cannot handle too complex cases and it would be helpful if the front-end could lend a hand. This change introduces the Cannot_Be_Superflat flag on N_Range nodes for this purpose, and sets it on the result of string concatenations when it is guaranteed to be nonnull. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Add Cannot_Be_Superflat. * gen_il-gen-gen_nodes.adb (N_Range): Add Cannot_Be_Superflat as semantical flag and change Includes_Infinities to semantical. * sinfo.ads (Cannot_Be_Superflat): Document it for N_Range. * exp_ch4.adb (Expand_Concatenate): Set Cannot_Be_Superflat on the range of the result if the result cannot be null.
2023-05-16ada: Change Present_Expr field type to UintRichard Kenner1-1/+1
We want the field to be initialized to No_Uint because we want to be able to test in GNAT LLVM whether we've already set it so we can be sure we only set it once. gcc/ada/ * gen_il-gen-gen_nodes.adb (Present_Expr): Type is now Uint.
2023-05-16ada: Simplify dramatically ghost code for proof of System.Arith_DoubleYannick Moy2-384/+56
Using Inline_For_Proof annotation on key expression functions makes it possible to remove hundreds of lines of ghost code that were previously needed to guide provers. gcc/ada/ * libgnat/s-aridou.adb (Big3, Is_Mult_Decomposition) (Is_Scaled_Mult_Decomposition): Add annotation for inlining. (Double_Divide, Scaled_Divide): Simplify and remove ghost code. (Prove_Multiplication): Add calls to lemmas to make proof go through. * libgnat/s-aridou.ads (Big, In_Double_Int_Range): Add annotation for inlining.
2023-05-16ada: Add intermediate assertions for proof of Super_TailYannick Moy1-0/+6
Proof of Superbounded internal unit requires a little more help. gcc/ada/ * libgnat/a-strsup.adb: Add intermediate assertions.
2023-05-16ada: Missing dependency with -gnatcArnaud Charlet1-11/+11
When using -gnatc, dependencies on preprocessor and config files were not recorded. gcc/ada/ * gnat1drv.adb: Ensure all dependencies are recorded even when not generating code.
2023-05-16ada: Set Loop_Variant assertion policy to Ignore in bothYannick Moy1-1/+2
Set Loop_Variant assertion policy to Ignore in both. gcc/ada/ * libgnat/a-strsup.adb: Set assertion policy for Loop_Variant.
2023-05-16ada: Trivial refactoring in Instantiate_*_BodyMarc Poulhiès1-10/+6
Factor out Par_Vis/Install_Parent/Par_Installed in Instantiate_Package_Body and Instantiate_Subprogram_Body. gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Simplify if/then/else. (Instantiate_Subprogram_Body): Likewise.
2023-05-16ada: Restore proof of System.Arith_DoubleYannick Moy1-31/+119
Use Assert_And_Cut to simplify proof of second part of the Scaled_Divide. Add intermediate assertions and simplify where necessary. gcc/ada/ * libgnat/s-aridou.adb: (Big3): Remove override made useless. (Lemma_Quot_Rem): Add new lemma and justify it, as no prover manages to prove it. (Lemma_Div_Pow2): Use new lemma Lemma_Quot_Rem. (Prove_Scaled_Mult_Decomposition_Regroup3): Retype for simplification. (Scaled_Divide): Remove useless assertions.Decompose some assertions with cut operations. Use Assert_And_Cut for second half. Add assertions.
2023-05-16RISC-V: Adjust stdint.h to stdint-gcc.h for rvv testsPan Li15-15/+15
This patch would like to align the stdint.h to the stdint-gcc.h for all the RVV test files. Aka: stdint.h => stdint-gcc.h Signed-off-by: Pan Li <pan2.li@intel.com> gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h: Replace stdint.h with stdint-gcc.h. * gcc.target/riscv/rvv/autovec/binop/shift-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vadd-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vand-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vdiv-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmax-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmin-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmul-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vor-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vrem-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vsub-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vxor-template.h: Ditto. * gcc.target/riscv/rvv/autovec/series-1.c: Ditto. * gcc.target/riscv/rvv/autovec/vmv-imm-run.c: Ditto. * gcc.target/riscv/rvv/autovec/vmv-imm-template.h: Ditto.
2023-05-16s390: Refactor block operation setmemStefan Schulze Frielinghaus4-20/+132
Vectorize memset with a constant length of less than or equal to 64 bytes. Do not perform a libc function call into memset in case the size is not a compile-time constant but bounded and the upper bound is less than or equal to 256 bytes. gcc/ChangeLog: * config/s390/s390-protos.h (s390_expand_setmem): Change function signature. * config/s390/s390.cc (s390_expand_setmem): For memset's less than or equal to 256 byte do not perform a libc call. * config/s390/s390.md: Change expander into a version which takes 8 operands. gcc/testsuite/ChangeLog: * gcc.target/s390/memset-1.c: Test case memset1 makes use of vst, now.