Commit Graph

216254 Commits

Author SHA1 Message Date
GCC Administrator
9946ab84cd Daily bump. 2024-12-13 00:19:02 +00:00
Jonathan Wakely
0566b2e64b libstdc++: Fix some -Wsign-compare warnings in the testsuite
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/unordered_map/modifiers/reserve.cc:
	Cast to size_t to fix -Wsign-compare warning.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/insert/move_range.cc:
	Likewise.
2024-12-12 23:17:28 +00:00
Jonathan Wakely
8f122894ee libstdc++: Fix -Wsign-compare warnings in bits/hashtable_policy.h
libstdc++-v3/ChangeLog:

	* include/bits/hashtable_policy.h (_Local_iterator_base): Fix
	-Wsign-compare warnings.
2024-12-12 21:09:47 +00:00
Jonathan Wakely
9306960694 libstdc++: Fix typo in comment in src/c++17/fs_dir.cc
libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc: Fix typo in comment.
2024-12-12 21:08:45 +00:00
John David Anglin
6f7626f7a7 hppa: Remove extra clobber from divsi3, udivsi3, modsi3 and umodsi3 patterns
The $$divI, $$divU, $$remI and $$remU millicode calls clobber r1,
r26, r25 and the return link register (r31 or r2).  We don't need
to clobber any other registers.

2024-12-12  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

	* config/pa/pa.cc (pa_emit_hpdiv_const): Clobber r1, r25,
	r25 and return register.
	* config/pa/pa.md (divsi3): Revise clobbers and operands.
	Remove second clobber from div:SI insns.
	(udivsi3, modsi3, umodsi3): Likewise.
2024-12-12 15:22:22 -05:00
Sandra Loosemore
4e1d200bb5 Regenerate attr-urls.def.
I noticed there is this new generated file that needs to be updated by
"make regenerate-attr-urls" similarly to "make regenerate-opt-urls", but
nobody had done that recently as the buildbot does not nag about it yet.

gcc/ChangeLog

	* attr-urls.def: Regenerate.
2024-12-12 20:18:51 +00:00
Sandra Loosemore
c768cd07f8 Clean up documentation of -Wsuggest-attribute= [PR115532]
The list of -Wsuggest-attribute= variants was out of date in the option
summary (and getting too long to fit on one line), and an index entry was
missing for -Wsuggest-attribute=returns_nonnull.

gcc/c-family/ChangeLog
	PR c/115532
	* c.opt.urls: Regenerated.

gcc/ChangeLog
	PR c/115532
	* common.opt.urls: Regenerated.
	* doc/invoke.texi (Option Summary): Don't try to list all the
	-Wsuggest-attribute= variants inline here.
	(Warning Options): Likewise.  Add @opindex for
	Wsuggest-attribute=returns_nonnull and its no- form.  Remove
	@itemx for no- form.

Co-Authored-By: Peter Eisentraut <peter@eisentraut.org>
2024-12-12 20:17:15 +00:00
Jakub Jelinek
f7d1b9cdc0 match.pd: Defer some CTZ/CLZ foldings until after ubsan pass for -fsanitize=builtin [PR115127]
As the following testcase shows, -fsanitize=builtin instruments the
builtins in the ubsan pass which is done shortly after going into
SSA, but if optimizations optimize the builtins away before that,
nothing is instrumented.  Now, I think it is just fine if the
result of the builtins isn't used in any way and we just DCE them,
but in the following optimizations the result is used.
So, the following patch for -fsanitize=builtin only defers the
optimizations that might turn single argument CLZ/CTZ (aka undefined
at zero) until the ubsan pass is done.
Now, we don't have PROP_ubsan and am not sure it is worth adding it,
there is PROP_ssa set by the ssa pass which is 3 passes before
ubsan, but there are only 2 warning passes in between, so PROP_ssa
looked good enough to me.

2024-12-12  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/115127
	* match.pd (clz (X) == C, ctz (X) == C, ctz (X) >= C): Don't
	optimize if -fsanitize=builtin and not yet in SSA form.

	* c-c++-common/ubsan/builtin-2.c: New test.
2024-12-12 19:47:46 +01:00
Tobias Burnus
2cbb2408a8 OpenMP: Enable has_device_addr clause for 'dispatch' in C/C++
The 'has_device_addr' of 'dispatch' has to be seen in conjunction with the
'need_device_addr' modifier to the 'adjust_args' clause of 'declare variant'.
As the latter has not yet been implemented, 'has_device_addr' has no real
effect. However, to prepare for 'need_device_addr' and as service to the user:

For C, where 'need_device_addr' is not permitted (contrary to C++ and Fortran),
a note is output when then the user tries to use it (alongside the existing
error that either 'nothing' or 'need_device_ptr' was expected).

