Compare commits

...

107 commits

Author SHA1 Message Date
Xing Li
dd98219865 LoongArch: Change {dg-do-what-default} save and restore logical.
The set of {dg-do-what-default} to 'run' may lead some test hang
during make check.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/loongarch-vector.exp: Change
	{dg-do-what-default} save and restore logical.
2025-04-18 14:53:15 +08:00
GCC Administrator
d776b20148 Daily bump. 2025-04-18 00:16:59 +00:00
翁愷邑
2d6f1ca17f [PATCH] RISC-V: Do not free a riscv_arch_string when handling target-arch attribute
The build_target_option_node() function may return a cached node when
fndecl having the same effective global_options. Therefore, freeing
memory used in target nodes can lead to a use-after-free issue, as a
target node may be shared by multiple fndecl.
This issue occurs in gcc.target/riscv/target-attr-16.c, where all
functions have the same march, but the last function tries to free its
old x_riscv_arch_string (which is shared) when processing the second
target attribute.However, the behavior of this issue depends on how the
OS handles malloc. It's very likely that xstrdup returns the old address
just freed, coincidentally hiding the issue. We can verify the issue by
forcing xstrdup to return a new address, e.g.,

-  if (opts->x_riscv_arch_string != default_opts->x_riscv_arch_string)
-    free (CONST_CAST (void *, (const void *) opts->x_riscv_arch_string));
+  // Force it to use a new address, NFCI
+  const char *tmp = opts->x_riscv_arch_string;
   opts->x_riscv_arch_string = xstrdup (local_arch_str);

+  if (tmp != default_opts->x_riscv_arch_string)
+    free (CONST_CAST (void *, (const void *) tmp));

This patch replaces xstrdup with ggc_strdup and let gc to take care of
unused strings.

gcc/ChangeLog:

	* config/riscv/riscv-target-attr.cc
	(riscv_target_attr_parser::update_settings):
	Do not manually free any arch string.
2025-04-17 16:24:20 -06:00
Jason Merrill
3f0eccfd90 c++: constexpr virtual base diagnostic
I thought this diagnostic could be clearer that the problem is the
combination of virtual bases and constexpr constructor, not just complain
that the class has virtual bases without context.

gcc/cp/ChangeLog:

	* constexpr.cc (is_valid_constexpr_fn): Improve diagnostic.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/constexpr-dtor16.C: Adjust diagnostic.
	* g++.dg/cpp2a/constexpr-dynamic10.C: Likewise.
2025-04-17 16:30:15 -04:00
Eric Botcazou
3dabe6a53e Document peculiarities of BOOLEAN_TYPE
gcc/
	* tree.def (BOOLEAN_TYPE): Add more details.
2025-04-17 20:48:26 +02:00
Jason Merrill
4cff0434e8 c++: constexpr new diagnostic location
Presenting the allocation location as the location of the outermost
expression we're trying to evaluate is inaccurate; let's provide both
locations.

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_outermost_constant_expr): Give both
	expression and allocation location in allocated storage diagnostics.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-new.C: Adjust diagnostics.
	* g++.dg/cpp1z/constexpr-asm-5.C: Likewise.
	* g++.dg/cpp26/static_assert1.C: Likewise.
	* g++.dg/cpp2a/constexpr-dtor7.C: Likewise.
	* g++.dg/cpp2a/constexpr-new26.C: Likewise.
	* g++.dg/cpp2a/constexpr-new3.C: Likewise.
	* g++.dg/cpp2a/constinit14.C: Likewise.
2025-04-17 13:21:09 -04:00
Jason Merrill
53d4e355db c++: vec_safe_reserve usage tweaks
A couple of cleanups from noticing that the semantics of
std::vector<T>::reserve() (request the new minimum allocation) differ from
the GCC vec<...>::reserve() (request a minimum number of slots available).

In preserve_state, we were tripling the size of the vec when doubling it is
more than enough.

In get_tinfo_desc we were using vec_safe_reserve properly, but it's
simpler to use vec_safe_grow_cleared.

gcc/cp/ChangeLog:

	* name-lookup.cc (name_lookup::preserve_state): Fix reserve call.
	* rtti.cc (get_tinfo_desc): Use vec_safe_grow_cleared.
2025-04-17 13:20:39 -04:00
Jason Merrill
20e31f507a c++: improve pack index diagnostics
While looking at pack-indexing16.C I thought it would be helpful to print
the problematic type/value.

gcc/cp/ChangeLog:

	* semantics.cc (finish_type_pack_element): Add more info
	to diagnostics.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust
	diagnostic.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp26/pack-indexing2.C: Adjust diagnostics.
	* g++.dg/ext/type_pack_element2.C: Likewise.
	* g++.dg/ext/type_pack_element4.C: Likewise.
2025-04-17 13:19:42 -04:00
Jason Merrill
eff4dc4233 c++: add assert to cp_make_fname_decl
In the PR118629 testcase, pushdecl_outermost_localscope was failing and
returning error_mark_node without ever actually giving an error; in addition
to my earlier fix for the failure, make sure failures aren't silent.

gcc/cp/ChangeLog:

	* decl.cc (cp_make_fname_decl): Prevent silent failure.
2025-04-17 13:19:17 -04:00
Jason Merrill
47b62be9ca c++: 'requires' diagnostic before C++20
We were giving a generic "not declared" error for a requires-expression
without concepts enabled; we can do better.

gcc/cp/ChangeLog:

	* lex.cc (unqualified_name_lookup_error): Handle 'requires' better.
2025-04-17 13:18:44 -04:00
Sam James
7c47badcdc
doc: say "compatible types" for -fstrict-aliasing
Include the term used in the standard to ease further research for users,
and while at it, rephrase the description of the rule entirely using
Alexander Monakov's suggestion: it was previously wrong (and imprecise) as
"the same address" may well be re-used later on, and the issue is the
access via an expression of the wrong type.

gcc/ChangeLog:

	* doc/invoke.texi: Use "compatible types" term. Rephrase to be
	more precise (and correct).
2025-04-17 16:19:44 +01:00
Jakub Jelinek
c237297ee5 ada: bump Library_Version to 16.
gcc/ada/ChangeLog:

	* gnatvsn.ads: Bump Library_Version to 16.
2025-04-17 12:51:46 +02:00
Jakub Jelinek
6027ba0c05 Update crontab and git_update_version.py
2025-04-17  Jakub Jelinek  <jakub@redhat.com>

maintainer-scripts/
	* crontab: Snapshots from trunk are now GCC 16 related.
	Add GCC 15 snapshots from the respective branch.
contrib/
	* gcc-changelog/git_update_version.py (active_refs): Add
	releases/gcc-15.
2025-04-17 12:50:35 +02:00
Jakub Jelinek
7eac294e08 Bump BASE-VER.
2025-04-17  Jakub Jelinek  <jakub@redhat.com>

	* BASE-VER: Set to 16.0.0.
2025-04-17 12:40:07 +02:00
Jakub Jelinek
5d05d496b2 libgomp: Don't test ompx::allocator::gnu_pinned_mem on non-linux targets.
The libgomp.c/alloc-pinned*.c test have
/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
so they are only run on Linux targets right now.  Duplicating the tests or
reworking them into headers looked like too much work for me right now this
late in stage4, so I've just #ifdefed the uses at least for now.

2025-04-17  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/119849
	* testsuite/libgomp.c++/allocator-1.C (test_inequality, main): Guard
	ompx::allocator::gnu_pinned_mem uses with #ifdef __gnu_linux__.
	* testsuite/libgomp.c++/allocator-2.C (main): Likewise.
2025-04-17 12:14:15 +02:00
Tomasz Kamiński
930b504b59 libstdc++: Fixed signed comparision in _M_parse_fill_and_align [PR119840]
Explicitly cast elements of __not_fill to _CharT. Only '{' and ':'
are used as `__not_fill`, so they are never negative.

	PR libstdc++/119840

libstdc++-v3/ChangeLog:

	* include/std/format (_M_parse_fill_and_align): Cast elements of
	__not_fill to _CharT.
2025-04-17 11:56:58 +02:00
Tamar Christina
7cf5503e0a middle-end: fix masking for partial vectors and early break [PR119351]
The following testcase shows an incorrect masked codegen:

#define N 512
#define START 1
#define END 505

int x[N] __attribute__((aligned(32)));

int __attribute__((noipa))
foo (void)
{
  int z = 0;
  for (unsigned int i = START; i < END; ++i)
    {
      z++;
      if (x[i] > 0)
        continue;

      return z;
    }
  return -1;
}

notice how there's a continue there instead of a break.  This means we generate
a control flow where success stays within the loop iteration:

  mask_patt_9.12_46 = vect__1.11_45 > { 0, 0, 0, 0 };
  vec_mask_and_47 = mask_patt_9.12_46 & loop_mask_41;
  if (vec_mask_and_47 == { -1, -1, -1, -1 })
    goto <bb 4>; [41.48%]
  else
    goto <bb 15>; [58.52%]

However when loop_mask_41 is a partial mask this comparison can lead to an
incorrect match.  In this case the mask is:

  # loop_mask_41 = PHI <next_mask_63(6), { 0, -1, -1, -1 }(2)>

due to peeling for alignment with masking and compiling with
-msve-vector-bits=128.

At codegen time we generate:

	ptrue   p15.s, vl4
	ptrue   p7.b, vl1
	not     p7.b, p15/z, p7.b
.L5:
	ld1w    z29.s, p7/z, [x1, x0, lsl 2]
	cmpgt   p7.s, p7/z, z29.s, #0
	not     p7.b, p15/z, p7.b
	ptest   p15, p7.b
	b.none  .L2
	...<early exit>...

Here the basic blocks are rotated and a not is generated.
But the generated not is unmasked (or predicated over an ALL true mask in this
case).  This has the unintended side-effect of flipping the results of the
inactive lanes (which were zero'd by the cmpgt) into -1.  Which then incorrectly
causes us to not take the branch to .L2.

This is happening because we're not comparing against the right value for the
forall case.  This patch gets rid of the forall case by rewriting the
if(all(mask)) into if (!all(mask)) which is the same as if (any(~mask)) by
negating the masks and flipping the branches.

	1. For unmasked loops we simply reduce the ~mask.
	2. For masked loops we reduce (~mask & loop_mask) which is the same as
	   doing (mask & loop_mask) ^ loop_mask.

For the above we now generate:

.L5:
        ld1w    z28.s, p7/z, [x1, x0, lsl 2]
        cmple   p7.s, p7/z, z28.s, #0
        ptest   p15, p7.b
        b.none  .L2

This fixes gromacs with > 1 OpenMP threads and improves performance.

gcc/ChangeLog:

	PR tree-optimization/119351
	* tree-vect-stmts.cc (vectorizable_early_exit): Mask both operands of
	the gcond for partial masking support.

gcc/testsuite/ChangeLog:

	PR tree-optimization/119351
	* gcc.target/aarch64/sve/pr119351.c: New test.
	* gcc.target/aarch64/sve/pr119351_run.c: New test.
2025-04-17 10:41:10 +01:00
Jonathan Wakely
0be3dff1aa
libstdc++: Do not use 'not' alternative token in <format>
This fixes:
FAIL: 17_intro/headers/c++1998/operator_names.cc  -std=gnu++23 (test for excess errors)
FAIL: 17_intro/headers/c++1998/operator_names.cc  -std=gnu++26 (test for excess errors)

The purpose of 'not defined<format_kind<R>>' is to be ill-formed (as
required by [format.range.fmtkind]) and to give an error that includes
the string "not defined<format_kind<R>>". That was intended to tell you
that format_kind<R> is not defined, just like it says!

But user code can use -fno-operator-names so we can't use 'not' here,
and "! defined" in the diagnostic doesn't seem as user-friendly. It also
raises questions about whether it was intended to be the preprocessor
token 'defined' (it's not) or where 'defined' is defined (it's not).

Replace it with __primary_template_not_defined<format_kind<R>> and a
comment, which seems to give a fairly clear diagnostic with both GCC and
Clang. The diagnostic now looks like:

.../include/c++/15.0.1/format:5165:7: error: use of 'std::format_kind<int>' before deduction of 'auto'
 5165 |       format_kind<_Rg> // you can specialize this for non-const input ranges
      |       ^~~~~~~~~~~~~~~~
.../include/c++/15.0.1/format:5164:35: error: '__primary_template_not_defined' was not declared in this scope
 5164 |     __primary_template_not_defined(
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 5165 |       format_kind<_Rg> // you can specialize this for non-const input ranges
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5166 |     );
      |     ~

libstdc++-v3/ChangeLog:

	* include/std/format (format_kind): Do not use 'not'
	alternative token to make the primary template ill-formed. Use
	the undeclared identifier __primary_template_not_defined and a
	comment that will appear in diagnostics.
	* testsuite/std/format/ranges/format_kind_neg.cc: New test.
2025-04-17 10:11:49 +01:00
Jakub Jelinek
22fe83d6fc s390: Use match_scratch instead of scratch in define_split [PR119834]
The following testcase ICEs since r15-1579 (addition of late combiner),
because *clrmem_short can't be split.
The problem is that the define_insn uses
   (use (match_operand 1 "nonmemory_operand" "n,a,a,a"))
   (use (match_operand 2 "immediate_operand" "X,R,X,X"))
   (clobber (match_scratch:P 3 "=X,X,X,&a"))
and define_split assumed that if operands[1] is const_int_operand,
match_scratch will be always scratch, and it will be reg only if
it was the last alternative where operands[1] is a reg.
The pattern doesn't guarantee it though, of course RA will not try to
uselessly assign a reg there if it is not needed, but during RA
on the testcase below we match the last alternative, but then comes
late combiner and propagates const_int 3 into operands[1].  And that
matches fine, match_scratch matches either scratch or reg and the constraint
in that case is X for the first variant, so still just fine.  But we won't
split that because the splitters only expect scratch.

The following patch fixes it by using match_scratch instead of scratch,
so that it accepts either.

2025-04-17  Jakub Jelinek  <jakub@redhat.com>

	PR target/119834
	* config/s390/s390.md (define_split after *cpymem_short): Use
	(clobber (match_scratch N)) instead of (clobber (scratch)).  Use
	(match_dup 4) and operands[4] instead of (match_dup 3) and operands[3]
	in the last of those.
	(define_split after *clrmem_short): Use (clobber (match_scratch N))
	instead of (clobber (scratch)).
	(define_split after *cmpmem_short): Likewise.

	* g++.target/s390/pr119834.C: New test.
2025-04-17 10:57:18 +02:00
Tomasz Kamiński
843b273c68 libstdc++: Remove dead code in range_formatter::format [PR109162]
Because the _M_format(__rg, __fc) were placed outside of if constexpr,
these method and its children  where instantiated, even if
_M_format<const _Range> could be used.

To simplify the if constexpr chain, we introduce a __simply_formattable_range
(name based on simple-view) exposition only concept, that checks if range is
const and mutable formattable and uses same formatter specialization for
references in each case.

	PR libstdc++/109162

libstdc++-v3/ChangeLog:

	* include/std/format (__format::__simply_formattable_range): Define.
	(range_formatter::format): Do not instantiate _M_format for mutable
	_Rg if const _Rg can be used.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-17 10:50:34 +02:00
Thomas Schwinge
55620672d7 nvptx: Remove 'TARGET_ASM_NEED_VAR_DECL_BEFORE_USE'
Unused; remnant of an (internal) experiment, before we had nvptx 'as'.

	gcc/
	* config/nvptx/nvptx.cc (TARGET_ASM_NEED_VAR_DECL_BEFORE_USE):
	Don't '#define'.
2025-04-17 10:43:16 +02:00
Tobias Burnus
4bff3f0b89 libgomp.texi: For HIP interop, mention cpp defines to set
The HIP header files recognize the used compiler, defaulting to either AMD
or Nvidia/CUDA; thus, the alternative way of explicitly defining a macro is
less prominently documented. With GCC, the user has to define the
preprocessor macro manually. Hence, as a service to the user, mention
__HIP_PLATFORM_AMD__ and __HIP_PLATFORM_NVIDIA__ in the interop documentation,
even though it has only indirectly to do with GCC and its interop support.

Note to commit-log readers, only: For Fortran, the hipfort modules can be
used; when compiling the hipfort package (defaults to use gfortran), it
generates the module (*.mod) files in include/hipfort/{amdgcn,nvidia}/ such
that the choice is made by setting the respective include path.

libgomp/ChangeLog:

	* libgomp.texi (gcn interop, nvptx interop): For HIP with C/C++, add
	a note about setting a preprocessor define.
2025-04-17 10:21:05 +02:00
Iain Buclaw
0eae20c899 d: Fix infinite loop regression in CTFE
An infinite loop was introduced by a previous refactoring in the
semantic pass for DeclarationExp nodes. Ensure the loop properly
terminates and add tests cases.

gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd 956e73d64e.

gcc/testsuite/ChangeLog:

	* gdc.test/fail_compilation/test21247.d: New test.
	* gdc.test/fail_compilation/test21247b.d: New test.

Reviewed-on: https://github.com/dlang/dmd/pull/21248
2025-04-17 08:59:36 +02:00
Hans-Peter Nilsson
a4f81e168e combine: Correct comments about combine_validate_cost
Fix misleading comments.  That function only determines whether
replacements cost more; it doesn't actually *validate* costs as being
cheaper.

For example, it returns true also if it for various reasons cannot
determine the costs, or if the new cost is the same, like when doing
an identity replacement.  The code has been the same since
r0-59417-g64b8935d4809f3.

	* combine.cc: Correct comments about combine_validate_cost.
2025-04-17 05:09:36 +02:00
Jason Merrill
ac31e41c58 c++: ill-formed constexpr function [PR113360]
If we already gave an error while parsing a function, we don't also need to
try to explain what's wrong with it when we later try to use it in a
constant-expression.  In the new testcase explain_invalid_constexpr_fn
couldn't find anything still in the function to complain about, so it said
because: followed by nothing.

We still try to constant-evaluate it to reduce error cascades, but we
shouldn't complain if it doesn't work very well.

This flag is similar to CLASSTYPE_ERRONEOUS that I added a while back.

	PR c++/113360

gcc/cp/ChangeLog:

	* cp-tree.h (struct language_function): Add erroneous bit.
	* constexpr.cc (explain_invalid_constexpr_fn): Return if set.
	(cxx_eval_call_expression): Quiet if set.
	* parser.cc (cp_parser_function_definition_after_declarator)
	* pt.cc (instantiate_body): Set it.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/constexpr-nonlit18.C: Remove redundant message.
	* g++.dg/cpp1y/constexpr-diag2.C: New test.
	* g++.dg/cpp1y/pr63996.C: Adjust expected errors.
	* g++.dg/template/explicit-args6.C: Likewise.
	* g++.dg/cpp0x/constexpr-ice21.C: Likewise.
2025-04-16 22:25:45 -04:00
GCC Administrator
5e3646a3cb Daily bump. 2025-04-17 00:18:03 +00:00
Alexandre Oliva
7b9d8d4315 [testsuite] [ppc] ipa-sra-19.c: pass -Wno-psabi on powerpc-*-elf as well
Like other ppc targets, powerpc-*-elf needs -Wno-psabi to compile
gcc.dg/ipa/ipa-sra-19.c without an undesired warning about vector
argument passing.


for  gcc/testsuite/ChangeLog

	* gcc.dg/ipa/ipa-sra-19.c: Add -Wno-psabi on ppc-elf too.
2025-04-16 20:21:42 -03:00
Sandra Loosemore
47561e459e Doc: Document raw string literals as GNU C extension [PR88382]
gcc/ChangeLog
	PR c/88382
	* doc/extend.texi (Syntax Extensions): Adjust menu.
	(Raw String Literals): New section.
2025-04-16 22:21:39 +00:00
Peter Bergner
17c5ad2581 testsuite: Replace altivec vector attribute with generic equivalent [PR112822]
Usage of the altivec vector attribute requires use of the -maltivec option.
Replace with a generic equivalent which allows building the test case on
multiple other targets and non-altivec ppc cpus, but still diagnoses the
ICE on unfixed compilers.

2025-04-16  Peter Bergner  <bergner@linux.ibm.com>

gcc/testsuite/
	PR tree-optimization/112822
	* g++.dg/pr112822.C: Replace altivec vector attribute with a generic
	vector attribute.
2025-04-16 21:51:52 +00:00
Bob Dubner
c3e721f489 cobol: Eliminate gcc/cobol/LICENSE. [PR119759]
gcc/cobol

	PR cobol/119759
	* LICENSE: Deleted.
2025-04-16 16:55:12 -04:00
Keith Packard
83340869a2 [PATCH] rx: avoid adding setpsw for rx_cmpstrn when len is const
pattern using rx_cmpstrn is cmpstrsi for which len is a constant -1,
so we'll be moving the setpsw instructions from rx_cmpstrn to
cmpstrnsi as follows:

 1. Adjust the predicate on the length operand from "register_operand"
    to "nonmemory_operand". This will allow constants to appear here,
    instead of having them already transferred into a register.

 2. Check to see if the len value is constant, and then check if it is
    actually zero. In that case, short-circuit the rest of the pattern
    and set the result register to 0.

 3. Emit 'setpsw c' and 'setpsw z' instructions when the len is not a
    constant, in case it turns out to be zero at runtime.

 4. Remove the two 'setpsw' instructions from rx_cmpstrn.

gcc/
	* config/rx/rx.md (cmpstrnsi): Allow constant length.  For
	static length 0, just store 0 into the output register.
	For dynamic zero, set C/Z appropriately.
	(rxcmpstrn): No longer set C/Z.
2025-04-16 14:10:18 -06:00
Eric Botcazou
d5d7dfab81 Fix wrong optimization of conditional expression with enumeration type
This is a regression introduced on the mainline and 14 branch by:
  https://gcc.gnu.org/pipermail/gcc-cvs/2023-October/391658.html

The change bypasses int_fits_type_p (essentially) to work around the
signedness constraints, but in doing so disregards the peculiarities
of boolean types whose precision is not 1 dealt with by the predicate,
leading to the creation of a problematic conversion here.

Fixed by special-casing boolean types whose precision is not 1, as done
in several other places.

gcc/
	* tree-ssa-phiopt.cc (factor_out_conditional_operation): Do not
	bypass the int_fits_type_p test for boolean types whose precision
	is not 1.

gcc/testsuite/
	* gnat.dg/opt105.adb: New test.
	* gnat.dg/opt105_pkg.ads, gnat.dg/opt105_pkg.adb: New helper.
2025-04-16 22:05:00 +02:00
Sandra Loosemore
dbffeadf7f Doc: make regenerate-opt-urls
gcc/ChangeLog
	* common.opt.urls: Regenerated.
2025-04-16 18:54:53 +00:00
Jason Merrill
5fdb0145fb c++: templates, attributes, #pragma target [PR114772]
Since r12-5426 apply_late_template_attributes suppresses various global
state to avoid applying active pragmas to earlier declarations; we also
need to override target_option_current_node.

	PR c++/114772
	PR c++/101180

gcc/cp/ChangeLog:

	* pt.cc (apply_late_template_attributes): Also override
	target_option_current_node.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/pragma-target2.C: New test.
2025-04-16 14:50:13 -04:00
Jason Merrill
b0d7d644f3 c++: format attribute redeclaration [PR116954]
Here when merging the two decls, remove_contract_attributes loses
ATTR_IS_DEPENDENT on the format attribute, so apply_late_template_attributes
just returns, so the attribute doesn't get propagated to the type where the
warning looks for it.

Fixed by using copy_node instead of tree_cons to preserve flags.

	PR c++/116954

gcc/cp/ChangeLog:

	* contracts.cc (remove_contract_attributes): Preserve flags
	on the attribute list.

gcc/testsuite/ChangeLog:

	* g++.dg/warn/Wformat-3.C: New test.
2025-04-16 14:48:35 -04:00
Ard Biesheuvel
6b4569a3eb i386: Enable -mnop-mcount for -fpic with PLTs [PR119386]
-mnop-mcount can be trivially enabled for -fPIC codegen as long as PLTs
are being used, given that the instruction encodings are identical, only
the target may resolve differently depending on how the linker decides
to incorporate the object file.

So relax the option check, and add a test to ensure that 5-byte NOPs are
emitted when -mnop-mcount is being used.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

gcc/ChangeLog:

	PR target/119386
	* config/i386/i386-options.cc: Permit -mnop-mcount when
	using -fpic with PLTs.

gcc/testsuite/ChangeLog:

	PR target/119386
	* gcc.target/i386/pr119386-3.c: New test.
2025-04-16 20:38:20 +02:00
Ard Biesheuvel
9b0ae0a8d7 i386: Prefer PLT indirection for __fentry__ calls under -fPIC [PR119386]
Commit bde21de120 ("i386: Honour -mdirect-extern-access when calling
__fentry__") updated the logic that emits mcount() / __fentry__() calls
into function prologues when profiling is enabled, to avoid GOT-based
indirect calls when a direct call would suffice.

There are two problems with that change:
- it relies on -mdirect-extern-access rather than -fno-plt to decide
  whether or not a direct [PLT based] call is appropriate;
- for the PLT case, it falls through to x86_print_call_or_nop(), which
  does not emit the @PLT suffix, resulting in the wrong relocation to be
  used (R_X86_64_PC32 instead of R_X86_64_PLT32)

Fix this by testing flag_plt instead of ix86_direct_extern_access, and
updating x86_print_call_or_nop() to take flag_pic and flag_plt into
account. This also ensures that -mnop-mcount works as expected when
emitting the PLT based profiling calls.

While at it, fix the 32-bit logic as well, and issue a PLT call unless
PLTs are explicitly disabled.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

gcc/ChangeLog:

	PR target/119386
	* config/i386/i386.cc (x86_print_call_or_nop): Add @PLT suffix
	where appropriate.
	(x86_function_profiler): Fall through to x86_print_call_or_nop()
	for PIC codegen when flag_plt is set.

gcc/testsuite/ChangeLog:

	PR target/119386
	* gcc.target/i386/pr119386-1.c: New test.
	* gcc.target/i386/pr119386-2.c: New test.
2025-04-16 20:38:02 +02:00
Sandra Loosemore
a5212edf26 Doc: Add pointer to --help use to main entry for -Q option [PR90465]
-Q does something completely different in conjunction with --help than it
does otherwise; its main entry in the manual didn't mention that, nor did
-Q have an entry in the index for the --help usage.

gcc/ChangeLog
	PR driver/90465
	* doc/invoke.texi (Overall Options): Add a @cindex for -Q in
	connection with --help=.
	(Developer Options): Point at --help= documentation for the
	other use of -Q.
2025-04-16 18:27:34 +00:00
Harald Anlauf
4e3060ee17 Fortran: pure subroutine with pure procedure as dummy [PR106948]
PR fortran/106948

gcc/fortran/ChangeLog:

	* resolve.cc (gfc_pure_function): If a function has been resolved,
	but esym is not yet set, look at its attributes to see whether it
	is pure or elemental.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pure_formal_proc_4.f90: New test.
2025-04-16 19:05:59 +02:00
Thomas Schwinge
518efed8cb Remove 'ALWAYS_INLINE' workaround in 'libgomp.c++/target-exceptions-pr118794-1.C'
With commit ca9cffe737
"For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]",
we're able to remove the 'ALWAYS_INLINE' workaround added in
commit fe283dba77
"GCN, nvptx: Support '-mfake-exceptions', and use it for offloading compilation [PR118794]".

	libgomp/
	* testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Remove
	'ALWAYS_INLINE' workaround.
2025-04-16 18:31:03 +02:00
Jakub Jelinek
34fe8e9000 libatomic: Fix up libat_{,un}lock_n for mingw [PR119796]
Here is just a port of the previously posted patch to mingw which
clearly has the same problems.

2025-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR libgcc/101075
	PR libgcc/119796
	* config/mingw/lock.c (libat_lock_n, libat_unlock_n): Start with
	computing how many locks will be needed and take into account
	((uintptr_t)ptr % WATCH_SIZE).  If some locks from the end of the
	locks array and others from the start of it will be needed, first
	lock the ones from the start followed by ones from the end.
2025-04-16 17:22:49 +02:00
Jakub Jelinek
61dfb0747a libatomic: Fix up libat_{,un}lock_n [PR119796]
As mentioned in the PR (and I think in PR101075 too), we can run into
deadlock with libat_lock_n calls with larger n.
As mentioned in PR66842, we use multiple locks (normally 64 mutexes
for each 64 byte cache line in 4KiB page) and currently can lock more
than one lock, in particular for n [0, 64] a single lock, for n [65, 128]
2 locks, for n [129, 192] 3 locks etc.
There are two problems with this:
1) we can deadlock if there is some wrap-around, because the locks are
   acquired always in the order from addr_hash (ptr) up to
   locks[NLOCKS-1].mutex and then if needed from locks[0].mutex onwards;
   so if e.g. 2 threads perform libat_lock_n with n = 2048+64, in one
   case at pointer starting at page boundary and in another case at
   page boundary + 2048 bytes, the first thread can lock the first
   32 mutexes, the second thread can lock the last 32 mutexes and
   then first thread wait for the lock 32 held by second thread and
   second thread wait for the lock 0 held by the first thread;
   fixed below by always locking the locks in order of increasing
   index, if there is a wrap-around, by locking in 2 loops, first
   locking some locks at the start of the array and second at the
   end of it
2) the number of locks seems to be determined solely depending on the
   n value, I think that is wrong, we don't know the structure alignment
   on the libatomic side, it could very well be 1 byte aligned struct,
   and so how many cachelines are actually (partly or fully) occupied
   by the atomic access depends not just on the size, but also on
   ptr % WATCH_SIZE, e.g. 2 byte structure at address page_boundary+63
   should IMHO lock 2 locks because it occupies the first and second
   cacheline

