Commit Graph

223923 Commits

Author SHA1 Message Date
Jakub Jelinek
0c0847158c Update to Unicode 17.0.0
The following patch updates GCC from Unicode 16.0.0 to 17.0.0.

I've followed what the README says and updated also one script from
glibc, but that needed another Unicode file - HangulSyllableType.txt -
around as well, so I'm adding it.
I've added one new test to named-universal-char-escape-1.c for
randomly chosen character from new CJK block.
Note, Unicode 17.0.0 authors forgot to adjust the 4-8 table, I've filed
bugreports about that but the UnicodeData.txt changes for the range ends
and the new range seems to match e.g. what is in the glyph tables, so
the patch follows UnicodeData.txt and not 4-8 table here.

Another thing was that makeuname2c.cc didn't handle correctly when
the size of the generated string table modulo 77 was 76 or 77, in which
case it forgot to emit a semicolon after the string literal and so failed
to compile.

And as can be seen in the emoji-data.txt diff, some properties like
Extended_Pictographic have been removed from certain characters, e.g.
from the Mahjong cards characters except U+1F004, and one libstdc++
test was testing that property exactly on U+1F000.  Dunno why that was
changed, but U+1F004 is the only colored one among tons of black and white
ones.

2025-10-08  Jakub Jelinek  <jakub@redhat.com>

contrib/
	* unicode/README: Add HangulSyllableType.txt file to the
	list as newest utf8_gen.py from glibc now needs it.  Adjust
	git commit hash and change unicode 16 version to 17.
	* unicode/from_glibc/utf8_gen.py: Updated from glibc.
	* unicode/DerivedCoreProperties.txt: Updated from Unicode 17.0.0.
	* unicode/emoji-data.txt: Likewise.
	* unicode/PropList.txt: Likewise.
	* unicode/GraphemeBreakProperty.txt: Likewise.
	* unicode/DerivedNormalizationProps.txt: Likewise.
	* unicode/NameAliases.txt: Likewise.
	* unicode/UnicodeData.txt: Likewise.
	* unicode/EastAsianWidth.txt: Likewise.
	* unicode/DerivedGeneralCategory.txt: Likewise.
	* unicode/HangulSyllableType.txt: New file.
gcc/testsuite/
	* c-c++-common/cpp/named-universal-char-escape-1.c: Add test for
	\N{CJK UNIFIED IDEOGRAPH-3340E}.
libcpp/
	* makeucnid.cc (write_copyright): Adjust copyright year.
	* makeuname2c.cc (generated_ranges): Adjust end points for a couple
	of ranges based on UnicodeData.txt Last changes and add a whole new
	CJK UNIFIED IDEOGRAPH- entry.  None of these changes are in the 4-8
	table, but clearly it has just been forgotten.
	(write_copyright): Adjust copyright year.
	(write_dict): Fix up condition when to print semicolon.
	* generated_cpp_wcwidth.h: Regenerate.
	* ucnid.h: Regenerate.
	* uname2c.h: Regenerate.
libstdc++-v3/
	* include/bits/unicode-data.h: Regenerate.
	* testsuite/ext/unicode/properties.cc: Test __is_extended_pictographic
	on U+1F004 rather than U+1F000.
2025-10-08 18:02:39 +02:00
Jason Merrill
d77b548fb6 c++: clobber non-placement new
And also add the clobber for non-placement new.

For now let's limit the clobber of an array with non-constant bound to
placement new in constant evaluation, where we need it to set the active
member of a union.

And catch some additional cases of there being no actual data to clobber.

This changes the diagnostics in a couple of analyzer tests, but the new
diagnostics are also valid.

It also adds some -Wuninitialized warnings which seem like an improvement;
the lines that now warn about an uninitialized vptr are correct, since
trying to assign to a member of a virtual base reads the vptr of an object
that was never created.

gcc/cp/ChangeLog:

	* init.cc (build_new_1): Also clobber for non-placement new.
	Only loop clobber in constexpr.
	* expr.cc (wrap_with_if_consteval): New.
	* cp-tree.h (wrap_with_if_consteval): Declare.

gcc/testsuite/ChangeLog:

	* g++.dg/analyzer/new-2.C: Adjust diags.
	* g++.dg/analyzer/noexcept-new.C: Adjust diags.
	* g++.dg/warn/Warray-bounds-23.C: Add warnings.
	* g++.dg/warn/Warray-bounds-24.C: Add warnings.
	* g++.dg/cpp26/constexpr-new4a.C: New test.
2025-10-08 16:09:49 +01:00
Antoni Boucher
d52a81fdb3 Regenerate gcc/configure
Use autoconf 2.69 to regenerate gcc/configure

gcc/ChangeLog:

	* configure: Regenerate.
2025-10-08 09:59:06 -04:00
Tomasz Kamiński
43f524c1c4 libstdc++: Fix type in computation of _M_weekday_index.
The value should use divide instead of modulo, as given 1st of month
being weekday X (Mon, Tue, ...), 01 is always X[1], 08 is X[2], e.t.c.

This values is currently not observable, as there is no user-accessible
format specifier that will print it, however it may be exposed in future.