And, on the ME side, is is lightly handled by diagnosing when - for the
same argument - there is a mismatch between the variant's adjust_args
'need_device_ptr' modifier and dispatch having an 'has_device_addr' clause
(or likewise for need_device_addr with is_device_ptr) as, according to the
spec, those are completely separate.
Thus, 'dispatch' will still do the host to device pointer conversion for
a 'need_device_ptr' argument, even if it appeared in a 'has_device_addr'
clause.

gcc/c/ChangeLog:

	* c-parser.cc (OMP_DISPATCH_CLAUSE_MASK): Add has_device_addr clause.
	(c_finish_omp_declare_variant): Add an 'inform' telling the user that
	'need_device_addr' is invalid for C.

gcc/cp/ChangeLog:

	* parser.cc (OMP_DISPATCH_CLAUSE_MASK): Add has_device_addr clause.

gcc/ChangeLog:

	* gimplify.cc (gimplify_call_expr): When handling OpenMP's dispatch,
	add diagnostic when there is a ptr vs. addr mismatch between
	need_device_{addr,ptr} and {is,has}_device_{ptr,addr}, respectively.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/adjust-args-3.c: New test.
	* gcc.dg/gomp/adjust-args-2.c: New test.
2024-12-12 18:58:59 +01:00
Paul Thomas
d4330ff9bc Fortran: Fix testsuite regressions after r15-5083 [PR117797]
2024-12-12  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/117797
	* trans-array.cc (class_array_element_size): New function.
	(gfc_get_array_span): Refactor, using class_array_element_size
	to return the span for descriptors that are the _data component
	of a class expression and then class dummy references. Revert
	the conditions to those before r15-5083 tidying up using 'sym'.

gcc/testsuite/
	PR fortran/117797
	* gfortran.dg/pr117797.f90: New test.
2024-12-12 17:51:20 +00:00
Eric Botcazou
b563a3a00d Fix precondition failure with Ada.Numerics.Generic_Real_Arrays.Eigenvalues
This fixes a precondition failure triggered when the Eigenvalues routine
of Ada.Numerics.Generic_Real_Arrays is instantiated with -gnata, beause
it calls Sort_Eigensystem on an empty vector.

gcc/ada
	PR ada/117996
	* libgnat/a-ngrear.adb (Jacobi): Remove default value for
	Compute_Vectors formal parameter.
	(Sort_Eigensystem): Add Compute_Vectors formal parameter.  Do not
	modify the Vectors if Compute_Vectors is False.
	(Eigensystem): Pass True as Compute_Vectors to Sort_Eigensystem.
	(Eigenvalues): Pass False as Compute_Vectors to Sort_Eigensystem.

gcc/testsuite
	* gnat.dg/matrix1.adb: New test.
2024-12-12 16:29:25 +01:00
Georg-Johann Lay
c94ac10ffc AVR: target/118000 - Fix copymem from address-spaces.
* rampz_rtx et al. were missing MEM_VOLATILE_P.  This is needed because
  avr_emit_cpymemhi is setting RAMPZ explicitly with an own insn.

* avr_out_cpymem was missing a final RAMPZ = 0 on EBI devices.

This only affects the __flash1 ... __flash5 spaces since the other ASes
use different routines,

gcc/
	PR target/118000
	* config/avr/avr.cc (avr_init_expanders) <sreg_rtx>
	<rampd_rtx, rampx_rtx, rampy_rtx, rampz_rtx>: Set MEM_VOLATILE_P.
	(avr_out_cpymem) [ELPM && EBI]: Restore RAMPZ to 0 after.