Note, before this patch it locked exactly one lock for n = 0, while
with this patch it could lock either no locks at all (if it is at cacheline
boundary) or 1 (otherwise).
Dunno of libatomic APIs can be called for zero sizes and whether
we actually care that much how many mutexes are locked in that case,
because one can't actually read/write anything into zero sized memory.
If you think it is important, I could add else if (nlocks == 0) nlocks = 1;
in both spots.

2025-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR libgcc/101075
	PR libgcc/119796
	* config/posix/lock.c (libat_lock_n, libat_unlock_n): Start with
	computing how many locks will be needed and take into account
	((uintptr_t)ptr % WATCH_SIZE).  If some locks from the end of the
	locks array and others from the start of it will be needed, first
	lock the ones from the start followed by ones from the end.
2025-04-16 17:21:39 +02:00
Thomas Schwinge
0b2a2490be Add 'libgomp.c++/pr106445-1{,-O0}.C' [PR106445]
PR target/106445
	libgomp/
	* testsuite/libgomp.c++/pr106445-1.C: New.
	* testsuite/libgomp.c++/pr106445-1-O0.C: Likewise.
2025-04-16 16:07:07 +02:00
Thomas Schwinge
ca9cffe737 For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
PR target/97106
	gcc/
	* config/nvptx/nvptx.cc (nvptx_asm_output_def_from_decls)
	[ACCEL_COMPILER]: Make sure to emit C++ constructor, destructor
	aliases.
	libgomp/
	* testsuite/libgomp.c++/pr96390.C: Un-XFAIL nvptx offloading.
	* testsuite/libgomp.c-c++-common/pr96390.c: Adjust.
2025-04-16 16:03:04 +02:00
Jan Hubicka
eabba7be04 Stream ipa_return_value_summary
Add streaming of return summaries from compile time to ltrans
which are now needed for vrp to not ouput false errors on musttail.

	Co-authored-by: Jakub Jelinek <jakub@redhat.com>

gcc/ChangeLog:
	PR tree-optimization/119614

	* ipa-prop.cc (ipa_write_return_summaries): New function.
	(ipa_record_return_value_range_1): Break out from ....
	(ipa_record_return_value_range): ... here.
	(ipa_read_return_summaries): New function.
	(ipa_prop_read_section): Read return summaries.
	(read_ipcp_transformation_info): Read return summaries.
	(ipcp_write_transformation_summaries): Write return summaries;
	do not stream stray 0.

gcc/testsuite/ChangeLog:

	* g++.dg/lto/pr119614_0.C: New test.
2025-04-16 15:28:32 +02:00
Waffl3x
0e8b6f0dad MAINTAINERS: Add myself to Write After Approval
ChangeLog:

	* MAINTAINERS: Add myself.
2025-04-16 07:26:50 -06:00
Tomasz Kamiński
aef8797522 libstdc++: Fix constification in range_formatter::format [PR109162]
The _Rg is deduced to lvalue reference for the lvalue arguments,
and in such case __format::__maybe_const_range<_Rg, _CharT> is always _Rg
(adding const to reference does not change behavior).

Now we correctly check if _Range = remove_reference_t<_Rg> is const
formattable range, furthermore as range_formatter<T> can only format
ranges of values of type (possibly const) _Tp, we additional check if the
remove_cvref_t<range_reference_t<const _Range>> is _Tp.

The range_reference_t<R> and range_reference_t<const R> have different
types (modulo remove_cvref_t) for std::vector<bool> (::reference and bool)
or flat_map<T, U> (pair<const T&, U&> and pair<const T&, const U&>).

	PR libstdc++/109162

libstdc++-v3/ChangeLog:

	* include/std/format (range_formatter::format): Format const range,
	only if reference type is not changed.
	* testsuite/std/format/ranges/formatter.cc: New tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-16 14:32:57 +02:00
Tamar Christina
fa99720e9f middle-end: force AMDGCN test for vect-early-break_18.c to consistent architecture [PR119286]
The given test is intended to test vectorization of a strided access done by
having a step of > 1.

GCN target doesn't support load lanes, so the testcase is expected to fail,
other targets create a permuted load here which we then then reject.

However some GCN arch don't seem to support the permuted loads either, so the
vectorizer tries a gather/scatter.  But the indices aren't supported by some
target, so instead the vectorizer scalarizes the loads.

I can't really test for which architecture is being used by the compiler, so
instead this updates the testcase to use one single architecture so we get a
consistent result.

gcc/testsuite/ChangeLog:

	PR target/119286
	* gcc.dg/vect/vect-early-break_18.c: Force -march=gfx908 for amdgcn.
2025-04-16 13:11:20 +01:00
Tamar Christina
46ccce1de6 middle-end: Fix incorrect codegen with PFA and VLS [PR119351]
The following example:

#define N 512
#define START 2
#define END 505

int x[N] __attribute__((aligned(32)));

int __attribute__((noipa))
foo (void)
{
  for (signed int i = START; i < END; ++i)
    {
      if (x[i] == 0)
        return i;
    }
  return -1;
}

generates incorrect code with fixed length SVE because for early break we need
to know which value to start the scalar loop with if we take an early exit.

Historically this means that we take the first element of every induction.
this is because there's an assumption in place, that even with masked loops the
masks come from a whilel* instruction.

As such we reduce using a BIT_FIELD_REF <, 0>.

When PFA was added this assumption was correct for non-masked loop, however we
assumed that PFA for VLA wouldn't work for now, and disabled it using the
alignment requirement checks.  We also expected VLS to PFA using scalar loops.

However as this PR shows, for VLS the vectorizer can, and does in some
circumstances choose to peel using masks by masking the first iteration of the
loop with an additional alignment mask.

When this is done, the first elements of the predicate can be inactive. In this
example element 1 is inactive based on the calculated misalignment.  hence the
-1 value in the first vector IV element.

When we reduce using BIT_FIELD_REF we get the wrong value.

This patch updates it by creating a new scalar PHI that keeps track of whether
we are the first iteration of the loop (with the additional masking) or whether
we have taken a loop iteration already.

The generated sequence:

pre-header:
  bb1:
    i_1 = <number of leading inactive elements>

header:
  bb2:
    i_2 = PHI <i_1(bb1), 0(latch)>
    …

early-exit:
  bb3:
    i_3 = iv_step * i_2 + PHI<vector-iv>

Which eliminates the need to do an expensive mask based reduction.

This fixes gromacs with one OpenMP thread. But with > 1 there is still an issue.

gcc/ChangeLog:

	PR tree-optimization/119351
	* tree-vectorizer.h (LOOP_VINFO_MASK_NITERS_PFA_OFFSET,
	LOOP_VINFO_NON_LINEAR_IV): New.
	(class _loop_vec_info): Add mask_skip_niters_pfa_offset and
	nonlinear_iv.
	* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info): Initialize them.
	(vect_analyze_scalar_cycles_1): Record non-linear inductions.
	(vectorizable_induction): If early break and PFA using masking create a
	new phi which tracks where the scalar code needs to start...
	(vectorizable_live_operation): ...and generate the adjustments here.
	(vect_use_loop_mask_for_alignment_p): Reject non-linear inductions and
	early break needing peeling.

gcc/testsuite/ChangeLog:

	PR tree-optimization/119351
	* gcc.target/aarch64/sve/peel_ind_10.c: New test.
	* gcc.target/aarch64/sve/peel_ind_10_run.c: New test.
	* gcc.target/aarch64/sve/peel_ind_5.c: New test.
	* gcc.target/aarch64/sve/peel_ind_5_run.c: New test.
	* gcc.target/aarch64/sve/peel_ind_6.c: New test.
	* gcc.target/aarch64/sve/peel_ind_6_run.c: New test.
	* gcc.target/aarch64/sve/peel_ind_7.c: New test.
	* gcc.target/aarch64/sve/peel_ind_7_run.c: New test.
	* gcc.target/aarch64/sve/peel_ind_8.c: New test.
	* gcc.target/aarch64/sve/peel_ind_8_run.c: New test.
	* gcc.target/aarch64/sve/peel_ind_9.c: New test.
	* gcc.target/aarch64/sve/peel_ind_9_run.c: New test.
2025-04-16 13:09:05 +01:00
Tomasz Kamiński
473dde5252 libstdc++: Implement formatters for pair and tuple [PR109162]
This patch implements formatter specializations for pair and tuple form
P2286R8. In addition using 'm` and range_format::map (from P2585R1) for
ranges are now supported.

The formatters for pairs and tuples whose corresponding elements are the same
(after applying remove_cvref_t) derive from the same __tuple_formatter class.
This reduce the code duplication, as most of the parsing and formatting is the
same in such cases. We use a custom reduced implementation of the tuple
(__formatters_storage) to store the elements formatters.

Handling of the padding (width and fill) options, is extracted to
__format::__format_padded function, that is used both by __tuple_formatter and
range_formatter. To reduce number of instantations range_formatter::format
triggers, we cast incoming range to __format::__maybe_const_range<_Rg, _CharT>&,
before formatting it.

As in the case of previous commits, the signatures of the user-facing parse
and format methods of the provided formatters deviate from the standard by
constraining types of parameters:
* _CharT is constrained __formatter::__char
* basic_format_parse_context<_CharT> for parse argument
* basic_format_context<_Out, _CharT> for format second argument
The standard specifies last three of above as unconstrained types.

Finally, test for tuple-like std::array and std::ranges::subrange,
that illustrate that they remain formatted as ranges.

	PR libstdc++/109162

libstdc++-v3/ChangeLog:

	* include/std/format (__formatter_int::_M_format_character_escaped)
	(__formatter_str::format): Use __sink.out() to produce _Sink_iter.
	(__format::__const_formattable_range): Moved closer to range_formatter.
	(__format::__maybe_const_range): Use `__conditional_t` and moved closer
	to range_formatter.
	(__format::__format_padded, __format::maybe_const)
	(__format::__indexed_formatter_storage, __format::__tuple_formatter)
	(std::formatter<pair<_Fp, _Sp>, _CharT>>)
	(std::formatter<tuple<_Tps...>, _CharT): Define.
	(std::formatter<_Rg, _CharT>::format): Cast incoming range to
	__format::__maybe_const_range<_Rg, _CharT>&.
	(std::formatter<_Rg, _CharT>::_M_format): Extracted from format,
	and use __format_padded.
	(std::formatter<_Rg, _CharT>::_M_format_no_padding): Rename...
	(std::formatter<_Rg, _CharT>::_M_format_elems): ...to this.
	(std::formatter<_Rg, _CharT>::_M_format_with_padding): Extracted as
	__format_padded.
	* testsuite/util/testsuite_iterators.h (test_input_range_nocopy):
	Define.
	* testsuite/std/format/ranges/formatter.cc: Tests for `m` specifier.
	* testsuite/std/format/ranges/sequence.cc: Tests for array and subrange.
	* testsuite/std/format/ranges/map.cc: New test.
	* testsuite/std/format/tuple.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-16 12:20:56 +02:00
Jakub Jelinek
5a48e7732d bitintlower: Fix interaction of gimple_assign_copy_p stmts vs. has_single_use [PR119808]
The following testcase is miscompiled, because we emit a CLOBBER in a place
where it shouldn't be emitted.
Before lowering we have:
  b_5 = 0;
  b.0_6 = b_5;
  b.1_1 = (unsigned _BitInt(129)) b.0_6;
...
  <retval> = b_5;
The bitint coalescing assigns the same partition/underlying variable
for both b_5 and b.0_6 (possible because there is a copy assignment)
and of course a different one for b.1_1 (and other SSA_NAMEs in between).
This is -O0 so stmts aren't DCEd and aren't propagated that much etc.
It is -O0 so we also don't try to optimize and omit some names from m_names
and handle multiple stmts at once, so the expansion emits essentially
  bitint.4 = {};
  bitint.4 = bitint.4;
  bitint.2 = cast of bitint.4;
  bitint.4 = CLOBBER;
...
  <retval> = bitint.4;
and the CLOBBER is the problem because bitint.4 is still live afterwards.
We emit the clobbers to improve code generation, but do it only for
(initially) has_single_use SSA_NAMEs (remembered in m_single_use_names)
being used, if they don't have the same partition on the lhs and a few
other conditions.
The problem above is that b.0_6 which is used in the cast has_single_use
and so was in m_single_use_names bitmask and the lhs in that case is
bitint.2, so a different partition.  But there is gimple_assign_copy_p
with SSA_NAME rhs1 and the partitioning special cases those and while
b.0_6 is single use, b_5 has multiple uses.  I believe this ought to be
a problem solely in the case of such copy stmts and its special case
by the partitioning, if instead of b.0_6 = b_5; there would be
b.0_6 = b_5 + 1; or whatever other stmts that performs or may perform
changes on the value, partitioning couldn't assign the same partition
to b.0_6 and b_5 if b_5 is used later, it couldn't have two different
(or potentially different) values in the same bitint.N var.  With
copy that is possible though.

So the following patch fixes it by being more careful when we set
m_single_use_names, don't set it if it is a has_single_use SSA_NAME
but SSA_NAME_DEF_STMT of it is a copy stmt with SSA_NAME rhs1 and that
rhs1 doesn't have single use, or has_single_use but SSA_NAME_DEF_STMT of it
is a copy stmt etc.

Just to make sure it doesn't change code generation too much, I've gathered
statistics how many times
      if (m_first
          && m_single_use_names
          && m_vars[p] != m_lhs
          && m_after_stmt
          && bitmap_bit_p (m_single_use_names, SSA_NAME_VERSION (op)))
        {
          tree clobber = build_clobber (TREE_TYPE (m_vars[p]),
                                        CLOBBER_STORAGE_END);
          g = gimple_build_assign (m_vars[p], clobber);
          gimple_stmt_iterator gsi = gsi_for_stmt (m_after_stmt);
          gsi_insert_after (&gsi, g, GSI_SAME_STMT);
        }
emits a clobber on
make check-gcc GCC_TEST_RUN_EXPENSIVE=1 RUNTESTFLAGS="--target_board=unix\{-m64,-m32\} GCC_TEST_RUN_EXPENSIVE=1 dg.exp='*bitint* pr112673.c builtin-stdc-bit-*.c pr112566-2.c pr112511.c pr116588.c pr116003.c pr113693.c pr113602.c flex-array-counted-by-7.c' dg-torture.exp='*bitint* pr116480-2.c pr114312.c pr114121.c' dfp.exp=*bitint* i386.exp='pr118017.c pr117946.c apx-ndd-x32-2a.c' vect.exp='vect-early-break_99-pr113287.c' tree-ssa.exp=pr113735.c"
and before this patch it was 41010 clobbers and after it is 40968,
so difference is 42 clobbers, 0.1% fewer.

2025-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/119808
	* gimple-lower-bitint.cc (gimple_lower_bitint): Don't set
	m_single_use_names bits for SSA_NAMEs which have single use but
	their SSA_NAME_DEF_STMT is a copy from another SSA_NAME which doesn't
	have a single use, or single use which is such a copy etc.

	* gcc.dg/bitint-121.c: New test.
2025-04-16 09:11:06 +02:00
Jesse Huang
fc4099a484 riscv: Fix incorrect gnu property alignment on rv32
Codegen is incorrectly emitting a ".p2align 3" that coerces the
alignment of the .note.gnu.property section from 4 to 8 on rv32.

2025-04-11  Jesse Huang  <jesse.huang@sifive.com>

gcc/ChangeLog

	* config/riscv/riscv.cc (riscv_file_end): Fix .p2align value.

gcc/testsuite/ChangeLog

	* gcc.target/riscv/gnu-property-align-rv32.c: New file.
	* gcc.target/riscv/gnu-property-align-rv64.c: New file.
2025-04-16 14:55:27 +08:00
Kito Cheng
1d9e02bb7e RISC-V: Put jump table in text for large code model
Large code model assume the data or rodata may put far away from
text section.  So we need to put jump table in text section for
large code model.

gcc/ChangeLog:

	* config/riscv/riscv.h (JUMP_TABLES_IN_TEXT_SECTION): Check if
	large code model.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/jump-table-large-code-model.c: New test.
2025-04-16 14:55:02 +08:00
Jakub Jelinek
45a708d7bf testsuite: Add testcase for already fixed PR [PR116093]
This testcase got fixed with r15-9397 PR119722 fix.

2025-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/116093
	* gcc.dg/bitint-122.c: New test.
2025-04-16 08:44:37 +02:00
Tejas Belagod
31e16c8b75 AArch64: Fix operands order in vec_extract expander
The operand order to gen_vcond_mask call in the vec_extract pattern is wrong.
Fix the order where predicate is operand 3.

Tested and bootstrapped on aarch64-linux-gnu. OK for trunk?

gcc/ChangeLog

	* config/aarch64/aarch64-sve.md (vec_extract<vpred><Vel>): Fix operand
	order to gen_vcond_mask_*.
2025-04-16 11:16:43 +05:30
Alice Carlotti
43cbf049f5 aarch64: Disable sysreg feature gating
This applies to the sysreg read/write intrinsics __arm_[wr]sr*.  It does
not depend on changes to Binutils, because GCC converts recognised
sysreg names to an encoding based form, which is already ungated in Binutils.

We have, however, agreed to make an equivalent change in Binutils (which
would then disable feature gating for sysreg accesses in inline
assembly), but this has not yet been posted upstream.

In the future we may introduce a new flag to renable some checking,
but these checks could not be comprehensive because many system
registers depend on architecture features that don't have corresponding
GCC/GAS --march options.  This would also depend on addressing numerous
inconsistencies in the existing list of sysreg feature dependencies.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc
	(aarch64_valid_sysreg_name_p): Remove feature check.
	(aarch64_retrieve_sysreg): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/acle/rwsr-ungated.c: New test.
2025-04-16 02:07:36 +01:00
GCC Administrator
60130b2d33 Daily bump. 2025-04-16 00:18:18 +00:00
Iain Buclaw
c5ffab99a5 d: Fix ICE: type variant differs by TYPE_MAX_VALUE with -g [PR119826]
Forward referenced enum types were never fixed up after the main
ENUMERAL_TYPE was finished.  All flags set are now propagated to all
variants after its mode, size, and alignment has been calculated.

	PR d/119826

gcc/d/ChangeLog:

	* types.cc (TypeVisitor::visit (TypeEnum *)): Propagate flags of main
	enum types to all forward-referenced variants.

gcc/testsuite/ChangeLog:

	* gdc.dg/debug/imports/pr119826b.d: New test.
	* gdc.dg/debug/pr119826.d: New test.
2025-04-16 01:44:27 +02:00
Nathaniel Shead
a6f4178d0d c++: Prune lambda captures from more places [PR119755]
Currently, pruned lambda captures are still leftover in the function's
BLOCK and topmost BIND_EXPR; this doesn't cause any issues for normal
compilation, but does break modules streaming as we try to reconstruct a
FIELD_DECL that no longer exists on the type itself.

	PR c++/119755

gcc/cp/ChangeLog:

	* lambda.cc (prune_lambda_captures): Remove pruned capture from
	function's BLOCK_VARS and BIND_EXPR_VARS.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/lambda-10_a.H: New test.
	* g++.dg/modules/lambda-10_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-04-16 09:24:00 +10:00
Jakub Jelinek
674b0875a9 testsuite: Fix up completion-2.c test
The r15-9487 change has added -flto-partition=default, which broke
the completion-2.c testcase because that case is now also printed
during completion.

2025-04-16  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/completion-2.c: Expect also -flto-partition=default line.
2025-04-16 00:30:09 +02:00
Tobias Burnus
1ff4a22103 libgomp.texi (gcn, nvptx): Mention self_maps alongside USM
libgomp/ChangeLog:

	* libgomp.texi (gcn, nvptx): Mention self_maps clause
	besides unified_shared_memory in the requirements item.
2025-04-15 23:19:50 +02:00
Qing Zhao
727f330f9a c: Fully fold each parameter for call to .ACCESS_WITH_SIZE [PR119717]
C_MAYBE_CONST_EXPR is a C FE operator that will be removed by c_fully_fold.
In c_fully_fold, it assumes that operands of function calls have already
been folded. However, when we build call to .ACCESS_WITH_SIZE, all its
operands are not fully folded. therefore the C FE specific operator is
passed to middle-end.

In order to fix this issue, fully fold the parameters before building the
call to .ACCESS_WITH_SIZE.

	PR c/119717

gcc/c/ChangeLog:

	* c-typeck.cc (build_access_with_size_for_counted_by): Fully fold the
	parameters for call to .ACCESS_WITH_SIZE.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr119717.c: New test.
2025-04-15 20:38:17 +00:00
waffl3x
99835bd68e OpenMP: omp.h omp::allocator C++ Allocator interface
The implementation of each allocator is simplified by inheriting from
__detail::__allocator_templ.  At the moment, none of the implementations
diverge in any way, simply passing in the allocator handle to be used when
an allocation is made.  In the future, const_mem will need special handling
added to it to support constant memory space.

libgomp/ChangeLog:

	* omp.h.in: Add omp::allocator::* and ompx::allocator::* allocators.
	(__detail::__allocator_templ<T, omp_allocator_handle_t>):
	New struct template.
	(null_allocator<T>): New struct template.
	(default_mem<T>): Likewise.
	(large_cap_mem<T>): Likewise.
	(const_mem<T>): Likewise.
	(high_bw_mem<T>): Likewise.
	(low_lat_mem<T>): Likewise.
	(cgroup_mem<T>): Likewise.
	(pteam_mem<T>): Likewise.
	(thread_mem<T>): Likewise.
	(ompx::allocator::gnu_pinned_mem<T>): Likewise.
	* testsuite/libgomp.c++/allocator-1.C: New test.
	* testsuite/libgomp.c++/allocator-2.C: New test.

Signed-off-by: waffl3x <waffl3x@baylibre.com>
2025-04-15 14:34:38 -06:00
H.J. Lu
5ed2fa4768 x86: Update gcc.target/i386/apx-interrupt-1.c
ix86_add_cfa_restore_note omits the REG_CFA_RESTORE REG note for registers
pushed in red-zone.  Since

commit 0a074b8c7e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Apr 13 12:20:42 2025 -0700

    APX: Don't use red-zone with 32 GPRs and no caller-saved registers

disabled red-zone, update gcc.target/i386/apx-interrupt-1.c to expect
31 .cfi_restore directives.

	PR target/119784
	* gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
	directives.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-04-15 12:31:05 -07:00
Sandra Loosemore
d91aab4dd6 Docs: Address -fivopts, -O0, and -Q confusion [PR71094]
There's a blurb at the top of the "Optimize Options" node telling
people that most optimization options are completely disabled at -O0
and a similar blurb in the entry for -Og, but nothing at the entry for
-O0.  Since this is a continuing point of confusion it seems wise to
duplicate the information in all the places users are likely to look
for it.

gcc/ChangeLog
	PR tree-optimization/71094
	* doc/invoke.texi (Optimize Options): Document that -fivopts is
	enabled at -O1 and higher.  Add blurb about -O0 causing GCC to
	completely ignore most optimization options.
2025-04-15 19:18:27 +00:00
Jason Merrill
628aecb050 c++: constexpr, trivial, and non-alias target [PR111075]
On Darwin and other targets with !can_alias_cdtor, we instead go to
maybe_thunk_ctor, which builds a thunk function that calls the general
constructor.  And then cp_fold tries to constant-evaluate that call, and we
ICE because we don't expect to ever be asked to constant-evaluate a call to
a trivial function.

No new test because this fixes g++.dg/torture/tail-padding1.C on affected
targets.

	PR c++/111075

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_call_expression): Allow trivial
	call from a thunk.
2025-04-15 15:14:57 -04:00
Iain Sandoe
7f56a8e8ad configure, Darwin: Recognise new naming for Xcode ld.
The latest editions of XCode have altered the identify reported by 'ld -v'
(again).  This means that GCC configure no longer detects the version.

Fixed by adding the new name to the set checked.

gcc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Recognise PROJECT:ld-mmmm.nn.aa as an identifier
	for Darwin's static linker.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-15 19:26:02 +01:00
Iain Sandoe
9cf6b52d04 includes, Darwin: Handle modular use for macOS SDKs [PR116827].
Recent changes to the OS SDKs have altered the way in which include guards
are used for a number of headers when C++ modules are enabled.  Instead of
placing the guards in the included header, they are being placed in the
including header.  This breaks the assumptions in the current GCC stddef.h
specifically, that the presence of __PTRDIFF_T and __SIZE_T means that the
relevant defs are already made.  However in the case of the module-enabled
C++ with these SDKs, that is no longer true.

stddef.h has a large body of special-cases already, but it seems that the
only viable solution here is to add a new one specifically for __APPLE__
and modular code.

This fixes around 280 new fails in the modules test-suite; it is needed on
all open branches that support modules.

	PR target/116827

gcc/ChangeLog:

	* ginclude/stddef.h: Undefine __PTRDIFF_T and __SIZE_T for module-
	enabled c++ on Darwin/macOS platforms.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-04-15 19:25:07 +01:00
Kyrylo Tkachov
5621b3b5c9
Regenerate common.opt.urls
Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>

	* common.opt.urls: Regenerate.
2025-04-15 20:06:49 +02:00
Richard Biener
248e228fec cobol/119302 - transform gcobol.3 name during install, install as gcobol-io.3
The following installs gcobol.3 as gcobol-io.3 and applies
program-transform-name to the gcobol-io part.  This follows
naming of the pdf and the html variants.
It also uses $(man1ext) and $(man3ext) consistently.

	PR cobol/119302
gcc/cobol/
	* Make-lang.in (GCOBOLIO_INSTALL_NAME): Define.
	Use $(GCOBOLIO_INSTALL_NAME) for gcobol.3 manpage source
	upon install.
2025-04-15 19:31:42 +02:00
Jan Hubicka
4a01869b96 Set znver5 issue rate to 4.
this patch sets issue rate of znver5 to 4.  With current model, unless a reservation is
missing, we will never issue more than 4 instructions per cycle since that is the limit
of decoders and the model does not take into acount the fact that typically code is run
from op cache.

gcc/ChangeLog:

	* config/i386/x86-tune-sched.cc (ix86_issue_rate): Set
	to 4 for znver5.
2025-04-15 19:30:02 +02:00
Jan Hubicka
e2011ab13d Set ADDSS cost to 3 for znver5
Znver5 has latency of addss 2 in typical case while all earlier versions has latency 3.
Unforunately addss cost is used to cost many other SSE instructions than just addss and
setting the cost to 2 makes us to vectorize 4 64bit stores into one 256bit store which
in turn regesses imagemagick.

This patch sets the cost back to 3.  Next stage1 we can untie addss from the other operatoins
and set it correctly.

bootstrapped/regtested x86_64-linux and also benchmarked on SPEC2k17

gcc/ChangeLog:

	PR target/119298
	* config/i386/x86-tune-costs.h (znver5_cost): Set ADDSS cost to 3.
2025-04-15 19:04:15 +02:00
Jonathan Wakely
25775e73ea
libstdc++: Do not define __cpp_lib_ranges_iota in <ranges>
In r14-7153-gadbc46942aee75 we removed a duplicate definition of
__glibcxx_want_range_iota from <ranges>, but __cpp_lib_ranges_iota
should be defined in <ranges> at all.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__glibcxx_want_ranges_iota): Do not
	define.
2025-04-15 17:34:34 +01:00
Jonathan Wakely
df59bf20d8
libstdc++: Do not declare namespace ranges in <numeric> unconditionally
Move namespace ranges inside the feature test macro guard, because
'ranges' is not a reserved name before C++20.