libstdc++-v3/ChangeLog:

	* include/bits/chrono_io.h (_ChronoData::_M_fill_day): Replace
	'%' by '/'.
2025-10-08 15:14:04 +02:00
Trevor Gross
8b6a18ecaf x86-64: mingw: Pass and return _Float16 in vector registers [PR115054]
For MinGW on x86-64, GCC currently passes and returns `_Float16` in
GPRs. Microsoft does not specify an ABI for the type so this is purely
an extension; however, there are a few reasons the current ABI is not
ideal:

1. `float` and `double` are both passed and returned in xmm registers
   under the MSVC ABI, there isn't any reason for `_Float16` to deviate.
2. `_Float16` is returned in xmm0 on Windows x86-32 by both GCC and
   Clang.
3. There is a platform-natural ABI with AVX512-FP16, which requires
   half-precision operands to be in vector registers.
4. System V uses vector registers for `_Float16`.

Thus, update the `HFmode` ABI to both pass and return in vector
registers, meaning its ABI is now identical to `float` and `double`.
This is already Clang's behavior on both its x64 MSVC and MinGW targets,
so the change here also resolves an ABI incompatibility (originally
reported in linked issue).

The results can be verified by evaluating the change in assembly output
with this source:

    void pass_f16(_Float16 x, _Float16 *dst) {
        *dst = x;
    }

    void callee_f16(_Float16);
    void call_f16() {
        callee_f16(1.0);
    }

    _Float16 ret_f16(_Float16 *x) {
        return *x;
    }

    /* Check libcall ABI */

    void extend_f16(_Float16 *x, _Float32 *dst) {
        *dst = (_Float32)*x;
    }

    void trunc_f16(_Float32 *x, _Float16 *dst) {
        *dst = (_Float16)*x;
    }

    /* Float varargs should be in vregs with a zeroed shadow GPR */

    void va(_Float16, ...);
    void va_f16() {
        va(1.0f16, 2.0f16, 3.0f16, 4.0f16, 5.0f16);
    }

While modifying the `function_value_ms_64` `switch` statement, a
redundant condition and trailing whitespace in the 16-byte case is
cleaned up.

2025-09-13  Trevor Gross  <tmgross@umich.edu>

gcc:
	PR target/115054
	* config/i386/i386.cc (function_arg_ms_64,
	function_value_ms_64): Pass and return _Float16 in vector
	registers on Windows.

Signed-off-by: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2025-10-08 12:17:30 +00:00
Jonathan Wakely
9e2db0f899 libstdc++: Add missing include to std/time/format/format.cc
libstdc++-v3/ChangeLog:

	* testsuite/std/time/format/format.cc: Include <vector>.
2025-10-08 12:53:15 +01:00
Richard Biener
055c6cc038 Add boolean pattern for bitwise ops
As we consider bitwise operations possible mask operations we have
to consider the case of only one operand arriving as mask.  The
following compensates for this by creating mask from the other operand
and insert possibly required mask conversions.

	PR tree-optimization/110223
	PR tree-optimization/122128
	* tree-vect-patterns.cc (vect_recog_bool_pattern): Add
	compensation for mixed mask/data bitwise operations.

	* gcc.dg/vect/vect-bool-2.c: New testcase.
	* gcc.dg/vect/vect-bool-cmp-3.c: Likewise.
	* gcc.dg/vect/vect-bool-cmp-4.c: Likewise.
2025-10-08 13:39:05 +02:00
Richard Biener
94f203a369 Check non-strictly vect_internal_def internal defs in integer_type_for_mask
We are missing masks produced by inductions or reductions otherwise.

	* tree-vect-patterns.cc (integer_type_for_mask): Only
	reject vect_external_defs.
2025-10-08 13:39:05 +02:00
Richard Biener
8ba0bb5a4d Adjust g++.dg/vect/pr64410.cc scan
We are now vectorizing more loops in standard library functions.
Restrict the dump scan to the loop we're interested in.

	PR testsuite/120100
	* g++.dg/vect/pr64410.cc: Adjust.
2025-10-08 12:51:56 +02:00
Luc Grosheintz
e269268e45 libstdc++: Implement submdspan_mapping_result. [PR110352]
Implement the class submdspan_mapping_result and add it to the std
module.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (submdspan_mapping_result): New class.
	* src/c++23/std.cc.in (submdspan_mapping_result): Add.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:39:44 +02:00
Luc Grosheintz
15498d5f96 libstdc++: Implement full_extent_t. [PR110352]
Add the class and updates the std module.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (full_extent_t): New class.
	* src/c++23/std.cc.in (full_extent_t): Add.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:35:19 +02:00
Luc Grosheintz
61061664e8 libstdc++: Implement strided_slice from <mdspan>. [PR110352]
Adds strided_slice as standardized in N5014. Also creates
the internal feature testing macro for submdspan.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/bits/version.def (submdspan): New internal macro.
	* include/bits/version.h: Regenerate.
	* include/std/mdspan (strided_slice): New class.
	* src/c++23/std.cc.in (strided_slice): Add.
	* testsuite/23_containers/mdspan/submdspan/strided_slice.cc: New test.
	* testsuite/23_containers/mdspan/submdspan/strided_slice_neg.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:32:17 +02:00