2024-12-12 16:27:53 +01:00
Alexandre Oliva
3eb6e1e333 ifcombine field-merge: set upper bound for get_best_mode
A bootstrap on aarch64-linux-gnu revealed that sometimes (for example,
when building shorten_branches in final.cc) we will find such things
as MEM <unsigned int>, where unsigned int happens to be a variant of
the original unsigned int type, but with 64-bit alignment.  This
unusual alignment circumstance caused (i) get_inner_reference to not
look inside the MEM, (ii) get_best_mode to choose DImode instead of
SImode to access the object, so we built a BIT_FIELD_REF that
attempted to select all 64 bits of a 32-bit object, and that failed
gimple verification ("position plus size exceeds size of referenced
object") because there aren't that many bits in the unsigned int
object.

This patch avoids this failure mode by limiting the bitfield range
with the size of the inner object, if it is a known constant.

This enables us to avoid creating a BIT_FIELD_REF and reusing the load
expr, but we still introduced a separate load, that would presumably
get optimized out, but that is easy enough to avoid in the first place
by reusing the SSA_NAME it was originally loaded into, so I
implemented that in make_bit_field_load.


for  gcc/ChangeLog

	* gimple-fold.cc (fold_truth_andor_for_ifcombine): Limit the
	size of the bitregion in get_best_mode calls by the inner
	object's type size, if known.
	(make_bit_field_load): Reuse SSA_NAME if we're attempting to
	issue an identical load.
2024-12-12 11:43:09 -03:00
Alexandre Oliva
e8febb6414 fold fold_truth_andor field merging into ifcombine
This patch introduces various improvements to the logic that merges
field compares, while moving it into ifcombine.

Before the patch, we could merge:

  (a.x1 EQNE b.x1)  ANDOR  (a.y1 EQNE b.y1)

into something like:

  (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK)

if both of A's fields live within the same alignment boundaries, and
so do B's, at the same relative positions.  Constants may be used
instead of the object B.

The initial goal of this patch was to enable such combinations when a
field crossed alignment boundaries, e.g. for packed types.  We can't
generally access such fields with a single memory access, so when we
come across such a compare, we will attempt to combine each access
separately.

Some merging opportunities were missed because of right-shifts,
compares expressed as e.g. ((a.x1 ^ b.x1) & MASK) EQNE 0, and
narrowing conversions, especially after earlier merges.  This patch
introduces handlers for several cases involving these.

The merging of multiple field accesses into wider bitfield-like
accesses is undesirable to do too early in compilation, so we move it
from folding to ifcombine, and guard its warnings with
-Wtautological-compare, turned into a common flag.

When the second of a noncontiguous pair of compares is the first that
accesses a word, we may merge the first compare with part of the
second compare that refers to the same word, keeping the compare of
the remaining bits at the spot where the second compare used to be.

Handling compares with non-constant fields was somewhat generalized
from what fold used to do, now handling non-adjacent fields, even if a
field of one object crosses an alignment boundary but the other
doesn't.


for  gcc/ChangeLog

	* fold-const.cc (make_bit_field): Export.
	(unextend, all_ones_mask_p): Drop.
	(decode_field_reference, fold_truth_andor_1): Move
	field compare merging logic...
	* gimple-fold.cc: (fold_truth_andor_for_ifcombine) ... here,
	with -Wtautological-compare warning guards, and...
	(decode_field_reference): ... here.  Rework for gimple.
	(gimple_convert_def_p, gimple_binop_def_p): New.
	(compute_split_boundary_from_align): New.
	(make_bit_field_load, build_split_load): New.
	(reuse_split_load): New.
	* fold-const.h: (make_bit_field_ref): Declare
	(fold_truth_andor_for_ifcombine): Declare.
	* tree-ssa-ifcombine.cc (ifcombine_ifandif): Try
	fold_truth_andor_for_ifcombine.
	* common.opt (Wtautological-compare): Move here.

for  gcc/c-family/ChangeLog

	* c.opt (Wtautological-compare): Move to ../common.opt.

for  gcc/testsuite/ChangeLog

	* gcc.dg/field-merge-1.c: New.
	* gcc.dg/field-merge-2.c: New.
	* gcc.dg/field-merge-3.c: New.
	* gcc.dg/field-merge-4.c: New.
	* gcc.dg/field-merge-5.c: New.
	* gcc.dg/field-merge-6.c: New.
	* gcc.dg/field-merge-7.c: New.
	* gcc.dg/field-merge-8.c: New.
	* gcc.dg/field-merge-9.c: New.
	* gcc.dg/field-merge-10.c: New.
	* gcc.dg/field-merge-11.c: New.
	* gcc.dg/field-merge-12.c: New.
	* gcc.target/aarch64/long_branch_1.c: Disable ifcombine.
2024-12-12 11:43:03 -03:00
Georg-Johann Lay
bc565843ea AVR: Assert minimal required bit width of section_common::flags.
gcc/
	* config/avr/avr.cc (avr_ctz): New constexpr function.
	(section_common::flags): Assert minimal bit width.
2024-12-12 15:02:21 +01:00
Georg-Johann Lay
f8a602ce53 AVR: target/118001 - Add __flashx as 24-bit named address space.
This patch adds __flashx as a new named address space that allocates
objects in .progmemx.data.  The handling is mostly the same or similar
to that of 24-bit space __memx, except that the asm routines are
simpler and more efficient.  Loads are emit inline when ELPMX or
LPMX is available.  The address space uses a 24-bit addresses even
on devices with a program memory size of 64 KiB or less.

	PR target/118001
gcc/
	* doc/extend.texi (AVR Named Address Spaces): Document __flashx.
	* config/avr/avr.h (ADDR_SPACE_FLASHX): New enum value.
	* config/avr/avr-protos.h (avr_out_fload, avr_mem_flashx_p)
	(avr_fload_libgcc_p, avr_load_libgcc_mem_p)
	(avr_load_libgcc_insn_p): New.
	* config/avr/avr.cc (avr_addrspace): Add ADDR_SPACE_FLASHX.
	(avr_decl_flashx_p, avr_mem_flashx_p, avr_fload_libgcc_p)
	(avr_load_libgcc_mem_p, avr_load_libgcc_insn_p, avr_out_fload):
	New functions.
	(avr_adjust_insn_length) [ADJUST_LEN_FLOAD]: Handle case.
	(avr_progmem_p) [avr_decl_flashx_p]: return 2.
	(avr_addr_space_legitimate_address_p) [ADDR_SPACE_FLASHX]:
	Has same behavior like ADDR_SPACE_MEMX.
	(avr_addr_space_convert): Use pointer sizes rather then ASes.
	(avr_addr_space_contains): New function.
	(avr_convert_to_type): Use it.
	(avr_emit_cpymemhi): Handle ADDR_SPACE_FLASHX.
	* config/avr/avr.md (adjust_len) <fload>: New attr value.
	(gen_load<mode>_libgcc): Renamed from load<mode>_libgcc.
	(xload8<mode>_A): Iterate over MOVMODE rather than over ALL1.
	(fxmov<mode>_A): New from xloadv<mode>_A.
	(xmov<mode>_8): New from xload<mode>_A.
	(fmov<mode>): New insns.
	(fxload<mode>_A): New from xload<mode>_A.
	(fxload_<mode>_libgcc): New from xload_<mode>_libgcc.
	(*fxload_<mode>_libgcc): New from *xload_<mode>_libgcc.
	(mov<mode>) [avr_mem_flashx_p]: Hande ADDR_SPACE_FLASHX.
	(cpymemx_<mode>): Make sure the address space is not lost
	when splitting.
	(*cpymemx_<mode>) [ADDR_SPACE_FLASHX]: Use __movmemf_<mode> for asm.
	(*ashlqi.1.zextpsi_split): New combine pattern.
	* config/avr/predicates.md (nox_general_operand): Don't match
	when avr_mem_flashx_p is true.
	* config/avr/avr-passes.cc (AVR_LdSt_Props):
	ADDR_SPACE_FLASHX has no post_inc.

gcc/testsuite/
	* gcc.target/avr/torture/addr-space-1.h [AVR_HAVE_ELPM]:
	Use a function to bump .progmemx.data to a high address.
	* gcc.target/avr/torture/addr-space-2.h: Same.
	* gcc.target/avr/torture/addr-space-1-fx.c: New test.
	* gcc.target/avr/torture/addr-space-2-fx.c: New test.

libgcc/
	* config/avr/t-avr (LIB1ASMFUNCS): Add _fload_1, _fload_2,
	_fload_3, _fload_4, _movmemf.
	* config/avr/lib1funcs.S (.branch_plus): New .macro.
	(__xload_1, __xload_2, __xload_3, __xload_4): When the address is
	located in flash, then forward to...
	(__fload_1, __fload_2, __fload_3, __fload_4): ...these new
	functions, respectively.
	(__movmemx_hi): When the address is located in flash, forward to...
	(__movmemf_hi): ...this new function.
2024-12-12 14:58:48 +01:00
Martin Uecker
d46c7f313b Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713,PR117724]
For checking or computing TYPE_CANONICAL, ignore the array size when it is
the last element of a structure or union.  To not get errors because of
an inconsistent number of members, zero-sized arrays which are the last
element are not ignored anymore when checking the fields of a struct.

	PR c/113688
	PR c/114014
	PR c/114713
	PR c/117724