libstdc++-v3/ChangeLog:

	* include/std/numeric (ranges): Only declare namespace for C++23
	and later.
	(ranges::iota_result): Fix indentation.
	* testsuite/17_intro/names.cc: Check ranges is not used as an
	identifier before C++20.
2025-04-15 17:34:34 +01:00
Vineet Gupta
edb4867412 RISC-V: vsetvl: elide abnormal edges from LCM computations [PR119533]
vsetvl phase4 uses LCM guided info to insert VSETVL insns, including a
straggler loop for "mising vsetvls" on certain edges. Currently it
asserts on encountering EDGE_ABNORMAL.

When enabling go frontend with V enabled, libgo build hits the assert.

The solution is to prevent abnormal edges from getting into LCM at all
(my prior attempt at this just ignored them after LCM which is not
right). Existing invalid_opt_bb_p () current does this for BB predecessors
but not for successors which is what the patch adds.

Crucially, the ICE/fix also depends on avoiding vsetvl hoisting past
non-transparent blocks: That is taken care of by Robin's patch
"RISC-V: Do not lift up vsetvl into non-transparent blocks [PR119547]"
for a different yet related issue.

Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>

	PR target/119533

gcc/ChangeLog:

	* config/riscv/riscv-vsetvl.cc (invalid_opt_bb_p): Check for
	EDGE_ABNOMAL.
	(pre_vsetvl::compute_lcm_local_properties): Initialize kill
	bitmap.
	Debug dump skipped edge.

gcc/testsuite/ChangeLog:

	* go.dg/pr119533-riscv.go: New test.
	* go.dg/pr119533-riscv-2.go: New test.
2025-04-15 09:29:08 -07:00
Robin Dapp
517f7e3f02 RISC-V: Do not lift up vsetvl into non-transparent blocks [PR119547].
When lifting up a vsetvl into a block we currently don't consider the
block's transparency with respect to the vsetvl as in other parts of the
pass.  This patch does not perform the lift when transparency is not
guaranteed.

This condition is more restrictive than necessary as we can still
perform a vsetvl lift if the conflicting register is only every used
in vsetvls and no regular insns but given how late we are in the GCC 15
cycle it seems better to defer this.  Therefore
gcc.target/riscv/rvv/vsetvl/avl_single-68.c is XFAILed for now.

This issue was found in OpenCV where it manifests as a runtime error.
Zhijin Zeng debugged PR119547 and provided an initial patch.

Reported-By: 曾治金 <zhijin.zeng@spacemit.com>

	PR target/119547

gcc/ChangeLog:

	* config/riscv/riscv-vsetvl.cc (pre_vsetvl::earliest_fuse_vsetvl_info):
	Do not perform lift if block is not transparent.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/avl_single-68.c: xfail.
	* g++.target/riscv/rvv/autovec/pr119547.C: New test.
	* g++.target/riscv/rvv/autovec/pr119547-2.C: New test.
	* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: Adjust.
2025-04-15 17:20:59 +02:00
Tomasz Kamiński
f62e5d720d libstdc++: Implement formatter for ranges and range_formatter [PR109162]
This patch implements formatter specialization for input_ranges and
range_formatter class from P2286R8, as adjusted by P2585R1. The formatter
for pair/tuple is not yet provided, making maps not formattable.

This introduces an new _M_format_range member to internal __formatter_str,
that formats range as _CharT as string, according to the format spec.
This function transform any contiguous range into basic_string_view directly,
by computing size if necessary. Otherwise, for ranges for which size can be
computed (forward_range or sized_range) we use a stack buffer, if they are
sufficiently small. Finally, we create a basic_string<_CharT> from the range,
and format its content.

In case when padding is specified, this is handled by firstly formatting
the content of the range to the temporary string object. However, this can be
only implemented if the iterator of the basic_format_context is internal
type-erased iterator used by implementation. Otherwise a new basic_format_context
would need to be created, which would require rebinding of handles stored in
the arguments: note that format spec for element type could retrieve any format
argument from format context, visit and use handle to format it.
As basic_format_context provide no user-facing constructor, the user are not able
to construct object of that type with arbitrary iterators.

The signatures of the user-facing parse and format methods of the provided
formatters deviate from the standard by constraining types of params:
* _CharT is constrained __formatter::__char
* basic_format_parse_context<_CharT> for parse argument
* basic_format_context<_Out, _CharT> for format second argument
The standard specifies last three of above as unconstrained types. These types
are later passed to possibly user-provided formatter specializations, that are
required via formattable concept to only accept above types.

Finally, the formatter<input_range, _CharT> specialization is implemented
without using specialization of range-default-formatter exposition only
template as base class, while providing same functionality.

	PR libstdc++/109162

libstdc++-v3/ChangeLog:

	* include/std/format (__format::__has_debug_format, _Pres_type::_Pres_seq)
	(_Pres_type::_Pres_str, __format::__Stackbuf_size): Define.
	(_Separators::_S_squares, _Separators::_S_parens, _Separators::_S_comma)
	(_Separators::_S_colon): Define additional constants.
	(_Spec::_M_parse_fill_and_align): Define overload accepting
	list of excluded characters for fill, and forward existing overload.
	(__formatter_str::_M_format_range): Define.
	(__format::_Buf_sink) Use __Stackbuf_size for size of array.
	(__format::__is_map_formattable, std::range_formatter)
	(std::formatter<_Rg, _CharT>): Define.
	* src/c++23/std.cc.in (std::format_kind, std::range_format)
	(std::range_formatter): Export.
	* testsuite/std/format/formatter/lwg3944.cc: Guarded tests with
	__glibcxx_format_ranges.
	* testsuite/std/format/formatter/requirements.cc: Adjusted for standard
	behavior.
	* testsuite/23_containers/vector/bool/format.cc: Test vector<bool> formatting.
	* testsuite/std/format/ranges/format_kind.cc: New test.
	* testsuite/std/format/ranges/formatter.cc: New test.
	* testsuite/std/format/ranges/sequence.cc: New test.
	* testsuite/std/format/ranges/string.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-15 17:09:59 +02:00
Andreas Schwab
a039bab957 libgcobol: mark riscv64-*-linux* as supported target
* configure.tgt: Set LIBGCOBOL_SUPPORTED for riscv64-*-linux* with
	64-bit multilib.
2025-04-15 16:59:03 +02:00
Tobias Burnus
99cd28c473 Fortran/OpenMP: Support automatic mapping allocatable components (deep mapping)
When mapping an allocatable variable (or derived-type component), explicitly
or implicitly, all its allocated allocatable components will automatically be
mapped. The patch implements the target hooks, added for this feature to
omp-low.cc with commit r15-3895-ge4a58b6f28383c.

Namely, there is a check whether there are allocatable components at all:
gfc_omp_deep_mapping_p. Then gfc_omp_deep_mapping_cnt, counting the number
of required mappings; this is a dynamic value as it depends on array
bounds and whether an allocatable is allocated or not.
And, finally, the actual mapping: gfc_omp_deep_mapping.

Polymorphic variables are partially supported: the mapping of the _data
component is fully supported, but only components of the declared type
are processed for additional allocatables. Additionally, _vptr is not
touched. This means that everything needing _vtab information requires
unified shared memory; in particular, _size data is required when
accessing elements of polymorphic arrays.
However, for scalar arrays, accessing components of the declare type
should work just fine.

As polymorphic variables are not (really) supported and OpenMP 6
explicitly disallows them, there is now a warning (-Wopenmp) when
they are encountered. Unlimited polymorphics are rejected (error).

Additionally, PRIVATE and FIRSTPRIVATE are not quite supported for
allocatable components, polymorphic components and as polymorphic
variable. Thus, those are now rejected as well.

gcc/fortran/ChangeLog:

	* f95-lang.cc (LANG_HOOKS_OMP_DEEP_MAPPING,
	LANG_HOOKS_OMP_DEEP_MAPPING_P, LANG_HOOKS_OMP_DEEP_MAPPING_CNT):
	Define.
	* openmp.cc (gfc_match_omp_clause_reduction): Fix location setting.
	(resolve_omp_clauses): Permit allocatable components, reject
	them and polymorphic variables in PRIVATE/FIRSTPRIVATE.
	* trans-decl.cc (add_clause): Set clause location.
	* trans-openmp.cc (gfc_has_alloc_comps): Add ptr_ok and
	shallow_alloc_only Boolean arguments.
	(gfc_omp_replace_alloc_by_to_mapping): New.
	(gfc_omp_private_outer_ref, gfc_walk_alloc_comps,
	gfc_omp_clause_default_ctor, gfc_omp_clause_copy_ctor,
	gfc_omp_clause_assign_op, gfc_omp_clause_dtor): Update call to it.
	(gfc_omp_finish_clause): Minor cleanups, improve location data,
	handle allocatable components.
	(gfc_omp_deep_mapping_map, gfc_omp_deep_mapping_item,
	gfc_omp_deep_mapping_comps, gfc_omp_gen_simple_loop,
	gfc_omp_get_array_size, gfc_omp_elmental_loop,
	gfc_omp_deep_map_kind_p, gfc_omp_deep_mapping_int_p,
	gfc_omp_deep_mapping_p, gfc_omp_deep_mapping_do,
	gfc_omp_deep_mapping_cnt, gfc_omp_deep_mapping): New.
	(gfc_trans_omp_array_section): Save array descriptor in case
	deep-mapping lang hook will need it.
	(gfc_trans_omp_clauses): Likewise; use better clause location data.
	* trans.h (gfc_omp_deep_mapping_p, gfc_omp_deep_mapping_cnt,
	gfc_omp_deep_mapping): Add function prototypes.

libgomp/ChangeLog:

	* libgomp.texi (5.0 Impl. Status): Mark mapping alloc comps as 'Y'.
	* testsuite/libgomp.fortran/allocatable-comp.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-3.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-4.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-5.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-6.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-7.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-8.f90: New test.
	* testsuite/libgomp.fortran/map-alloc-comp-9.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/map-alloc-comp-1.f90: Remove dg-error.
	* gfortran.dg/gomp/polymorphic-mapping-2.f90: Update warn wording.
	* gfortran.dg/gomp/polymorphic-mapping.f90: Change expected
	diagnostic; some tests moved to ...
	* gfortran.dg/gomp/polymorphic-mapping-1.f90: ... here as new test.
	* gfortran.dg/gomp/polymorphic-mapping-3.f90: New test.
	* gfortran.dg/gomp/polymorphic-mapping-4.f90: New test.
	* gfortran.dg/gomp/polymorphic-mapping-5.f90: New test.
2025-04-15 16:42:42 +02:00
Kyrylo Tkachov
6d9fdf4bf5
Locality cloning pass: -fipa-reorder-for-locality
Implement partitioning and cloning in the callgraph to help locality.
A new -fipa-reorder-for-locality flag is used to enable this.
The majority of the logic is in the new IPA pass in ipa-locality-cloning.cc
The optimization has two components:
* Partitioning the callgraph so as to group callers and callees that frequently
call each other in the same partition
* Cloning functions that straddle multiple callchains and allowing each clone
to be local to the partition of its callchain.

The majority of the logic is in the new IPA pass in ipa-locality-cloning.cc.
It creates a partitioning plan and does the prerequisite cloning.
The partitioning is then implemented during the existing LTO partitioning pass.

To guide these locality heuristics we use PGO data.
In the absence of PGO data we use a static heuristic that uses the accumulated
estimated edge frequencies of the callees for each function to guide the
reordering.
We are investigating some more elaborate static heuristics, in particular using
the demangled C++ names to group template instantiatios together.
This is promising but we are working out some kinks in the implementation
currently and want to send that out as a follow-up once we're more confident
in it.

A new bootstrap-lto-locality bootstrap config is added that allows us to test
this on GCC itself with either static or PGO heuristics.
GCC bootstraps with both (normal LTO bootstrap and profiledbootstrap).

As this new pass enables a new partitioning scheme it is incompatible with
explicit -flto-partition= options so an error is introduced when the user
uses both flags explicitly.

With this optimization we are seeing good performance gains on some large
internal workloads that stress the parts of the processor that is sensitive
to code locality, but we'd appreciate wider performance evaluation.

Bootstrapped and tested on aarch64-none-linux-gnu.
Ok for mainline?
Thanks,
Kyrill

Signed-off-by: Prachi Godbole <pgodbole@nvidia.com>
Co-authored-by: Kyrylo Tkachov <ktkachov@nvidia.com>

config/ChangeLog:

	* bootstrap-lto-locality.mk: New file.

gcc/ChangeLog:

	* Makefile.in (OBJS): Add ipa-locality-cloning.o.
	* cgraph.h (set_new_clone_decl_and_node_flags): Declare prototype.
	* cgraphclones.cc (set_new_clone_decl_and_node_flags): Remove static
	qualifier.
	* common.opt (fipa-reorder-for-locality): New flag.
	(LTO_PARTITION_DEFAULT): Declare.
	(flto-partition): Change default to LTO_PARTITION_DFEAULT.
	* doc/invoke.texi: Document -fipa-reorder-for-locality.
	* flag-types.h (enum lto_locality_cloning_model): Declare.
	(lto_partitioning_model): Add LTO_PARTITION_DEFAULT.
	* lto-cgraph.cc (lto_set_symtab_encoder_in_partition): Add dumping of
	node and index.
	* opts.cc (validate_ipa_reorder_locality_lto_partition): Define.
	(finish_options): Handle LTO_PARTITION_DEFAULT.
	* params.opt (lto_locality_cloning_model): New enum.
	(lto-partition-locality-cloning): New param.
	(lto-partition-locality-frequency-cutoff): Likewise.
	(lto-partition-locality-size-cutoff): Likewise.
	(lto-max-locality-partition): Likewise.
	* passes.def: Register pass_ipa_locality_cloning.
	* timevar.def (TV_IPA_LC): New timevar.
	* tree-pass.h (make_pass_ipa_locality_cloning): Declare.
	* ipa-locality-cloning.cc: New file.
	* ipa-locality-cloning.h: New file.

gcc/lto/ChangeLog:

	* lto-partition.cc (add_node_references_to_partition): Define.
	(create_partition): Likewise.
	(lto_locality_map): Likewise.
	(lto_promote_cross_file_statics): Add extra dumping.
	* lto-partition.h (lto_locality_map): Declare prototype.
	* lto.cc (do_whole_program_analysis): Handle
	flag_ipa_reorder_for_locality.
2025-04-15 16:35:44 +02:00
Martin Jambor
b4cf69503b
ipa-bit-cp: Fix adjusting value according to mask (PR119803)
In my fix for PR 119318 I put mask calculation in
ipcp_bits_lattice::meet_with_1 above a final fix to value so that all
the bits in the value which are meaningless according to mask have
value zero, which has tripped a validator in PR 119803.  This patch
fixes that by moving the adjustment down.

Even thought the fix for PR 119318 did a similar thing in
ipcp_bits_lattice::meet_with, the same is not necessary because that
code path then feeds the new value and mask to
ipcp_bits_lattice::set_to_constant which does the final adjustment
correctly.

In both places, however, Jakup proposed a better way of calculating
cap_mask and so I have changed it accordingly.

gcc/ChangeLog:

2025-04-15  Martin Jambor  <mjambor@suse.cz>

	PR ipa/119803
	* ipa-cp.cc (ipcp_bits_lattice::meet_with_1): Move m_value adjustmed
	according to m_mask below the adjustment of the latter according to
	cap_mask.  Optimize the  calculation of cap_mask a bit.
	(ipcp_bits_lattice::meet_with): Optimize the calculation of cap_mask a
	bit.

gcc/testsuite/ChangeLog:

2025-04-15  Martin Jambor  <mjambor@suse.cz>

	PR ipa/119803
	* gcc.dg/ipa/pr119803.c: New test.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
2025-04-15 15:56:17 +02:00
Iain Buclaw
074b2b0f91 d: Fix internal compiler error: in visit, at d/decl.cc:838 [PR119799]
This was caused by a check in the D front-end disallowing static
VAR_DECLs with a size `0'.

While empty structs in D are give the size `1', the same symbol coming
from ImportC modules do infact have no size, so allow C variables to
pass the check as well as array objects.

	PR d/119799

gcc/d/ChangeLog:

	* decl.cc (DeclVisitor::visit (VarDeclaration *)): Check front-end
	type size before building the VAR_DECL.  Allow C symbols to have a
	size of `0'.

gcc/testsuite/ChangeLog:

	* gdc.dg/import-c/pr119799.d: New test.
	* gdc.dg/import-c/pr119799c.c: New test.
2025-04-15 15:26:58 +02:00
Patrick Palka
369461d074 c++: prev declared hidden tmpl friend inst, cont [PR119807]
When remapping existing specializations of a hidden template friend from
a previous declaration to the new definition, we must remap only those
specializations that match this new definition, but currently we
remap all specializations (since they all appear in the same
DECL_TEMPLATE_INSTANTIATIONS list of the most general template).

Concretely, in the first testcase below, we form two specializations of
the friend A::f, one with arguments {{0},{bool}} and another with
arguments {{1},{bool}}.  Later when instantiating B, we need to remap
these specializations.  During the B<0> instantiation we only want to
remap the first specialization, and during the B<1> instantiation only
the second specialization, but currently we remap both specializations
twice.

tsubst_friend_function needs to determine if an existing specialization
matches the shape of the new definition, which is tricky in general,
e.g. if the outer template parameters may not match up.  Fortunately we
don't have to reinvent the wheel here since is_specialization_of_friend
seems to do exactly what we need.  We can check this unconditionally,
but I think it's only necessary when dealing with specializations formed
from a class template scope previous declaration, hence the
TMPL_ARGS_HAVE_MULTIPLE_LEVELS check.

	PR c++/119807
	PR c++/112288

gcc/cp/ChangeLog:

	* pt.cc (tsubst_friend_function): Skip remapping an
	existing specialization if it doesn't match the shape of
	the new friend definition.

gcc/testsuite/ChangeLog:

	* g++.dg/template/friend86.C: New test.
	* g++.dg/template/friend87.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
2025-04-15 09:06:40 -04:00
Iain Buclaw
f5ed7d19c9 d: Fix ICE in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676 [PR119817]
The ImportVisitor method for handling the importing of overload sets was
pushing NULL_TREE to the array of import decls, which in turn got passed
to `debug_hooks->imported_module_or_decl', triggering the observed
internal compiler error.

