]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
7 weeks agoAssorted --disable-checking fixes [PR117249]
Jakub Jelinek [Fri, 25 Oct 2024 12:09:42 +0000 (14:09 +0200)] 
Assorted --disable-checking fixes [PR117249]

We have currently 3 different definitions of gcc_assert macro, one used most
of the time (unless --disable-checking) which evaluates the condition at
runtime and also checks it at runtime, then one for --disable-checking GCC 4.5+
which looks like
((void)(UNLIKELY (!(EXPR)) ? __builtin_unreachable (), 0 : 0))
and a fallback one
((void)(0 && (EXPR)))
Now, the last one actually doesn't evaluate any of the side-effects in the
argument, just quiets up unused var/parameter warnings.
I've tried to replace the middle definition with
({ [[assume (EXPR)]]; (void) 0; })
for compilers which support assume attribute and statement expressions
(surprisingly quite a few spots use gcc_assert inside of comma expressions),
but ran into PR117287, so for now such a change isn't being proposed.

The following patch attempts to move important side-effects from gcc_assert
arguments.

Bootstrapped/regtested on x86_64-linux and i686-linux with normal
--enable-checking=yes,rtl,extra, plus additionally I've attempted to do
x86_64-linux bootstrap with --disable-checking and gcc_assert changed to the
((void)(0 && (EXPR)))
version when --disable-checking.  That version ran into spurious middle-end
warnings
../../gcc/../include/libiberty.h:733:36: error: argument to ‘alloca’ is too large [-Werror=alloca-larger-than=]
../../gcc/tree-ssa-reassoc.cc:5659:20: note: in expansion of macro ‘XALLOCAVEC’
  int op_num = ops.length ();
  int op_normal_num = op_num;
  gcc_assert (op_num > 0);
  int stmt_num = op_num - 1;
  gimple **stmts = XALLOCAVEC (gimple *, stmt_num);
where we have gcc_assert exactly to work-around middle-end warnings.
Guess I'd need to also disable -Werror for this experiment, which actually
isn't a problem with unmodified system.h, because even for
--disable-checking we use the __builtin_unreachable at least in
stage2/stage3 and so the warnings aren't emitted, and even if it used
[[assume ()]]; it would work too because in stage2/stage3 we could again
rely on assume and statement expression support.

2024-10-25  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/117249
* tree-ssa-structalias.cc (insert_vi_for_tree): Move put calls out of
gcc_assert.
* lto-cgraph.cc (lto_symtab_encoder_delete_node): Likewise.
* gimple-ssa-strength-reduction.cc (get_alternative_base,
add_cand_for_stmt): Likewise.
* tree-eh.cc (add_stmt_to_eh_lp_fn): Likewise.
* except.cc (duplicate_eh_regions_1): Likewise.
* tree-ssa-reassoc.cc (insert_operand_rank): Likewise.
* config/nvptx/nvptx.cc (nvptx_expand_call): Use == rather than = in
gcc_assert.
* genautomata.cc (output_default_latencies): Move j++ side-effect
outside of gcc_assert.
* tree-ssa-loop-ivopts.cc (get_alias_ptr_type_for_ptr_address): Use
== rather than = in gcc_assert.
* cgraph.cc (symbol_table::create_edge): Move ++edges_max_uid
side-effect outside of gcc_assert.

(cherry picked from commit e2a8772c9328960c625f5b95091d4312efa0e284)

7 weeks agoc++: Further fix for get_member_function_from_ptrfunc [PR117259]
Jakub Jelinek [Thu, 24 Oct 2024 10:56:19 +0000 (12:56 +0200)] 
c++: Further fix for get_member_function_from_ptrfunc [PR117259]

The following testcase shows that the previous get_member_function_from_ptrfunc
changes weren't sufficient and we still have cases where
-fsanitize=undefined with pointers to member functions can cause wrong code
being generated and related false positive warnings.

The problem is that save_expr doesn't always create SAVE_EXPR, it can skip
some invariant arithmetics and in the end it could be really large
expressions which would be evaluated several times (and what is worse, with
-fsanitize=undefined those expressions then can have SAVE_EXPRs added to
their subparts for -fsanitize=bounds or -fsanitize=null or
-fsanitize=alignment instrumentation).  Tried to just build1 a SAVE_EXPR
+ add TREE_SIDE_EFFECTS instead of save_expr, but that doesn't work either,
because cp_fold happily optimizes those SAVE_EXPRs away when it sees
SAVE_EXPR operand is tree_invariant_p.

So, the following patch instead of using save_expr or building SAVE_EXPR
manually builds a TARGET_EXPR.  Both types are pointers, so it doesn't need
to be destroyed in any way, but TARGET_EXPR is what doesn't get optimized
away immediately.

2024-10-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/117259
* typeck.cc (get_member_function_from_ptrfunc): Use force_target_expr
rather than save_expr for instance_ptr and function.  Don't call it
for TREE_CONSTANT.

* g++.dg/ubsan/pr117259.C: New test.

(cherry picked from commit b25d3201b6338d9f71c64f524ca2974d9a1f38e8)

7 weeks agoc-family: Fix up -Wsizeof-pointer-memaccess ICEs [PR117230]
Jakub Jelinek [Tue, 22 Oct 2024 18:30:41 +0000 (20:30 +0200)] 
c-family: Fix up -Wsizeof-pointer-memaccess ICEs [PR117230]

In the following testcases, we ICE on all 4 function calls.
The problem is using TYPE_PRECISION on vector types (but guess it
would be similarly problematic on structures/unions/arrays).
The test only differentiates between suggestion what to do, whether
to supply explicit size because sizeof (*p) for
{,{,un}signed }char *p is not very likely what the user want, or
dereferencing the pointer, so I think limiting that suggestion
to integral types is ok.

2024-10-22  Jakub Jelinek  <jakub@redhat.com>

PR c/117230
* c-warn.cc (sizeof_pointer_memaccess_warning): Only compare
TYPE_PRECISION of TREE_TYPE (type) to precision of char if
TREE_TYPE (type) is integral type.

* c-c++-common/Wsizeof-pointer-memaccess5.c: New test.

(cherry picked from commit 5fd1c0c1b6968d55e3f997d67a4c149edf20c012)

7 weeks agoi386: Fix up _mm_min_ss etc. handling of zeros and NaNs [PR116738]
Jakub Jelinek [Fri, 20 Sep 2024 07:14:29 +0000 (09:14 +0200)] 
i386: Fix up _mm_min_ss etc. handling of zeros and NaNs [PR116738]

min/max patterns for intrinsics which on x86 result in the second
input operand if the two operands are both zeros or one or both of them
are a NaN shouldn't use SMIN/SMAX RTL, because that is similarly to
MIN_EXPR/MAX_EXPR undefined what will be the result in those cases.

The following patch adds an expander which uses either a new pattern with
UNSPEC_IEEE_M{AX,IN} or use the S{MIN,MAX} representation of the same.