gcc/ChangeLog:
	* tree.cc (gimple_canonical_types_compatible_p): Add exception.

gcc/lto/ChangeLog:
	* lto-common.cc (hash_canonical_type): Add exception.

gcc/testsuite/ChangeLog:
	* gcc.dg/pr113688.c: New test.
	* gcc.dg/pr114014.c: New test.
	* gcc.dg/pr114713.c: New test.
	* gcc.dg/pr117724.c: New test.
2024-12-12 13:26:27 +01:00
Martin Uecker
1f48225a0d Fix type compatibility for types with flexible array member 1/2 [PR113688,PR114713,PR117724]
Allow the TYPE_MODE of a type with an array as last member to differ from
another compatible type.

gcc/ChangeLog:
	* tree.cc (gimple_canonical_types_compatible_p): Add exception.
	(verify_type): Add exception.

gcc/lto/ChangeLog:
	* lto-common.cc (hash_canonical_type): Add exception.
2024-12-12 13:26:09 +01:00
Torbjörn SVENSSON
e7615f6c99 testsuite: arm: Use -mtune=cortex-m4 for thumb-ifcvt.c test
On Cortex-M4, the code generated is:
     cmp     r0, r1
     itte    ne
     lslne   r0, r0, r1
     asrne   r0, r0, #1
     moveq   r0, r1
     add     r0, r0, r1
     bx      lr

On Cortex-M7, the code generated is:
     cmp     r0, r1
     beq     .L3
     lsls    r0, r0, r1
     asrs    r0, r0, #1
     add     r0, r0, r1
     bx      lr
.L3:
     mov     r0, r1
     add     r0, r0, r1
     bx      lr