Luc Grosheintz
5733ecea07 libstdc++: Improve and cleanup mdspan related code.
The improvement is that in __index_type_cast, we don't need to check at
runtime if we know that _IndexType is smaller than _OIndexType.

The cleanup is whitespace (overlength lines) in <mdspan>, grouping is_always_foo
and is_foo together, and de-uglifying a variable in test code.

libstdc++-v3/ChangeLog:

	* include/std/mdspan (__mdspan::__index_type_cast): Optimize by
	skipping a __glibcxx_assert if it's know at compile-time.
	(std::layout_left_padded, std::layout_righ_padded): Reorder
	is_always_strided and is_unique member functions.
	* testsuite/23_containers/mdspan/int_like.h: Rename _M_i to
	value.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 12:30:51 +02:00
Richard Biener
6b999bf400 Do not expect 8 byte vectorization with ia32
We are not considering ia32 to be TARGET_MMX_WITH_SSE so the testcase
cannot work there.

	PR target/120091
gcc/testsuite/
	* gcc.target/i386/pr119919.c: Only check for vectorization
	when !ia32.
2025-10-08 11:39:48 +02:00
Luc Grosheintz
bfd41adc61 libstdc++: Implement std::layout_right_padded [PR110352].
This commit adds the right padded layout as described in N5014, with
LWG4372 (dynamic padding value) and LWG4314 (move in operator()).

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/std/mdspan (_RightPaddedIndices): Traits for right
	padded layouts.
	(layout_right::mapping::mapping) New overload for right padded
	layouts.
	(layout_right_padded): Add implementation.
	* src/c++23/std.cc.in (layout_right_padded): Add.
	* testsuite/23_containers/mdspan/layouts/ctors.cc: Update
	test for right padded layouts.
	* testsuite/23_containers/mdspan/layouts/empty.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_traits.h: Ditto.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 11:35:43 +02:00
Luc Grosheintz
8c71d18f54 libstdc++: Implement std::layout_left_padded [PR110352].
This commit adds a new layout layout_left_padded as standardized in
N5014. It adds a purely internal feature testing macro padded_layouts
and registers layout_left_padded in the std module.

This commit implements LWG4372, because without it's not possible
to properly test padded layouts with a dynamic padding value. It also
implements LWG4314, for consistency with prior layouts.

The implementation uses a _PaddedStorage to deduplicate most of the code
shared between left- and right-padded layouts. It's implemented through
aggregation rather than inheritence, because of a bug related to
inheriting conditionally explicit ctors.

The tests are written such that the canonical version works for
layout_left_padded. A version for layout_right_padded is derived
essentially by reversing the order of the extents.

	PR libstdc++/110352

libstdc++-v3/ChangeLog:

	* include/bits/version.def (padded_layouts): Add new internal
	feature testing macro.
	* include/bits/version.h: Regenerate.
	* include/std/mdspan (__fwd_prod): New overload.
	(layout_left_padded): Add declaration and implementation.
	(layout_right_padded): Add declaration only.
	(layout_left::mapping::mapping): New overload for left
	padded mappings.
	(__index_type_cast): New function that performs a checked cast
	to index_type.
	(__is_left_padded_mapping): New concept.
	(__is_right_padded_mapping): Ditto.
	(__standardized_mapping): Recognize left and right padded
	mappings.
	(_LeftPaddedIndices): Traits for left padded details.
	(_PaddedStorage): New class for implementing padded layouts.
	* src/c++23/std.cc.in (layout_left_padded): Add.
	* testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc:
	Refactor and add tests for layout_left_padded.
	* testsuite/23_containers/mdspan/layouts/ctors.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/empty.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.
	* testsuite/23_containers/mdspan/layouts/padded_traits.h: New
	traits.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
2025-10-08 11:22:32 +02:00
Richard Biener
c5bee7e24d Add missing menu item for JIT Language and ABI
Build of gccint.texi is currently broken, the following fixes it.

	* doc/tm.texi.in (JIT Language and ABI): Add menu item.
	* doc/tm.texi: Re-generate.
2025-10-08 11:14:52 +02:00
Alfie Richards
d78bd76a49 c: Fix i386 target attribute regression [PR 122180]
My patch (r16-4182-g73888cefe6da65) broke another target (i386), which this
patch fixes.

The issue was the target_version code was incorrectly being triggered on
targets that do not support target_version semantics (i386).

	PR target/122180

gcc/c/ChangeLog:

	* c-decl.cc (pushdecl): Add TARGET_HAS_FMV_TARGET_ATTRIBUTE check.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr122180.c: New test.
2025-10-08 08:22:26 +00:00
Jakub Jelinek
bb22f7d4d6 gimplify: Fix up __builtin_c[lt]zg gimplification [PR122188]
The following testcase ICEs during gimplification.
The problem is that save_expr sometimes doesn't create a SAVE_EXPR but
returns the original complex tree (COND_EXPR) and the code then uses that
tree in 2 different spots without unsharing.  As this is done during
gimplification it wasn't unshared when whole body is unshared and because
gimplification is destructive, the first time we gimplify it we destruct it
and second time we try to gimplify it we ICE on it.
Now, we could replace one a use with unshare_expr (a), but because this
is a gimplification hook, I think easier than trying to create a save_expr
is just gimplify the argument, then we know it is is_gimple_val and so
something without side-effects and can safely use it twice.  That argument
would be the first thing to gimplify after return GS_OK anyway, so it
doesn't change argument sequencing etc.