2024-09-20  Uros Bizjak  <ubizjak@gmail.com>
    Jakub Jelinek  <jakub@redhat.com>

PR target/116738
* config/i386/subst.md (mask_scalar_operand_arg34,
mask_scalar_expand_op3, round_saeonly_scalar_mask_arg3): New
subst attributes.
* config/i386/sse.md
(<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
Change from define_insn to define_expand, rename the old define_insn
to ...
(*<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
... this.
(<sse>_ieee_vm<ieee_maxmin><mode>3<mask_scalar_name><round_saeonly_scalar_name>):
New define_insn.

* gcc.target/i386/sse-pr116738.c: New test.

(cherry picked from commit 624d3af025e820ede7ec4334f7a2d5d4731c99a9)

7 weeks agoc++: Don't emit deprecated/unavailable attribute diagnostics when creating cdtor...
Jakub Jelinek [Fri, 13 Sep 2024 14:13:01 +0000 (16:13 +0200)] 
c++: Don't emit deprecated/unavailable attribute diagnostics when creating cdtor thunks [PR116678]

Another spot where we mark_used a function (in this case ctor or dtor)
even when it is just artificially used inside of thunks (emitted on mingw
with -Os for the testcase).

2024-09-13  Jakub Jelinek  <jakub@redhat.com>

PR c++/116678
* optimize.cc: Include decl.h.
(maybe_thunk_body): Temporarily change deprecated_state to
UNAVAILABLE_DEPRECATED_SUPPRESS.

* g++.dg/warn/deprecated-20.C: New test.

(cherry picked from commit b7b67732e20217196f2a13a10fc3df4605b2b2ab)

7 weeks agotestsuite: Fix up builtin-clear-padding-3.c for -funsigned-char
Jakub Jelinek [Thu, 18 Jul 2024 07:22:10 +0000 (09:22 +0200)] 
testsuite: Fix up builtin-clear-padding-3.c for -funsigned-char

As reported on gcc-regression, this test FAILs on aarch64, but my
r15-2090 change didn't change anything on the generated assembly,
just added the forgotten dg-do run directive to the test, so the
test has been failing forever, just we didn't know it.

I can actually reproduce it on x86_64 with -funsigned-char too,
s2.b.a has int type and -1 is stored to it, so we should compare
it against -1 rather than (char) -1; the latter is appropriate for
testing char fields into which we've stored -1.

2024-07-18  Jakub Jelinek  <jakub@redhat.com>

* c-c++-common/torture/builtin-clear-padding-3.c (main): Compare
s2.b.a against -1 rather than (char) -1.

(cherry picked from commit 958ee138748fae4371e453eb9b357f576abbe83e)

7 weeks agoc++: Fix get_member_function_from_ptrfunc with -fsanitize=bounds [PR116449]
Jakub Jelinek [Tue, 10 Sep 2024 16:32:58 +0000 (18:32 +0200)] 
c++: Fix get_member_function_from_ptrfunc with -fsanitize=bounds [PR116449]

The following testcase is miscompiled, because
get_member_function_from_ptrfunc
emits something like
(((FUNCTION.__pfn & 1) != 0)
 ? ptr + FUNCTION.__delta + FUNCTION.__pfn - 1
 : FUNCTION.__pfn) (ptr + FUNCTION.__delta, ...)
or so, so FUNCTION tree is used there 5 times.  There is
if (TREE_SIDE_EFFECTS (function)) function = save_expr (function);
but in this case function doesn't have side-effects, just nested ARRAY_REFs.
Now, if all the FUNCTION trees would be shared, it would work fine,
FUNCTION is evaluated in the first operand of COND_EXPR; but unfortunately
that isn't the case, both the BIT_AND_EXPR shortening and conversion to
bool done for build_conditional_expr actually unshare_expr that first
expression, but none of the other 4 are unshared.  With -fsanitize=bounds,
.UBSAN_BOUNDS calls are added to the ARRAY_REFs and use save_expr to avoid
evaluating the argument multiple times, but because that FUNCTION tree is
first used in the second argument of COND_EXPR (i.e. conditionally), the
SAVE_EXPR initialization is done just there and then the third argument
of COND_EXPR just uses the uninitialized temporary and so does the first
argument computation as well.

The following patch fixes that by doing save_expr even if !TREE_SIDE_EFFECTS,
but to avoid doing that too often only if !nonvirtual and if the expression
isn't a simple decl.

2024-09-10  Jakub Jelinek  <jakub@redhat.com>

PR c++/116449
* typeck.cc (get_member_function_from_ptrfunc): Use save_expr
on instance_ptr and function even if it doesn't have side-effects,
as long as it isn't a decl.

* g++.dg/ubsan/pr116449.C: New test.

(cherry picked from commit 0008050b9d6046ba4e811a03b406fb5d98707cae)

7 weeks agolibiberty: Fix up > 64K section handling in simple_object_elf_copy_lto_debug_section...
Jakub Jelinek [Sat, 7 Sep 2024 07:36:53 +0000 (09:36 +0200)] 
libiberty: Fix up > 64K section handling in simple_object_elf_copy_lto_debug_section [PR116614]

cat abc.C
  #define A(n) struct T##n {} t##n;
  #define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
  #define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
  #define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
  #define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9)
  E(1) E(2) E(3)
  int main () { return 0; }
./xg++ -B ./ -o abc{.o,.C} -flto -flto-partition=1to1 -O2 -g -fdebug-types-section -c
./xgcc -B ./ -o abc{,.o} -flto -flto-partition=1to1 -O2
(not included in testsuite as it takes a while to compile) FAILs with
lto-wrapper: fatal error: Too many copied sections: Operation not supported
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

The following patch fixes that.  Most of the 64K+ section support for
reading and writing was already there years ago (and especially reading used
quite often already) and a further bug fixed in it in the PR104617 fix.

Yet, the fix isn't solely about removing the
  if (new_i - 1 >= SHN_LORESERVE)
    {
      *err = ENOTSUP;
      return "Too many copied sections";
    }
5 lines, the missing part was that the function only handled reading of
the .symtab_shndx section but not copying/updating of it.
If the result has less than 64K-epsilon sections, that actually wasn't
needed, but e.g. with -fdebug-types-section one can exceed that pretty
easily (reported to us on WebKitGtk build on ppc64le).
Updating the section is slightly more complicated, because it basically
needs to be done in lock step with updating the .symtab section, if one
doesn't need to use SHN_XINDEX in there, the section should (or should be
updated to) contain SHN_UNDEF entry, otherwise needs to have whatever would
be overwise stored but couldn't fit.  But repeating due to that all the
symtab decisions what to discard and how to rewrite it would be ugly.

So, the patch instead emits the .symtab_shndx section (or sections) last
and prepares the content during the .symtab processing and in a second
pass when going just through .symtab_shndx sections just uses the saved
content.

2024-09-07  Jakub Jelinek  <jakub@redhat.com>

PR lto/116614
* simple-object-elf.c (SHN_COMMON): Align comment with neighbouring
comments.
(SHN_HIRESERVE): Use uppercase hex digits instead of lowercase for
consistency.
(simple_object_elf_find_sections): Formatting fixes.
(simple_object_elf_fetch_attributes): Likewise.
(simple_object_elf_attributes_merge): Likewise.
(simple_object_elf_start_write): Likewise.
(simple_object_elf_write_ehdr): Likewise.
(simple_object_elf_write_shdr): Likewise.
(simple_object_elf_write_to_file): Likewise.
(simple_object_elf_copy_lto_debug_section): Likewise.  Don't fail for
new_i - 1 >= SHN_LORESERVE, instead arrange in that case to copy
over .symtab_shndx sections, though emit those last and compute their
section content when processing associated .symtab sections.  Handle
simple_object_internal_read failure even in the .symtab_shndx reading
case.

(cherry picked from commit bb8dd0980b39cfd601f88703fd356055727ef24d)

7 weeks agoi386: Fix up __builtin_ia32_b{extr{,i}_u{32,64},zhi_{s,d}i} folding [PR116287]
Jakub Jelinek [Fri, 9 Aug 2024 12:32:51 +0000 (14:32 +0200)] 
i386: Fix up __builtin_ia32_b{extr{,i}_u{32,64},zhi_{s,d}i} folding [PR116287]

The GENERIC folding of these builtins have cases where it folds to a
constant regardless of the value of the first operand.  If so, we need
to use omit_one_operand to avoid throwing away side-effects in the first
operand if any.  The cases which verify the first argument is INTEGER_CST
don't need that, INTEGER_CST doesn't have side-effects.

2024-08-09  Jakub Jelinek  <jakub@redhat.com>

PR target/116287
* config/i386/i386.cc (ix86_fold_builtin) <case IX86_BUILTIN_BEXTR32>:
When folding into zero without checking whether first argument is
constant, use omit_one_operand.
(ix86_fold_builtin) <case IX86_BUILTIN_BZHI32>: Likewise.

* gcc.target/i386/bmi-pr116287.c: New test.
* gcc.target/i386/bmi2-pr116287.c: New test.
* gcc.target/i386/tbm-pr116287.c: New test.

(cherry picked from commit 6e7088dbe3bf87108a89558ffb7df36df3469206)

7 weeks agotestsuite: Fix up pr116034.c test for big/pdp endian [PR116061]
Jakub Jelinek [Wed, 24 Jul 2024 16:00:05 +0000 (18:00 +0200)] 
testsuite: Fix up pr116034.c test for big/pdp endian [PR116061]

Didn't notice the memmove is into an int variable, so the test
was still failing on big endian.

2024-07-24  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/116034
PR testsuite/116061
* gcc.dg/pr116034.c (g): Change type from int to unsigned short.
(foo): Guard memmove call on __SIZEOF_SHORT__ == 2.

(cherry picked from commit 69e69847e21a8d951ab5f09fd3421449564dba31)

7 weeks agossa: Fix up maybe_rewrite_mem_ref_base complex type handling [PR116034]
Jakub Jelinek [Tue, 23 Jul 2024 08:50:29 +0000 (10:50 +0200)] 
ssa: Fix up maybe_rewrite_mem_ref_base complex type handling [PR116034]

The folding into REALPART_EXPR is correct, used only when the mem_offset
is zero, but for IMAGPART_EXPR it didn't check the exact offset value (just
that it is not 0).
The following patch fixes that by using IMAGPART_EXPR only if the offset
is right and using BITFIELD_REF or whatever else otherwise.