As Cortex-M7 only allow maximum one conditional instruction, force
Cortex-M4 to have a stable test case.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/thumb-ifcvt.c: Use -mtune=cortex-m4.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:19 +01:00
Torbjörn SVENSSON
09499ffbb3 testsuite: arm: Fix build error for thumb2-slow-flash-data-3.c test
gcc/testsuite/ChangeLog:

	* gcc.target/arm/thumb2-slow-flash-data-3.c: Added argument to
	fn1 to avoid compile error.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:19 +01:00
Torbjörn SVENSSON
b7e11b4999 testsuite: arm: Check that a far jump is used in thumb1-far-jump-2.c
With the changes in r15-1579-g792f97b44ff, the code used as "padding" in
the test case is optimized way. Prevent this optimization by forcing a
read of the volatile memory.
Also, validate that there is a far jump in the generated assembler.

Without this patch, the generated assembler is reduced to:
f3:
        cmp     r0, #0
        beq     .L1
        ldr     r4, .L6
.L1:
        bx      lr
.L7:
        .align  2
.L6:
        .word   g_0_1

With the patch, the generated assembler is:
f3:
        movs    r2, #1
        ldr     r3, .L6
        push    {lr}
        str     r2, [r3]
        cmp     r0, #0
        bne     .LCB10
        bl      .L1     @far jump
.LCB10:
        b       .L7
.L8:
        .align  2
.L6:
        .word   .LANCHOR0
.L7:
        str     r2, [r3]
        ...
        str     r2, [r3]
.L1:
        pop     {pc}

gcc/testsuite/ChangeLog:

	* gcc.target/arm/thumb1-far-jump-2.c: Write to volatile memmory
	in macro to avoid optimization.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:19 +01:00
Torbjörn SVENSSON
95a0c71612 testsuite: arm: Use effective-target for pr96939 test
Update test case to use -mcpu=unset/-march=unset feature introduced in
r15-3606-g7d6c6a0d15c.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/lto/pr96939_0.c: Use effective-target
	arm_arch_v8a.
	* gcc.target/arm/lto/pr96939_1.c: Remove dg-options.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:19 +01:00
Torbjörn SVENSSON
bdf75257aa testsuite: arm: Use effective-target for its.c test [PR94531]
The test case gcc.target/arm/its.c was created together with restriction
of IT blocks for Cortex-M7. As the test case fails on all tunes that
does not match Cortex-M7, explicitly test it for Cortex-M7. To have some
additional faith that GCC does the correct thing, I also added another
variant of the test for Cortex-M3 that should allow longer IT blocks.

gcc/testsuite/ChangeLog:

	PR testsuite/94531
	* gcc.target/arm/its.c: Removed.
	* gcc.target/arm/its-1.c: Copy of gcc.target/arm/its.c. Use
	effective-target arm_cpu_cortex_m7.
	* gcc.target/arm/its-2.c: Copy of gcc.target/arm/its.c. Use
	effective-target arm_cpu_cortex_m3.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:19 +01:00
Torbjörn SVENSSON
a2006457c6 testsuite: arm: Use -mcpu=unset when overriding -march
Update test cases to use -mcpu=unset/-march=unset feature introduced in
r15-3606-g7d6c6a0d15c.

gcc/testsuite/ChangeLog:
	* gcc.dg/pr41574.c: Added option "-mcpu=unset".
	* gcc.dg/pr59418.c: Likewise.
	* lib/target-supports.exp (add_options_for_vect_early_break):
	Likewise.
	(add_options_for_arm_v8_neon): Likewise.
	(check_effective_target_arm_neon_ok_nocache): Likewise.
	(check_effective_target_arm_simd32_ok_nocache): Likewise.
	(check_effective_target_arm_sat_ok_nocache): Likewise.
	(check_effective_target_arm_dsp_ok_nocache): Likewise.
	(check_effective_target_arm_crc_ok_nocache): Likewise.
	(check_effective_target_arm_v8_neon_ok_nocache): Likewise.
	(check_effective_target_arm_v8_1m_mve_fp_ok_nocache): Likewise.
	(check_effective_target_arm_v8_1a_neon_ok_nocache): Likewise.
	(check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_2a_fp16_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_1m_mve_ok_nocache): Likewise.
	(check_effective_target_arm_v8_2a_i8mm_ok_nocache): Likewise.
	(check_effective_target_arm_fp16fml_neon_ok_nocache): Likewise.
	(check_effective_target_arm_v8_2a_bf16_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8m_main_cde_ok_nocache): Likewise.
	(check_effective_target_arm_v8m_main_cde_fp_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_1m_main_cde_mve_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_1m_main_cde_mve_fp_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_3a_complex_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_1_lob_ok): Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:18 +01:00