2025-10-08  Jakub Jelinek  <jakub@redhat.com>

	PR c/122188
	* c-gimplify.cc (c_gimplify_expr): Gimplify CALL_EXPR_ARG (*expr_p, 0)
	instead of calling save_expr on it.

	* c-c++-common/pr122188.c: New test.
2025-10-08 09:58:41 +02:00
Jakub Jelinek
7fb8339ca3 testsuite: Fix up pr121987.c testcase for ilp32 [PR121206]
The test FAILs on ilp32 targets with
pr121987.c:5:21: warning: unsigned conversion from 'long long int' to 'long unsigned int' changes value from '10000000000' to '1410065408' [-Woverflow]
excess error.  Fixed by using unsigned long long instead of unsigned and
using a suffix on the constant.
Tested on x86_64-linux with -m32/-m64, additionally tested with older cc1
where it ICEd in both cases in upper_bound.

2025-10-08  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/121206
	* gcc.dg/pr121987.c (main): Use unsigned long long type for e instead
	of unsigned long and use ULL suffix on the initializer.
2025-10-08 09:49:25 +02:00
Paul Thomas
39961581f2 Fortran: Fix PDT parameter substitution [PR93175,PR102240,PR102686]
2025-10-08  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/93175
	PR fortran/102240
	PR fortran/102686
	* array.cc (match_array_element_spec): For pdt templates, call
	gfc_correct_parm_expr to elimante extraneous symbols from the
	bound expressions.
	* decl.cc (correct_parm_expr, gfc_correct_parm_expr): New fcns
	that remove symbols that are not PDT parameters from the type
	specification expressions.
	(insert_parameter_exprs): Process function symbols as if they
	are variables in the substitution with parameter expressions.
	(gfc_get_pdt_instance): Make sure that the parameter list of
	PDT components is updated as the instance is built. Move the
	construction of pdt_strings down a bit in the function and
	remove the tie up with pdt_arrays.
	* gfortran.h: Add prototype for gfc_correct_parm_expr.
	* resolve.cc (resolve_component): Skip testing for constant
	specification expressions in pdt_template component string
	lengths and pdt_strings.
	* trans-array.cc (structure_alloc_comps): Remove testing for
	deferred parameters and instead make sure that components of
	PDT type have parameters substituted with the parameter exprs
	of the enclosing PDT.

gcc/testsuite/
	PR fortran/93175
	PR fortran/102240
	PR fortran/102686
	* gfortran.dg/pdt_55.f03: New test.
2025-10-08 08:17:10 +01:00
Richard Biener
81aa79e977 Fixup store bool pattern
I think the bool pattern recognition for a store from a bool we
decided to represent with a mask type is a bit confused.  The
following streamlines it by using the mask to create a data 0/1
and first possibly converting the mask according to the vector
data type we produce (that was missing and is noticable in PR110223).

This alone doesn't fix the 2nd testcase from the PR, but is required.

	PR tree-optimization/110223
	* tree-vect-patterns.cc (vect_recog_bool_pattern): Fix
	mistakes in the store-from-mask bool pattern.  Add
	required mask conversions.
2025-10-08 09:03:05 +02:00
Richard Biener
82a865f3a7 tree-optimization/105490 - improve COND_EXPR bool pattern
We miss to add a mask conversion from the mask producer to the
appropriate mask for the condition operation.  The following moves
required helpers and adds the missing part of the pattern.  That's
required both for the case we have different mask element sizes
and for the case we have a different number of elements because
cond expression vectorization doesn't handle the mask having
different nunits than the data vector.

	PR tree-optimization/105490
	* tree-vect-patterns.cc (build_mask_conversion): Move earlier.
	(vect_convert_mask_for_vectype): Likewise.
	(vect_recog_bool_pattern): Remove redundant truth type
	construction.  Add missing possibly required mask conversion.

	* gcc.dg/vect/vect-cond-14.c: New testcase.
2025-10-08 09:03:05 +02:00
Antoni Boucher
2a54db2d8b libgccjit: Add ability to get CPU features
gcc/ChangeLog:
	PR jit/112466
	* Makefile.in (tm_jit_file_list, tm_jit_include_list, TM_JIT_H,
	JIT_TARGET_DEF, JIT_TARGET_H, JIT_TARGET_OBJS): New variables.
	(tm_jit.h, cs-tm_jit.h, jit/jit-target-hooks-def.h,
	s-jit-target-hooks-def-h, default-jit.o): New rules.
	(s-tm-texi): Also check timestamp on jit-target.def.
	(generated_files): Add TM_JIT_H and jit/jit-target-hooks-def.h.
	(build/genhooks.o): Also depend on JIT_TARGET_DEF.
	* config.gcc (tm_jit_file, jit_target_objs, target_has_targetjitm):
	New variables.
	* config/i386/t-i386 (i386-jit.o): New rule.
	* configure: Regenerate.
	* configure.ac (tm_jit_file_list, tm_jit_include_list,
	jit_target_objs): Add substitutes.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (targetjitm): Document.
	(target_has_targetjitm): Document.
	* genhooks.cc: Include jit/jit-target.def.
	* config/default-jit.cc: New file.
	* config/i386/i386-jit.cc: New file.
	* config/i386/i386-jit.h: New file.