2024-07-23  Jakub Jelinek  <jakub@redhat.com>
    Andrew Pinski  <quic_apinski@quicinc.com>

PR tree-optimization/116034
* tree-ssa.cc (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR
if MEM_REF offset is equal to element type size.

* gcc.dg/pr116034.c: New test.

(cherry picked from commit b9cefd67a2a464a3c9413e6b3f28e7dc7a9ef162)

7 weeks agogimple-fold: Fix up __builtin_clear_padding lowering [PR115527]
Jakub Jelinek [Wed, 17 Jul 2024 09:38:33 +0000 (11:38 +0200)] 
gimple-fold: Fix up __builtin_clear_padding lowering [PR115527]

The builtin-clear-padding-6.c testcase fails as clear_padding_type
doesn't correctly recompute the buf->size and buf->off members after
expanding clearing of an array using a runtime loop.
buf->size should be in that case the offset after which it should continue
with next members or padding before them modulo UNITS_PER_WORD and
buf->off that offset minus buf->size.  That is what the code was doing,
but with off being the start of the loop cleared array, not its end.
So, the last hunk in gimple-fold.cc fixes that.
When adding the testcase, I've noticed that the
c-c++-common/torture/builtin-clear-padding-* tests, although clearly
written as runtime tests to test the builtins at runtime, didn't have
{ dg-do run } directive and were just compile tests because of that.
When adding that to the tests, builtin-clear-padding-1.c was already
failing without that clear_padding_type hunk too, but
builtin-clear-padding-5.c was still failing even after the change.
That is due to a bug in clear_padding_flush which the patch fixes as
well - when clear_padding_flush is called with full=true (that happens
at the end of the whole __builtin_clear_padding or on those array
padding clears done by a runtime loop), it wants to flush all the pending
padding clearings rather than just some.  If it is at the end of the whole
object, it decreases wordsize when needed to make sure the code never writes
including RMW cycles to something outside of the object:
      if ((unsigned HOST_WIDE_INT) (buf->off + i + wordsize)
          > (unsigned HOST_WIDE_INT) buf->sz)
        {
          gcc_assert (wordsize > 1);
          wordsize /= 2;
          i -= wordsize;
          continue;
        }
but if it is full==true flush in the middle, this doesn't happen, but we
still process just the buffer bytes before the current end.  If that end
is not on a wordsize boundary, e.g. on the builtin-clear-padding-5.c test
the last chunk is 2 bytes, '\0', '\xff', i is 16 and end is 18,
nonzero_last might be equal to the end - i, i.e. 2 here, but still all_ones
might be true, so in some spots we just didn't emit any clearing in that
last chunk.

2024-07-17  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/115527
* gimple-fold.cc (clear_padding_flush): Introduce endsize
variable and use it instead of wordsize when comparing it against
nonzero_last.
(clear_padding_type): Increment off by sz.

* c-c++-common/torture/builtin-clear-padding-1.c: Add dg-do run
directive.
* c-c++-common/torture/builtin-clear-padding-2.c: Likewise.
* c-c++-common/torture/builtin-clear-padding-3.c: Likewise.
* c-c++-common/torture/builtin-clear-padding-4.c: Likewise.
* c-c++-common/torture/builtin-clear-padding-5.c: Likewise.
* c-c++-common/torture/builtin-clear-padding-6.c: New test.

(cherry picked from commit 8b5919bae11754f4b65a17e63663d3143f9615ac)

7 weeks agoDaily bump.
GCC Administrator [Fri, 13 Jun 2025 00:20:47 +0000 (00:20 +0000)] 
Daily bump.

7 weeks agoDaily bump.
GCC Administrator [Thu, 12 Jun 2025 00:21:50 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agolibstdc++: Fix Python deprecation warning in printers.py
Jonathan Wakely [Wed, 16 Oct 2024 08:22:37 +0000 (09:22 +0100)] 
libstdc++: Fix Python deprecation warning in printers.py

python/libstdcxx/v6/printers.py:1355: DeprecationWarning: 'count' is passed as positional argument

The Python docs say:

  Deprecated since version 3.13: Passing count and flags as positional
  arguments is deprecated. In future Python versions they will be
  keyword-only parameters.

Using a keyword argument for count only became possible with Python 3.1
so introduce a new function to do the substitution.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py (strip_fundts_namespace): New.
(StdExpAnyPrinter, StdExpOptionalPrinter): Use it.

(cherry picked from commit b9e98bb9919fa9f07782f23f79b3d35abb9ff542)

7 weeks agolibstdc++: Make system_clock::to_time_t always_inline [PR99832]
Jonathan Wakely [Wed, 28 May 2025 14:19:18 +0000 (15:19 +0100)] 
libstdc++: Make system_clock::to_time_t always_inline [PR99832]

For some 32-bit targets Glibc supports changing the size of time_t to be
64 bits by defining _TIME_BITS=64. That causes an ABI change which
would affect std::chrono::system_clock::to_time_t. Because to_time_t is
not a function template, its mangled name does not depend on the return
type, so it has the same mangled name whether it returns a 32-bit time_t
or a 64-bit time_t. On targets where the size of time_t can be selected
at preprocessing time, that can cause ODR violations, e.g. the linker
selects a definition of to_time_t that returns a 32-bit value but a
caller expects 64-bit and so reads 32 bits of garbage from the stack.

This commit adds always_inline to to_time_t so that all callers inline
the conversion to time_t, and will do so using whatever type time_t
happens to be in that translation unit.

Existing objects compiled before this change will either have inlined
the function anyway (which is likely if compiled with any optimization
enabled) or will contain a COMDAT definition of the inline function and
so still be able to find it at link-time.

The attribute is also added to system_clock::from_time_t, because that's
an equally simple function and it seems reasonable for them to both be
always inlined.

libstdc++-v3/ChangeLog:

PR libstdc++/99832
* include/bits/chrono.h (system_clock::to_time_t): Add
always_inline attribute to be agnostic to the underlying type of
time_t.
(system_clock::from_time_t): Add always_inline for consistency
with to_time_t.
* testsuite/20_util/system_clock/99832.cc: New test.

(cherry picked from commit d045eb13b0b42870a1f081895df3901112a358f0)

7 weeks agolibstdc++: Fix incorrect links to archived SGI STL docs
Jonathan Wakely [Tue, 20 May 2025 09:53:41 +0000 (10:53 +0100)] 
libstdc++: Fix incorrect links to archived SGI STL docs

In r8-7777-g25949ee33201f2 I updated some URLs to point to copies of the
SGI STL docs in the Wayback Machine, because the original pags were no
longer hosted on sgi.com. However, I incorrectly assumed that if one
archived page was at https://web.archive.org/web/20171225062613/... then
all the other pages would be too. Apparently that's not how the Wayback
Machine works, and each page is archived on a different date. That meant
that some of our links were redirecting to archived copies of the
announcement that the SGI STL docs have gone away.

This fixes each URL to refer to a correctly archived copy of the
original docs.

libstdc++-v3/ChangeLog:

* doc/xml/faq.xml: Update URL for archived SGI STL docs.
* doc/xml/manual/containers.xml: Likewise.
* doc/xml/manual/extensions.xml: Likewise.
* doc/xml/manual/using.xml: Likewise.
* doc/xml/manual/utilities.xml: Likewise.
* doc/html/*: Regenerate.

(cherry picked from commit 501e6e786652748ff0ad9a322f74b9b47970031f)

7 weeks agoDaily bump.
GCC Administrator [Wed, 11 Jun 2025 00:21:36 +0000 (00:21 +0000)] 
Daily bump.

7 weeks agotree-sra: Do not create stores into const aggregates (PR111873)
Martin Jambor [Wed, 14 May 2025 10:08:24 +0000 (12:08 +0200)] 
tree-sra: Do not create stores into const aggregates (PR111873)

This patch fixes (hopefully the) one remaining place where gimple SRA
was still creating a load into const aggregates.  It occurs when there
is a replacement for a load but that replacement is not type
compatible - typically because it is a single field structure.

I have used testcases from duplicates because the original test-case
no longer reproduces for me.

gcc/ChangeLog:

2025-05-13  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/111873
* tree-sra.cc (sra_modify_expr): When processing a load which has
a type-incompatible replacement, do not store the contents of the
replacement into the original aggregate when that aggregate is
const.

gcc/testsuite/ChangeLog:

2025-05-13  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/ipa/pr120044-1.c: New test.
* gcc.dg/ipa/pr120044-2.c: Likewise.
* gcc.dg/tree-ssa/pr114864.c: Likewise.

(cherry picked from commit 9d039eff453f777c58642ff16178c1ce2a4be6ab)

7 weeks agoDaily bump.
GCC Administrator [Tue, 10 Jun 2025 00:21:08 +0000 (00:21 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Mon, 9 Jun 2025 00:20:37 +0000 (00:20 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Sun, 8 Jun 2025 00:20:06 +0000 (00:20 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Sat, 7 Jun 2025 00:21:21 +0000 (00:21 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Fri, 6 Jun 2025 00:21:03 +0000 (00:21 +0000)] 
Daily bump.

8 weeks agoDaily bump.
GCC Administrator [Thu, 5 Jun 2025 00:22:30 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 4 Jun 2025 00:22:10 +0000 (00:22 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 3 Jun 2025 00:20:21 +0000 (00:20 +0000)] 
Daily bump.

2 months agoc++: lambda this capture and requires [PR120123]
Jason Merrill [Fri, 30 May 2025 22:27:45 +0000 (18:27 -0400)] 
c++: lambda this capture and requires [PR120123]

We shouldn't need to be within the lambda body to look through it to the
enclosing non-static member function.

This change is a small subset of r16-970.

PR c++/120123

gcc/cp/ChangeLog:

* lambda.cc (nonlambda_method_basetype): Look through lambdas
even when current_class_ref is null.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-lambda24.C: New test.

2 months agoFortran: Suppress failing part of testcase [PR109345]
Paul Thomas [Mon, 2 Jun 2025 08:56:02 +0000 (09:56 +0100)] 
Fortran: Suppress failing part of testcase [PR109345]

2024-06-02  Paul Thomas  <pault@gcc.gnu.org>

gcc/testsuite/
PR fortran/109345
* gfortran.dg/pr109345.f90: Comment out test of component refs.

2 months agoDaily bump.
GCC Administrator [Mon, 2 Jun 2025 00:19:37 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 1 Jun 2025 00:21:05 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 31 May 2025 00:21:03 +0000 (00:21 +0000)] 
Daily bump.

2 months agoaarch64: Fix CFA offsets in non-initial stack probes [PR119610]
Richard Sandiford [Fri, 30 May 2025 15:35:54 +0000 (16:35 +0100)] 
aarch64: Fix CFA offsets in non-initial stack probes [PR119610]

PR119610 is about incorrect CFI output for a stack probe when that
probe is not the initial allocation.  The main aarch64 stack probe
function, aarch64_allocate_and_probe_stack_space, implicitly assumed
that the incoming stack pointer pointed to the top of the frame,
and thus held the CFA.

aarch64_save_callee_saves and aarch64_restore_callee_saves use a
parameter called bytes_below_sp to track how far the stack pointer
is above the base of the static frame.  This patch does the same
thing for aarch64_allocate_and_probe_stack_space.

Also, I noticed that the SVE path was attaching the first CFA note
to the wrong instruction: it was attaching the note to the calculation
of the stack size, rather than to the r11<-sp copy.

gcc/
PR target/119610
* config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space):
Add a bytes_below_sp parameter and use it to calculate the CFA
offsets.  Attach the first SVE CFA note to the move into the
associated temporary register.
(aarch64_allocate_and_probe_stack_space): Update calls accordingly.
Start out with bytes_per_sp set to the frame size and decrement
it after each allocation.

gcc/testsuite/
PR target/119610
* g++.dg/torture/pr119610.C: New test.
* g++.target/aarch64/sve/pr119610-sve.C: Likewise.

(cherry picked from commit fa61afef18a8566d1907a5ae0e7754e1eac207d9)

2 months agoDaily bump.
GCC Administrator [Fri, 30 May 2025 00:21:06 +0000 (00:21 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 29 May 2025 00:20:11 +0000 (00:20 +0000)] 
Daily bump.

2 months agos390x: Fix vec_xl/vec_xst type aliasing [PR114676]
Andreas Krebbel [Tue, 23 Apr 2024 08:05:46 +0000 (10:05 +0200)] 
s390x: Fix vec_xl/vec_xst type aliasing [PR114676]

The requirements of the vec_xl/vec_xst intrinsincs wrt aliasing of the
pointer argument are not really documented.  As it turns out, users
are likely to get it wrong.  With this patch we let the pointer
argument alias everything in order to make it more robust for users.

gcc/ChangeLog:

PR target/114676
* config/s390/s390-c.cc (s390_expand_overloaded_builtin): Use a
MEM_REF with an addend of type ptr_type_node.

gcc/testsuite/ChangeLog:

PR target/114676
* gcc.target/s390/zvector/pr114676.c: New test.

Suggested-by: Jakub Jelinek <jakub@redhat.com>
(cherry picked from commit 42189f21b22c43ac8ab46edf5f6a7b4d99bc86a5)

2 months agoDaily bump.
GCC Administrator [Wed, 28 May 2025 00:19:38 +0000 (00:19 +0000)] 
Daily bump.

2 months agos390: Fix tf_to_fprx2
Stefan Schulze Frielinghaus [Wed, 14 May 2025 07:22:00 +0000 (09:22 +0200)] 
s390: Fix tf_to_fprx2

Insn tf_to_fprx2 moves a TF value into a floating-point register pair.
For alternative 0, the input is a vector register, however, in the else
case instruction ldr is emitted which expects floating-point register
operands only.  Thus, this works only for vector registers which overlap
with floating-point registers.  Replace ldr with vlr so that the
remaining vector registers are dealt with, too.  Emitting a vlr instead
of a ldr is fine since the destination register %v0 is part of a
floating-point register pair which means that the low half of %v0 is
ignored in the end anyway and therefore may be clobbered.

gcc/ChangeLog:

* config/s390/vector.md: Fix tf_to_fprx2 by using vlr instead of
ldr.

(cherry picked from commit 8519b8ba9dd9567a5f90966351c1e758dbf511a4)

2 months agoAVR: target/120441 - Fix f7_exp for |x| ≥ 512.
Georg-Johann Lay [Tue, 27 May 2025 07:43:57 +0000 (09:43 +0200)] 
AVR: target/120441 - Fix f7_exp for |x| ≥ 512.

f7_exp limited exponents to 512, but 1023 * ln2 ≈ 709,
hence 1024 is a correct limit.

libgcc/config/avr/libf7/
PR target/120441
* libf7.c (f7_exp): Limit aa->expo to 10 (not to 9).

(cherry picked from commit 672569cee76a1927d14b5eb754a5ff0b9cee1bc8)

2 months agoDaily bump.
GCC Administrator [Tue, 27 May 2025 00:20:12 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Mon, 26 May 2025 00:18:56 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 25 May 2025 00:18:36 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 24 May 2025 00:20:09 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Fri, 23 May 2025 00:20:45 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 22 May 2025 00:20:46 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 21 May 2025 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 20 May 2025 00:20:36 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Mon, 19 May 2025 00:18:47 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 18 May 2025 00:18:25 +0000 (00:18 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 17 May 2025 00:19:17 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Fri, 16 May 2025 00:19:58 +0000 (00:19 +0000)] 
Daily bump.

2 months agocrypto/tls: fix Config.Time in tests using expired certificates
Ian Lance Taylor [Sat, 4 Jan 2025 23:54:58 +0000 (15:54 -0800)] 
crypto/tls: fix Config.Time in tests using expired certificates

This is a backport of https://go.dev/cl/640237 from the main repo.

Fixes PR go/118286

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/640435
(cherry picked from commit ed1493e12ed75e837e9b9aa794ed24daf397df7c)

2 months agoDaily bump.
GCC Administrator [Thu, 15 May 2025 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 14 May 2025 00:20:28 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 13 May 2025 00:20:28 +0000 (00:20 +0000)] 
Daily bump.

2 months agofinal: Fix get_attr_length for asm goto [PR118411]
Andrew Pinski [Sat, 11 Jan 2025 04:04:09 +0000 (20:04 -0800)] 
final: Fix get_attr_length for asm goto [PR118411]

The problem is for inline-asm goto, the outer rtl insn type
is a jump_insn and get_attr_length does not handle ASM specially
unlike if the outer rtl insn type was just insn.

This fixes the issue by adding support for both CALL_INSN and JUMP_INSN
with asm.

OK? Bootstrapped and tested on x86_64-linux-gnu.

PR middle-end/118411

gcc/ChangeLog:

* final.cc (get_attr_length_1): Handle asm for CALL_INSN
and JUMP_INSNs.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit c1729df6ec1eff4815a9cdd71392691ce21da028)

2 months agoDaily bump.
GCC Administrator [Mon, 12 May 2025 00:19:37 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sun, 11 May 2025 00:19:41 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Sat, 10 May 2025 00:20:10 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Fri, 9 May 2025 00:20:55 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Thu, 8 May 2025 00:19:37 +0000 (00:19 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Wed, 7 May 2025 00:20:59 +0000 (00:20 +0000)] 
Daily bump.

2 months agoDaily bump.
GCC Administrator [Tue, 6 May 2025 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

2 months agoEnable generation of GNU stack notes on Linux
John David Anglin [Mon, 6 Nov 2023 20:33:15 +0000 (20:33 +0000)] 
Enable generation of GNU stack notes on Linux

2023-11-06  John David Anglin  <danglin@gcc.gnu.org>

* config/pa/pa-linux.h (NEED_INDICATE_EXEC_STACK): Define to 1.

2 months agoDaily bump.
GCC Administrator [Mon, 5 May 2025 00:19:56 +0000 (00:19 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 4 May 2025 00:18:57 +0000 (00:18 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 3 May 2025 00:20:59 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 2 May 2025 00:21:21 +0000 (00:21 +0000)] 
Daily bump.

3 months agodf: Treat partial defs as uses in df_simulate_defs [PR116564]
Alex Coplan [Mon, 10 Mar 2025 16:44:15 +0000 (16:44 +0000)] 
df: Treat partial defs as uses in df_simulate_defs [PR116564]

The PR shows us spinning in dce.cc:fast_dce at the start of combine.
This spinning appears to be because of a disagreement between the fast_dce code
and the code in df-problems.cc:df_lr_bb_local_compute.  Specifically, they
disagree on the treatment of partial defs.  For the testcase in the PR, we have
the following insn in bb 3:

(insn 10 8 13 3 (clobber (subreg:V1DF (reg/v:V2x1DF 104 [ __val ]) 8)) -1
     (nil))

which gives rise to a DF def with DF_REF_FLAGS = 0x8b0, i.e.
DF_REF_PARTIAL | DF_REF_READ_WRITE | DF_REF_MUST_CLOBBER | DF_REF_SUBREG.

Eliding the large block comment for readability, the code in
df_lr_bb_local_compute does the following (for each insn):

      FOR_EACH_INSN_INFO_DEF (def, insn_info)
        {
          unsigned int dregno = DF_REF_REGNO (def);
          bitmap_set_bit (&bb_info->def, dregno);
          if (DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL))
            bitmap_set_bit (&bb_info->use, dregno);
          else
            bitmap_clear_bit (&bb_info->use, dregno);
        }

i.e. it models partial defs as a RMW operation; thus for the def arising
from i10 above, it records a use of r104; hence it ends up in the
live-in set for bb 3.

However, as it stands, the code in dce.cc:fast_dce (and its callee
dce_process_block) has no such provision for DF_REF_PARTIAL defs.  It
does not treat these as a RMW and does not compute r104 above as being
live-in to bb 3.  At the end of dce_process_block we compute the
following "did something happen" condition used to decide termination of
the analysis:

  block_changed = !bitmap_equal_p (local_live, DF_LR_IN (bb));
  if (block_changed)
    bitmap_copy (DF_LR_IN (bb), local_live);

  BITMAP_FREE (local_live);
  return block_changed;

because of the disagreement between df_lr_local_compute and the local
analysis done by fast_dce, we invariably have r104 in DF_LR_IN, but not
in local_live.  Hence we always return true here, call
df_analyze_problem (which re-computes DF_LR_IN according to
df_lr_bb_local_compute, re-adding r104), and so the analysis never
terminates.

This patch therefore adjusts df_simulate_defs (called from
dce_process_block) to match the behaviour of df_lr_bb_local_compute in
this respect, namely we make it model partial defs as RMW operations by
setting the relevant register live.  This fixes the spinning in fast_dce
for this testcase.

gcc/ChangeLog:

PR rtl-optimization/116564
* df-problems.cc (df_simulate_defs): For partial defs, mark the
register live (treat it as a RMW operation).

gcc/testsuite/ChangeLog:

PR rtl-optimization/116564
* gcc.target/aarch64/torture/pr116564.c: New test.

(cherry picked from commit 758e617bcf224dc9d4a7e26dd858d43c1e63b916)

3 months agoDaily bump.
GCC Administrator [Thu, 1 May 2025 00:22:46 +0000 (00:22 +0000)] 
Daily bump.

3 months agoAdd test-case for PR118924
Martin Jambor [Tue, 29 Apr 2025 16:24:29 +0000 (18:24 +0200)] 
Add test-case for PR118924

Because the testcase for the issue in master is in a commit I do not
plan to backport to GCC 12 but the issue is avoided by my previous one
nevertheless, I am backporting the testcase in this one.

gcc/testsuite/ChangeLog:

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

PR tree-optimization/118924
* g++.dg/tree-ssa/pr118924.C: New test.

3 months agosra: Clear grp_same_access_path of acesses created by total scalarization (PR118924)
Martin Jambor [Mon, 7 Apr 2025 11:32:10 +0000 (13:32 +0200)] 
sra: Clear grp_same_access_path of acesses created by total scalarization (PR118924)

During analysis of PR 118924 it was discussed that total scalarization
invents access paths (strings of COMPONENT_REFs and possibly even
ARRAY_REFs) which did not exist in the program before which can have
unintended effects on subsequent AA queries.  Although not doing that
does not mean that SRA cannot create such situations (see the bug for
more info), it has been agreed that not doing this is generally better.
This patch therfore makes SRA fall back on creating simple MEM_REFs when
accessing components of an aggregate corresponding to what a SRA
variable now represents.

gcc/ChangeLog:

2025-03-26  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/118924
* tree-sra.cc (create_total_scalarization_access): Set
grp_same_access_path flag to zero.

(cherry picked from commit 40445711b8af113ef423d8bcac1a7ce1c47f62d7)

3 months agoFix GNAT build failure for x86/FreeBSD
Eric Botcazou [Wed, 30 Apr 2025 10:41:36 +0000 (12:41 +0200)] 
Fix GNAT build failure for x86/FreeBSD

gcc/ada/
PR ada/112958
* Makefile.rtl (LIBGNAT_TARGET_PAIRS) [x86 FreeBSD]: Add specific
version of s-dorepr.adb.
* libgnat/s-dorepr__freebsd.adb: New file.

3 months agoAVR: target/119989 - Add missing clobbers to xload_<mode>_libgcc.
Georg-Johann Lay [Wed, 30 Apr 2025 06:43:51 +0000 (08:43 +0200)] 
AVR: target/119989 - Add missing clobbers to xload_<mode>_libgcc.

libgcc's __xload_1...4 is clobbering Z (and also R21 is some cases),
but avr.md had clobbers of respective GPRs only up to reload.
Outcome was that code reading from the same __memx address twice
could be wrong.  This patch adds respective clobbers.

      Backport from 2025-04-30 r14-11703
      PR target/119989
gcc/
* config/avr/avr.md (xload_<mode>_libgcc): Clobber R21, Z.

gcc/testsuite/
* gcc.target/avr/torture/pr119989.h: New file.
* gcc.target/avr/torture/pr119989-memx-1.c: New test.
* gcc.target/avr/torture/pr119989-memx-2.c: New test.
* gcc.target/avr/torture/pr119989-memx-3.c: New test.
* gcc.target/avr/torture/pr119989-memx-4.c: New test.

(cherry picked from commit 1ca1c1fc3b58ae5e1d3db4f5a2014132fe69f82a)

3 months agoDaily bump.
GCC Administrator [Wed, 30 Apr 2025 00:20:58 +0000 (00:20 +0000)] 
Daily bump.

3 months agos390: Accept only Pmode for registers AP/FP/RA [PR119235]
Stefan Schulze Frielinghaus [Fri, 21 Mar 2025 09:29:19 +0000 (10:29 +0100)] 
s390: Accept only Pmode for registers AP/FP/RA [PR119235]

gcc/ChangeLog:

PR target/119235
* config/s390/s390.cc (s390_hard_regno_mode_ok): Accept only
Pmode for registers AP/FP/RA.

(cherry picked from commit 2b383ae2a6e5fc0530bfd8b86ad0e6b27e760bd2)

3 months agoDaily bump.
GCC Administrator [Tue, 29 Apr 2025 00:22:02 +0000 (00:22 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 28 Apr 2025 00:20:51 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sun, 27 Apr 2025 00:20:36 +0000 (00:20 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 26 Apr 2025 00:21:26 +0000 (00:21 +0000)] 
Daily bump.

3 months agoAvoid using POINTER_DIFF_EXPR for overlap checks [PR119399]
Richard Sandiford [Fri, 25 Apr 2025 11:04:47 +0000 (12:04 +0100)] 
Avoid using POINTER_DIFF_EXPR for overlap checks [PR119399]

In r10-4803-g8489e1f45b50600c I'd used POINTER_DIFF_EXPR to subtract
the two pointers involved in an overlap test.  I'm not sure whether
I'd specifically chosen that over MINUS_EXPR or not; if so, the only
reason I can think of is that it is probably faster on targets with
PSImode pointers.  Regardless, as the PR points out, subtracting
unrelated pointers using POINTER_DIFF_EXPR is undefined behaviour.

gcc/
PR tree-optimization/119399
* tree-data-ref.cc (create_waw_or_war_checks): Use a MINUS_EXPR
on two converted pointers, rather than converting a POINTER_DIFF_EXPR
on the pointers.

gcc/testsuite/
PR tree-optimization/119399
* gcc.dg/vect/pr119399.c: New test.

(cherry picked from commit 4c8c373495d7d863dfb7102726ac3b4b41685df4)

3 months agovect: Enforce dr_with_seg_len::align precondition [PR116125]
Richard Sandiford [Fri, 25 Apr 2025 11:04:46 +0000 (12:04 +0100)] 
vect: Enforce dr_with_seg_len::align precondition [PR116125]

tree-data-refs.cc uses alignment information to try to optimise
the code generated for alias checks.  The assumption for "normal"
non-grouped, full-width scalar accesses was that the access size
would be a multiple of the alignment.  As Richi notes in the PR,
this is a documented precondition of dr_with_seg_len:

  /* The minimum common alignment of DR's start address, SEG_LEN and
     ACCESS_SIZE.  */
  unsigned int align;

PR115192 was a case in which this assumption didn't hold.  The access
was part of an aligned 4-element group, but only the first 2 elements
of the group were accessed.  The alignment was therefore double the
access size.

In r15-820-ga0fe4fb1c8d78045 I'd "fixed" that by capping the
alignment in one of the output routines.  But I think that was
misconceived.  The precondition means that we should cap the
alignment at source instead.

Failure to do that caused a similar wrong code bug in this PR,
where the alignment comes from a short bitfield access rather
than from a group access.

gcc/
PR tree-optimization/116125
* tree-vect-data-refs.cc (vect_prune_runtime_alias_test_list): Make
the dr_with_seg_len alignment fields describe tha access sizes as
well as the pointer alignment.
* tree-data-ref.cc (create_intersect_range_checks): Don't compensate
for invalid alignment fields here.

gcc/testsuite/
PR tree-optimization/116125
* gcc.dg/vect/pr116125.c: New test.

(cherry picked from commit e8651b80aeb86da935035e218747a6b41b611497)

3 months agoDaily bump.
GCC Administrator [Fri, 25 Apr 2025 00:19:43 +0000 (00:19 +0000)] 
Daily bump.

3 months agoc++: templates, attributes, #pragma target [PR114772]
Jason Merrill [Wed, 16 Apr 2025 16:02:58 +0000 (12:02 -0400)] 
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.

(cherry picked from commit 5fdb0145fb9499f5db9e27f775895ce4a39215e4)

3 months agoDaily bump.
GCC Administrator [Wed, 23 Apr 2025 00:19:29 +0000 (00:19 +0000)] 
Daily bump.

3 months agoFortran: fix issue with impure elemental subroutine and interface [PR119656]
Harald Anlauf [Tue, 8 Apr 2025 20:30:15 +0000 (22:30 +0200)] 
Fortran: fix issue with impure elemental subroutine and interface [PR119656]

PR fortran/119656

gcc/fortran/ChangeLog:

* interface.cc (gfc_compare_actual_formal): Fix front-end memleak
when searching for matching interfaces.
* trans-expr.cc (gfc_conv_procedure_call): If there is a formal
dummy corresponding to an absent argument, use its type, and only
fall back to inferred type otherwise.

gcc/testsuite/ChangeLog:

* gfortran.dg/optional_absent_13.f90: New test.

(cherry picked from commit 334545194d9023fb9b2f72ee0dcde8af94930f25)

3 months agoDaily bump.
GCC Administrator [Tue, 22 Apr 2025 00:21:04 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Mon, 21 Apr 2025 00:19:36 +0000 (00:19 +0000)] 
Daily bump.

3 months agoFix compilation of server.cc on hpux.
John David Anglin [Mon, 9 Jan 2023 15:41:51 +0000 (15:41 +0000)] 
Fix compilation of server.cc on hpux.

Select and FD_ISSET are declared in sys/time.h on most versions
of hpux.  As a result, HAVE_PSELECT and HAVE_SELECT can be 0.

2023-01-08  John David Anglin  <danglin@gcc.gnu.org>

c++tools/ChangeLog:

PR other/107616
* server.cc (server): Don't call FD_ISSET when HAVE_PSELECT
and HAVE_SELECT are zero.

3 months agod: Fix ICE in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676 [PR119817]
Iain Buclaw [Tue, 15 Apr 2025 12:49:34 +0000 (14:49 +0200)] 
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.

(cherry picked from commit f5ed7d19c965de9ccb158d77e929b17459bf65b5)

3 months agoDaily bump.
GCC Administrator [Sun, 20 Apr 2025 00:21:12 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Sat, 19 Apr 2025 00:21:01 +0000 (00:21 +0000)] 
Daily bump.

3 months agoDaily bump.
GCC Administrator [Fri, 18 Apr 2025 00:20:19 +0000 (00:20 +0000)] 
Daily bump.

3 months agolibstdc++: Qualify calls to debug mode helpers
Jonathan Wakely [Fri, 23 Jun 2023 12:50:01 +0000 (13:50 +0100)] 
libstdc++: Qualify calls to debug mode helpers

These functions should be qualified to disable unwanted ADL.

The overload of __check_singular_aux for safe iterators was previously
being found by ADL, because it wasn't declared before __check_singular.
Add a declaration so that it can be found by qualified lookup.

libstdc++-v3/ChangeLog:

* include/debug/helper_functions.h (__get_distance)
(__check_singular, __valid_range_aux, __valid_range): Qualify
calls to disable ADL.
(__check_singular_aux(const _Safe_iterator_base*)): Declare
overload that was previously found via ADL.

(cherry picked from commit fa98bc4270dcb4ec78b5b1c0f4c067094c84bae6)

3 months agolibstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]
Jonathan Wakely [Thu, 4 Apr 2024 09:33:33 +0000 (10:33 +0100)] 
libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672]