NULL_TREE is returned from `build_import_decl' when the symbol was
ignored for being non-trivial to represent in debug, for example,
template or tuple declarations.  So similarly "skip" adding the symbol
when this is the case for overload sets too.

	PR d/119817

gcc/d/ChangeLog:

	* imports.cc (ImportVisitor::visit (OverloadSet *)): Don't push
	NULL_TREE to vector of import symbols.

gcc/testsuite/ChangeLog:

	* gdc.dg/debug/imports/m119817/a.d: New test.
	* gdc.dg/debug/imports/m119817/b.d: New test.
	* gdc.dg/debug/imports/m119817/package.d: New test.
	* gdc.dg/debug/pr119817.d: New test.
2025-04-15 15:04:13 +02:00
Jakub Jelinek
bf115fd457 ipa-cp: Fix up ipcp_print_widest_int
On Mon, Mar 31, 2025 at 03:34:07PM +0200, Martin Jambor wrote:
> This patch just introduces a form of dumping of widest ints that only
> have zeros in the lowest 128 bits so that instead of printing
> thousands of f's the output looks like:
>
>        Bits: value = 0xffff, mask = all ones folled by 0xffffffffffffffffffffffffffff0000
>
> and then makes sure we use the function not only to print bits but
> also to print masks where values like these can also occur.

Shouldn't that be followed by instead?
And the widest_int checks seems to be quite expensive (especially for
large widest_ints), I think for the first one we can just == -1
and for the second one wi::arshift (value, 128) == -1 and the zero extension
by using wi::zext.

Anyway, I wonder if it wouldn't be better to use something shorter,
the variant patch uses 0xf..f prefix before the 128-bit hexadecimal
number (maybe we could also special case the even more common bits 64+
are all ones case).  Or it could be 0xf*f prefix.  Or printing such
numbers as -0x prefixed negative, though that is not a good idea for masks.

This version doesn't print e.g.
0xf..fffffffffffffffffffffffffffff0000
but just
0xf..f0000
(of course, for say mask of
0xf..f0000000000000000000000000000ffff
it prints it like that, doesn't try to shorten the 0 digits.
But if the most significant bits aren't set, it will be just
0xffff.

2025-04-15  Jakub Jelinek  <jakub@redhat.com>

	* ipa-cp.cc (ipcp_print_widest_int): Print values with all ones in
	bits 128+ with "0xf..f" prefix instead of "all ones folled by ".
	Simplify wide_int check for -1 or all ones above least significant
	128 bits.
2025-04-15 14:56:30 +02:00
Jakub Jelinek
0756511537 tailc: Fix up musttail calls vs. -fsanitize=thread [PR119801]
Calls with musttail attribute don't really work with -fsanitize=thread in
GCC.  The problem is that TSan instrumentation adds
  __tsan_func_entry (__builtin_return_address (0));
calls at the start of each instrumented function and
  __tsan_func_exit ();
call at the end of those and the latter stands in a way of normal tail calls
as well as musttail tail calls.

Looking at what LLVM does, for normal calls -fsanitize=thread also prevents
tail calls like in GCC (well, the __tsan_func_exit () call itself can be
tail called in GCC (and from what I see not in clang)).
But for [[clang::musttail]] calls it arranges to move the
__tsan_func_exit () before the musttail call instead of after it.

The following patch handles it similarly.  If we for -fsanitize=thread
instrumented function detect __builtin_tsan_func_exit () call, we process
it normally (so that the call can be tail called in function returning void)
but set a flag that the builtin has been seen (only for cfun->has_musttail
in the diag_musttail phase).  And then let tree_optimize_tail_calls_1
call find_tail_calls again in a new mode where the __tsan_func_exit ()
call is ignored and so we are able to find calls before it, but only
accept that if the call before it is actually a musttail.  For C++ it needs
to verify that EH cleanup if any also has the __tsan_func_exit () call
and if all goes well, the musttail call is registered for tailcalling with
a flag that it has __tsan_func_exit () after it and when optimizing that
we emit __tsan_func_exit (); call before the musttail tail call (or musttail
tail recursion).

2025-04-15  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/119801
	* sanitizer.def (BUILT_IN_TSAN_FUNC_EXIT): Use BT_FN_VOID rather
	than BT_FN_VOID_PTR.
	* tree-tailcall.cc: Include attribs.h and asan.h.
	(struct tailcall): Add has_tsan_func_exit member.
	(empty_eh_cleanup): Add eh_has_tsan_func_exit argument, set what
	it points to to 1 if there is exactly one __tsan_func_exit call
	and ignore that call otherwise.  Adjust recursive call.
	(find_tail_calls): Add RETRY_TSAN_FUNC_EXIT argument, pass it
	to recursive calls.  When seeing __tsan_func_exit call with
	RETRY_TSAN_FUNC_EXIT 0, set it to -1.  If RETRY_TSAN_FUNC_EXIT
	is 1, initially ignore __tsan_func_exit calls.  Adjust
	empty_eh_cleanup caller.  When looking through stmts after the call,
	ignore exactly one __tsan_func_exit call but remember it in
	t->has_tsan_func_exit.  Diagnose if EH cleanups didn't have
	__tsan_func_exit and normal path did or vice versa.
	(optimize_tail_call): Emit __tsan_func_exit before the tail call
	or tail recursion.
	(tree_optimize_tail_calls_1): Adjust find_tail_calls callers.  If
	find_tail_calls changes retry_tsan_func_exit to -1, set it to 1
	and call it again with otherwise the same arguments.

	* c-c++-common/tsan/pr119801.c: New test.
2025-04-15 14:09:55 +02:00
Jonathan Yong
039b566f2f Wbuiltin-declaration-mismatch-4.c: accept long long in warning for llp64
llp64 targets like mingw-w64 will print:
gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c:80:17: warning: ‘memset’ argument 3 promotes to ‘ptrdiff_t’ {aka ‘long long int’} where ‘long long unsigned int’ is expected in a call to built-in function declared without prototype [-
Wbuiltin-declaration-mismatch]
Change the regex pattern to accept it.

Signed-off-by: Jonathan Yong <10walls@gmail.com>

gcc/testsuite/ChangeLog:

	* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Make diagnostic
	accept long long.
2025-04-15 11:38:40 +00:00
Jakub Jelinek
a591629420 testsuite: Fix up ipa/pr119318.c test [PR119318]
dg-additional-options followed by dg-options is ignored.  I've added the
-w from there to dg-options and removed dg-additional-options.

2025-04-15  Jakub Jelinek  <jakub@redhat.com>

	PR ipa/119318
	* gcc.dg/ipa/pr119318.c: Remove dg-additional-options, add -w to
	dg-options.
2025-04-15 12:26:11 +02:00
Jonathan Wakely
05d3aebe24
libstdc++: Fix std::string construction from volatile char* [PR119748]
My recent r15-9381-g648d5c26e25497 change assumes that a contiguous
iterator with the correct value_type can be converted to a const charT*
but that's not true for volatile charT*. The optimization should only be
done if it can be converted to the right pointer type.

Additionally, some generic loops for non-contiguous iterators need an
explicit cast to deal with iterator reference types that do not bind to
the const charT& parameter of traits_type::assign.

libstdc++-v3/ChangeLog:

	PR libstdc++/119748
	* include/bits/basic_string.h (_S_copy_chars): Only optimize for
	contiguous iterators that are convertible to const charT*. Use
	explicit conversion to charT after dereferencing iterator.
	(_S_copy_range): Likewise for contiguous ranges.
	* include/bits/basic_string.tcc (_M_construct): Use explicit
	conversion to charT after dereferencing iterator.
	* include/bits/cow_string.h (_S_copy_chars): Likewise.
	(basic_string(from_range_t, R&&, const Allocator&)): Likewise.
	Only optimize for contiguous iterators that are convertible to
	const charT*.
	* testsuite/21_strings/basic_string/cons/char/119748.cc: New
	test.
	* testsuite/21_strings/basic_string/cons/wchar_t/119748.cc:
	New test.

Reviewed-by: Tomasz Kaminski <tkaminsk@redhat.com>
2025-04-15 09:24:58 +01:00
Jonathan Wakely
8a208899e9
libstdc++: Enable __gnu_test::test_container constructor for C++98
The only reason this constructor wasn't defined for C++98 is that it
uses constructor delegation, but that isn't necessary.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_iterators.h (test_container): Define
	array constructor for C++98 as well.
2025-04-15 09:24:44 +01:00
Jakub Jelinek
69ffddd8bd libgcobol: Handle long double as an alternate IEEE754 quad [PR119244]
I think there should be consistency in what we use, so like
libgcobol-fp.h specifies, IEEE quad long double should have highest
priority, then _Float128 with *f128 APIs, then libquadmath.
And when we decide to use say long double, we shouldn't mix that with
strfromf128/strtof128.

Additionally, given that the *l vs. *f128 vs. *q API decision is done
solely in libgcobol and not in the compiler (which is different from
the Fortran case where compiled code emits say sinq or sinf128 calls),
I think libgcobol.spec should only have -lquadmath in any form only in
the case when using libquadmath for everything.  In the Fortran case
it is for backwards compatibility purposes, if something has been
compiled with older gfortran which used say sinq and link is done by
gfortran which has been configured against new glibc with *f128, linking
would fail otherwise.

2025-04-15  Jakub Jelinek  <jakub@redhat.com>
	    Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR cobol/119244
	* acinclude.m4 (LIBGCOBOL_CHECK_FLOAT128): Ensure
	libgcob_cv_have_float128 is not yes on targets with IEEE quad
	long double.  Don't check for --as-needed nor set LIBQUADSPEC
	on targets which USE_IEC_60559.
	* libgcobol-fp.h (FP128_FMT, strtofp128, strfromfp128): Define.
	* intrinsic.cc (strtof128): Don't redefine.
	(WEIRD_TRANSCENDENT_RETURN_VALUE): Use GCOB_FP128_LITERAL macro.
	(__gg__numval_f): Use strtofp128 instead of strtof128.
	* libgcobol.cc (strtof128): Don't redefine.
	(format_for_display_internal): Use strfromfp128 instead of
	strfromf128 or quadmath_snprintf and use FP128_FMT in the format
	string.
	(get_float128, __gg__compare_2, __gg__move, __gg__move_literala):
	Use strtofp128 instead of strtof128.
	* configure: Regenerate.
2025-04-15 07:55:55 +02:00
Sandra Loosemore
fc89b1face Doc: always_inline attribute vs multiple TUs and LTO [PR113203]
gcc/ChangeLog
	PR ipa/113203
	* doc/extend.texi (Common Function Attributes): Explain how to
	use always_inline in programs that have multiple translation
	units, and that LTO inlining additionally needs optimization
	enabled.
2025-04-15 03:58:31 +00:00
Jason Merrill
764f02327f c++: shortcut constexpr vector ctor [PR113835]
Since std::vector became usable in constant evaluation in C++20, a vector
variable with static storage duration might be manifestly
constant-evaluated, so we properly try to constant-evaluate its initializer.
But it can never succeed since the result will always refer to the result of
operator new, so trying is a waste of time.  Potentially a large waste of
time for a large vector, as in the testcase in the PR.

So, let's recognize this case and skip trying constant-evaluation.  I do
this only for the case of an integer argument, as that's the case that's
easy to write but slow to (fail to) evaluate.

In the test, I use dg-timeout-factor to lower the default timeout from 300
seconds to 15; on my laptop, compilation without the patch takes about 20
seconds versus about 2 with the patch.

	PR c++/113835

gcc/cp/ChangeLog:

	* constexpr.cc (cxx_eval_outermost_constant_expr): Bail out early
	for std::vector(N).

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/constexpr-vector1.C: New test.
2025-04-14 23:23:05 -04:00
liuhongt
fa58ff249a Revert documents from r11-344-g0fec3f62b9bfc0
gcc/ChangeLog:

	PR target/108134
	* doc/extend.texi: Remove documents from r11-344-g0fec3f62b9bfc0.
2025-04-14 18:29:57 -07:00
Sandra Loosemore
f7a2f0aa6b Doc: clarify -march=pentiumpro has no MMX support [PR42683]
gcc/ChangeLog
	PR target/42683
	* doc/invoke.texi (x86 Options): Clarify that -march=pentiumpro
	doesn't include MMX.
2025-04-15 01:09:36 +00:00
GCC Administrator
9f3d2506e4 Daily bump. 2025-04-15 00:19:09 +00:00
Thomas Schwinge
fe283dba77 GCN, nvptx: Support '-mfake-exceptions', and use it for offloading compilation [PR118794]
With '-mfake-exceptions' enabled, the user-visible behavior in presence of
exception handling constructs changes such that the compile-time
'sorry, unimplemented: exception handling not supported' is skipped, code
generation proceeds, and instead, exception handling constructs 'abort' at
run time.  (..., or don't, if they're in dead code.)

	PR target/118794
	gcc/
	* config/gcn/gcn.opt (-mfake-exceptions): Support.
	* config/nvptx/nvptx.opt (-mfake-exceptions): Likewise.
	* config/gcn/gcn.md (define_expand "exception_receiver"): Use it.
	* config/nvptx/nvptx.md (define_expand "exception_receiver"):
	Likewise.
	* config/gcn/mkoffload.cc (main): Set it.
	* config/nvptx/mkoffload.cc (main): Likewise.
	* config/nvptx/nvptx.cc (nvptx_assemble_integer)
	<in_section == exception_section>: Special handling for
	'SYMBOL_REF's.
	* except.cc (expand_dw2_landing_pad_for_region): Don't generate
	bogus code for (default)
	'#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM'.
	libgcc/
	* config/gcn/unwind-gcn.c (_Unwind_Resume): New.
	* config/nvptx/unwind-nvptx.c (_Unwind_Resume): Likewise.
	gcc/testsuite/
	* g++.target/gcn/exceptions-bad_cast-2.C: Set
	'-mno-fake-exceptions'.
	* g++.target/gcn/exceptions-pr118794-1.C: Likewise.
	* g++.target/gcn/exceptions-throw-2.C: Likewise.
	* g++.target/nvptx/exceptions-bad_cast-2.C: Likewise.
	* g++.target/nvptx/exceptions-pr118794-1.C: Likewise.
	* g++.target/nvptx/exceptions-throw-2.C: Likewise.
	* g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C: New.
	* g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C:
	Likewise.
	* g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C: Likewise.
	* g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C:
	Likewise.
	* g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C:
	Likewise.
	* g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C:
	Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-GCN.C:
	Set '-foffload-options=-mno-fake-exceptions'.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-nvptx.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-GCN.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-nvptx.C:
	Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-GCN.C:
	Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-nvptx.C:
	Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-GCN.C:
	Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-nvptx.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: Adjust.
	* testsuite/libgomp.c++/target-exceptions-pr118794-1.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-throw-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-throw-2-O0.C: New.
2025-04-14 23:56:05 +02:00
Thomas Schwinge
6c0ea84026 Add 'throw', dead code test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-throw-3.C: New.
	* g++.target/nvptx/exceptions-throw-3.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-throw-3.C: New.
	* testsuite/libgomp.oacc-c++/exceptions-throw-3.C: Likewise.
2025-04-14 23:54:54 +02:00
Thomas Schwinge
1daf570498 Add 'throw', caught test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-throw-2.C: New.
	* g++.target/nvptx/exceptions-throw-2.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-throw-2.C: New.
	* testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-GCN.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-throw-2-offload-sorry-nvptx.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-GCN.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-2-offload-sorry-nvptx.C: Likewise.
2025-04-14 23:54:54 +02:00
Thomas Schwinge
1362d9d494 Add 'throw' test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-throw-1.C: New.
	* g++.target/nvptx/exceptions-throw-1.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-throw-1.C: New.
	* testsuite/libgomp.c++/target-exceptions-throw-1-O0.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-throw-1.C: Likewise.
2025-04-14 23:54:53 +02:00
Thomas Schwinge
27f88cc799 Add 'std::bad_cast' exception, dead code test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-bad_cast-3.C: New.
	* g++.target/nvptx/exceptions-bad_cast-3.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-bad_cast-3.C: New.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-3.C: Likewise.
2025-04-14 23:54:53 +02:00
Thomas Schwinge
00cde164ee Add 'std::bad_cast' exception, caught test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-bad_cast-2.C: New.
	* g++.target/nvptx/exceptions-bad_cast-2.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: New.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-GCN.C: Likewise.
	* testsuite/libgomp.c++/target-exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-GCN.C: Likewise.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-2-offload-sorry-nvptx.C: Likewise.
2025-04-14 23:54:53 +02:00
Thomas Schwinge
0e68f49db9 Add 'std::bad_cast' exception test cases for GCN, nvptx target and OpenACC, OpenMP 'target' offloading
gcc/testsuite/
	* g++.target/gcn/exceptions-bad_cast-1.C: New.
	* g++.target/nvptx/exceptions-bad_cast-1.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: New.
	* testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
2025-04-14 23:54:53 +02:00
Thomas Schwinge
aa3e72f943 Add test cases for exception handling constructs in dead code for GCN, nvptx target and OpenMP 'target' offloading [PR118794]
PR target/118794
	gcc/testsuite/
	* g++.target/gcn/exceptions-pr118794-1.C: New.
	* g++.target/nvptx/exceptions-pr118794-1.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/target-exceptions-pr118794-1.C: New.
	* testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-GCN.C:
	Likewise.
	* testsuite/libgomp.c++/target-exceptions-pr118794-1-offload-sorry-nvptx.C:
	Likewise.
2025-04-14 23:54:48 +02:00
Thomas Schwinge
a304c88b6f Add PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' offloading" test cases [PR119692]
... documenting the status quo.

	PR c++/119692
	gcc/testsuite/
	* g++.target/gcn/pr119692-1-1.C: New.
	* g++.target/nvptx/pr119692-1-1.C: Likewise.
	libgomp/
	* testsuite/libgomp.c++/pr119692-1-1.C: New.
	* testsuite/libgomp.c++/pr119692-1-2.C: Likewise.
	* testsuite/libgomp.c++/pr119692-1-3.C: Likewise.
	* testsuite/libgomp.c++/pr119692-1-4.C: Likewise.
	* testsuite/libgomp.c++/pr119692-1-5.C: Likewise.
	* testsuite/libgomp.oacc-c++/pr119692-1-1.C: Likewise.
	* testsuite/libgomp.oacc-c++/pr119692-1-2.C: Likewise.
	* testsuite/libgomp.oacc-c++/pr119692-1-3.C: Likewise.
2025-04-14 23:54:48 +02:00
Thomas Schwinge
785448f046 Add 'g++.target/gcn/gcn.exp' for GCN-specific C++ test cases
Like 'gcc.target/gcn/gcn.exp' is modeled after 'gcc.dg/dg.exp', this new
'g++.target/gcn/gcn.exp' is modeled after 'g++.dg/dg.exp'.

	gcc/testsuite/
	* g++.target/gcn/gcn.exp: New.
2025-04-14 23:54:48 +02:00
Thomas Schwinge
8621554d96 Polish 'dg-output-file' test logs
Per commit r15-8260-g563e6d926d9826d76895086d0c40a29dc90d66e5
"testsuite: Add support for dg-output-file directive", this currently produces
test logs as follows:

    PASS: gcc.dg/dg-output-file-1.c (test for excess errors)
    PASS: dg-output-file-1-lp64.txt output file test
    PASS: gcc.dg/dg-output-file-1.c execution test

    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  (test for excess errors)
    PASS: COMP-6_arithmetic.out output file test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  execution test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  (test for excess errors)
    PASS: COMP-6_arithmetic.out output file test
    PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  execution test
    [Etc.]

Notice that the 'PASS: [...] output file test' lines easily produce duplicate
test names, or might even produce PASS plus FAIL for the same test names.

Make the "output file test" use the same "descriptive name" as the other parts,
and get properly sorted with parallel-testing 'contrib/dg-extract-results.sh'
processing:

     PASS: c-c++-common/zero-scratch-regs-leafy-2.c  -Wc++-compat  (test for excess errors)
    -PASS: dg-output-file-1-lp64.txt output file test
     PASS: gcc.dg/20000108-1.c (test for excess errors)
    [...]
     PASS: gcc.dg/devnull-dump.c (test for excess errors)
     PASS: gcc.dg/dg-output-file-1.c (test for excess errors)
     PASS: gcc.dg/dg-output-file-1.c execution test
    +PASS: gcc.dg/dg-output-file-1.c output file test
     PASS: gcc.dg/dg-test-1.c (test for excess errors)

..., and gets de-duplicated test names, for example:

     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  (test for excess errors)
    -PASS: COMP-6_arithmetic.out output file test
    +PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0   output file test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O0  execution test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  (test for excess errors)
    -PASS: COMP-6_arithmetic.out output file test
    +PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1   output file test
     PASS: cobol.dg/group2/COMP-6_arithmetic.cob   -O1  execution test
    [Etc.]

(Given that only ever a single 'dg-output-file' directive is active, don't
print the output filename.)

	gcc/testsuite/
	* lib/gcc-dg.exp (${tool}_load): Polish 'dg-output-file' test
	logs.
2025-04-14 23:50:18 +02:00
296 changed files with 12383 additions and 803 deletions

View file

@ -1,3 +1,7 @@
2025-04-16 Waffl3x <waffl3x@baylibre.com>
* MAINTAINERS: Add myself.
2025-04-02 Iain Sandoe <iain@sandoe.co.uk>
* configure: Regenerate.

View file

@ -862,6 +862,7 @@ Ville Voutilainen ville <ville.voutilainen@gmail.com>
Tom de Vries vries <tdevries@suse.de>
Nenad Vukicevic nenadv <nenad@intrepid.com>
Dmitry Vyukov dvyukov <dvyukov@google.com>
Waffl3x waffl3x <waffl3x@baylibre.com>
Jonathan Wakely redi <jwakely@redhat.com>
Krister Walfridsson kristerw <krister.walfridsson@gmail.com>
Feng Wang - <wangfeng@eswincomputing.com>

View file

@ -1,3 +1,7 @@
2025-04-15 Kyrylo Tkachov <ktkachov@nvidia.com>
* bootstrap-lto-locality.mk: New file.
2024-11-25 Sandra Loosemore <sloosemore@baylibre.com>
* mt-nios2-elf: Deleted.

View file

@ -0,0 +1,20 @@
# This option enables LTO and locality partitioning for stage2 and stage3 in slim mode
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -fipa-reorder-for-locality
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -fipa-reorder-for-locality
STAGEprofile_CFLAGS += -flto=jobserver -frandom-seed=1 -fipa-reorder-for-locality
STAGEtrain_CFLAGS += -flto=jobserver -frandom-seed=1 -fipa-reorder-for-locality
STAGEfeedback_CFLAGS += -flto=jobserver -frandom-seed=1 -fipa-reorder-for-locality
# assumes the host supports the linker plugin
LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
LTO_NM = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-nm$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/
LTO_EXPORTS = AR="$(LTO_AR)"; export AR; \
RANLIB="$(LTO_RANLIB)"; export RANLIB; \
NM="$(LTO_NM)"; export NM;
LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)" NM="$(LTO_NM)"
do-compare = $(SHELL) $(srcdir)/contrib/compare-lto $$f1 $$f2
extra-compare = gcc/lto1$(exeext)

View file

@ -1,3 +1,8 @@
2025-04-17 Jakub Jelinek <jakub@redhat.com>
* gcc-changelog/git_update_version.py (active_refs): Add
releases/gcc-15.
2025-04-11 Tomasz Kamiński <tkaminsk@redhat.com>
PR libstdc++/109162

View file

@ -85,8 +85,8 @@ def prepend_to_changelog_files(repo, folder, git_commit, add_to_git):
repo.git.add(full_path)
active_refs = ['master',
'releases/gcc-12', 'releases/gcc-13', 'releases/gcc-14']
active_refs = ['master', 'releases/gcc-12',
'releases/gcc-13', 'releases/gcc-14', 'releases/gcc-15']
parser = argparse.ArgumentParser(description='Update DATESTAMP and generate '
'ChangeLog entries')

View file

@ -1 +1 @@
15.0.1
16.0.0

View file

@ -1,3 +1,429 @@
2025-04-17 翁愷邑 <kaiweng9487@gmail.com>
* config/riscv/riscv-target-attr.cc
(riscv_target_attr_parser::update_settings):
Do not manually free any arch string.
2025-04-17 Eric Botcazou <ebotcazou@gcc.gnu.org>
* tree.def (BOOLEAN_TYPE): Add more details.
2025-04-17 Sam James <sam@gentoo.org>
* doc/invoke.texi: Use "compatible types" term. Rephrase to be
more precise (and correct).
2025-04-17 Tamar Christina <tamar.christina@arm.com>
PR tree-optimization/119351
* tree-vect-stmts.cc (vectorizable_early_exit): Mask both operands of
the gcond for partial masking support.
2025-04-17 Jakub Jelinek <jakub@redhat.com>
PR target/119834
* config/s390/s390.md (define_split after *cpymem_short): Use
(clobber (match_scratch N)) instead of (clobber (scratch)). Use
(match_dup 4) and operands[4] instead of (match_dup 3) and operands[3]
in the last of those.
(define_split after *clrmem_short): Use (clobber (match_scratch N))
instead of (clobber (scratch)).
(define_split after *cmpmem_short): Likewise.
2025-04-17 Thomas Schwinge <tschwinge@baylibre.com>
* config/nvptx/nvptx.cc (TARGET_ASM_NEED_VAR_DECL_BEFORE_USE):
Don't '#define'.
2025-04-17 Hans-Peter Nilsson <hp@axis.com>
* combine.cc: Correct comments about combine_validate_cost.
2025-04-16 Sandra Loosemore <sloosemore@baylibre.com>
PR c/88382
* doc/extend.texi (Syntax Extensions): Adjust menu.
(Raw String Literals): New section.
2025-04-16 Keith Packard <keithp@keithp.com>
* config/rx/rx.md (cmpstrnsi): Allow constant length. For
static length 0, just store 0 into the output register.
For dynamic zero, set C/Z appropriately.
(rxcmpstrn): No longer set C/Z.
2025-04-16 Eric Botcazou <ebotcazou@gcc.gnu.org>
* tree-ssa-phiopt.cc (factor_out_conditional_operation): Do not
bypass the int_fits_type_p test for boolean types whose precision
is not 1.
2025-04-16 Sandra Loosemore <sloosemore@baylibre.com>
* common.opt.urls: Regenerated.
2025-04-16 Ard Biesheuvel <ardb@kernel.org>
PR target/119386
* config/i386/i386-options.cc: Permit -mnop-mcount when
using -fpic with PLTs.
2025-04-16 Ard Biesheuvel <ardb@kernel.org>
PR target/119386
* config/i386/i386.cc (x86_print_call_or_nop): Add @PLT suffix
where appropriate.
(x86_function_profiler): Fall through to x86_print_call_or_nop()
for PIC codegen when flag_plt is set.
2025-04-16 Sandra Loosemore <sloosemore@baylibre.com>
PR driver/90465
* doc/invoke.texi (Overall Options): Add a @cindex for -Q in
connection with --help=.
(Developer Options): Point at --help= documentation for the
other use of -Q.
2025-04-16 Thomas Schwinge <tschwinge@baylibre.com>
PR target/97106
* config/nvptx/nvptx.cc (nvptx_asm_output_def_from_decls)
[ACCEL_COMPILER]: Make sure to emit C++ constructor, destructor
aliases.
2025-04-16 Jan Hubicka <hubicka@ucw.cz>
PR tree-optimization/119614
* ipa-prop.cc (ipa_write_return_summaries): New function.
(ipa_record_return_value_range_1): Break out from ....
(ipa_record_return_value_range): ... here.
(ipa_read_return_summaries): New function.
(ipa_prop_read_section): Read return summaries.
(read_ipcp_transformation_info): Read return summaries.
(ipcp_write_transformation_summaries): Write return summaries;
do not stream stray 0.
2025-04-16 Tamar Christina <tamar.christina@arm.com>
PR tree-optimization/119351
* tree-vectorizer.h (LOOP_VINFO_MASK_NITERS_PFA_OFFSET,
LOOP_VINFO_NON_LINEAR_IV): New.
(class _loop_vec_info): Add mask_skip_niters_pfa_offset and
nonlinear_iv.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info): Initialize them.
(vect_analyze_scalar_cycles_1): Record non-linear inductions.
(vectorizable_induction): If early break and PFA using masking create a
new phi which tracks where the scalar code needs to start...
(vectorizable_live_operation): ...and generate the adjustments here.
(vect_use_loop_mask_for_alignment_p): Reject non-linear inductions and
early break needing peeling.
2025-04-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/119808
* gimple-lower-bitint.cc (gimple_lower_bitint): Don't set
m_single_use_names bits for SSA_NAMEs which have single use but
their SSA_NAME_DEF_STMT is a copy from another SSA_NAME which doesn't
have a single use, or single use which is such a copy etc.
2025-04-16 Jesse Huang <jesse.huang@sifive.com>
* config/riscv/riscv.cc (riscv_file_end): Fix .p2align value.
2025-04-16 Kito Cheng <kito.cheng@sifive.com>
* config/riscv/riscv.h (JUMP_TABLES_IN_TEXT_SECTION): Check if
large code model.
2025-04-16 Tejas Belagod <tejas.belagod@arm.com>
* config/aarch64/aarch64-sve.md (vec_extract<vpred><Vel>): Fix operand
order to gen_vcond_mask_*.
2025-04-16 Alice Carlotti <alice.carlotti@arm.com>
* config/aarch64/aarch64.cc
(aarch64_valid_sysreg_name_p): Remove feature check.
(aarch64_retrieve_sysreg): Ditto.
2025-04-15 Sandra Loosemore <sloosemore@baylibre.com>
PR tree-optimization/71094
* doc/invoke.texi (Optimize Options): Document that -fivopts is
enabled at -O1 and higher. Add blurb about -O0 causing GCC to
completely ignore most optimization options.
2025-04-15 Iain Sandoe <iain@sandoe.co.uk>
* configure: Regenerate.
* configure.ac: Recognise PROJECT:ld-mmmm.nn.aa as an identifier
for Darwin's static linker.
2025-04-15 Iain Sandoe <iainsandoe@mini-05-seq.local>
PR target/116827
* ginclude/stddef.h: Undefine __PTRDIFF_T and __SIZE_T for module-
enabled c++ on Darwin/macOS platforms.
2025-04-15 Kyrylo Tkachov <ktkachov@nvidia.com>
* common.opt.urls: Regenerate.
2025-04-15 Jan Hubicka <hubicka@ucw.cz>
* config/i386/x86-tune-sched.cc (ix86_issue_rate): Set
to 4 for znver5.
2025-04-15 Jan Hubicka <hubicka@ucw.cz>
PR target/119298
* config/i386/x86-tune-costs.h (znver5_cost): Set ADDSS cost to 3.
2025-04-15 Vineet Gupta <vineetg@rivosinc.com>
PR target/119533
* config/riscv/riscv-vsetvl.cc (invalid_opt_bb_p): Check for
EDGE_ABNOMAL.
(pre_vsetvl::compute_lcm_local_properties): Initialize kill
bitmap.
Debug dump skipped edge.
2025-04-15 Robin Dapp <rdapp@ventanamicro.com>
PR target/119547
* config/riscv/riscv-vsetvl.cc (pre_vsetvl::earliest_fuse_vsetvl_info):
Do not perform lift if block is not transparent.
2025-04-15 Kyrylo Tkachov <ktkachov@nvidia.com>
* Makefile.in (OBJS): Add ipa-locality-cloning.o.
* cgraph.h (set_new_clone_decl_and_node_flags): Declare prototype.
* cgraphclones.cc (set_new_clone_decl_and_node_flags): Remove static
qualifier.
* common.opt (fipa-reorder-for-locality): New flag.
(LTO_PARTITION_DEFAULT): Declare.
(flto-partition): Change default to LTO_PARTITION_DFEAULT.
* doc/invoke.texi: Document -fipa-reorder-for-locality.
* flag-types.h (enum lto_locality_cloning_model): Declare.
(lto_partitioning_model): Add LTO_PARTITION_DEFAULT.
* lto-cgraph.cc (lto_set_symtab_encoder_in_partition): Add dumping of
node and index.
* opts.cc (validate_ipa_reorder_locality_lto_partition): Define.
(finish_options): Handle LTO_PARTITION_DEFAULT.
* params.opt (lto_locality_cloning_model): New enum.
(lto-partition-locality-cloning): New param.
(lto-partition-locality-frequency-cutoff): Likewise.
(lto-partition-locality-size-cutoff): Likewise.
(lto-max-locality-partition): Likewise.
* passes.def: Register pass_ipa_locality_cloning.
* timevar.def (TV_IPA_LC): New timevar.
* tree-pass.h (make_pass_ipa_locality_cloning): Declare.
* ipa-locality-cloning.cc: New file.
* ipa-locality-cloning.h: New file.
2025-04-15 Martin Jambor <mjambor@suse.cz>
Jakub Jelinek <jakub@redhat.com>
PR ipa/119803
* ipa-cp.cc (ipcp_bits_lattice::meet_with_1): Move m_value adjustmed
according to m_mask below the adjustment of the latter according to
cap_mask. Optimize the calculation of cap_mask a bit.
(ipcp_bits_lattice::meet_with): Optimize the calculation of cap_mask a
bit.
2025-04-15 Jakub Jelinek <jakub@redhat.com>
* ipa-cp.cc (ipcp_print_widest_int): Print values with all ones in
bits 128+ with "0xf..f" prefix instead of "all ones folled by ".
Simplify wide_int check for -1 or all ones above least significant
128 bits.
2025-04-15 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/119801
* sanitizer.def (BUILT_IN_TSAN_FUNC_EXIT): Use BT_FN_VOID rather
than BT_FN_VOID_PTR.
* tree-tailcall.cc: Include attribs.h and asan.h.
(struct tailcall): Add has_tsan_func_exit member.
(empty_eh_cleanup): Add eh_has_tsan_func_exit argument, set what
it points to to 1 if there is exactly one __tsan_func_exit call
and ignore that call otherwise. Adjust recursive call.
(find_tail_calls): Add RETRY_TSAN_FUNC_EXIT argument, pass it
to recursive calls. When seeing __tsan_func_exit call with
RETRY_TSAN_FUNC_EXIT 0, set it to -1. If RETRY_TSAN_FUNC_EXIT
is 1, initially ignore __tsan_func_exit calls. Adjust
empty_eh_cleanup caller. When looking through stmts after the call,
ignore exactly one __tsan_func_exit call but remember it in
t->has_tsan_func_exit. Diagnose if EH cleanups didn't have
__tsan_func_exit and normal path did or vice versa.
(optimize_tail_call): Emit __tsan_func_exit before the tail call
or tail recursion.
(tree_optimize_tail_calls_1): Adjust find_tail_calls callers. If
find_tail_calls changes retry_tsan_func_exit to -1, set it to 1
and call it again with otherwise the same arguments.
2025-04-15 Sandra Loosemore <sloosemore@baylibre.com>
PR ipa/113203
* doc/extend.texi (Common Function Attributes): Explain how to
use always_inline in programs that have multiple translation
units, and that LTO inlining additionally needs optimization
enabled.
2025-04-15 liuhongt <hongtao.liu@intel.com>
PR target/108134
* doc/extend.texi: Remove documents from r11-344-g0fec3f62b9bfc0.
2025-04-15 Sandra Loosemore <sloosemore@baylibre.com>
PR target/42683
* doc/invoke.texi (x86 Options): Clarify that -march=pentiumpro
doesn't include MMX.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
PR target/118794
* config/gcn/gcn.opt (-mfake-exceptions): Support.
* config/nvptx/nvptx.opt (-mfake-exceptions): Likewise.
* config/gcn/gcn.md (define_expand "exception_receiver"): Use it.
* config/nvptx/nvptx.md (define_expand "exception_receiver"):
Likewise.
* config/gcn/mkoffload.cc (main): Set it.
* config/nvptx/mkoffload.cc (main): Likewise.
* config/nvptx/nvptx.cc (nvptx_assemble_integer)
<in_section == exception_section>: Special handling for
'SYMBOL_REF's.
* except.cc (expand_dw2_landing_pad_for_region): Don't generate
bogus code for (default)
'#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM'.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/119785
* expmed.cc (init_expmed): Always pass QImode rather than mode to
set_src_cost passed to set_zero_cost.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/119718
* tree-pretty-print.cc (dump_generic_node) <case CALL_EXPR>: Dump
also CALL_EXPR_MUST_TAIL_CALL flag.
* calls.cc (maybe_complain_about_tail_call): Emit error about
CALL_EXPR_MUST_TAIL_CALL only after emitting dump message, not before
it.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* doc/install.texi: Add requirements for building gccrs.
2025-04-14 H.J. Lu <hjl.tools@gmail.com>
PR target/119784
* config/i386/i386.cc (ix86_using_red_zone): Don't use red-zone
with 32 GPRs and no caller-saved registers.
2025-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/118097
* ipa-cp.cc (ipa_get_jf_arith_result): Require res_operand for
anything except NOP_EXPR or ADDR_EXPR, document it and remove the code
trying to deduce it.
(ipa_value_from_jfunc): Use the stored and streamed type of arithmetic
pass-through functions.
(ipa_agg_value_from_jfunc): Use the stored and streamed type of
arithmetic pass-through functions, convert to the type used to store
the value if necessary.
(get_val_across_arith_op): New parameter op_type, pass it to
ipa_get_jf_arith_result.
(propagate_vals_across_arith_jfunc): New parameter op_type, pass it to
get_val_across_arith_op.
(propagate_vals_across_pass_through): Use the stored and streamed type
of arithmetic pass-through functions.
(propagate_aggregate_lattice): Likewise.
(push_agg_values_for_index_from_edge): Use the stored and streamed
type of arithmetic pass-through functions, convert to the type used to
store the value if necessary.
2025-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/118785
* ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Use the stored
and streamed type of arithmetic pass-through functions.
2025-04-14 Martin Jambor <mjambor@suse.cz>
* ipa-cp.cc (ipcp_print_widest_int): Also add a truncated form of
dumping of widest ints which only have zeros in the lowest 128 bits.
Update the comment.
(ipcp_bits_lattice::print): Also dump the mask using
ipcp_print_widest_int.
(ipcp_store_vr_results): Likewise.
2025-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/119318
* ipa-cp.cc (ipcp_bits_lattice::meet_with_1): Set all mask bits
not covered by precision to one.
(ipcp_bits_lattice::meet_with): Likewise.
(propagate_bits_across_jump_function): Use the stored operation
type to perform meet with other lattices.
2025-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/118097
PR ipa/118785
PR ipa/119318
* lto-streamer.h (lto_variably_modified_type_p): Declare.
* ipa-prop.h (ipa_pass_through_data): New field op_type.
(ipa_get_jf_pass_through_op_type): New function.
* ipa-prop.cc: Include lto-streamer.h.
(ipa_dump_jump_function): Dump also pass-through
operation types, if any. Dump pass-through operands only if not NULL.
(ipa_set_jf_simple_pass_through): Set op_type accordingly.
(compute_complex_assign_jump_func): Set op_type of arithmetic
pass-through jump_functions.
(analyze_agg_content_value): Update lhs when walking assighment
copies. Set op_type of aggregate arithmetic pass-through
jump_functions.
(update_jump_functions_after_inlining): Also transfer the operation
type from the source arithmentic pass-through jump function to the
destination jump function.
(ipa_write_jump_function): Stream also the op_type when necessary.
(ipa_read_jump_function): Likewise.
(ipa_agg_pass_through_jf_equivalent_p): Also compare operation types.
* lto-streamer-out.cc (lto_variably_modified_type_p): Make public.
2025-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/119757
* tree-vect-slp.cc (vect_build_slp_tree_1): Record and compare
whether a stmt uses a maks.
2025-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/119778
* tree-inline.cc (copy_edges_for_bb): Mark calls that are
source of abnormal edges as altering control-flow.
2025-04-14 Gaius Mulley <gaiusmod2@gmail.com>
PR modula2/119779
* doc/gm2.texi (Interface to assembly language): Use eax
rather than rax in both examples.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR driver/119727
* configure.ac (HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE): New check.
* gcc.cc: Include sys/personality.h if
HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined.
(try_generate_repro): Call
personality (personality (0xffffffffU) | ADDR_NO_RANDOMIZE)
if HOST_HAS_PERSONALITY_ADDR_NO_RANDOMIZE is defined.
* config.in: Regenerate.
* configure: Regenerate.
2025-04-13 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
* config/s390/s390.cc: Add z17 scheduler description.

View file

@ -1 +1 @@
20250414
20250418

View file

@ -1555,6 +1555,7 @@ OBJS = \
incpath.o \
init-regs.o \
internal-fn.o \
ipa-locality-cloning.o \
ipa-cp.o \
ipa-sra.o \
ipa-devirt.o \
@ -3026,6 +3027,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/ipa-param-manipulation.h $(srcdir)/ipa-sra.cc \
$(srcdir)/ipa-modref.h $(srcdir)/ipa-modref.cc \
$(srcdir)/ipa-modref-tree.h \
$(srcdir)/ipa-locality-cloning.cc \
$(srcdir)/signop.h \
$(srcdir)/diagnostic-spec.h $(srcdir)/diagnostic-spec.cc \
$(srcdir)/dwarf2out.h \

View file

@ -1,3 +1,7 @@
2025-04-17 Jakub Jelinek <jakub@redhat.com>
* gnatvsn.ads: Bump Library_Version to 16.
2025-04-12 Eric Botcazou <ebotcazou@adacore.com>
PR ada/119643

View file

@ -32,7 +32,7 @@ package Gnatvsn is
-- Static string identifying this version, that can be used as an argument
-- to e.g. pragma Ident.
Library_Version : constant String := "15";
Library_Version : constant String := "16";
-- Library version. It needs to be updated whenever the major version
-- number is changed.
--

View file

@ -1,3 +1,9 @@
2025-04-15 Qing Zhao <qing.zhao@oracle.com>
PR c/119717
* c-typeck.cc (build_access_with_size_for_counted_by): Fully fold the
parameters for call to .ACCESS_WITH_SIZE.
2025-04-08 Martin Uecker <uecker@tugraz.at>
PR c/119612

View file

@ -3013,12 +3013,16 @@ build_access_with_size_for_counted_by (location_t loc, tree ref,
gcc_assert (c_flexible_array_member_type_p (TREE_TYPE (ref)));
/* The result type of the call is a pointer to the flexible array type. */
tree result_type = c_build_pointer_type (TREE_TYPE (ref));
tree first_param
= c_fully_fold (array_to_pointer_conversion (loc, ref), false, NULL);
tree second_param
= c_fully_fold (counted_by_ref, false, NULL);
tree call
= build_call_expr_internal_loc (loc, IFN_ACCESS_WITH_SIZE,
result_type, 6,
array_to_pointer_conversion (loc, ref),
counted_by_ref,
first_param,
second_param,
build_int_cst (integer_type_node, 1),
build_int_cst (counted_by_type, 0),
build_int_cst (integer_type_node, -1),

View file

@ -2627,6 +2627,7 @@ void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *,
void dump_callgraph_transformation (const cgraph_node *original,
const cgraph_node *clone,
const char *suffix);
void set_new_clone_decl_and_node_flags (cgraph_node *new_node);
/* In cgraphbuild.cc */
int compute_call_stmt_bb_frequency (tree, basic_block bb);
void record_references_in_initializer (tree, bool);

View file

@ -158,7 +158,7 @@ cgraph_edge::clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid,
/* Set flags of NEW_NODE and its decl. NEW_NODE is a newly created private
clone or its thunk. */
static void
void
set_new_clone_decl_and_node_flags (cgraph_node *new_node)
{
DECL_EXTERNAL (new_node->decl) = 0;

View file

@ -1,3 +1,38 @@
2025-04-16 Bob Dubner <rdubner@symas.com>
PR cobol/119759
* LICENSE: Deleted.
2025-04-15 Richard Biener <rguenther@suse.de>
PR cobol/119302
* Make-lang.in (GCOBOLIO_INSTALL_NAME): Define.
Use $(GCOBOLIO_INSTALL_NAME) for gcobol.3 manpage source
upon install.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR cobol/119776
* lang.opt (fmax-errors): Remove.
* lang.opt.urls: Regenerate.
* cobol1.cc (cobol_langhook_handle_option) <case OPT_fmax_errors>:
Remove.
* gcobol.1: Document -fmax-errors=nerror rather than
-fmax-errors nerror.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR cobol/119777
* lang.opt (include): Remove Var(cobol_include).
* cobol1.cc (cobol_langhook_handle_option) <case OPT_include>: Use
arg instead of cobol_include.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR cobol/119777
* lang.opt (fsyntax-only): Remove.
* lang.opt.urls: Regenerate.
2025-04-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Simon Sobisch <simonsobisch@gnu.org>

View file

@ -1,29 +0,0 @@
#########################################################################
#
# Copyright (c) 2021-2025 Symas Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of the Symas Corporation nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -35,6 +35,7 @@
# - define the names for selecting the language in LANGUAGES.
GCOBOL_INSTALL_NAME := $(shell echo gcobol|sed '$(program_transform_name)')
GCOBOLIO_INSTALL_NAME := $(shell echo gcobol-io|sed '$(program_transform_name)')
GCOBOL_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcobol|sed '$(program_transform_name)')
GCOBC_INSTALL_NAME := $(shell echo gcobc|sed '$(program_transform_name)')
@ -293,7 +294,7 @@ cobol.install-common: installdirs
cobol.install-man: installdirs
$(INSTALL_DATA) $(srcdir)/cobol/gcobol.1 $(DESTDIR)$(man1dir)/$(GCOBOL_INSTALL_NAME)$(man1ext)
$(INSTALL_DATA) $(srcdir)/cobol/gcobol.3 $(DESTDIR)$(man3dir)/
$(INSTALL_DATA) $(srcdir)/cobol/gcobol.3 $(DESTDIR)$(man3dir)/$(GCOBOLIO_INSTALL_NAME)$(man3ext)
cobol.install-info:
@ -342,8 +343,8 @@ cobol.uninstall:
rm -rf $(DESTDIR)$(bindir)/$(GCOBOL_INSTALL_NAME)$(exeext) \
$(DESTDIR)$(bindir)/$(GCOBC_INSTALL_NAME) \
$(DESTDIR)$(datadir)/gcobol/ \
$(DESTDIR)$(man1dir)/$(GCOBOL_INSTALL_NAME).1 \
$(DESTDIR)$(man3dir)/gcobol.3
$(DESTDIR)$(man1dir)/$(GCOBOL_INSTALL_NAME)$(man1ext) \
$(DESTDIR)$(man3dir)/$(GCOBOLIO_INSTALL_NAME)$(man3ext)
cobol.man:
cobol.srcman:

View file

@ -815,7 +815,7 @@ do_SUBST_LINK (struct insn_link **into, struct insn_link *newval)
#define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval)
/* Subroutine of try_combine. Determine whether the replacement patterns
NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_cost
NEWPAT, NEWI2PAT and NEWOTHERPAT are more expensive according to insn_cost
than the original sequence I0, I1, I2, I3 and undobuf.other_insn. Note
that I0, I1 and/or NEWI2PAT may be NULL_RTX. Similarly, NEWOTHERPAT and
undobuf.other_insn may also both be NULL_RTX. Return false if the cost
@ -4129,8 +4129,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
}
}
/* Only allow this combination if insn_cost reports that the
replacement instructions are cheaper than the originals. */
/* Reject this combination if insn_cost reports that the replacement
instructions are more expensive than the originals. */
if (!combine_validate_cost (i0, i1, i2, i3, newpat, newi2pat, other_pat))
{
undo_all ();

View file

@ -2116,6 +2116,10 @@ fipa-modref
Common Var(flag_ipa_modref) Optimization
Perform interprocedural modref analysis.
fipa-reorder-for-locality
Common Var(flag_ipa_reorder_for_locality) Init(0) Optimization
Perform reordering and cloning of functions to maximize locality.
fipa-profile
Common Var(flag_ipa_profile) Init(0) Optimization
Perform interprocedural profile propagation.
@ -2274,6 +2278,9 @@ Number of cache entries in incremental LTO after which to prune old entries.
Enum
Name(lto_partition_model) Type(enum lto_partition_model) UnknownError(unknown LTO partitioning model %qs)
EnumValue
Enum(lto_partition_model) String(default) Value(LTO_PARTITION_DEFAULT)
EnumValue
Enum(lto_partition_model) String(none) Value(LTO_PARTITION_NONE)
@ -2293,7 +2300,7 @@ EnumValue
Enum(lto_partition_model) String(cache) Value(LTO_PARTITION_CACHE)
flto-partition=
Common Joined RejectNegative Enum(lto_partition_model) Var(flag_lto_partition) Init(LTO_PARTITION_BALANCED)
Common Joined RejectNegative Enum(lto_partition_model) Var(flag_lto_partition) Init(LTO_PARTITION_DEFAULT)
Specify the algorithm to partition symbols and vars at linktime.
; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h.

View file

@ -31,8 +31,9 @@ UrlSuffix(gcc/Optimize-Options.html#index-Og)
Oz
UrlSuffix(gcc/Optimize-Options.html#index-Oz)
Q
UrlSuffix(gcc/Developer-Options.html#index-Q)
; skipping UrlSuffix for 'Q' due to multiple URLs:
; duplicate: 'gcc/Developer-Options.html#index-Q-1'
; duplicate: 'gcc/Overall-Options.html#index-Q'
Qn
UrlSuffix(gcc/System-V-Options.html#index-Qn)
@ -868,6 +869,9 @@ UrlSuffix(gcc/Optimize-Options.html#index-fipa-bit-cp)
fipa-modref
UrlSuffix(gcc/Optimize-Options.html#index-fipa-modref)
fipa-reorder-for-locality
UrlSuffix(gcc/Optimize-Options.html#index-fipa-reorder-for-locality)
fipa-profile
UrlSuffix(gcc/Optimize-Options.html#index-fipa-profile)

View file

@ -3133,9 +3133,9 @@
"TARGET_SVE"
{
rtx tmp = gen_reg_rtx (<MODE>mode);
emit_insn (gen_vcond_mask_<mode><vpred> (tmp, operands[1],
CONST1_RTX (<MODE>mode),
CONST0_RTX (<MODE>mode)));
emit_insn (gen_vcond_mask_<mode><vpred> (tmp, CONST1_RTX (<MODE>mode),
CONST0_RTX (<MODE>mode),
operands[1]));
emit_insn (gen_vec_extract<mode><Vel> (operands[0], tmp, operands[2]));
DONE;
}

View file

@ -31073,8 +31073,6 @@ aarch64_valid_sysreg_name_p (const char *regname)
const sysreg_t *sysreg = aarch64_lookup_sysreg_map (regname);
if (sysreg == NULL)
return aarch64_is_implem_def_reg (regname);
if (sysreg->arch_reqs)
return bool (aarch64_isa_flags & sysreg->arch_reqs);
return true;
}
@ -31098,8 +31096,6 @@ aarch64_retrieve_sysreg (const char *regname, bool write_p, bool is128op)
if ((write_p && (sysreg->properties & F_REG_READ))
|| (!write_p && (sysreg->properties & F_REG_WRITE)))
return NULL;
if ((~aarch64_isa_flags & sysreg->arch_reqs) != 0)
return NULL;
return sysreg->encoding;
}

View file

@ -1018,7 +1018,9 @@
[(const_int 0)]
""
{
sorry ("exception handling not supported");
if (!fake_exceptions)
sorry ("exception handling not supported");
DONE;
})
;; }}}

View file

@ -101,3 +101,11 @@ Enum(gcn_preferred_vectorization_factor) String(32) Value(32)
EnumValue
Enum(gcn_preferred_vectorization_factor) String(64) Value(64)
mfake-exceptions
Target Var(fake_exceptions) Init(0) Undocumented
; With '-mfake-exceptions' enabled, the user-visible behavior in presence of
; exception handling constructs changes such that the compile-time
; 'sorry, unimplemented: exception handling not supported' is skipped, code
; generation proceeds, and instead, exception handling constructs 'abort' at
; run time. (..., or don't, if they're in dead code.)

View file

@ -1160,6 +1160,9 @@ main (int argc, char **argv)
obstack_ptr_grow (&cc_argv_obstack, "-xlto");
if (fopenmp)
obstack_ptr_grow (&cc_argv_obstack, "-mgomp");
/* The host code may contain exception handling constructs.
Handle these as good as we can. */
obstack_ptr_grow (&cc_argv_obstack, "-mfake-exceptions");
for (int ix = 1; ix != argc; ix++)
{

View file

@ -2828,8 +2828,8 @@ ix86_option_override_internal (bool main_args_p,
if (flag_nop_mcount)
error ("%<-mnop-mcount%> is not compatible with this target");
#endif
if (flag_nop_mcount && flag_pic)
error ("%<-mnop-mcount%> is not implemented for %<-fPIC%>");
if (flag_nop_mcount && flag_pic && !flag_plt)
error ("%<-mnop-mcount%> is not implemented for %<-fno-plt%>");
/* Accept -msseregparm only if at least SSE support is enabled. */
if (TARGET_SSEREGPARM_P (opts->x_target_flags)

View file

@ -23164,6 +23164,12 @@ x86_print_call_or_nop (FILE *file, const char *target)
if (flag_nop_mcount || !strcmp (target, "nop"))
/* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */
fprintf (file, "1:" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n");
else if (!TARGET_PECOFF && flag_pic)
{
gcc_assert (flag_plt);
fprintf (file, "1:\tcall\t%s@PLT\n", target);
}
else
fprintf (file, "1:\tcall\t%s\n", target);
}
@ -23327,7 +23333,7 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED)
break;
case CM_SMALL_PIC:
case CM_MEDIUM_PIC:
if (!ix86_direct_extern_access)
if (!flag_plt)
{
if (ASSEMBLER_DIALECT == ASM_INTEL)
fprintf (file, "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]\n",
@ -23358,7 +23364,9 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED)
"\tleal\t%sP%d@GOTOFF(%%ebx), %%" PROFILE_COUNT_REGISTER "\n",
LPREFIX, labelno);
#endif
if (ASSEMBLER_DIALECT == ASM_INTEL)
if (flag_plt)
x86_print_call_or_nop (file, mcount_name);
else if (ASSEMBLER_DIALECT == ASM_INTEL)
fprintf (file, "1:\tcall\t[DWORD PTR %s@GOT[ebx]]\n", mcount_name);
else
fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name);

View file

@ -2120,7 +2120,7 @@ struct processor_costs znver5_cost = {
COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
/* ADDSS has throughput 2 and latency 2
(in some cases when source is another addition). */
COSTS_N_INSNS (2), /* cost of ADDSS/SD SUBSS/SD insns. */
COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
/* MULSS has throughput 2 and latency 3. */
COSTS_N_INSNS (3), /* cost of MULSS instruction. */
COSTS_N_INSNS (3), /* cost of MULSD instruction. */

View file

@ -81,6 +81,14 @@ ix86_issue_rate (void)
case PROCESSOR_YONGFENG:
case PROCESSOR_SHIJIDADAO:
case PROCESSOR_GENERIC:
/* For znver5 decoder can handle 4 or 8 instructions per cycle,
op cache 12 instruction/cycle, dispatch 8 instructions
integer rename 8 instructions and Fp 6 instructions.
The scheduler, without understanding out of order nature of the CPU
is not going to be able to use more than 4 instructions since that
is limits of the decoders. */
case PROCESSOR_ZNVER5:
return 4;
case PROCESSOR_ICELAKE_CLIENT:
@ -91,13 +99,6 @@ ix86_issue_rate (void)
return 5;
case PROCESSOR_SAPPHIRERAPIDS:
/* For znver5 decoder can handle 4 or 8 instructions per cycle,
op cache 12 instruction/cycle, dispatch 8 instructions
integer rename 8 instructions and Fp 6 instructions.
The scheduler, without understanding out of order nature of the CPU
is unlikely going to be able to fill all of these. */
case PROCESSOR_ZNVER5:
return 6;
default:

View file

@ -778,6 +778,9 @@ main (int argc, char **argv)
}
if (fopenmp)
obstack_ptr_grow (&argv_obstack, "-mgomp");
/* The host code may contain exception handling constructs.
Handle these as good as we can. */
obstack_ptr_grow (&argv_obstack, "-mfake-exceptions");
for (int ix = 1; ix != argc; ix++)
{

View file

@ -2359,7 +2359,25 @@ nvptx_assemble_integer (rtx x, unsigned int size, int ARG_UNUSED (aligned_p))
{
gcc_checking_assert (!init_frag.active);
/* Just use the default machinery; it's not getting used, anyway. */
return default_assemble_integer (x, size, aligned_p);
bool ok = default_assemble_integer (x, size, aligned_p);
/* ..., but a few cases need special handling. */
switch (GET_CODE (x))
{
case SYMBOL_REF:
/* The default machinery won't work: we don't define the necessary
operations; don't use them outside of this. */
gcc_checking_assert (!ok);
{
/* Just emit something; it's not getting used, anyway. */
const char *op = "\t.symbol_ref\t";
ok = (assemble_integer_with_op (op, x), true);
}
break;
default:
break;
}
return ok;
}
gcc_checking_assert (init_frag.active);
@ -7771,6 +7789,18 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
#endif
cgraph_node *cnode = cgraph_node::get (name);
#ifdef ACCEL_COMPILER
/* For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
For some reason (yet to be analyzed), they're not 'cnode->referred_to_p ()'.
(..., or that's not the right approach at all;
<https://inbox.sourceware.org/87v7rx8lbx.fsf@euler.schwinge.ddns.net>
"Re: [committed][nvptx] Use .alias directive for mptx >= 6.3"). */
if (DECL_CXX_CONSTRUCTOR_P (name)
|| DECL_CXX_DESTRUCTOR_P (name))
;
else
#endif
if (!cnode->referred_to_p ())
/* Prevent "Internal error: reference to deleted section". */
return;
@ -7875,8 +7905,6 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
#define TARGET_ASM_DECLARE_CONSTANT_NAME nvptx_asm_declare_constant_name
#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true
#undef TARGET_ASM_NEED_VAR_DECL_BEFORE_USE
#define TARGET_ASM_NEED_VAR_DECL_BEFORE_USE true
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG nvptx_reorg

View file

@ -1644,7 +1644,9 @@
[(const_int 0)]
""
{
sorry ("exception handling not supported");
if (!fake_exceptions)
sorry ("exception handling not supported");
DONE;
})
(define_expand "nonlocal_goto"

View file

@ -168,6 +168,14 @@ Target Var(nvptx_alias) Init(0) Undocumented
mexperimental
Target Var(nvptx_experimental) Init(0) Undocumented
mfake-exceptions
Target Var(fake_exceptions) Init(0) Undocumented
; With '-mfake-exceptions' enabled, the user-visible behavior in presence of
; exception handling constructs changes such that the compile-time
; 'sorry, unimplemented: exception handling not supported' is skipped, code
; generation proceeds, and instead, exception handling constructs 'abort' at
; run time. (..., or don't, if they're in dead code.)
mfake-ptx-alloca
Target Var(nvptx_fake_ptx_alloca) Init(0) Undocumented
; With '-mfake-ptx-alloca' enabled, the user-visible behavior changes only

View file

@ -257,11 +257,7 @@ riscv_target_attr_parser::update_settings (struct gcc_options *opts) const
{
std::string local_arch = m_subset_list->to_string (true);
const char* local_arch_str = local_arch.c_str ();
struct cl_target_option *default_opts
= TREE_TARGET_OPTION (target_option_default_node);
if (opts->x_riscv_arch_string != default_opts->x_riscv_arch_string)
free (CONST_CAST (void *, (const void *) opts->x_riscv_arch_string));
opts->x_riscv_arch_string = xstrdup (local_arch_str);
opts->x_riscv_arch_string = ggc_strdup (local_arch_str);
riscv_set_arch_by_subset_list (m_subset_list, opts);
}

View file

@ -685,7 +685,7 @@ invalid_opt_bb_p (basic_block cfg_bb)
/* We only do LCM optimizations on blocks that are post dominated by
EXIT block, that is, we don't do LCM optimizations on infinite loop. */
FOR_EACH_EDGE (e, ei, cfg_bb->succs)
if (e->flags & EDGE_FAKE)
if ((e->flags & EDGE_FAKE) || (e->flags & EDGE_ABNORMAL))
return true;
return false;
@ -2698,6 +2698,7 @@ pre_vsetvl::compute_lcm_local_properties ()
m_avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), num_exprs);
bitmap_vector_clear (m_avloc, last_basic_block_for_fn (cfun));
bitmap_vector_clear (m_kill, last_basic_block_for_fn (cfun));
bitmap_vector_clear (m_antloc, last_basic_block_for_fn (cfun));
bitmap_vector_ones (m_transp, last_basic_block_for_fn (cfun));
@ -2749,6 +2750,10 @@ pre_vsetvl::compute_lcm_local_properties ()
if (invalid_opt_bb_p (bb->cfg_bb ()))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n --- skipping bb %u due to weird edge",
bb->index ());
bitmap_clear (m_antloc[bb_index]);
bitmap_clear (m_transp[bb_index]);
}
@ -3022,6 +3027,18 @@ pre_vsetvl::earliest_fuse_vsetvl_info (int iter)
continue;
}
/* We cannot lift a vsetvl into the source block if the block is
not transparent WRT to it.
This is too restrictive for blocks where a register's use only
feeds into vsetvls and no regular insns. One example is the
test rvv/vsetvl/avl_single-68.c which is currently XFAILed for
that reason.
In order to support this case we'd need to check the vsetvl's
AVL operand's uses in the source block and make sure they are
only used in other vsetvls. */
if (!bitmap_bit_p (m_transp[eg->src->index], expr_index))
continue;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,

View file

@ -10382,7 +10382,7 @@ riscv_file_end ()
fprintf (asm_out_file, "1:\n");
/* pr_type. */
fprintf (asm_out_file, "\t.p2align\t3\n");
fprintf (asm_out_file, "\t.p2align\t%u\n", p2align);
fprintf (asm_out_file, "2:\n");
fprintf (asm_out_file, "\t.long\t0xc0000000\n");
/* pr_datasz. */

View file

@ -888,7 +888,7 @@ extern enum riscv_cc get_riscv_cc (const rtx use);
#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
(PTR) = riscv_asm_output_opcode(STREAM, PTR)
#define JUMP_TABLES_IN_TEXT_SECTION 0
#define JUMP_TABLES_IN_TEXT_SECTION (riscv_cmodel == CM_LARGE)
#define CASE_VECTOR_MODE SImode
#define CASE_VECTOR_PC_RELATIVE (riscv_cmodel != CM_MEDLOW)

View file

@ -2541,10 +2541,17 @@
(unspec_volatile:SI [(match_operand:BLK 1 "memory_operand") ;; String1
(match_operand:BLK 2 "memory_operand")] ;; String2
UNSPEC_CMPSTRN))
(use (match_operand:SI 3 "register_operand")) ;; Max Length
(use (match_operand:SI 3 "nonmemory_operand")) ;; Max Length
(match_operand:SI 4 "immediate_operand")] ;; Known Align
"rx_allow_string_insns"
{
bool const_len = CONST_INT_P (operands[3]);
if (const_len && operands[3] == CONST0_RTX (SImode))
{
emit_move_insn (operands[0], CONST0_RTX (SImode));
DONE;
}
rtx str1 = gen_rtx_REG (SImode, 1);
rtx str2 = gen_rtx_REG (SImode, 2);
rtx len = gen_rtx_REG (SImode, 3);
@ -2553,6 +2560,13 @@
emit_move_insn (str2, force_operand (XEXP (operands[2], 0), NULL_RTX));
emit_move_insn (len, operands[3]);
/* Set flags in case len is zero */
if (!const_len)
{
emit_insn (gen_setpsw (GEN_INT ('C')));
emit_insn (gen_setpsw (GEN_INT ('Z')));
}
emit_insn (gen_rx_cmpstrn (operands[0], operands[1], operands[2]));
DONE;
}
@ -2590,9 +2604,7 @@
(clobber (reg:SI 3))
(clobber (reg:CC CC_REG))]
"rx_allow_string_insns"
"setpsw z ; Set flags in case len is zero
setpsw c
scmpu ; Perform the string comparison
"scmpu ; Perform the string comparison
mov #-1, %0 ; Set up -1 result (which cannot be created
; by the SC insn)
bnc ?+ ; If Carry is not set skip over

View file

@ -3597,7 +3597,7 @@
(match_operand:BLK 1 "memory_operand" ""))
(use (match_operand 2 "const_int_operand" ""))
(use (match_operand 3 "immediate_operand" ""))
(clobber (scratch))]
(clobber (match_scratch 4))]
"reload_completed"
[(parallel
[(set (match_dup 0) (match_dup 1))
@ -3609,7 +3609,7 @@
(match_operand:BLK 1 "memory_operand" ""))
(use (match_operand 2 "register_operand" ""))
(use (match_operand 3 "memory_operand" ""))
(clobber (scratch))]
(clobber (match_scratch 4))]
"reload_completed"
[(parallel
[(unspec [(match_dup 2) (match_dup 3)
@ -3623,14 +3623,14 @@
(match_operand:BLK 1 "memory_operand" ""))
(use (match_operand 2 "register_operand" ""))
(use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
(clobber (scratch))]
(clobber (match_scratch 3))]
"TARGET_Z10 && reload_completed"
[(parallel
[(unspec [(match_dup 2) (const_int 0)
(label_ref (match_dup 3))] UNSPEC_EXECUTE)
(label_ref (match_dup 4))] UNSPEC_EXECUTE)
(set (match_dup 0) (match_dup 1))
(use (const_int 1))])]
"operands[3] = gen_label_rtx ();")
"operands[4] = gen_label_rtx ();")
(define_split
[(set (match_operand:BLK 0 "memory_operand" "")
@ -3852,7 +3852,7 @@
(const_int 0))
(use (match_operand 1 "const_int_operand" ""))
(use (match_operand 2 "immediate_operand" ""))
(clobber (scratch))
(clobber (match_scratch 3))
(clobber (reg:CC CC_REGNUM))]
"reload_completed"
[(parallel
@ -3866,7 +3866,7 @@
(const_int 0))
(use (match_operand 1 "register_operand" ""))
(use (match_operand 2 "memory_operand" ""))
(clobber (scratch))
(clobber (match_scratch 3))
(clobber (reg:CC CC_REGNUM))]
"reload_completed"
[(parallel
@ -3882,7 +3882,7 @@
(const_int 0))
(use (match_operand 1 "register_operand" ""))
(use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
(clobber (scratch))
(clobber (match_scratch 2))
(clobber (reg:CC CC_REGNUM))]
"TARGET_Z10 && reload_completed"
[(parallel
@ -4047,7 +4047,7 @@
(match_operand:BLK 1 "memory_operand" "")))
(use (match_operand 2 "const_int_operand" ""))
(use (match_operand 3 "immediate_operand" ""))
(clobber (scratch))]
(clobber (match_scratch 4))]
"reload_completed"
[(parallel
[(set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1)))
@ -4060,7 +4060,7 @@
(match_operand:BLK 1 "memory_operand" "")))
(use (match_operand 2 "register_operand" ""))
(use (match_operand 3 "memory_operand" ""))
(clobber (scratch))]
(clobber (match_scratch 4))]
"reload_completed"
[(parallel
[(unspec [(match_dup 2) (match_dup 3)
@ -4075,7 +4075,7 @@
(match_operand:BLK 1 "memory_operand" "")))
(use (match_operand 2 "register_operand" ""))
(use (const:BLK (unspec:BLK [(const_int 0)] UNSPEC_INSN)))
(clobber (scratch))]
(clobber (match_scratch 3))]
"TARGET_Z10 && reload_completed"
[(parallel
[(unspec [(match_dup 2) (const_int 0)

7
gcc/configure vendored
View file

@ -3948,7 +3948,7 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
as_fn_error $? "cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" "$LINENO" 5
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
gnu_ld_flag=yes
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep 'PROJECT:ld\(64\)*-' > /dev/null; then
ld64_flag=yes
fi
@ -32730,8 +32730,9 @@ $as_echo "$gcc_cv_ld64_major" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker version" >&5
$as_echo_n "checking linker version... " >&6; }
if test x"${gcc_cv_ld64_version}" = x; then
gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld' \
| sed -e 's/.*ld64-//' -e 's/.*dyld-//'| awk '{print $1}'`
gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld|PROJECT:ld' \
| sed -e 's/.*ld64-//' -e 's/.*dyld-//' -e 's/.*PROJECT:ld-//' \
| awk '{print $1}'`
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_version" >&5
$as_echo "$gcc_cv_ld64_version" >&6; }

View file

@ -358,7 +358,7 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
AC_MSG_ERROR([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
gnu_ld_flag=yes
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep ld64- > /dev/null; then
elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep 'PROJECT:ld\(64\)*-' > /dev/null; then
ld64_flag=yes
fi
AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
@ -6418,8 +6418,9 @@ if test x"$ld64_flag" = x"yes"; then
# If the version was not specified, try to find it.
AC_MSG_CHECKING(linker version)
if test x"${gcc_cv_ld64_version}" = x; then
gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld' \
| sed -e 's/.*ld64-//' -e 's/.*dyld-//'| awk '{print $1}'`
gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld|PROJECT:ld' \
| sed -e 's/.*ld64-//' -e 's/.*dyld-//' -e 's/.*PROJECT:ld-//' \
| awk '{print $1}'`
fi
AC_MSG_RESULT($gcc_cv_ld64_version)

View file

@ -1,3 +1,84 @@
2025-04-17 Jason Merrill <jason@redhat.com>
* constexpr.cc (is_valid_constexpr_fn): Improve diagnostic.
2025-04-17 Jason Merrill <jason@redhat.com>
* constexpr.cc (cxx_eval_outermost_constant_expr): Give both
expression and allocation location in allocated storage diagnostics.
2025-04-17 Jason Merrill <jason@redhat.com>
* name-lookup.cc (name_lookup::preserve_state): Fix reserve call.
* rtti.cc (get_tinfo_desc): Use vec_safe_grow_cleared.
2025-04-17 Jason Merrill <jason@redhat.com>
* semantics.cc (finish_type_pack_element): Add more info
to diagnostics.
2025-04-17 Jason Merrill <jason@redhat.com>
* decl.cc (cp_make_fname_decl): Prevent silent failure.
2025-04-17 Jason Merrill <jason@redhat.com>
* lex.cc (unqualified_name_lookup_error): Handle 'requires' better.
2025-04-17 Jason Merrill <jason@redhat.com>
PR c++/113360
* cp-tree.h (struct language_function): Add erroneous bit.
* constexpr.cc (explain_invalid_constexpr_fn): Return if set.
(cxx_eval_call_expression): Quiet if set.
* parser.cc (cp_parser_function_definition_after_declarator)
* pt.cc (instantiate_body): Set it.
2025-04-16 Jason Merrill <jason@redhat.com>
PR c++/114772
PR c++/101180
* pt.cc (apply_late_template_attributes): Also override
target_option_current_node.
2025-04-16 Jason Merrill <jason@redhat.com>
PR c++/116954
* contracts.cc (remove_contract_attributes): Preserve flags
on the attribute list.
2025-04-15 Nathaniel Shead <nathanieloshead@gmail.com>
PR c++/119755
* lambda.cc (prune_lambda_captures): Remove pruned capture from
function's BLOCK_VARS and BIND_EXPR_VARS.
2025-04-15 Jason Merrill <jason@redhat.com>
PR c++/111075
* constexpr.cc (cxx_eval_call_expression): Allow trivial
call from a thunk.
2025-04-15 Patrick Palka <ppalka@redhat.com>
PR c++/119807
PR c++/112288
* pt.cc (tsubst_friend_function): Skip remapping an
existing specialization if it doesn't match the shape of
the new friend definition.
2025-04-15 Jason Merrill <jason@redhat.com>
PR c++/113835
* constexpr.cc (cxx_eval_outermost_constant_expr): Bail out early
for std::vector(N).
2025-04-14 Patrick Palka <ppalka@redhat.com>
PR c++/99214
* constraint.cc (satisfy_declaration_constraints): Pass the
original ARGS to push_tinst_level.
2025-04-13 Patrick Palka <ppalka@redhat.com>
PR c++/115639

View file

@ -307,7 +307,14 @@ is_valid_constexpr_fn (tree fun, bool complain)
{
ret = false;
if (complain)
error ("%q#T has virtual base classes", DECL_CONTEXT (fun));
{
if (DECL_CONSTRUCTOR_P (fun))
error ("%<constexpr%> constructor in %q#T that has "
"virtual base classes", DECL_CONTEXT (fun));
else
error ("%<constexpr%> destructor in %q#T that has "
"virtual base classes", DECL_CONTEXT (fun));
}
}
return ret;
@ -1048,6 +1055,12 @@ explain_invalid_constexpr_fn (tree fun)
{
static hash_set<tree> *diagnosed;
tree body;
/* Don't try to explain a function we already complained about. */
if (function *f = DECL_STRUCT_FUNCTION (fun))
if (f->language->erroneous)
return;
/* In C++23, a function marked 'constexpr' may not actually be a constant
expression. We haven't diagnosed the problem yet: -Winvalid-constexpr
wasn't enabled. The function was called, so diagnose why it cannot be
@ -3079,6 +3092,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
}
constexpr_ctx new_ctx = *ctx;
ctx = &new_ctx;
if (DECL_CONSTRUCTOR_P (fun) && !ctx->object
&& TREE_CODE (t) == AGGR_INIT_EXPR)
{
@ -3088,21 +3102,20 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
tree ctor = new_ctx.ctor = build_constructor (DECL_CONTEXT (fun), NULL);
CONSTRUCTOR_NO_CLEARING (ctor) = true;
ctx->global->put_value (new_ctx.object, ctor);
ctx = &new_ctx;
}
/* An immediate invocation is manifestly constant evaluated including the
arguments of the call, so use mce_true even for the argument
evaluation. */
if (DECL_IMMEDIATE_FUNCTION_P (fun))
{
new_ctx.manifestly_const_eval = mce_true;
ctx = &new_ctx;
}
new_ctx.manifestly_const_eval = mce_true;
/* We used to shortcut trivial constructor/op= here, but nowadays
we can only get a trivial function here with -fno-elide-constructors. */
gcc_checking_assert (!trivial_fn_p (fun)
|| !flag_elide_constructors
/* Or it's a call from maybe_thunk_body (111075). */
|| (TREE_CODE (t) == CALL_EXPR ? CALL_FROM_THUNK_P (t)
: AGGR_INIT_FROM_THUNK_P (t))
/* We don't elide constructors when processing
a noexcept-expression. */
|| cp_noexcept_operand);
@ -3182,6 +3195,11 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
}
}
/* Don't complain about problems evaluating an ill-formed function. */
if (function *f = DECL_STRUCT_FUNCTION (fun))
if (f->language->erroneous)
new_ctx.quiet = true;
int depth_ok = push_cx_call_context (t);
/* Remember the object we are constructing or destructing. */
@ -9127,6 +9145,15 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
tree fndecl = cp_get_callee_fndecl_nofold (x);
if (fndecl && DECL_IMMEDIATE_FUNCTION_P (fndecl))
is_consteval = true;
/* Don't try to evaluate a std::vector constructor taking an integer, it
will fail in the 'if (heap_var)' block below after doing all the work
(c++/113835). This will need adjustment if P3554 is accepted. Note
that evaluation of e.g. the vector default constructor can succeed, so
we don't shortcut all vector constructors. */
if (fndecl && DECL_CONSTRUCTOR_P (fndecl) && allow_non_constant
&& is_std_class (type, "vector") && call_expr_nargs (x) > 1
&& TREE_CODE (TREE_TYPE (get_nth_callarg (x, 1))) == INTEGER_TYPE)
return t;
}
if (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type))
{
@ -9242,9 +9269,11 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
if (heap_var)
{
if (!allow_non_constant && !non_constant_p)
error_at (DECL_SOURCE_LOCATION (heap_var),
"%qE is not a constant expression because it refers to "
"a result of %<operator new%>", t);
{
error ("%qE is not a constant expression because it refers to "
"a result of %<operator new%>", t);
inform (DECL_SOURCE_LOCATION (heap_var), "allocated here");
}
r = t;
non_constant_p = true;
}
@ -9253,9 +9282,11 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
if (DECL_NAME (heap_var) != heap_deleted_identifier)
{
if (!allow_non_constant && !non_constant_p)
error_at (DECL_SOURCE_LOCATION (heap_var),
"%qE is not a constant expression because allocated "
"storage has not been deallocated", t);
{
error ("%qE is not a constant expression because allocated "
"storage has not been deallocated", t);
inform (DECL_SOURCE_LOCATION (heap_var), "allocated here");
}
r = t;
non_constant_p = true;
}

View file

@ -863,7 +863,11 @@ remove_contract_attributes (tree fndecl)
tree list = NULL_TREE;
for (tree p = DECL_ATTRIBUTES (fndecl); p; p = TREE_CHAIN (p))
if (!cxx_contract_attribute_p (p))
list = tree_cons (TREE_PURPOSE (p), TREE_VALUE (p), list);
{
tree nl = copy_node (p);
TREE_CHAIN (nl) = list;
list = nl;
}
DECL_ATTRIBUTES (fndecl) = nreverse (list);
}

View file

@ -2206,6 +2206,8 @@ struct GTY(()) language_function {
BOOL_BITFIELD invalid_constexpr : 1;
BOOL_BITFIELD throwing_cleanup : 1;
/* True if we gave any errors in this function. */
BOOL_BITFIELD erroneous : 1;
hash_table<named_label_hash> *x_named_labels;

View file

@ -5339,6 +5339,8 @@ cp_make_fname_decl (location_t loc, tree id, int type_dep)
decl = pushdecl_outermost_localscope (decl);
if (decl != error_mark_node)
add_decl_expr (decl);
else
gcc_assert (seen_error ());
}
else
{

View file

@ -1858,6 +1858,13 @@ prune_lambda_captures (tree body)
cp_walk_tree_without_duplicates (&body, mark_const_cap_r, &const_vars);
tree bind_expr = expr_single (DECL_SAVED_TREE (lambda_function (lam)));
if (bind_expr && TREE_CODE (bind_expr) == MUST_NOT_THROW_EXPR)
bind_expr = expr_single (TREE_OPERAND (bind_expr, 0));
/* FIXME: We don't currently handle noexcept lambda captures correctly,
so bind_expr may not be set; see PR c++/119764. */
gcc_assert (!bind_expr || TREE_CODE (bind_expr) == BIND_EXPR);
tree *fieldp = &TYPE_FIELDS (LAMBDA_EXPR_CLOSURE (lam));
for (tree *capp = &LAMBDA_EXPR_CAPTURE_LIST (lam); *capp; )
{
@ -1879,6 +1886,23 @@ prune_lambda_captures (tree body)
fieldp = &DECL_CHAIN (*fieldp);
*fieldp = DECL_CHAIN (*fieldp);
/* And out of the bindings for the function. */
tree *blockp = &BLOCK_VARS (current_binding_level->blocks);
while (*blockp != DECL_EXPR_DECL (**use))
blockp = &DECL_CHAIN (*blockp);
*blockp = DECL_CHAIN (*blockp);
/* And maybe out of the vars declared in the containing
BIND_EXPR, if it's listed there. */
if (bind_expr)
{
tree *bindp = &BIND_EXPR_VARS (bind_expr);
while (*bindp && *bindp != DECL_EXPR_DECL (**use))
bindp = &DECL_CHAIN (*bindp);
if (*bindp)
*bindp = DECL_CHAIN (*bindp);
}
/* And remove the capture proxy declaration. */
**use = void_node;
continue;

View file

@ -749,6 +749,9 @@ unqualified_name_lookup_error (tree name, location_t loc)
if (IDENTIFIER_ANY_OP_P (name))
error_at (loc, "%qD not defined", name);
else if (!flag_concepts && name == ridpointers[(int)RID_REQUIRES])
error_at (loc, "%<requires%> only available with %<-std=c++20%> or "
"%<-fconcepts%>");
else
{
if (!objc_diagnose_private_ivar (name))

View file

@ -583,7 +583,7 @@ name_lookup::preserve_state ()
if (previous)
{
unsigned length = vec_safe_length (previous->scopes);
vec_safe_reserve (previous->scopes, length * 2);
vec_safe_reserve (previous->scopes, length);
for (unsigned ix = length; ix--;)
{
tree decl = (*previous->scopes)[ix];

View file

@ -33634,6 +33634,8 @@ cp_parser_function_definition_after_declarator (cp_parser* parser,
= parser->num_template_parameter_lists;
parser->num_template_parameter_lists = 0;
int errs = errorcount + sorrycount;
/* If the next token is `try', `__transaction_atomic', or
`__transaction_relaxed`, then we are looking at either function-try-block
or function-transaction-block. Note that all of these include the
@ -33653,6 +33655,9 @@ cp_parser_function_definition_after_declarator (cp_parser* parser,
fn = finish_function (inline_p);
check_module_decl_linkage (fn);
if ((errorcount + sorrycount) > errs)
DECL_STRUCT_FUNCTION (fn)->language->erroneous = true;
if (modules_p ()
&& !inline_p
&& TYPE_P (DECL_CONTEXT (fn))

View file

@ -11772,6 +11772,10 @@ tsubst_friend_function (tree decl, tree args)
elt.args = DECL_TI_ARGS (spec);
elt.spec = NULL_TREE;
if (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (DECL_TI_ARGS (spec))
&& !is_specialization_of_friend (spec, new_template))
continue;
decl_specializations->remove_elt (&elt);
tree& spec_args = DECL_TI_ARGS (spec);
@ -12425,6 +12429,8 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
auto o4 = make_temp_override (scope_chain->omp_declare_target_attribute,
NULL);
auto o5 = make_temp_override (scope_chain->omp_begin_assumes, NULL);
auto o6 = make_temp_override (target_option_current_node,
target_option_default_node);
cplus_decl_attributes (decl_p, late_attrs, attr_flags);
@ -27752,6 +27758,11 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p)
if (DECL_OMP_DECLARE_REDUCTION_P (code_pattern))
cp_check_omp_declare_reduction (d);
if (int errs = errorcount + sorrycount)
if (errs > current_tinst_level->errors)
if (function *f = DECL_STRUCT_FUNCTION (d))
f->language->erroneous = true;
}
/* We're not deferring instantiation any more. */