gcc/jit/ChangeLog:
	PR jit/112466
	* Make-lang.in (JIT_OBJS): New variable.
	* jit-playback.cc (replay): Include jit-target.h and initialize
	target.
	* jit-playback.h (class populate_target_info): New class.
	* jit-recording.cc (recording::context::populate_target_info): New
	method.
	* jit-recording.h (recording::context::populate_target_info): New
	method.
	(recording::context::m_populated_target_info): New field.
	* libgccjit.cc: Include jit-target.h.
	(struct gcc_jit_target_info): New struct.
	(gcc_jit_context_get_target_info, gcc_jit_target_info_release,
	gcc_jit_target_info_cpu_supports, gcc_jit_target_info_arch,
	gcc_jit_target_info_supports_target_dependent_type): New functions.
	* libgccjit.h (gcc_jit_context_get_target_info,
	gcc_jit_target_info_release, gcc_jit_target_info_cpu_supports,
	gcc_jit_target_info_arch,
	gcc_jit_target_info_supports_target_dependent_type):
	New functions.
	* libgccjit.map (LIBGCCJIT_ABI_35): New ABI tag.
	* docs/topics/compilation.rst: Add documentation for the
	functions gcc_jit_context_get_target_info, gcc_jit_target_info_release,
	gcc_jit_target_info_cpu_supports, gcc_jit_target_info_arch,
	gcc_jit_target_info_supports_target_dependent_type.
	* docs/topics/compatibility.rst (LIBGCCJIT_ABI_35): New ABI tag.
	* jit-target-def.h: New file.
	* jit-target.cc: New file.
	* jit-target.def: New file.
	* jit-target.h: New file.

gcc/testsuite/ChangeLog:
	PR jit/112466
	* jit.dg/all-non-failing-tests.h: Mention
	test-target-info.c.
	* jit.dg/test-target-info.c: New test.
	* jit.dg/test-error-target-info.c: New test.
2025-10-07 20:28:30 -04:00
GCC Administrator
491cae7d30 Daily bump. 2025-10-08 00:20:55 +00:00
Joseph Myers
84b4687eb4 c: Implement C2y handling of incomplete tentative definitions [PR26581]
Before C2y, a tentative definition (file-scope, not extern, no
initializer) with internal linkage and incomplete type was undefined
behavior ("shall" outside Constraints violated).  In C2y, this has
changed to a constraint violation if the type has not been completed
by the end of the translation unit, and is valid if the type has been
completed by the end of the translation unit.  This change originates
from N3347 but the wording accepted into C2y was that from reflector
message 26758.

In GCC, the case of incomplete array types was a hard error with
-pedantic, rather than a pedwarn, contrary to how -pedantic is
supposed to behave; bug 26581 requested a change to allow this case
with -pedantic (i.e. the change made in C2y).  For incomplete structs
and unions, GCC only diagnoses them if the type remains incomplete at
the end of the translation unit; bug 88727 (*not* fixed here) requests
the case where the type gets completed should also be diagnosed as a
quality of implementation matter (and that bug is still applicable for
pre-C2y langauge versions and -Wc23-c2y-compat).

Change the handling of arrays following C2y; the previous error
becomes a pedwarn_c23 while there is a new error at the end of the
translation unit if the type remains incomplete there in C2y mode.

There is an ambiguity in the wording in C2y for the case where the
type gets completed only in an inner scope; I've raised that in
reflector message 34118.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

	PR c/26581

gcc/c/
	* c-decl.cc (c_finish_incomplete_decl): Give error for tentative
	definition of incomplete array for C2y with internal linkage.
	(finish_decl): Do not set DO_DEFAULT based on -pedantic.  Use
	pedwarn_c23 for missing array sizes for internal linkage.

gcc/testsuite/
	* gcc.dg/c23-incomplete-2.c, gcc.dg/c23-incomplete-3.c,
	gcc.dg/c23-incomplete-4.c, gcc.dg/c2y-incomplete-4.c,
	gcc.dg/c2y-incomplete-5.c: New tests.
	* gcc.dg/c23-thread-local-2.c, gcc.dg/c2y-incomplete-1.c: Update
	expected errors.
2025-10-07 23:04:54 +00:00
H.J. Lu
3dcf3410a7 libbid: Set rounding mode to round-to-nearest for _Decimal128 arithmetic
Since _Decimal128 arithmetic requires the round-to-nearest rounding
mode, define DFP_INIT_ROUNDMODE and DFP_RESTORE_ROUNDMODE, similar to
FP_INIT_ROUNDMODE in sfp-machine.h, to set the rounding mode to
round-to-nearest at _Decimal128 related arithmetic function entrances
and restores it upon return.  This doesn't require linking with libm
when libgcc is used.