Torbjörn SVENSSON
721c689f18 testsuite: arm: Use -march=unset for bfloat16_scalar* tests
Update test cases to use -mcpu=unset/-march=unset feature introduced in
r15-3606-g7d6c6a0d15c.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/bfloat16_scalar_1_1.c: Use effective-target
	arm_arch_v8_2a_bf16_hard.
	* gcc.target/arm/bfloat16_scalar_2_1.c: Likewise.
	* gcc.target/arm/bfloat16_scalar_3_1.c: Likewise.
	* gcc.target/arm/bfloat16_scalar_1_2.c: Use effective-target
	arm_arch_v8_2a_bf16.
	* gcc.target/arm/bfloat16_scalar_2_2.c: Likewise.
	* gcc.target/arm/bfloat16_scalar_3_2.c: Likewise.
	* lib/target-supports.exp: Define effective-target
	v8_2a_bf16 and v8_2a_bf16_hard.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:18 +01:00
Torbjörn SVENSSON
68b4d6bda8 testsuite: arm: Use effective-target for pr56184.C and pr59985.C
Update test cases to use -mcpu=unset/-march=unset feature introduced in
r15-3606-g7d6c6a0d15c.

gcc/testsuite/ChangeLog:

	* g++.dg/other/pr56184.C: Use effective-target
	arm_arch_v7a_neon_thumb.
	* g++.dg/other/pr59985.C: Use effective-target
	arm_arch_v7a_fp_hard.
	* lib/target-supports.exp: Define effective-target
	arm_arch_v7a_fp_hard, arm_arch_v7a_neon_thumb

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2024-12-12 12:25:18 +01:00
Sam James
63317bf991 i386: regenerate i386.opt.urls
r15-6128-gfa878dc8c45fa3 missed the regeneration of the URL doc map, so
regenerate it here to make the buildbots happy.

gcc/ChangeLog:

	* config/i386/i386.opt.urls: Regenerate.
2024-12-12 10:52:47 +00:00
Jakub Jelinek
bb7f98d269 crc: Comment spelling fix
"replacement is succeeded" doesn't look correct, this patch drops the
is.

2024-12-12  Jakub Jelinek  <jakub@redhat.com>

	* gimple-crc-optimization.cc (crc_optimization::optimize_crc_loop):
	Comment spelling fix, is succeeded -> succeeded.
2024-12-12 11:26:14 +01:00
Piotr Trojanek
8da9d141db ada: Fix reference to Ada 2020 in comment
Code cleanup.

gcc/ada/ChangeLog:

	* par-ch5.adb (Test_Statement_Required): Fix comment.
2024-12-12 10:58:01 +01:00
Eric Botcazou
481fcc6769 ada: Elide the copy for bit-packed aggregates in object declarations
The in-place expansion has been historically disabled for them, but there
does not seem to be any good reason left for this.  However, this requires
a small trick in order for the expanded code not to be flagged as using the
object uninitialized by the code generator.

gcc/ada/ChangeLog:

	* exp_aggr.adb (Convert_Aggr_In_Object_Decl): Clear the component
	referenced on the right-hand side of the first assignment generated
	for a bit-packed array, if any.
	(Expand_Array_Aggregate): Do not exclude aggregates of bit-packed
	array types in object declarations from in-place expansion.
	* sem_eval.adb (Eval_Indexed_Component): Do not attempt a constant
	evaluation for a bit-packed array type.
2024-12-12 10:58:01 +01:00
Ronan Desplanques
bbcf4d2ab6 ada: Defend against risk of infinite loop
A recently fixed bug caused an infinite loop when assertions were not
checked. With assertions checked, the symptom was just an internal
error caused by an assertion failure. This patch makes it so that if
another bug ever causes the same condition to fail, there will never be
an infinite loop with any assertion policy.

gcc/ada/ChangeLog:

	* sem_ch3.adb (Access_Subprogram_Declaration): Replace assertion with
	more defensive code.
2024-12-12 10:58:01 +01:00
Viljar Indus
07fe98fb1a ada: Avoid going through symlinks in the json report
gcc/ada/ChangeLog:

	* errout.adb (Write_JSON_Location): Avoid going through
	symbolic links when printing the full name.
2024-12-12 10:58:01 +01:00
Ronan Desplanques
9ea2c78197 ada: Fix minor display issue on invalid floats
GNAT implements a format with trailing '*' signs for the Image attribute
of NaN, +inf and -inf. It was probably always intended to be the same
length as the image of 1.0, but one '*' was actually missing. This patch
fixes this.

gcc/ada/ChangeLog:

	* libgnat/s-imager.adb (Image_Floating_Point): Tweak display of
	invalid floating point values.
2024-12-12 10:58:00 +01:00
Ronan Desplanques
8f931770a5 ada: Improve task entry context detection
Access parameters are not allowed in specifications of task entries.
Before this patch, the compiler failed to detect that case in accept
statements that were not directly in their task body's scopes. This
patch fixes this issue.

gcc/ada/ChangeLog:

	* sem_ch3.adb (Access_Definition): Remove test for task entry context.
	* sem_ch6.adb (Process_Formals): Add improved test for task entry
	context.