A negative delim value passed to std::istream::ignore can never match
any character in the stream, because the comparison is done using
traits_type::eq_int_type(sb->sgetc(), delim) and sgetc() never returns
negative values (except at EOF). The optimized version of ignore for the
std::istream specialization uses traits_type::find to locate the delim
character in the streambuf, which _can_ match a negative delim on
platforms where char is signed, but then we do another comparison using
eq_int_type which fails. The code then keeps looping forever, with
traits_type::find locating the character and traits_type::eq_int_type
saying it's not a match, so traits_type::find is used again and finds
the same character again.

A possible fix would be to check with eq_int_type after a successful
find, to see whether we really have a match. However, that would be
suboptimal since we know that a negative delimiter will never match
using eq_int_type. So a better fix is to adjust the check at the top of
the function that handles delim==eof(), so that we treat all negative
delim values as equivalent to EOF. That way we don't bother using find
to search for something that will never match with eq_int_type.

The version of ignore in the primary template doesn't need a change,
because it doesn't use traits_type::find, instead characters are
extracted one-by-one and always matched using eq_int_type. That avoids
the inconsistency between find and eq_int_type. The specialization for
std::wistream does use traits_type::find, but traits_type::to_int_type
is equivalent to an implicit conversion from wchar_t to wint_t, so
passing a wchar_t directly to ignore without using to_int_type works.