libgcc/

	PR target/120691
	* Makefile.in (DECNUMINC): Add -I$(srcdir)/config/$(cpu_type).
	* config/i386/dfp-machine.h: New file.
	* config/i386/32/dfp-machine.h: Likewise.
	* config/i386/64/dfp-machine.h: Likewise.

libgcc/config/libbid/

	PR target/120691
	* bid128_div.c: Run DFP_INIT_ROUNDMODE at function entrace and
	DFP_RESTORE_ROUNDMODE at function exit.
	* bid128_rem.c: Likewise.
	* bid128_sqrt.c: Likewise.
	* bid64_div.c (bid64_div): Likewise.
	* bid64_sqrt.c (bid64_sqrt): Likewise.
	* bid_conf.h: Include <dfp-machine.h>.
	* dfp-machine.h: New file.

gcc/testsuite/

	PR target/120691
	* gcc.target/i386/pr120691.c: New test.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-08 06:08:52 +08:00
Jason Merrill
f4b60fe6d6 c++: new-expr clobber of constant-size array
I previously tried to clobber an array as a whole, but fell back on a loop
due to issues with std::construct_at following the resolution of LWG3436.
But the loop seems to make life hard for the optimizers and it occurs to me
that for a one-element array we can just clobber the element type.

This also fixes some xfails in Warray-bounds-20.C.

gcc/cp/ChangeLog:

	* init.cc (build_new_1): Clobber a constant-bound array as a whole.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Warray-bounds-20.C: Remove xfails, add diags.
2025-10-07 19:34:54 +01:00
Alfie Richards
8b5d577caa docs: Add documentation for TARGET_HAS_FMV_TARGET_ATTRIBUTE macro
Adds documentation for the TARGET_HAS_FMV_TARGET_ATTRIBUTE macro hook.

gcc/ChangeLog:

	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in: Add documentation for TARGET_HAS_FMV_TARGET_ATTRIBUTE.
2025-10-07 16:13:19 +00:00
Georg-Johann Lay
3cbd43d640 AVR: target/122187 - Don't clobber recog_data.operand[] in insn out.
avr.cc::avr_out_extr() and avr.cc::avr_out_extr_not()
changed xop for output, which spoiled the operand for
the next invokation, running into an assertion.

This patch makes a local copy of the operands.

	PR target/122187
gcc/
	* config/avr/avr.cc (avr_out_extr, avr_out_extr_not):
	Make a local copy of the passed rtx[] operands.

gcc/testsuite/
	* gcc.target/avr/torture/pr122187.c: New test.
2025-10-07 17:52:36 +02:00
Jonathan Wakely
26ada8fc9e all: Fix "specifc", "costant" and "constat" typos in comments
gcc/ChangeLog:

	* config/i386/i386-features.cc
	(general_scalar_chain::vector_const_cost): Fix spelling in
	comment.
	* ipa-prop.h (enum jump_func_type): Likewise.
	* tree-vectorizer.cc (try_vectorize_loop_1): Likewise.

gcc/cp/ChangeLog:

	* module.cc (trees_out::lang_vals): Fix spelling in comment.

gcc/jit/ChangeLog:

	* docs/_build/texinfo/libgccjit.texi: Fix spelling.
	* docs/internals/index.rst: Likewise.

libgm2/ChangeLog:

	* configure.host: Fix spelling in comment.

libstdc++-v3/ChangeLog:

	* configure.host: Fix spelling in comment.

gcc/testsuite/ChangeLog:

	* gfortran.dg/dynamic_dispatch_9.f03: Fix spelling in comment.
	* gfortran.dg/use_only_3.inc: Likewise
2025-10-07 15:03:42 +01:00
Robin Dapp
62631c39a7 [PATCH] RISC-V: Detect wrap in shuffle_series_pattern [PR121845].
Hi,

In shuffle_series_pattern we use series_p to determine if the permute
mask is a simple series.  This didn't take into account that series_p
also returns true for e.g. {0, 3, 2, 1} where the step is 3 and the
indices form a series modulo 4.

We emit
 vid + vmul
in order to synthesize a series.  In order to be always correct we would
need a vrem afterwards still which does not seem worth it.