2024-12-12 10:58:00 +01:00
Piotr Trojanek
6b23686af7 ada: Refactor warning about null loops
Code cleanup; semantics is unaffected.

gcc/ada/ChangeLog:

	* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Move call
	to Comes_From_Source to the outer if-statement.
2024-12-12 10:58:00 +01:00
Piotr Trojanek
29fe40e0d1 ada: Fix internal error on loop parameter specifications
Originally loop parameter specification only occurred in loops, but now
it also occurs in quantified expressions. This patch guards against
flagging non-loop nodes as null loop statements. This was causing
internal compiler errors that were only visible with switch -gnatdk,
which happens to be default in GNATprove testsuite.

gcc/ada/ChangeLog:

	* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Only set
	flag Is_Null_Loop when loop parameter specification comes from
	a loop and not from a quantified expression.
2024-12-12 10:57:59 +01:00
Eric Botcazou
8999aba832 ada: Elide the copy for bit-packed aggregates in allocators
The in-place expansion has been historically disabled for them, but there
does not seem to be any good reason left for this.

gcc/ada/ChangeLog:

	* exp_aggr.adb (Expand_Array_Aggregate): Do not exclude aggregates
	of bit-packed array types in allocators from in-place expansion.
2024-12-12 10:57:59 +01:00
Sebastian Poeplau
bbe71e3333 ada: Fix the level of the LLVM chapter in the User's Guide
gcc/ada/ChangeLog:

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Move
	the LLVM chapter one level up.
	* gnat_ugn.texi: Regenerate.
2024-12-12 10:57:59 +01:00
Ronan Desplanques
003ed7d393 ada: Accept static strings with External_Initialization
Before this patch, the argument to the External_Initialization aspect
had to be a string literal. This patch extends the possibilities so that
any static string is accepted.

A new helper function, Is_OK_Static_Expression_Of_Type, is introduced,
and in addition to the main change of this patch a couple of calls to
that helper function are added in other places to replace equivalent
inline code.

gcc/ada/ChangeLog:

	* sem_eval.ads (Is_OK_Static_Expression_Of_Type): New function.
	* sem_eval.adb (Is_OK_Static_Expression_Of_Type): Likewise.
	* sem_ch13.adb (Check_Expr_Is_OK_Static_Expression): Use new function.
	* sem_prag.adb (Check_Expr_Is_OK_Static_Expression): Likewise.
	* sem_ch3.adb (Apply_External_Initialization): Accept static strings
	for the parameter.
2024-12-12 10:57:58 +01:00
Ronan Desplanques
fac69bd389 ada: Fix reference manual clauses
The clauses in section 3.5 of the reference manual were moved around
along the different Ada versions, which caused some comments in our
source code to go out of date. This patch updates the references in
those comments.

gcc/ada/ChangeLog:

	* libgnat/a-tifiio.adb: Fix comment.
	* libgnat/a-tifiio__128.adb: Likewise.
	* libgnat/s-imaged.ads (Image_Decimal): Likewise.
	* libgnat/s-imagef.ads (Image_Fixed): Likewise.
	* libgnat/s-imager.ads (Image_Fixed_Point): Likewise.
	* libgnat/s-imde32.ads (Image_Decimal32): Likewise.
	* libgnat/s-imfi64.ads (Image_Fixed64): Likewise.
	* libgnat/s-imgcha.adb (Image_Character): Likewise.
	* libgnat/s-valuer.adb (Scan_Raw_Real): Likewise.
	* sem_attr.adb (Eval_Attribute): Likewise.
2024-12-12 10:57:58 +01:00
Eric Botcazou
3602347865 ada: Fix pragma Compile_Time_Error for sizes of nonstatic array types
The pragma is consistenly rejected for the sizes of nonstatic array types
because Eval_Attribute does not evaluate it even if it is known.

gcc/ada/ChangeLog:

	* sem_attr.adb (Eval_Attribute): Treat the various size attributes
	like Component_Size for nonstatic array types.
2024-12-12 10:57:58 +01:00
Javier Miranda
92d65775d7 ada: Refactor code of Check_Ambiguous_Call and Valid_Conversion
gcc/ada/ChangeLog:

	* sem_res.adb (Is_Ambiguous_Operand): Add missing decoration of
	the operand when it is labeled overloaded but has just one
	interpretation.
2024-12-12 10:57:57 +01:00
Eric Botcazou
255d701748 ada: Minor refactoring in expansion of array aggregates
This just moves a couple of checks done in conjunction with the predicate
Aggr_Assignment_OK_For_Backend into its body and adds a couple of comments.

No functional changes.

gcc/ada/ChangeLog:

	* exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Add Target formal
	parameter and check that it is not a bit-aligned component or slice.
	Return False in CodePeer mode as well.
	(Build_Array_Aggr_Code): Remove redundant tests done in conjunction
	with a call to Aggr_Assignment_OK_For_Backend.
	(Expand_Array_Aggregate): Likewise.  Add a couple of comments and
	improve formatting.