View file

@ -1318,18 +1318,9 @@ get_pseudo_ti_index (tree type)
static tinfo_s *
get_tinfo_desc (unsigned ix)
{
unsigned len = tinfo_descs->length ();
if (len <= ix)
{
/* too short, extend. */
len = ix + 1 - len;
vec_safe_reserve (tinfo_descs, len);
tinfo_s elt;
elt.type = elt.vtable = elt.name = NULL_TREE;
while (len--)
tinfo_descs->quick_push (elt);
}
if (tinfo_descs->length () <= ix)
/* too short, extend. */
vec_safe_grow_cleared (tinfo_descs, ix + 1);
tinfo_s *res = &(*tinfo_descs)[ix];

View file

@ -5088,22 +5088,32 @@ static tree
finish_type_pack_element (tree idx, tree types, tsubst_flags_t complain)
{
idx = maybe_constant_value (idx, NULL_TREE, mce_true);
if (TREE_CODE (idx) != INTEGER_CST || !INTEGRAL_TYPE_P (TREE_TYPE (idx)))
if (!INTEGRAL_TYPE_P (TREE_TYPE (idx)))
{
if (complain & tf_error)
error ("pack index is not an integral constant");
error ("pack index has non-integral type %qT", TREE_TYPE (idx));
return error_mark_node;
}
if (TREE_CODE (idx) != INTEGER_CST)
{
if (complain & tf_error)
{
error ("pack index is not an integral constant");
cxx_constant_value (idx);
}
return error_mark_node;
}
if (tree_int_cst_sgn (idx) < 0)
{
if (complain & tf_error)
error ("pack index is negative");
error ("pack index %qE is negative", idx);
return error_mark_node;
}
if (wi::to_widest (idx) >= TREE_VEC_LENGTH (types))
{
if (complain & tf_error)
error ("pack index is out of range");
error ("pack index %qE is out of range for pack of length %qd",
idx, TREE_VEC_LENGTH (types));
return error_mark_node;
}
return TREE_VEC_ELT (types, tree_to_shwi (idx));

View file

@ -1,3 +1,26 @@
2025-04-17 Iain Buclaw <ibuclaw@gdcproject.org>
* dmd/MERGE: Merge upstream dmd 956e73d64e.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119826
* types.cc (TypeVisitor::visit (TypeEnum *)): Propagate flags of main
enum types to all forward-referenced variants.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119799
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Check front-end
type size before building the VAR_DECL. Allow C symbols to have a
size of `0'.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119817
* imports.cc (ImportVisitor::visit (OverloadSet *)): Don't push
NULL_TREE to vector of import symbols.
2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/109023

View file

@ -791,6 +791,12 @@ public:
}
else if (d->isDataseg ())
{
/* When the front-end type size is invalid, an error has already been
given for the declaration or type. */
dinteger_t size = dmd::size (d->type, d->loc);
if (size == SIZE_INVALID)
return;
tree decl = get_symbol_decl (d);
/* Only need to build the VAR_DECL for extern declarations. */
@ -804,9 +810,7 @@ public:
return;
/* How big a symbol can be should depend on back-end. */
tree size = build_integer_cst (dmd::size (d->type, d->loc),
build_ctype (Type::tsize_t));
if (!valid_constant_size_p (size))
if (!valid_constant_size_p (build_integer_cst (size, size_type_node)))
{
error_at (make_location_t (d->loc), "size is too large");
return;
@ -835,8 +839,9 @@ public:
}
/* Frontend should have already caught this. */
gcc_assert (!integer_zerop (size)
|| d->type->toBasetype ()->isTypeSArray ());
gcc_assert ((size != 0 && size != SIZE_INVALID)
|| d->type->toBasetype ()->isTypeSArray ()
|| d->isCsymbol ());
d_finish_decl (decl);

View file

@ -1,4 +1,4 @@
1b34fea4788136b54ec77c6ed9678754d109fc79
956e73d64e532a68213970316c2590c572ec03f3
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.

View file

@ -6978,10 +6978,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
while (1)
{
AttribDeclaration ad = s.isAttribDeclaration();
if (!ad)
break;
if (ad.decl && ad.decl.length == 1)
if (ad && ad.decl && ad.decl.length == 1)
s = (*ad.decl)[0];
else
break;
}
//printf("inserting '%s' %p into sc = %p\n", s.toChars(), s, sc);

View file

@ -182,7 +182,11 @@ public:
vec_alloc (tset, d->a.length);
for (size_t i = 0; i < d->a.length; i++)
vec_safe_push (tset, build_import_decl (d->a[i]));
{
tree overload = build_import_decl (d->a[i]);
if (overload != NULL_TREE)
vec_safe_push (tset, overload);
}
this->result_ = build_tree_list_vec (tset);
tset->truncate (0);

View file

@ -1179,6 +1179,26 @@ public:
layout_type (t->ctype);
/* Fix up all forward-referenced variants of this enum type. */
for (tree v = TYPE_MAIN_VARIANT (t->ctype); v;
v = TYPE_NEXT_VARIANT (v))
{
if (v == t->ctype)
continue;
TYPE_VALUES (v) = TYPE_VALUES (t->ctype);
TYPE_LANG_SPECIFIC (v) = TYPE_LANG_SPECIFIC (t->ctype);
TYPE_MIN_VALUE (v) = TYPE_MIN_VALUE (t->ctype);
TYPE_MAX_VALUE (v) = TYPE_MAX_VALUE (t->ctype);
TYPE_UNSIGNED (v) = TYPE_UNSIGNED (t->ctype);
TYPE_SIZE (v) = TYPE_SIZE (t->ctype);
TYPE_SIZE_UNIT (v) = TYPE_SIZE_UNIT (t->ctype);
SET_TYPE_MODE (v, TYPE_MODE (t->ctype));
TYPE_PRECISION (v) = TYPE_PRECISION (t->ctype);
SET_TYPE_ALIGN (v, TYPE_ALIGN (t->ctype));
TYPE_USER_ALIGN (v) = TYPE_USER_ALIGN (t->ctype);
}
/* Complete forward-referenced fields of this enum type. */
finish_incomplete_fields (t->ctype);
}

View file

@ -1933,6 +1933,13 @@ Note that if such a function is called indirectly the compiler may
or may not inline it depending on optimization level and a failure
to inline an indirect call may or may not be diagnosed.
If you need to use the inlined function in multiple translation units,
you should put the @code{always_inline} attribute on a function
definition in a header file that is included in all translation units
where the function is used. Link-time optimization can inline
functions across translation units, but only if an optimization level
that normally enables inlining is additionally specified.
@cindex @code{artificial} function attribute
@item artificial
This attribute is useful for small inline wrappers that if possible
@ -12299,15 +12306,6 @@ for the @samp{att} and @samp{intel} dialects of assembler:
@item @code{%3}
@tab @code{$.L3}
@tab @code{OFFSET FLAT:.L3}
@item @code{%4}
@tab @code{$8}
@tab @code{8}
@item @code{%5}
@tab @code{%xmm0}
@tab @code{xmm0}
@item @code{%7}
@tab @code{$0}
@tab @code{0}
@end multitable
The table below shows the list of supported modifiers and their effects.
@ -12324,32 +12322,17 @@ The table below shows the list of supported modifiers and their effects.
@tab @code{%b0}
@tab @code{%al}
@tab @code{al}
@item @code{B}
@tab print the opcode suffix of b.
@tab @code{%B0}
@tab @code{b}
@tab
@item @code{c}
@tab Require a constant operand and print the constant expression with no punctuation.
@tab @code{%c1}
@tab @code{2}
@tab @code{2}
@item @code{d}
@tab print duplicated register operand for AVX instruction.
@tab @code{%d5}
@tab @code{%xmm0, %xmm0}
@tab @code{xmm0, xmm0}
@item @code{E}
@tab Print the address in Double Integer (DImode) mode (8 bytes) when the target is 64-bit.
Otherwise mode is unspecified (VOIDmode).
@tab @code{%E1}
@tab @code{%(rax)}
@tab @code{[rax]}
@item @code{g}
@tab Print the V16SFmode name of the register.
@tab @code{%g0}
@tab @code{%zmm0}
@tab @code{zmm0}
@item @code{h}
@tab Print the QImode name for a ``high'' register.
@tab @code{%h0}
@ -12371,16 +12354,6 @@ high 8 bytes of SSE values. For a memref in (%rax), it generates
@tab @code{%l3}
@tab @code{.L3}
@tab @code{.L3}
@item @code{L}
@tab print the opcode suffix of l.
@tab @code{%L0}
@tab @code{l}
@tab
@item @code{N}
@tab print maskz.
@tab @code{%N7}
@tab @code{@{z@}}
@tab @code{@{z@}}
@item @code{p}
@tab Print raw symbol name (without syntax-specific prefixes).
@tab @code{%p2}
@ -12396,76 +12369,20 @@ issue the bare constant. See @code{p} above.
@tab @code{%q0}
@tab @code{%rax}
@tab @code{rax}
@item @code{Q}
@tab print the opcode suffix of q.
@tab @code{%Q0}
@tab @code{q}
@tab
@item @code{R}
@tab print embedded rounding and sae.
@tab @code{%R4}
@tab @code{@{rn-sae@}, }
@tab @code{, @{rn-sae@}}
@item @code{r}
@tab print only sae.
@tab @code{%r4}
@tab @code{@{sae@}, }
@tab @code{, @{sae@}}
@item @code{s}
@tab print a shift double count, followed by the assemblers argument
delimiterprint the opcode suffix of s.
@tab @code{%s1}
@tab @code{$2, }
@tab @code{2, }
@item @code{S}
@tab print the opcode suffix of s.
@tab @code{%S0}
@tab @code{s}
@tab
@item @code{t}
@tab print the V8SFmode name of the register.
@tab @code{%t5}
@tab @code{%ymm0}
@tab @code{ymm0}
@item @code{T}
@tab print the opcode suffix of t.
@tab @code{%T0}
@tab @code{t}
@tab
@item @code{V}
@tab print naked full integer register name without %.
@tab @code{%V0}
@tab @code{eax}
@tab @code{eax}
@item @code{w}
@tab Print the HImode name of the register.
@tab @code{%w0}
@tab @code{%ax}
@tab @code{ax}
@item @code{W}
@tab print the opcode suffix of w.
@tab @code{%W0}
@tab @code{w}
@tab
@item @code{x}
@tab print the V4SFmode name of the register.
@tab @code{%x5}
@tab @code{%xmm0}
@tab @code{xmm0}
@item @code{y}
@tab print "st(0)" instead of "st" as a register.
@tab @code{%y6}
@tab @code{%st(0)}
@tab @code{st(0)}
@item @code{z}
@tab Print the opcode suffix for the size of the current integer operand (one of @code{b}/@code{w}/@code{l}/@code{q}).
@tab @code{%z0}
@tab @code{l}
@tab
@item @code{Z}
@tab Like @code{z}, with special suffixes for x87 instructions.
@end multitable
@code{V} is a special modifier which prints the name of the full integer
register without @code{%}.
@anchor{x86floatingpointasmoperands}
@subsubsection x86 Floating-Point @code{asm} Operands
@ -13061,6 +12978,7 @@ C and/or C++ standards, while others remain specific to GNU C.
* Binary constants:: Binary constants using the @samp{0b} prefix.
* Dollar Signs:: Dollar sign is allowed in identifiers.
* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
* Raw String Literals:: C++ raw string literals are supported in C.
* Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files.
* Function Names:: Printable strings which are the name of the current
function.
@ -14082,6 +14000,25 @@ machines, typically because the target assembler does not allow them.
You can use the sequence @samp{\e} in a string or character constant to
stand for the ASCII character @key{ESC}.
@node Raw String Literals
@subsection Raw String Literals
@cindex raw string literals
@cindex string literals, raw
The C++11 standard added syntax for raw string literals prefixed
with @samp{R}. This syntax allows you to use an arbitrary delimiter
sequence instead of escaping special characters within the string.
For example, these string constants are all equivalent:
@smallexample
const char *s1 = "\\";
const char *s2 = R"(\)";
const char *s3 = R"foo(\)foo";
@end smallexample
As an extension, GCC also accepts raw string literals in C with
@option{-std=gnu99} or later.
@node Alternate Keywords
@subsection Alternate Keywords
@cindex alternate keywords

View file

@ -593,7 +593,7 @@ Objective-C and Objective-C++ Dialects}.
-finline-functions -finline-functions-called-once -finline-limit=@var{n}
-finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone
-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
-fipa-reference -fipa-reference-addressable
-fipa-reference -fipa-reference-addressable -fipa-reorder-for-locality
-fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm}
-flate-combine-instructions -flifetime-dse -flive-patching=@var{level}
-fira-region=@var{region} -fira-hoist-pressure
@ -2199,6 +2199,7 @@ those that have already been displayed. If @option{--help} is also
specified anywhere on the command line then this takes precedence
over any @option{--help=} option.
@opindex Q
If the @option{-Q} option appears on the command line before the
@option{--help=} option, then the descriptive text displayed by
@option{--help=} is changed. Instead of describing the displayed
@ -12746,6 +12747,7 @@ complexity than at @option{-O}.
-fipa-pure-const
-fipa-reference
-fipa-reference-addressable
-fivopts
-fmerge-constants
-fmove-loop-invariants
-fmove-loop-stores
@ -12854,6 +12856,13 @@ by @option{-O2} and also turns on the following optimization flags:
Reduce compilation time and make debugging produce the expected
results. This is the default.
At @option{-O0}, GCC completely disables most optimization passes;
they are not run even if you explicitly enable them on the command
line, or are listed by @option{-Q --help=optimizers} as being enabled by
default. Many optimizations performed by GCC depend on code analysis
or canonicalization passes that are enabled by @option{-O}, and it would
not be useful to run individual optimization passes in isolation.
@opindex Os
@item -Os
Optimize for size. @option{-Os} enables all @option{-O2} optimizations
@ -13871,6 +13880,21 @@ Enabled by default at @option{-O1} and higher.
Discover read-only, write-only and non-addressable static variables.
Enabled by default at @option{-O1} and higher.
@opindex fipa-reorder-for-locality
@item -fipa-reorder-for-locality
Group call chains close together in the binary layout to improve code
locality and minimize jump distances between frequently called functions.
Unlike @option{-freorder-functions} this pass considers the call
chains between functions and groups them together, rather than grouping all
hot/normal/cold/never-executed functions into separate sections.
Unlike @option{-fprofile-reorder-functions} it aims to improve code locality
throughout the runtime of the program rather than focusing on program startup.
This option is incompatible with an explicit
@option{-flto-partition=} option since it enforces a custom partitioning
scheme.
If using this option it is recommended to also use profile feedback, but this
option is not enabled by default otherwise.
@opindex fipa-stack-alignment
@item -fipa-stack-alignment
Reduce stack alignment on call sites if possible.
@ -14291,6 +14315,7 @@ Enabled by default at @option{-O1} and higher.
@item -fivopts
Perform induction variable optimizations (strength reduction, induction
variable merging and induction variable elimination) on trees.
Enabled by default at @option{-O1} and higher.
@opindex ftree-parallelize-loops
@item -ftree-parallelize-loops=n
@ -14606,11 +14631,13 @@ Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
@opindex freorder-functions
@item -freorder-functions
Reorder functions in the object file in order to
improve code locality. This is implemented by using special
subsections @code{.text.hot} for most frequently executed functions and
@code{.text.unlikely} for unlikely executed functions. Reordering is done by
the linker so object file format must support named sections and linker must
place them in a reasonable way.
improve code locality. Unlike @option{-fipa-reorder-for-locality} this option
prioritises grouping all functions within a category
(hot/normal/cold/never-executed) together.
This is implemented by using special subsections @code{.text.hot} for most
frequently executed functions and @code{.text.unlikely} for unlikely executed
functions. Reordering is done by the linker so object file format must support
named sections and linker must place them in a reasonable way.
This option isn't effective unless you either provide profile feedback
(see @option{-fprofile-arcs} for details) or manually annotate functions with
@ -14622,12 +14649,14 @@ Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
@item -fstrict-aliasing
Allow the compiler to assume the strictest aliasing rules applicable to
the language being compiled. For C (and C++), this activates
optimizations based on the type of expressions. In particular, an
object of one type is assumed never to reside at the same address as an
object of a different type, unless the types are almost the same. For
example, an @code{unsigned int} can alias an @code{int}, but not a
@code{void*} or a @code{double}. A character type may alias any other
type.
optimizations based on the type of expressions. In particular, accessing
an object of one type via an expression of a different type is not allowed,
unless the types are @dfn{compatible types}, differ only in signedness or
qualifiers, or the expression has a character type. Accessing scalar
objects via a corresponding vector type is also allowed.
For example, an @code{unsigned int} can alias an @code{int}, but not a
@code{void*} or a @code{double}. A character type may alias any other type.
@anchor{Type-punning}Pay special attention to code like this:
@smallexample
@ -15635,7 +15664,8 @@ Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
@item -fprofile-reorder-functions
Function reordering based on profile instrumentation collects
first time of execution of a function and orders these functions
in ascending order.
in ascending order, aiming to optimize program startup through more
efficient loading of text segments.
Enabled with @option{-fprofile-use}.
@ -21284,8 +21314,13 @@ Toggle @option{-fvar-tracking-assignments}, in the same way that
@opindex Q
@item -Q
Makes the compiler print out each function name as it is compiled, and
print some statistics about each pass when it finishes.
When used on the command line prior to @option{--help=}, @option{-Q}
acts as a modifier to the help output. @xref{Overall Options},
for details about @option{--help=}.
Otherwise, this option makes the compiler print out each function name
as it is compiled, and print some statistics about each pass when it
finishes.
@opindex ftime-report
@item -ftime-report
@ -34872,7 +34907,7 @@ Intel Lakemont MCU, based on Intel Pentium CPU.
Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
@item pentiumpro
Intel Pentium Pro CPU@.
Intel Pentium Pro CPU with no MMX support.
@item i686
When used with @option{-march}, the Pentium Pro

View file

@ -970,12 +970,26 @@ expand_dw2_landing_pad_for_region (eh_region region)
{ /* Nothing */ }
if (region->exc_ptr_reg)
emit_move_insn (region->exc_ptr_reg,
gen_rtx_REG (ptr_mode, EH_RETURN_DATA_REGNO (0)));
{
rtx exc_ptr_reg;
if (EH_RETURN_DATA_REGNO (0) != INVALID_REGNUM)
exc_ptr_reg = gen_rtx_REG (ptr_mode, EH_RETURN_DATA_REGNO (0));
else
/* The target must be doing something special. Submit a dummy. */
exc_ptr_reg = constm1_rtx;
emit_move_insn (region->exc_ptr_reg, exc_ptr_reg);
}
if (region->filter_reg)
emit_move_insn (region->filter_reg,
gen_rtx_REG (targetm.eh_return_filter_mode (),
EH_RETURN_DATA_REGNO (1)));
{
rtx filter_reg;
if (EH_RETURN_DATA_REGNO (1) != INVALID_REGNUM)
filter_reg = gen_rtx_REG (targetm.eh_return_filter_mode (),
EH_RETURN_DATA_REGNO (1));
else
/* The target must be doing something special. Submit a dummy. */
filter_reg = constm1_rtx;
emit_move_insn (region->filter_reg, filter_reg);
}
}
/* Expand the extra code needed at landing pads for dwarf2 unwinding. */

View file

@ -404,7 +404,15 @@ enum lto_partition_model {
LTO_PARTITION_BALANCED = 2,
LTO_PARTITION_1TO1 = 3,
LTO_PARTITION_MAX = 4,
LTO_PARTITION_CACHE = 5
LTO_PARTITION_CACHE = 5,
LTO_PARTITION_DEFAULT= 6
};
/* flag_lto_locality_cloning initialization values. */
enum lto_locality_cloning_model {
LTO_LOCALITY_NO_CLONING = 0,
LTO_LOCALITY_NON_INTERPOSABLE_CLONING = 1,
LTO_LOCALITY_MAXIMAL_CLONING = 2,
};
/* flag_lto_linker_output initialization values. */

View file

@ -1,3 +1,39 @@
2025-04-16 Harald Anlauf <anlauf@gmx.de>
PR fortran/106948
* resolve.cc (gfc_pure_function): If a function has been resolved,
but esym is not yet set, look at its attributes to see whether it
is pure or elemental.
2025-04-15 Tobias Burnus <tburnus@baylibre.com>
* f95-lang.cc (LANG_HOOKS_OMP_DEEP_MAPPING,
LANG_HOOKS_OMP_DEEP_MAPPING_P, LANG_HOOKS_OMP_DEEP_MAPPING_CNT):
Define.
* openmp.cc (gfc_match_omp_clause_reduction): Fix location setting.
(resolve_omp_clauses): Permit allocatable components, reject
them and polymorphic variables in PRIVATE/FIRSTPRIVATE.
* trans-decl.cc (add_clause): Set clause location.
* trans-openmp.cc (gfc_has_alloc_comps): Add ptr_ok and
shallow_alloc_only Boolean arguments.
(gfc_omp_replace_alloc_by_to_mapping): New.
(gfc_omp_private_outer_ref, gfc_walk_alloc_comps,
gfc_omp_clause_default_ctor, gfc_omp_clause_copy_ctor,
gfc_omp_clause_assign_op, gfc_omp_clause_dtor): Update call to it.
(gfc_omp_finish_clause): Minor cleanups, improve location data,
handle allocatable components.
(gfc_omp_deep_mapping_map, gfc_omp_deep_mapping_item,
gfc_omp_deep_mapping_comps, gfc_omp_gen_simple_loop,
gfc_omp_get_array_size, gfc_omp_elmental_loop,
gfc_omp_deep_map_kind_p, gfc_omp_deep_mapping_int_p,
gfc_omp_deep_mapping_p, gfc_omp_deep_mapping_do,
gfc_omp_deep_mapping_cnt, gfc_omp_deep_mapping): New.
(gfc_trans_omp_array_section): Save array descriptor in case
deep-mapping lang hook will need it.
(gfc_trans_omp_clauses): Likewise; use better clause location data.
* trans.h (gfc_omp_deep_mapping_p, gfc_omp_deep_mapping_cnt,
gfc_omp_deep_mapping): Add function prototypes.
2025-04-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/119669

View file

@ -148,6 +148,9 @@ gfc_get_sarif_source_language (const char *)
#undef LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR
#undef LANG_HOOKS_OMP_CLAUSE_DTOR
#undef LANG_HOOKS_OMP_FINISH_CLAUSE
#undef LANG_HOOKS_OMP_DEEP_MAPPING
#undef LANG_HOOKS_OMP_DEEP_MAPPING_P
#undef LANG_HOOKS_OMP_DEEP_MAPPING_CNT
#undef LANG_HOOKS_OMP_ALLOCATABLE_P
#undef LANG_HOOKS_OMP_SCALAR_TARGET_P
#undef LANG_HOOKS_OMP_SCALAR_P
@ -188,6 +191,9 @@ gfc_get_sarif_source_language (const char *)
#define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR gfc_omp_clause_linear_ctor
#define LANG_HOOKS_OMP_CLAUSE_DTOR gfc_omp_clause_dtor
#define LANG_HOOKS_OMP_FINISH_CLAUSE gfc_omp_finish_clause
#define LANG_HOOKS_OMP_DEEP_MAPPING gfc_omp_deep_mapping
#define LANG_HOOKS_OMP_DEEP_MAPPING_P gfc_omp_deep_mapping_p
#define LANG_HOOKS_OMP_DEEP_MAPPING_CNT gfc_omp_deep_mapping_cnt
#define LANG_HOOKS_OMP_ALLOCATABLE_P gfc_omp_allocatable_p
#define LANG_HOOKS_OMP_SCALAR_P gfc_omp_scalar_p
#define LANG_HOOKS_OMP_SCALAR_TARGET_P gfc_omp_scalar_target_p

View file

@ -1588,7 +1588,7 @@ gfc_match_omp_clause_reduction (char pc, gfc_omp_clauses *c, bool openacc,
{
gfc_omp_namelist *p = gfc_get_omp_namelist (), **tl;
p->sym = n->sym;
p->where = p->where;
p->where = n->where;
p->u.map.op = OMP_MAP_ALWAYS_TOFROM;
tl = &c->lists[OMP_LIST_MAP];
@ -9681,22 +9681,6 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
&& n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array %qs in %s clause at %L",
n->sym->name, name, &n->where);
if (!openacc
&& list == OMP_LIST_MAP
&& n->sym->ts.type == BT_DERIVED
&& n->sym->ts.u.derived->attr.alloc_comp)
gfc_error ("List item %qs with allocatable components is not "
"permitted in map clause at %L", n->sym->name,
&n->where);
if (!openacc
&& (list == OMP_LIST_MAP
|| list == OMP_LIST_FROM
|| list == OMP_LIST_TO)
&& ((n->expr && n->expr->ts.type == BT_CLASS)
|| (!n->expr && n->sym->ts.type == BT_CLASS)))
gfc_warning (OPT_Wopenmp,
"Mapping polymorphic list item at %L is "
"unspecified behavior", &n->where);
if (list == OMP_LIST_MAP && !openacc)
switch (code->op)
{
@ -10008,9 +9992,11 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
n->sym->name, name, &n->where);
if (!openacc
&& list == OMP_LIST_FIRSTPRIVATE
&& ((n->expr && n->expr->ts.type == BT_CLASS)
|| (!n->expr && n->sym->ts.type == BT_CLASS)))
&& (list == OMP_LIST_PRIVATE
|| list == OMP_LIST_FIRSTPRIVATE)
&& ((n->sym->ts.type == BT_DERIVED
&& n->sym->ts.u.derived->attr.alloc_comp)
|| n->sym->ts.type == BT_CLASS))
switch (code->op)
{
case EXEC_OMP_TARGET:
@ -10025,9 +10011,19 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
case EXEC_OMP_TARGET_TEAMS_LOOP:
gfc_warning (OPT_Wopenmp,
"FIRSTPRIVATE with polymorphic list item at "
"%L is unspecified behavior", &n->where);
if (n->sym->ts.type == BT_DERIVED
&& n->sym->ts.u.derived->attr.alloc_comp)
gfc_error ("Sorry, list item %qs at %L with allocatable"
" components is not yet supported in %s "
"clause", n->sym->name, &n->where,
list == OMP_LIST_PRIVATE ? "PRIVATE"
: "FIRSTPRIVATE");
else
gfc_error ("Polymorphic list item %qs at %L in %s "
"clause has unspecified behavior and "
"unsupported", n->sym->name, &n->where,
list == OMP_LIST_PRIVATE ? "PRIVATE"
: "FIRSTPRIVATE");
break;
default:
break;

View file

@ -3190,6 +3190,13 @@ gfc_pure_function (gfc_expr *e, const char **name)
|| e->value.function.isym->elemental;
*name = e->value.function.isym->name;
}
else if (e->symtree && e->symtree->n.sym && e->symtree->n.sym->attr.dummy)
{
/* The function has been resolved, but esym is not yet set.
This can happen with functions as dummy argument. */
pure = e->symtree->n.sym->attr.pure;
*name = e->symtree->n.sym->name;
}
else
{
/* Implicit functions are not pure. */

View file

@ -6920,6 +6920,7 @@ add_clause (gfc_symbol *sym, gfc_omp_map_op map_op)
n = gfc_get_omp_namelist ();
n->sym = sym;
n->where = sym->declared_at;
n->u.map.op = map_op;
if (!module_oacc_clauses)

File diff suppressed because it is too large Load diff

View file

@ -839,6 +839,10 @@ tree gfc_omp_clause_assign_op (tree, tree, tree);
tree gfc_omp_clause_linear_ctor (tree, tree, tree, tree);
tree gfc_omp_clause_dtor (tree, tree);
void gfc_omp_finish_clause (tree, gimple_seq *, bool);
bool gfc_omp_deep_mapping_p (const gimple *, tree);
tree gfc_omp_deep_mapping_cnt (const gimple *, tree, gimple_seq *);
void gfc_omp_deep_mapping (const gimple *, tree, unsigned HOST_WIDE_INT, tree,
tree, tree, tree, tree, gimple_seq *);
bool gfc_omp_allocatable_p (tree);
bool gfc_omp_scalar_p (tree, bool);
bool gfc_omp_scalar_target_p (tree);

View file

@ -6647,10 +6647,28 @@ gimple_lower_bitint (void)
bitmap_set_bit (large_huge.m_names, SSA_NAME_VERSION (s));
if (has_single_use (s))
{
if (!large_huge.m_single_use_names)
large_huge.m_single_use_names = BITMAP_ALLOC (NULL);
bitmap_set_bit (large_huge.m_single_use_names,
SSA_NAME_VERSION (s));
tree s2 = s;
/* The coalescing hook special cases SSA_NAME copies.
Make sure not to mark in m_single_use_names single
use SSA_NAMEs copied from non-single use SSA_NAMEs. */
while (gimple_assign_copy_p (SSA_NAME_DEF_STMT (s2)))
{
s2 = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (s2));
if (TREE_CODE (s2) != SSA_NAME)
break;
if (!has_single_use (s2))
{
s2 = NULL_TREE;
break;
}
}
if (s2)
{
if (!large_huge.m_single_use_names)
large_huge.m_single_use_names = BITMAP_ALLOC (NULL);
bitmap_set_bit (large_huge.m_single_use_names,
SSA_NAME_VERSION (s));
}
}
if (SSA_NAME_VAR (s)
&& ((TREE_CODE (SSA_NAME_VAR (s)) == PARM_DECL

View file

@ -89,6 +89,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef _PTRDIFF_T_
#endif
/* When modular code is enabled with macOS SDKs from version 15, the
include guards are set in the includers of this code, rather than as
part of it. This means the we must unset them or the intended code
here will be bypassed (resulting in undefined values). */
#if defined (__APPLE__)
# if defined(__has_feature) && __has_feature(modules)
# if defined (__need_ptrdiff_t)
# undef __PTRDIFF_T
# endif
# if defined (__need_size_t)
# undef __SIZE_T
# endif
# endif
#endif
/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
_TYPE_size_t which will typedef size_t. fixincludes patched the
vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is

View file

@ -313,14 +313,24 @@ ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, bool dump_benefits)
static void
ipcp_print_widest_int (FILE *f, const widest_int &value)
{
if (wi::eq_p (wi::bit_not (value), 0))
if (value == -1)
fprintf (f, "-1");
else if (wi::eq_p (wi::bit_not (wi::bit_or (value,
wi::sub (wi::lshift (1, 128),
1))), 0))
else if (wi::arshift (value, 128) == -1)
{
fprintf (f, "all ones folled by ");
print_hex (wi::bit_and (value, wi::sub (wi::lshift (1, 128), 1)), f);
char buf[35], *p = buf + 2;
widest_int v = wi::zext (value, 128);
size_t len;
print_hex (v, buf);
len = strlen (p);
if (len == 32)
{
fprintf (f, "0xf..f");
while (*p == 'f')
++p;
}
else
fprintf (f, "0xf..f%0*d", (int) (32 - len), 0);
fputs (p, f);
}
else
print_hex (value, f);
@ -923,13 +933,13 @@ ipcp_bits_lattice::meet_with_1 (widest_int value, widest_int mask,
m_mask = (m_mask | mask) | (m_value ^ value);
if (drop_all_ones)
m_mask |= m_value;
m_value &= ~m_mask;
widest_int cap_mask = wi::bit_not (wi::sub (wi::lshift (1, precision), 1));
widest_int cap_mask = wi::shifted_mask <widest_int> (0, precision, true);
m_mask |= cap_mask;
if (wi::sext (m_mask, precision) == -1)
return set_to_bottom ();
m_value &= ~m_mask;
return m_mask != old_mask;
}
@ -1005,7 +1015,7 @@ ipcp_bits_lattice::meet_with (ipcp_bits_lattice& other, unsigned precision,
adjusted_mask |= adjusted_value;
adjusted_value &= ~adjusted_mask;
}
widest_int cap_mask = wi::bit_not (wi::sub (wi::lshift (1, precision), 1));
widest_int cap_mask = wi::shifted_mask <widest_int> (0, precision, true);
adjusted_mask |= cap_mask;
if (wi::sext (adjusted_mask, precision) == -1)
return set_to_bottom ();

1137
gcc/ipa-locality-cloning.cc Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
/* LTO partitioning logic routines.
Copyright The GNU Toolchain Authors
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef IPA_LOCALITY_CLONING_H
#define IPA_LOCALITY_CLONING_H
/* Structure describing locality partitions. */
struct locality_partition_def
{
int part_id;
vec<cgraph_node *> nodes;
int insns;
};
typedef struct locality_partition_def *locality_partition;
extern vec<locality_partition> locality_partitions;
#endif /* IPA_LOCALITY_CLONING_H */

View file

@ -5439,6 +5439,49 @@ ipa_read_node_info (class lto_input_block *ib, struct cgraph_node *node,
}
}
/* Stream out ipa_return_summary. */
static void
ipa_write_return_summaries (output_block *ob)
{
if (!ipa_return_value_sum)
{
streamer_write_uhwi (ob, 0);
return;
}
lto_symtab_encoder_t encoder = ob->decl_state->symtab_node_encoder;
unsigned int count = 0;
for (int i = 0; i < lto_symtab_encoder_size (encoder); i++)
{
symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
ipa_return_value_summary *v;
if (cnode && cnode->definition && !cnode->alias
&& (v = ipa_return_value_sum->get (cnode))
&& v->vr)
count++;
}
streamer_write_uhwi (ob, count);
for (int i = 0; i < lto_symtab_encoder_size (encoder); i++)
{
symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
ipa_return_value_summary *v;
if (cnode && cnode->definition && !cnode->alias
&& (v = ipa_return_value_sum->get (cnode))
&& v->vr)
{
streamer_write_uhwi
(ob,
lto_symtab_encoder_encode (encoder, cnode));
v->vr->streamer_write (ob);
}
}
}
/* Write jump functions for nodes in SET. */
void
@ -5475,11 +5518,58 @@ ipa_prop_write_jump_functions (void)
&& ipa_node_params_sum->get (node) != NULL)
ipa_write_node_info (ob, node);
}
streamer_write_char_stream (ob->main_stream, 0);
ipa_write_return_summaries (ob);
produce_asm (ob);
destroy_output_block (ob);
}
/* Record that return value range of N is VAL. */
static void
ipa_record_return_value_range_1 (cgraph_node *n, value_range val)
{
if (!ipa_return_value_sum)
{
if (!ipa_vr_hash_table)
ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
ipa_return_value_sum = new (ggc_alloc_no_dtor <ipa_return_value_sum_t> ())
ipa_return_value_sum_t (symtab, true);
ipa_return_value_sum->disable_insertion_hook ();
}
ipa_return_value_sum->get_create (n)->vr = ipa_get_value_range (val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Recording return range of %s:", n->dump_name ());
val.dump (dump_file);
fprintf (dump_file, "\n");
}
}
/* Stream out ipa_return_summary. */
static void
ipa_read_return_summaries (lto_input_block *ib,
struct lto_file_decl_data *file_data,
class data_in *data_in)
{
unsigned int f_count = streamer_read_uhwi (ib);
for (unsigned int i = 0; i < f_count; i++)
{
unsigned int index = streamer_read_uhwi (ib);
lto_symtab_encoder_t encoder = file_data->symtab_node_encoder;
struct cgraph_node *node
= dyn_cast <cgraph_node *>
(lto_symtab_encoder_deref (encoder, index));
ipa_vr rvr;
rvr.streamer_read (ib, data_in);
if (node->prevailing_p ())
{
value_range tmp;
rvr.get_vrange (tmp);
ipa_record_return_value_range_1 (node, tmp);
}
}
}
/* Read section in file FILE_DATA of length LEN with data DATA. */
static void
@ -5516,6 +5606,7 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
gcc_assert (node->definition);
ipa_read_node_info (&ib_main, node, data_in);
}
ipa_read_return_summaries (&ib_main, file_data, data_in);
lto_free_section_data (file_data, LTO_section_jump_functions, NULL, data,
len);
lto_data_in_delete (data_in);
@ -5635,6 +5726,7 @@ read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node,
}
}
/* Write all aggregate replacement for nodes in set. */
void
@ -5673,7 +5765,7 @@ ipcp_write_transformation_summaries (void)
&& lto_symtab_encoder_encode_body_p (encoder, cnode))
write_ipcp_transformation_info (ob, cnode, ts);
}
streamer_write_char_stream (ob->main_stream, 0);
ipa_write_return_summaries (ob);
produce_asm (ob);
destroy_output_block (ob);
}
@ -5714,6 +5806,7 @@ read_replacements_section (struct lto_file_decl_data *file_data,
index));
read_ipcp_transformation_info (&ib_main, node, data_in);
}
ipa_read_return_summaries (&ib_main, file_data, data_in);
lto_free_section_data (file_data, LTO_section_jump_functions, NULL, data,
len);
lto_data_in_delete (data_in);
@ -6194,22 +6287,8 @@ ipcp_transform_function (struct cgraph_node *node)
void
ipa_record_return_value_range (value_range val)
{
cgraph_node *n = cgraph_node::get (current_function_decl);
if (!ipa_return_value_sum)
{
if (!ipa_vr_hash_table)
ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
ipa_return_value_sum = new (ggc_alloc_no_dtor <ipa_return_value_sum_t> ())
ipa_return_value_sum_t (symtab, true);
ipa_return_value_sum->disable_insertion_hook ();
}
ipa_return_value_sum->get_create (n)->vr = ipa_get_value_range (val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Recording return range ");
val.dump (dump_file);
fprintf (dump_file, "\n");
}
ipa_record_return_value_range_1
(cgraph_node::get (current_function_decl), val);
}
/* Return true if value range of DECL is known and if so initialize RANGE. */

View file

@ -229,6 +229,8 @@ lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t encoder,
symtab_node *node)
{
int index = lto_symtab_encoder_encode (encoder, node);
if (dump_file)
fprintf(dump_file, "Node %s, index %d\n", node->asm_name(), index);
encoder->nodes[index].in_partition = true;
}

View file

@ -1,3 +1,13 @@
2025-04-15 Kyrylo Tkachov <ktkachov@nvidia.com>
* lto-partition.cc (add_node_references_to_partition): Define.
(create_partition): Likewise.
(lto_locality_map): Likewise.
(lto_promote_cross_file_statics): Add extra dumping.
* lto-partition.h (lto_locality_map): Declare prototype.
* lto.cc (do_whole_program_analysis): Handle
flag_ipa_reorder_for_locality.
2025-02-28 Richard Biener <rguenther@suse.de>
PR lto/91299

View file

@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
#include "lto-partition.h"
#include "ipa-locality-cloning.h"
#include <limits>
@ -1418,6 +1419,126 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
}
}
/* Add all references of NODE into PARTITION. */
static void
add_node_references_to_partition (ltrans_partition partition, symtab_node *node)
{
struct ipa_ref *ref = NULL;
varpool_node *vnode;
for (int j = 0; node->iterate_reference (j, ref); j++)
if (is_a <varpool_node *> (ref->referred))
{
vnode = dyn_cast <varpool_node *> (ref->referred);
if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder
&& vnode->get_partitioning_class () == SYMBOL_PARTITION)
{
add_symbol_to_partition (partition, vnode);
if (dump_file)
fprintf (dump_file, "Varpool Node: %s\n", vnode->dump_asm_name ());
add_node_references_to_partition (partition, vnode);
}
}
for (int j = 0; node->iterate_referring (j, ref); j++)
if (is_a <varpool_node *> (ref->referring))
{
vnode = dyn_cast <varpool_node *> (ref->referring);
gcc_assert (vnode->definition);
if (!symbol_partitioned_p (vnode)
&& !vnode->no_reorder
&& !vnode->can_remove_if_no_refs_p ()
&& vnode->get_partitioning_class () == SYMBOL_PARTITION)
{
add_symbol_to_partition (partition, vnode);
if (dump_file)
fprintf (dump_file, "Varpool Node: %s\n", vnode->dump_asm_name ());
add_node_references_to_partition (partition, vnode);
}
}
if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
{
struct cgraph_edge *e;
/* Add all inline clones and callees that are duplicated. */
for (e = cnode->callees; e; e = e->next_callee)
if (e->callee->get_partitioning_class () == SYMBOL_DUPLICATE)
add_node_references_to_partition (partition, e->callee);
/* Add all thunks associated with the function. */
for (e = cnode->callers; e; e = e->next_caller)
if (e->caller->thunk && !e->caller->inlined_to)
add_node_references_to_partition (partition, e->caller);
}
}
/* Create and return the created partition of name NAME. */
static ltrans_partition
create_partition (int &npartitions, const char *name)
{
npartitions++;
return new_partition (name);
}
/* Partitioning for code locality.
The partitioning plan (and prerequisite cloning) will have been done by the
IPA locality cloning pass. This function just implements that plan by
assigning those partitions to ltrans_parititions. */
void
lto_locality_map (int max_partition_size)
{
symtab_node *snode;
int npartitions = 0;
auto_vec<varpool_node *> varpool_order;
struct cgraph_node *node;
if (locality_partitions.length () == 0)
{
if (dump_file)
{
fprintf (dump_file, "Locality partition: falling back to balanced "
"model\n");
}
lto_balanced_map (param_lto_partitions, param_max_partition_size);
return;
}
ltrans_partition partition = nullptr;
for (auto part : locality_partitions)
{
partition = create_partition (npartitions, "");
for (unsigned j = 0; j < part->nodes.length (); j++)
{
node = part->nodes[j];
if (symbol_partitioned_p (node))
continue;
add_symbol_to_partition (partition, node);
add_node_references_to_partition (partition, node);
}
}
int64_t partition_size = max_partition_size;
/* All other unpartitioned symbols. */
FOR_EACH_SYMBOL (snode)
{
if (snode->get_partitioning_class () == SYMBOL_PARTITION
&& !symbol_partitioned_p (snode))
{
if (partition->insns > partition_size)
partition = create_partition (npartitions, "");
add_symbol_to_partition (partition, snode);
if (dump_file)
fprintf (dump_file, "Un-ordered Node: %s\n", snode->dump_asm_name ());
}
}
}
/* Return true if we must not change the name of the NODE. The name as
extracted from the corresponding decl should be passed in NAME. */
@ -1732,7 +1853,12 @@ lto_promote_cross_file_statics (void)
{
ltrans_partition part
= ltrans_partitions[i];
if (dump_file)
fprintf (dump_file, "lto_promote_cross_file_statics for part %s %p\n",
part->name, (void *)part->encoder);
part->encoder = compute_ltrans_boundary (part->encoder);
if (dump_file)
fprintf (dump_file, "new encoder %p\n", (void *)part->encoder);
}
lto_clone_numbers = new hash_map<const char *, unsigned>;

View file

@ -37,6 +37,7 @@ void lto_1_to_1_map (void);
void lto_max_map (void);
void lto_cache_map (int, int);
void lto_balanced_map (int, int);
void lto_locality_map (int);
void lto_promote_cross_file_statics (void);
void free_ltrans_partitions (void);
void lto_promote_statics_nonwpa (void);

View file

@ -547,7 +547,9 @@ do_whole_program_analysis (void)
symtab_node::checking_verify_symtab_nodes ();
bitmap_obstack_release (NULL);
if (flag_lto_partition == LTO_PARTITION_1TO1)
if (flag_ipa_reorder_for_locality)
lto_locality_map (param_max_locality_partition_size);
else if (flag_lto_partition == LTO_PARTITION_1TO1)
lto_1_to_1_map ();
else if (flag_lto_partition == LTO_PARTITION_MAX)
lto_max_map ();

View file

@ -1037,6 +1037,25 @@ report_conflicting_sanitizer_options (struct gcc_options *opts, location_t loc,
}
}
/* Validate from OPTS and OPTS_SET that when -fipa-reorder-for-locality is
enabled no explicit -flto-partition is also passed as the locality cloning
pass uses its own partitioning scheme. */
static void
validate_ipa_reorder_locality_lto_partition (struct gcc_options *opts,
struct gcc_options *opts_set)
{
static bool validated_p = false;
if (opts->x_flag_lto_partition != LTO_PARTITION_DEFAULT)
{
if (opts_set->x_flag_ipa_reorder_for_locality && !validated_p)
error ("%<-fipa-reorder-for-locality%> is incompatible with"
" an explicit %qs option", "-flto-partition");
}
validated_p = true;
}
/* After all options at LOC have been read into OPTS and OPTS_SET,
finalize settings of those options and diagnose incompatible
combinations. */
@ -1249,6 +1268,10 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
if (opts->x_flag_reorder_blocks_and_partition)
SET_OPTION_IF_UNSET (opts, opts_set, flag_reorder_functions, 1);
validate_ipa_reorder_locality_lto_partition (opts, opts_set);
if (opts_set->x_flag_lto_partition != LTO_PARTITION_DEFAULT)
opts_set->x_flag_lto_partition = opts->x_flag_lto_partition = LTO_PARTITION_BALANCED;
/* The -gsplit-dwarf option requires -ggnu-pubnames. */
if (opts->x_dwarf_split_debug_info)
opts->x_debug_generate_pub_sections = 2;

View file

@ -469,6 +469,33 @@ Minimal size of a partition for LTO (in estimated instructions).
Common Joined UInteger Var(param_lto_partitions) Init(128) IntegerRange(1, 65536) Param
Number of partitions the program should be split to.
Enum
Name(lto_locality_cloning_model) Type(enum lto_locality_cloning_model) UnknownError(unknown LTO partitioning model %qs)
EnumValue
Enum(lto_locality_cloning_model) String(no) Value(LTO_LOCALITY_NO_CLONING)
EnumValue
Enum(lto_locality_cloning_model) String(non_interposable) Value(LTO_LOCALITY_NON_INTERPOSABLE_CLONING)
EnumValue
Enum(lto_locality_cloning_model) String(maximal) Value(LTO_LOCALITY_MAXIMAL_CLONING)
-param=lto-partition-locality-cloning=
Common Joined RejectNegative Enum(lto_locality_cloning_model) Var(flag_lto_locality_cloning) Init(LTO_LOCALITY_MAXIMAL_CLONING) Optimization
-param=lto-partition-locality-frequency-cutoff=
Common Joined UInteger Var(param_lto_locality_frequency) Init(1) IntegerRange(0, 65536) Param Optimization
The denominator n of fraction 1/n of the execution frequency of callee to be cloned for a particular caller. Special value of 0 dictates to always clone without a cut-off.
-param=lto-partition-locality-size-cutoff=
Common Joined UInteger Var(param_lto_locality_size) Init(1000) IntegerRange(1, 65536) Param Optimization
Size cut-off for callee including inlined calls to be cloned for a particular caller.
-param=lto-max-locality-partition=
Common Joined UInteger Var(param_max_locality_partition_size) Init(1000000) Param
Maximal size of a locality partition for LTO (in estimated instructions). Value of 0 results in default value being used.
-param=max-average-unrolled-insns=
Common Joined UInteger Var(param_max_average_unrolled_insns) Init(80) Param Optimization
The maximum number of instructions to consider to unroll in a loop on average.

View file

@ -162,6 +162,7 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_ipa_sra);
NEXT_PASS (pass_ipa_fn_summary);
NEXT_PASS (pass_ipa_inline);
NEXT_PASS (pass_ipa_locality_cloning);
NEXT_PASS (pass_ipa_pure_const);
NEXT_PASS (pass_ipa_modref);
NEXT_PASS (pass_ipa_free_fn_summary, false /* small_p */);

View file

@ -1,3 +1,162 @@
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Add new manually_drop lang item.
* util/rust-lang-item.cc: Likewise.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attribute-values.h: Add RUSTFMT value.
* util/rust-attributes.cc: Define the attribute.
* util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant.
* expand/rust-macro-builtins.cc: Fix formatting.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Remove assertion.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attribute-values.h: Add missing attributes.
* util/rust-attributes.cc: Likewise.
* util/rust-attributes.h (enum CompilerPass): Mention adding something for const
functions.
2025-04-14 beamandala <mandalapubhavesh@gmail.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers):
Add entry for track_caller.
* util/rust-attribute-values.h: add `TRACK_CALLER` attribute.
* util/rust-attributes.cc: add `track_caller` attribute definition.
2025-04-14 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Visit the enum items of enums.
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Resolve enum discriminants during nr1.0.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Improve safety,
allow extra commas after end of argument list.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Call into
TokenTreeDesugar.
* expand/rust-token-tree-desugar.cc: New file.
* expand/rust-token-tree-desugar.h: New file.
* Make-lang.in: Compile them.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::match_n_matches): Do not
insert fragments and substack fragments if the matcher failed.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Call the visitor later in the pipeline.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (DelimTokenTree::get_locus): New function.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-expr.h (class RangeExpr): Add empty outer attributes and allow getting them
and setting them.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Return if module
is unloaded.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-expr.cc (is_default_fn): New.
(emit_ambiguous_resolution_error): New.
(handle_multiple_candidates): Properly handle multiple candidates in
the case of specialization.
(TypeCheckExpr::visit): Call `handle_multiple_candidates`.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
PR rust/119342
* rust-gcc.cc (block): Add comment on why chaining
the variables of the scope toether.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
PR rust/119341
* rust-gcc.cc (function_type): Use range fors.
(function_type_variadic): Likewise.
(fill_in_fields): Likewise.
(statement_list): Likewise.
(block): Likewise.
(block_add_statements): Likewise.
(function_set_parameters): Likewise.
(write_global_definitions): Likewise.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
* rust-gcc.cc (Bvariable::get_tree): Use error_operand_p.
(pointer_type): Likewise.
(reference_type): Likewise.
(immutable_type): Likewise.
(function_type): Likewise.
(function_type_variadic): Likewise.
Cleanup the check for receiver.type first.
(function_ptr_type): Use error_operand_p.
(fill_in_fields): Likewise.
(fill_in_array): Likewise.
(named_type): Likewise.
(type_size): Likewise.
(type_alignment): Likewise.
(type_field_alignment): Likewise.
(type_field_offset): Likewise.
(zero_expression): Likewise.
(float_constant_expression): Likewise.
(convert_expression): Likewise.
(struct_field_expression): Likewise.
(compound_expression): Likewise.
(conditional_expression): Likewise.
(negation_expression): Likewise.
(arithmetic_or_logical_expression): Likewise.
(arithmetic_or_logical_expression_checked): Likewise.
(comparison_expression): Likewise.
(lazy_boolean_expression): Likewise.
(constructor_expression): Likewise.
(array_constructor_expression): Likewise.
(array_index_expression): Likewise.
(call_expression): Likewise.
(init_statement): Likewise.
(assignment_statement): Likewise.
(return_statement): Likewise.
(exception_handler_statement): Likewise.
(if_statement): Likewise.
(compound_statement): Likewise.
Tighten up the code, removing t variable.
(statement_list): Use error_operand_p.
(block): Likewise.
(block_add_statements): Likewise.
(convert_tree): Likewise.
(global_variable): Likewise.
(global_variable_set_init): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(function): Likewise. Tighten up the code.
(function_defer_statement): Use error_operand_p.
(function_set_parameters): Use error_operand_p.
(write_global_definitions): Use error_operand_p.
Tighten up the code around the loop.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
* rust-gcc.cc (is_floating_point): Use FLOAT_TYPE_P
instead of manually checking the type.
2025-04-08 Matty Kuhn <matty.kuhn.1@gmail.com>
* ast/rust-ast.h: (AST::Attribute): add empty_input function

View file

@ -247,7 +247,7 @@ DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_INIT, "__tsan_init",
DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_FUNC_ENTRY, "__tsan_func_entry",
BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_FUNC_EXIT, "__tsan_func_exit",
BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)
BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_VPTR_UPDATE, "__tsan_vptr_update",
BT_FN_VOID_PTR_PTR, ATTR_NOTHROW_LEAF_LIST)
DEF_SANITIZER_BUILTIN(BUILT_IN_TSAN_READ1, "__tsan_read1",

View file

@ -1,3 +1,391 @@
2025-04-17 Jason Merrill <jason@redhat.com>
* g++.dg/cpp2a/constexpr-dtor16.C: Adjust diagnostic.
* g++.dg/cpp2a/constexpr-dynamic10.C: Likewise.
2025-04-17 Jason Merrill <jason@redhat.com>
* g++.dg/cpp1y/constexpr-new.C: Adjust diagnostics.
* g++.dg/cpp1z/constexpr-asm-5.C: Likewise.
* g++.dg/cpp26/static_assert1.C: Likewise.
* g++.dg/cpp2a/constexpr-dtor7.C: Likewise.
* g++.dg/cpp2a/constexpr-new26.C: Likewise.
* g++.dg/cpp2a/constexpr-new3.C: Likewise.
* g++.dg/cpp2a/constinit14.C: Likewise.
2025-04-17 Jason Merrill <jason@redhat.com>
* g++.dg/cpp26/pack-indexing2.C: Adjust diagnostics.
* g++.dg/ext/type_pack_element2.C: Likewise.
* g++.dg/ext/type_pack_element4.C: Likewise.
2025-04-17 Tamar Christina <tamar.christina@arm.com>
PR tree-optimization/119351
* gcc.target/aarch64/sve/pr119351.c: New test.
* gcc.target/aarch64/sve/pr119351_run.c: New test.
2025-04-17 Jakub Jelinek <jakub@redhat.com>
PR target/119834
* g++.target/s390/pr119834.C: New test.
2025-04-17 Iain Buclaw <ibuclaw@gdcproject.org>
* gdc.test/fail_compilation/test21247.d: New test.
* gdc.test/fail_compilation/test21247b.d: New test.
2025-04-17 Jason Merrill <jason@redhat.com>
PR c++/113360
* g++.dg/cpp23/constexpr-nonlit18.C: Remove redundant message.
* g++.dg/cpp1y/constexpr-diag2.C: New test.
* g++.dg/cpp1y/pr63996.C: Adjust expected errors.
* g++.dg/template/explicit-args6.C: Likewise.
* g++.dg/cpp0x/constexpr-ice21.C: Likewise.
2025-04-16 Alexandre Oliva <oliva@adacore.com>
* gcc.dg/ipa/ipa-sra-19.c: Add -Wno-psabi on ppc-elf too.
2025-04-16 Peter Bergner <bergner@linux.ibm.com>
PR tree-optimization/112822
* g++.dg/pr112822.C: Replace altivec vector attribute with a generic
vector attribute.
2025-04-16 Eric Botcazou <ebotcazou@gcc.gnu.org>
* gnat.dg/opt105.adb: New test.
* gnat.dg/opt105_pkg.ads, gnat.dg/opt105_pkg.adb: New helper.
2025-04-16 Jason Merrill <jason@redhat.com>
PR c++/114772
PR c++/101180
* g++.dg/ext/pragma-target2.C: New test.
2025-04-16 Jason Merrill <jason@redhat.com>
PR c++/116954
* g++.dg/warn/Wformat-3.C: New test.
2025-04-16 Ard Biesheuvel <ardb@kernel.org>
PR target/119386
* gcc.target/i386/pr119386-3.c: New test.
2025-04-16 Ard Biesheuvel <ardb@kernel.org>
PR target/119386
* gcc.target/i386/pr119386-1.c: New test.
* gcc.target/i386/pr119386-2.c: New test.
2025-04-16 Harald Anlauf <anlauf@gmx.de>
PR fortran/106948
* gfortran.dg/pure_formal_proc_4.f90: New test.
2025-04-16 Jan Hubicka <hubicka@ucw.cz>
* g++.dg/lto/pr119614_0.C: New test.
2025-04-16 Tamar Christina <tamar.christina@arm.com>
PR target/119286
* gcc.dg/vect/vect-early-break_18.c: Force -march=gfx908 for amdgcn.
2025-04-16 Tamar Christina <tamar.christina@arm.com>
PR tree-optimization/119351
* gcc.target/aarch64/sve/peel_ind_10.c: New test.
* gcc.target/aarch64/sve/peel_ind_10_run.c: New test.
* gcc.target/aarch64/sve/peel_ind_5.c: New test.
* gcc.target/aarch64/sve/peel_ind_5_run.c: New test.
* gcc.target/aarch64/sve/peel_ind_6.c: New test.
* gcc.target/aarch64/sve/peel_ind_6_run.c: New test.
* gcc.target/aarch64/sve/peel_ind_7.c: New test.
* gcc.target/aarch64/sve/peel_ind_7_run.c: New test.
* gcc.target/aarch64/sve/peel_ind_8.c: New test.
* gcc.target/aarch64/sve/peel_ind_8_run.c: New test.
* gcc.target/aarch64/sve/peel_ind_9.c: New test.
* gcc.target/aarch64/sve/peel_ind_9_run.c: New test.
2025-04-16 Jakub Jelinek <jakub@redhat.com>
PR middle-end/119808
* gcc.dg/bitint-121.c: New test.
2025-04-16 Jesse Huang <jesse.huang@sifive.com>
* gcc.target/riscv/gnu-property-align-rv32.c: New file.
* gcc.target/riscv/gnu-property-align-rv64.c: New file.
2025-04-16 Kito Cheng <kito.cheng@sifive.com>
* gcc.target/riscv/jump-table-large-code-model.c: New test.
2025-04-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/116093
* gcc.dg/bitint-122.c: New test.
2025-04-16 Alice Carlotti <alice.carlotti@arm.com>
* gcc.target/aarch64/acle/rwsr-ungated.c: New test.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119826
* gdc.dg/debug/imports/pr119826b.d: New test.
* gdc.dg/debug/pr119826.d: New test.
2025-04-15 Nathaniel Shead <nathanieloshead@gmail.com>
PR c++/119755
* g++.dg/modules/lambda-10_a.H: New test.
* g++.dg/modules/lambda-10_b.C: New test.
2025-04-15 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/completion-2.c: Expect also -flto-partition=default line.
2025-04-15 Qing Zhao <qing.zhao@oracle.com>
PR c/119717
* gcc.dg/pr119717.c: New test.
2025-04-15 H.J. Lu <hjl.tools@gmail.com>
PR target/119784
* gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore
directives.
2025-04-15 Vineet Gupta <vineetg@rivosinc.com>
PR target/119533
* go.dg/pr119533-riscv.go: New test.
* go.dg/pr119533-riscv-2.go: New test.
2025-04-15 Robin Dapp <rdapp@ventanamicro.com>
PR target/119547
* gcc.target/riscv/rvv/vsetvl/avl_single-68.c: xfail.
* g++.target/riscv/rvv/autovec/pr119547.C: New test.
* g++.target/riscv/rvv/autovec/pr119547-2.C: New test.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: Adjust.
2025-04-15 Tobias Burnus <tburnus@baylibre.com>
* gfortran.dg/gomp/map-alloc-comp-1.f90: Remove dg-error.
* gfortran.dg/gomp/polymorphic-mapping-2.f90: Update warn wording.
* gfortran.dg/gomp/polymorphic-mapping.f90: Change expected
diagnostic; some tests moved to ...
* gfortran.dg/gomp/polymorphic-mapping-1.f90: ... here as new test.
* gfortran.dg/gomp/polymorphic-mapping-3.f90: New test.
* gfortran.dg/gomp/polymorphic-mapping-4.f90: New test.
* gfortran.dg/gomp/polymorphic-mapping-5.f90: New test.
2025-04-15 Martin Jambor <mjambor@suse.cz>
Jakub Jelinek <jakub@redhat.com>
PR ipa/119803
* gcc.dg/ipa/pr119803.c: New test.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119799
* gdc.dg/import-c/pr119799.d: New test.
* gdc.dg/import-c/pr119799c.c: New test.
2025-04-15 Patrick Palka <ppalka@redhat.com>
PR c++/119807
PR c++/112288
* g++.dg/template/friend86.C: New test.
* g++.dg/template/friend87.C: New test.
2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/119817
* gdc.dg/debug/imports/m119817/a.d: New test.
* gdc.dg/debug/imports/m119817/b.d: New test.
* gdc.dg/debug/imports/m119817/package.d: New test.
* gdc.dg/debug/pr119817.d: New test.
2025-04-15 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/119801
* c-c++-common/tsan/pr119801.c: New test.
2025-04-15 Jonathan Yong <10walls@gmail.com>
* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Make diagnostic
accept long long.
2025-04-15 Jakub Jelinek <jakub@redhat.com>
PR ipa/119318
* gcc.dg/ipa/pr119318.c: Remove dg-additional-options, add -w to
dg-options.
2025-04-15 Jason Merrill <jason@redhat.com>
PR c++/113835
* g++.dg/cpp2a/constexpr-vector1.C: New test.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
PR target/118794
* g++.target/gcn/exceptions-bad_cast-2.C: Set
'-mno-fake-exceptions'.
* g++.target/gcn/exceptions-pr118794-1.C: Likewise.
* g++.target/gcn/exceptions-throw-2.C: Likewise.
* g++.target/nvptx/exceptions-bad_cast-2.C: Likewise.
* g++.target/nvptx/exceptions-pr118794-1.C: Likewise.
* g++.target/nvptx/exceptions-throw-2.C: Likewise.
* g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C: New.
* g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C:
Likewise.
* g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C: Likewise.
* g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C:
Likewise.
* g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C:
Likewise.
* g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C:
Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-throw-3.C: New.
* g++.target/nvptx/exceptions-throw-3.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-throw-2.C: New.
* g++.target/nvptx/exceptions-throw-2.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-throw-1.C: New.
* g++.target/nvptx/exceptions-throw-1.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-bad_cast-3.C: New.
* g++.target/nvptx/exceptions-bad_cast-3.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-bad_cast-2.C: New.
* g++.target/nvptx/exceptions-bad_cast-2.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/exceptions-bad_cast-1.C: New.
* g++.target/nvptx/exceptions-bad_cast-1.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
PR target/118794
* g++.target/gcn/exceptions-pr118794-1.C: New.
* g++.target/nvptx/exceptions-pr118794-1.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
PR c++/119692
* g++.target/gcn/pr119692-1-1.C: New.
* g++.target/nvptx/pr119692-1-1.C: Likewise.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* g++.target/gcn/gcn.exp: New.
2025-04-14 Thomas Schwinge <tschwinge@baylibre.com>
* lib/gcc-dg.exp (${tool}_load): Polish 'dg-output-file' test
logs.
2025-04-14 Jakub Jelinek <jakub@redhat.com>
PR ipa/119318
* gcc.dg/ipa/pr119530.c (d): Change type from char to signed char.
(e): Change argument type from long to long long.
2025-04-14 beamandala <mandalapubhavesh@gmail.com>
* rust/compile/track_caller.rs: New test.
2025-04-14 Owen Avery <powerboat9.gamer@gmail.com>
* rust/compile/enum_discriminant2.rs: New test.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust/compile/format_args_extra_comma.rs: New test.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust/compile/macros/mbe/macro-issue3709-1.rs: New test.
* rust/compile/macros/mbe/macro-issue3709-2.rs: New test.
* rust/compile/macros/mbe/macro-issue3693.rs: New file.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust/compile/macros/mbe/macro-issue3708.rs: New test.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust/execute/torture/min_specialization2.rs: New test.
* rust/execute/torture/min_specialization3.rs: New test.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
PR tree-optimization/118476
* gcc.dg/torture/pr118476-1.c: New test.
2025-04-14 Patrick Palka <ppalka@redhat.com>
PR c++/99214
* g++.dg/concepts/diagnostic20.C: New test.
2025-04-14 H.J. Lu <hjl.tools@gmail.com>
PR target/119784
* gcc.target/i386/pr119784a.c: New test.
* gcc.target/i386/pr119784b.c: Likewise.
2025-04-14 Martin Jambor <mjambor@suse.cz>
PR ipa/119318
* gcc.dg/ipa/pr119318.c: New test.
* gcc.dg/ipa/pr119530.c: Likwise.
2025-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/119757
* gcc.dg/vect/pr119757.c: New testcase.
2025-04-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/119778
* g++.dg/torture/pr119778.C: New testcase.
2025-04-14 Gaius Mulley <gaiusmod2@gmail.com>
PR modula2/119779
* gm2.dg/doc/examples/pass/doc-examples-pass.exp: New test.
* gm2.dg/doc/examples/pass/exampleadd.mod: New test.
* gm2.dg/doc/examples/pass/exampleadd2.mod: New test.
* gm2.dg/doc/examples/pass/hello.mod: New test.
* gm2.dg/doc/examples/pass/hellopim.mod: New test.
2025-04-14 Eric Botcazou <ebotcazou@adacore.com>
PR lto/119792
* gnat.dg/lto29.adb: New test.
* gnat.dg/lto29_pkg.ads: New helper.
2025-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/119502

View file

@ -0,0 +1,24 @@
/* PR sanitizer/119801 */
/* { dg-do compile } */
/* { dg-options "-fsanitize=thread" } */
[[gnu::noipa]] int
bar (int *p)
{
return ++*p;
}
int
foo (int *p)
{
++*p;
[[gnu::musttail]] return bar (p);
}
[[gnu::noinline]] int
baz (int x)
{
if (x < 10)
return x;
[[gnu::musttail]] return baz (x - 2);
}

View file

@ -3,7 +3,7 @@
struct NoMut1 { int a, b; };
struct NoMut3 : virtual NoMut1 {
constexpr NoMut3(int a, int b) // { dg-error "virtual base" "" { target c++23 } }
constexpr NoMut3(int a, int b)
: NoMut1{a, b}
{} // { dg-error "virtual base" }
};

View file

@ -0,0 +1,12 @@
// PR c++/113360
// { dg-do compile { target c++14 } }
constexpr bool init_list() // { dg-bogus "because" }
{
int total{};
for (int x : {1, 2, 3}) // { dg-error "initializer list" }
total += x;
return total == 6;
}
static_assert(init_list(), ""); // { dg-error "constant" }

View file

@ -6,7 +6,9 @@ constexpr int *f4(bool b) {
return nullptr;
} else {
return new int{42}; // { dg-error "call to non-.constexpr." "" { target c++17_down } }
} // { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++2a } .-1 }
// { dg-message "allocated here" "" { target c++20 } .-1 }
}
}
static_assert(f4(true) == nullptr, "");
static_assert(f4(false) == nullptr, ""); // { dg-error "non-.constant. condition|" }
static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" }
// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 }

View file

@ -1,5 +1,4 @@
// { dg-do compile { target c++14 } }
// { dg-additional-options "-Wno-return-type" }
constexpr int
foo (int i)
@ -8,4 +7,4 @@ foo (int i)
if (i == 23) return 0;
}
constexpr int j = foo (1); // { dg-error "flows off the end|in .constexpr. expansion of" }
constexpr int j = foo (1);

View file

@ -28,7 +28,7 @@ struct M { constexpr K size () const { return {}; }
constexpr L data () const { return {}; } };
#if __cpp_constexpr_dynamic_alloc >= 201907L
struct N { constexpr int size () const { return 3; }
constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } }
constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } };
#endif
constexpr const char a[] = { 't', 'e', 's', 't' };
struct O { constexpr int size () const { return 4; }
@ -117,6 +117,7 @@ foo ()
asm ((M {}));
#if __cpp_constexpr_dynamic_alloc >= 201907L
asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } }
// { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 }
#endif
asm ((O {}));
asm ((P (0)));
@ -190,6 +191,7 @@ bar ()
asm ((M {}));
#if __cpp_constexpr_dynamic_alloc >= 201907L
asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } }
// { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 }
#endif
asm ((O {}));
asm ((P (0)));

View file

@ -24,7 +24,7 @@ f3 ()
}
constexpr int
f4 () // { dg-message "declared here" "" { target c++20_down } }
f4 ()
{ // { dg-message "is not usable as a 'constexpr' function because:" "" { target c++23 } .-1 }
static const int a = f1 (1); // { dg-error "'a' defined 'static' in 'constexpr' function only available with" "" { target c++20_down } }
return 0; // { dg-error "'a' defined 'static' in 'constexpr' context" "" { target c++23 } .-1 }

View file

@ -49,7 +49,7 @@ template<int N>
int
getT2 (auto... Ts)
{
return Ts...[N]; // { dg-error "pack index is negative" }
return Ts...[N]; // { dg-error "pack index '-1' is negative" }
}
template<auto N, typename... Ts>
@ -63,7 +63,7 @@ template<auto N, typename... Ts>
void
badtype2 ()
{
Ts...[N] t; // { dg-error "pack index is out of range" }
Ts...[N] t; // { dg-error "pack index '1' is out of range for pack of length '1'" }
}
template<auto N, typename... Ts>
@ -77,7 +77,7 @@ template<auto N, typename... Ts>
void
badtype4 ()
{
Ts...[N] t; // { dg-error "pack index is negative" }
Ts...[N] t; // { dg-error "pack index '-1' is negative" }
}
int nonconst () { return 42; }

View file

@ -69,10 +69,11 @@ static_assert (false, M {}); // { dg-warning "'static_assert' with non-string me
// { dg-error "static assertion failed: test" "" { target *-*-* } .-1 }
#if __cpp_constexpr_dynamic_alloc >= 201907L
struct N { constexpr int size () const { return 3; }
constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } }
constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } };
static_assert (true, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } }
static_assert (false, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } }
// { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } .-1 }
// { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-2 }
#endif
constexpr const char a[] = { 't', 'e', 's', 't' };
struct O { constexpr int size () const { return 4; }

View file

@ -3,5 +3,5 @@
struct A { virtual ~A (); };
struct B : virtual A { constexpr ~B () {} };
// { dg-error "'struct B' has virtual base classes" "" { target c++20 } .-1 }
// { dg-error "'constexpr' destructor in 'struct B' that has virtual base classes" "" { target c++20 } .-1 }
// { dg-error "'constexpr' destructors only available with" "" { target c++17_down } .-2 }

View file

@ -3,7 +3,7 @@
struct S {
int *s;
constexpr S () : s(new int) {} // { dg-error "is not a constant expression because allocated storage has not been deallocated" }
constexpr S () : s(new int) {}
S (const S &) = delete;
S &operator= (const S &) = delete;
constexpr ~S () { delete s; }
@ -17,3 +17,4 @@ foo (S v)
}
static_assert (foo (S ())); // { dg-error "non-constant condition for static assertion" }
// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target *-*-* } .-1 }

Some files were not shown because too many files have changed in this diff Show more