This patch adds the modulo for VLA permutes and punts if we wrap around
for VLS permutes.  I'm not really certain whether we'll really see a wrapping
VLA series (certainly we haven't so far in the test suite) but as we observed
a VLS one here now it appears conservatively correct to module the indices.

Regtested on rv64gcv_zvl512b.

Regards
 Robin

	PR target/121845

gcc/ChangeLog:

	* config/riscv/riscv-v.cc (shuffle_series_patterns):
	Modulo indices for VLA and punt when wrapping for VLS.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr121845.c: New test.
2025-10-07 07:18:27 -06:00
Raphael Moreira Zinsly
34ef2eec90 [PATCH] RISC-V: Fix slide pattern recognition [PR122124]
Ensure the second pivot is really a pivot and it's not in OP1.

	PR target/122124
gcc/ChangeLog:
	* config/riscv/riscv-v.cc (shuffle_slide_patterns): Check if
	the second pivot is in OP1 and improve comments.

gcc/testsuite/ChangeLog:
	* gcc.target/riscv/rvv/autovec/pr122124.c: New test.
2025-10-07 07:14:01 -06:00
Paul Thomas
05d3dd6010 Fortran: Fix ICE in pdt_1[3-5].f03 with -fcheck=all [PR102901]
2025-10-07  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
	PR fortran/102901
	* trans-array.cc (structure_alloc_comps): Do not use
	gfc_check_pdt_dummy with pointer or allocatable components.

gcc/testsuite/
	PR fortran/102901
	* gfortran.dg/pdt_56.f03: Copy of pdt_13.f03 compiled with
	-fcheck=all.
2025-10-07 13:30:43 +01:00
Jonathan Wakely
a06d127372 libstdc++: Initialize local variable in __gnu_cxx::rope
This avoids -Wmaybe-uninitialized warnings.

libstdc++-v3/ChangeLog:

	* include/ext/ropeimpl.h (rope::_S_fetch): Initialize variable.
2025-10-07 12:15:28 +01:00
Jonathan Wakely
2f399316fc libstdc++: Fix -Wparentheses warning in std::mul_sat
libstdc++-v3/ChangeLog:

	* include/bits/sat_arith.h (mul_sat): Add parentheses around
	operands.
2025-10-07 12:15:28 +01:00
Jonathan Wakely
20bf909f18 libstdc++: Fix -Wmaybe-uninitialized warning in another test
Like r16-4120-ge1b9ccaa10df01 this is a false positive, but we can just
initialize the variable.

libstdc++-v3/ChangeLog:

	* testsuite/std/time/parse/parse.cc: Initialize variable.
2025-10-07 12:12:45 +01:00
Jonathan Wakely
5dce50b6a2 libstdc++: Suppress -Wpessimizing-move warnings in shared_ptr tests
libstdc++-v3/ChangeLog:

	* testsuite/20_util/shared_ptr/cons/move.cc: Add comment and
	dg-prune-output for -Wpessimizing-move warning.
	* testsuite/experimental/memory/shared_ptr/cons/move_ctor.cc:
	Likewise.
2025-10-07 12:12:39 +01:00
Jonathan Wakely
9af9532118 libstdc++: Fix -Wreorder warning in std::philox_engine
libstdc++-v3/ChangeLog:

	* include/bits/random.h (philox_engine(result_type)): Reorder
	ctor-initializer-list to match declaration order.
2025-10-07 12:11:21 +01:00
Jonathan Wakely
3f2a291ef3 libstdc++: Fix -Wformat warning in std::string
The __throw_out_of_range_fmt function works like fprintf and so the
arguments corresponding to %zu specifiers need to be size_t. The
std::basic_string<C,T,A>::size_type type is A::size_type which is not
necessarily size_t. Add explicit casts to avoid a -Wformat warning with
-Wsystem-headers.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h (basic_string::_M_check): Cast
	size_type arguments to size_t.
2025-10-07 12:11:21 +01:00
Eric Botcazou
bb23a04417 Revert "Ada: Remove useless Makefile variable"
This reverts commit 49aed8ceb5.
2025-10-07 10:35:05 +02:00
Andrew Pinski
d3e963d1cc match: Extend -(a ptrdiff b) pattern by allowing a nop conversion between the neg and ptrdiff [PR121921]
When I tried to fix this before I didn't realize there was already a pattern for
`-(a ptrdiff b) -> (b ptrdiff a)`, I had added a complex pattern to match `ptr0 - (ptr0 - ptr1)`.
But with there being a pattern for `-(a ptrdiff b)`, we just need to extend the pattern
to support a nop conversion inbetween the negative and the ptrdiff.
Also the check for TYPE_OVERFLOW_UNDEFINED was wrong, in the case of `-(a - b) -> (b - a)`, the check
is !TYPE_OVERFLOW_SANITIZED so this pattern should use the same check.

Bootstrapped and tested on x86_64-linux-gnu.

Changes since v1:
* v2: Use the old type of the pointer_diff rather than ssizetype.

	PR tree-optimization/121921

gcc/ChangeLog:

	* match.pd (`-(a ptrdiff b)`): Extend for a nop_convert
	between the neg and ptrdiff.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr121921-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-10-06 19:05:41 -07:00
Andrew Pinski
decd4277e9 phiopt/cselim: Improve cselim-limited to commonalize all stores [PR122083]
cselim (and the phiopt's cselim-limited) can commonalize a single
store which makes this too limited in some/many cases. Instead let's
commonalize all trailing stores as much as possible (only in the same
order).
The change is smallish, basically the restriction on being the only store
is removed from single_trailing_store_in_bb (renamed too). And also
looping to remove all of the trailing stores instead of just doing one for
the pass.

Note sink will do the same optimization so doing it earlier seems like a good
idea because it improve change inlining size estimates.
For an example with this change, early inlining can happen for min_cmp<long int>
in g++.dg/opt/pr122083-1.C now; that avoids a -Wnonnull warning as the memcmp with
the null argument is optimized early. It can also catch some min in phiopt1 in some
cases.

Bootstrapped and tested on x86_64-linux-gnu.

Changes since v1:
* v2: For !flag_expensive_optimizations, handle the only store rather than just the last
      store.

	PR tree-optimization/122083

gcc/ChangeLog:

	* tree-ssa-phiopt.cc (single_trailing_store_in_bb): Rename to ...
	(trailing_store_in_bb): This and take new argument to check for
	only store.
	(cond_if_else_store_replacement_limited): Update to use
	trailing_store_in_bb.
	(cond_if_else_store_replacement): Loop until
	cond_if_else_store_replacement_limited returns false.
	(pass_phiopt::execute): Instead of calling cond_if_else_store_replacement_limited
	once, also loop on it.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/ssa-pre-19.c: Disable phiopt and cselim.
	* g++.dg/opt/pr122083-1.C: New test.
	* gcc.dg/tree-ssa/cselim-1.c: New test.
	* gcc.dg/tree-ssa/cselim-2.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-10-06 19:05:40 -07:00
H.J. Lu
9242a89d08 x86: Swap %edx/%rdx with %eax/%rax for PR middle-end/122122
Swap %edx/%rdx with %eax/%rax after

commit r16-4255-g075310d3a3ef1a8b483b62d9535887b37f291ee4
Author: Jan Hubicka <hubicka@ucw.cz>
Date:   Mon Oct 6 21:35:22 2025 +0200

    Update profile in tree-ssa-dce

commit 8498ef3d07
Author: Jan Hubicka <hubicka@ucw.cz>
Date:   Wed Oct 1 16:56:15 2025 +0200

    Improve profile update in merge_blocks

	PR middle-end/122122
	* gcc.target/i386/memcpy-pr120683-2.c: Swap %edx/%rdx with
	%eax/%rax after
	* gcc.target/i386/memcpy-pr120683-3.c: Likewise.
	* gcc.target/i386/memcpy-pr120683-4.c: Likewise.
	* gcc.target/i386/memcpy-pr120683-5.c: Likewise.
	* gcc.target/i386/memcpy-pr120683-6.c: Likewise.
	* gcc.target/i386/memcpy-pr120683-7.c: Likewise.
	* gcc.target/i386/pr111657-1.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-07 08:33:16 +08:00
GCC Administrator
f7b0636b5f Daily bump. 2025-10-07 00:21:28 +00:00
Andrew Pinski
b667503f03 cselim: Don't create a phi node if the rhs side are the same [PR122155]
This is a small compile time optimization where if commonalizing stores
that have the same rhs, a phi node does not need to be created.
This uses the same code as what was added for the `= {};` case.
The reason why it is a compile time optimization is that Copy prop
later on will do the same thing so not creating a new phi and a new
ssa name will have a small compile time improvement.

Bootstrapped and tested on x86_64-linux-gnu.

	PR tree-optimization/122155

gcc/ChangeLog:

	* tree-ssa-phiopt.cc (cond_if_else_store_replacement_1): Don't
	create a phi if the 2 rhs are the same.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/cselim-3.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2025-10-06 14:45:46 -07:00
Georg-Johann Lay
e3a05e0502 AVR/LibF7: Implement sincos.
libgcc/config/avr/libf7/
	* libf7-common.mk (F7_ASM_PARTS): Add D_sincos.
	* libf7-asm.sx: (D_sincos): New module implements sincos / sincosl.

gcc/testsuite/
	* gcc.target/avr/sincos-1.c: New test.
2025-10-06 21:37:59 +02:00
Jan Hubicka
075310d3a3 Update profile in tree-ssa-dce
The profile mismatches uncovered by my merge_blocks change are actually caused
by tree-ssa-dce not updating profile of blocks with no statements for whose it
optimized away control dependencies.  In most cases those basic blocks are
merged or skipped as forwarders.  I tried to simply set their count as
uninitialized but that upsets verifier since in some cases we keep the block
around (for example, when it is header of a loop).

In all cases I debugged we optimized away an unnecesary loop and while merging
old code picked porfile of loop preheader, while we now pick loop header.  This
is however not guaranteed and we may process blocks in different order and pick
wrong profile.

Since regions of dead basic blocks must be acyclic it is easy to propagate the
frequencies as implemented by this patch.

Bootstrapped/regtested x86_64-linux. Comitted

gcc/ChangeLog:

	PR middle-end/122122
	* tree-cfgcleanup.cc (tree_forwarder_block_p): Cleanup.
	* tree-ssa-dce.cc (propagate_counts): New function.
	(eliminate_unnecessary_stmts): Use it.
2025-10-06 21:35:22 +02:00
Jan Hubicka
e04e815708 Fix description of --param auto-profile-bbs
gcc/ChangeLog:

	* params.opt (-param=auto-profile-bbs=): Add missing full stop after
	description.
2025-10-06 21:33:47 +02:00
Andrew MacLeod
13f5a627dc If a range's bitmask changes, reflect it in the bounds.
Rather than trying to be smart, if the bitmask changes, adjust all range
bounds to satisfy the bitmask requirements.

	PR tree-optimization/121206
	gcc/
	* value-range.cc (irange::intersect_bitmask): Always call
	set_range_from_bitmask if the bitmask changes.

	gcc/testsuite
	* gcc.dg/pr121987.c: New.
2025-10-06 12:25:33 -04:00