libstdc++-v3/ChangeLog:

PR libstdc++/93672
* src/c++98/istream.cc (istream::ignore(streamsize, int_type)):
Treat all negative delimiter values as eof().
* testsuite/27_io/basic_istream/ignore/char/93672.cc: New test.
* testsuite/27_io/basic_istream/ignore/wchar_t/93672.cc: New
test.

(cherry picked from commit 2d694414ada8e3b58f504c1b175d31088529632e)

3 months agolibstdc++: Fix bogus -Wstringop-overflow in std::vector::insert [PR117983]
Jonathan Wakely [Fri, 28 Mar 2025 22:00:38 +0000 (22:00 +0000)] 
libstdc++: Fix bogus -Wstringop-overflow in std::vector::insert [PR117983]

This was fixed on trunk by r15-4473-g3abe751ea86e34, but that isn't
suitable for backporting. Instead, just add another unreachable
condition in std::vector::_M_range_insert so the compiler knows this
memcpy doesn't use a length originating from a negative ptrdiff_t
converted to a very positive size_t.

libstdc++-v3/ChangeLog:

PR libstdc++/117983
* include/bits/vector.tcc (vector::_M_range_insert): Add
unreachable condition to tell the compiler begin() <= end().
* testsuite/23_containers/vector/modifiers/insert/117983.cc: New
test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit 878812b6f6905774ab37cb78903e3e11bf1c508c)