2024-12-12 10:57:57 +01:00
Ronan Desplanques
1f4e0e7381 ada: Fix validity check for private types
Before this patch, the machinery to generate validity checks got
confused in some situations involving private views of types, and ended
up generating incorrect conversions from floating point types to integer
types. This patch fixes this.

gcc/ada/ChangeLog:

	* exp_attr.adb (Expand_N_Attribute_Reference): Fix computation of type
	category.
2024-12-12 10:57:57 +01:00
Eric Botcazou
ae68258f19 ada: Add minimal support for other delayed aspects on controlled objects
This extends the processing done for the Address aspect to other delayed
aspects.  The External_Name aspect is also reclassified as a representation
aspect and the three representation aspects External_Name, Link_Name and
Linker_Section are moved from the Always_Delay to the Rep_Aspect category,
which makes it possible not to delay them in most cases with a small tweak.

gcc/ada/ChangeLog:

	* aspects.ads (Is_Representation_Aspect): True for External_Name.
	(Aspect_Delay): Use Rep_Aspect for External_Name, Link_Name and
	Linker_Section.
	* einfo.ads (Initialization_Statements): Document extended usage.
	* exp_util.adb (Needs_Initialization_Statements): Return True for
	all delayed aspects.
	* freeze.adb (Check_Address_Clause): Do not move the initialization
	expression here...
	(Freeze_Object_Declaration): ...but here instead, as well as for all
	delayed aspects.  Remove test for pragma Linker_Section.
	* sem_ch13.adb (Analyze_One_Aspect): Do not delay in the Rep_Aspect
	case if the expression is a string literal.
2024-12-12 10:57:57 +01:00
Ronan Desplanques
8061959032 ada: Fix documentation comment for Scan_Sign
This patches fixes a couple of details that were wrong in the
documentation comment for System.Val_Util.Scan_Sign.

gcc/ada/ChangeLog:

	* libgnat/s-valuti.ads (Scan_Sign): Fix documentation comment.
2024-12-12 10:57:56 +01:00
Bob Duff
2e6a337a3e ada: Crash on assignment of task allocator with expanded name
The compiler crashes on an assignment statement of the form
"X.Y := new T;", where X.Y is an expanded name (i.e. not a record
component or similar) and T is a type containing tasks.

gcc/ada/ChangeLog:

	* exp_util.adb (Build_Task_Image_Decls):
	Deal properly with the case of an expanded name.
	Minor cleanup: use a case statement instead of if/elsif chain.
2024-12-12 10:57:56 +01:00
Eric Botcazou
10131a4d6e ada: Lift technical limitation in expansion of record aggregates
The mechanim deferring the expansion of record aggregates nested in other
aggregates with intermediate conditional expressions is disabled in the
case where they contain self-references, because of a technical limitation
in the replacements done by Build_Record_Aggr_Code.  This change lifts it.

gcc/ada/ChangeLog:

	* exp_aggr.adb (Traverse_Proc_For_Aggregate): New generic procedure.
	(Replace_Discriminants): Instantiate it instead of Traverse_Proc.
	(Replace_Self_Reference): Likewise.
	(Convert_To_Assignments): Remove limitation for nested aggregates
	that contain self-references.
2024-12-12 10:57:56 +01:00
Eric Botcazou
3e4b9c6786 ada: Small improvements to expansion of conditional expressions
They comprise using a nonnull accesss type for the indirect expansion to
avoid useless checks, smplifying the expansion of if expressions whose
condition is known at compile time to avoid an N_Expression_With_Actions,
using the indirect expansion for them in the indefinite case too, which
makes the special case for an unconstrained array type obsolete.

No functional changes.

gcc/ada/ChangeLog:

	* exp_ch4.adb (Expand_N_Case_Expression): Remove obsolete comment
	about C code generation.  Do not create a useless target type if
	the parent statement is rewritten instead of the expression.  Use
	a nonnull accesss type for the expansion done for composite types.
	(Expand_N_If_Expression): Simplify the expansion when the condition
	is known at compile time.  Apply the expansion done for by-reference
	types to indefinite types and remove the obsolete special case for
	unconstrained array types  Use a nonnull access type in this case.
	Rename New_If local variable to If_Stmt for the sake of consistency.
2024-12-12 10:57:55 +01:00
Eric Botcazou
ca0145281f ada: Fix wrong finalization with private unconstrained array type
The address passed to the routine attaching a controlled object to the
finalization master must be that of its dope vector for an object whose
nominal subtype is an unconstrained array type, but this is not the case
when this subtype has a private declaration.

gcc/ada/ChangeLog:

	* exp_ch7.adb (Make_Address_For_Finalize): Look at the underlying
	subtype to detect the unconstrained array type case.
	* sprint.adb (Write_Itype) <E_Private_Subtype>: New case.
2024-12-12 10:57:55 +01:00