3 months agolibstdc++: Fix std::deque::insert(pos, first, last) undefined behaviour [PR118035]
Jonathan Wakely [Mon, 16 Dec 2024 17:42:24 +0000 (17:42 +0000)] 
libstdc++: Fix std::deque::insert(pos, first, last) undefined behaviour [PR118035]

Inserting an empty range into a std::deque results in undefined calls to
either std::copy, std::copy_backward, std::move, or std::move_backward.
We call those algos with invalid arguments where the output range is the
same as the input range, e.g.  std::copy(first, last, first) which
violates the preconditions for the algorithms.

This fix simply returns early if there's nothing to insert. Most callers
already ensure that we don't even call _M_range_insert_aux with an empty
range, but some callers don't. Rather than checking for n == 0 in each
of the callers, this just does the check once and uses __builtin_expect
to treat empty insertions as unlikely.

libstdc++-v3/ChangeLog:

PR libstdc++/118035
* include/bits/deque.tcc (_M_range_insert_aux): Return
immediately if inserting an empty range.
* testsuite/23_containers/deque/modifiers/insert/118035.cc: New
test.

(cherry picked from commit b273e25e11c842a5729d0e03c85088cf5ba8e06c)

3 months agoDaily bump.
GCC Administrator [Thu, 17 Apr 2025 00:20:34 +0000 (00:20 +0000)] 
Daily bump.

3 months agotestcase: Add testcase for already fixed PR [PR118476]
Andrew Pinski [Mon, 14 Apr 2025 15:40:24 +0000 (08:40 -0700)] 
testcase: Add testcase for already fixed PR [PR118476]

This testcase was fixed by r15-3052-gc7b76a076cb2c6ded but is
a testcase that failed in a different fashion and a much older
failure than the one added with r15-3052.

Pushed as obvious after a quick test.

PR tree-optimization/118476

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr118476-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit d45a6502d1ec87d43f1a39f87cca58f1e28369c8)

3 months agomatch: Reject non-ssa name/min invariants in gimple_extract [PR116412]
Andrew Pinski [Mon, 19 Aug 2024 15:06:36 +0000 (08:06 -0700)] 
match: Reject non-ssa name/min invariants in gimple_extract [PR116412]

After the conversion for phiopt's conditional operand
to use maybe_push_res_to_seq, it was found that gimple_extract
will extract out from REALPART_EXPR/IMAGPART_EXPR/VCE and BIT_FIELD_REF,
a memory load. But that extraction was not needed as memory loads are not
simplified in match and simplify. So gimple_extract should return false
in those cases.

Changes since v1:
* Move the rejection to gimple_extract from factor_out_conditional_operation.

GCC13: the function is in gimple-match-head.cc rather than gimple-match-exports.cc.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/116412

gcc/ChangeLog:

* gimple-match-head.cc (gimple_extract): Return false if op0
was not a SSA name nor a min invariant for REALPART_EXPR/IMAGPART_EXPR/VCE
and BIT_FIELD_REF.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr116412-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
(cherry picked from commit c7b76a076cb2c6ded7ae208464019b04cb0531a2)