[PATCH stage1 6/6] ssa-fre-4.c: Enable for all targets and adjust scan match

2025-03-14 Thread H.J. Lu
Since the C frontend no longer promotes char argument, enable ssa-fre-4.c for all targets and adjust scan match. PR middle-end/112877 * gcc.dg/tree-ssa/ssa-fre-4.c: Enable for all targets and adjust scan match. Signed-off-by: H.J. Lu --- gcc/testsuite/gcc.dg/tree-ssa/ssa

Re: [RFC] [C]New syntax for the argument of counted_by attribute for C language

2025-03-14 Thread John McCall
On 14 Mar 2025, at 15:18, Martin Uecker wrote: Am Freitag, dem 14.03.2025 um 14:42 -0400 schrieb John McCall: On 14 Mar 2025, at 14:13, Martin Uecker wrote: Am Freitag, dem 14.03.2025 um 10:11 -0700 schrieb David Tarditi: Hi Martin, The C design of VLAs misunderstood dependent typing. They

[PATCH stage1 2/6] Drop targetm.promote_prototypes from C, C++ and Ada frontends

2025-03-14 Thread H.J. Lu
Remove the targetm.calls.promote_prototypes call from C, C++ and Ada frontends. gcc/ PR c/48274 PR middle-end/112877 PR middle-end/118288 * gimple.cc (gimple_builtin_call_types_compatible_p): Remove the targetm.calls.promote_prototypes call. * tree.

[PATCH] libstdc++: Add P1206R7 from_range members to ordered maps [PR111055]

2025-03-14 Thread Tomasz Kamiński
This is another piece of P1206R7, adding new members to std::map and std::multimap. PR libstdc++/111055 libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (__detail::__range_to_alloc_type): Define. * include/bits/stl_multimap.h: (inser_range) (multimap(f

[PATCH stage1 1/6] Honor TARGET_PROMOTE_PROTOTYPES during RTL expand

2025-03-14 Thread H.J. Lu
Promote integer arguments smaller than int if TARGET_PROMOTE_PROTOTYPES returns true. gcc/ PR middle-end/112877 * calls.c (initialize_argument_information): Promote small integer arguments if TARGET_PROMOTE_PROTOTYPES returns true. gcc/testsuite/ PR middle-end/11

[PATCH stage1 0/6] Correct outgoing integer argument promotion

2025-03-14 Thread H.J. Lu
1. Honor TARGET_PROMOTE_PROTOTYPES during RTL expand. 2. Drop targetm.promote_prototypes from C, C++ and Ada frontends. 3. Adjust tests for the C frontend promotion removal. 4. gcc.dg/tree-ssa/pr108357.c fails with the C frontend promotion removal. This is a known issue: https://gcc.gnu.org/bugzil

[PATCH stage1 4/6] vect-simd-clone-1[6-8][cd].c: Expect in-branch clones for x86

2025-03-14 Thread H.J. Lu
Since the C frontend no longer promotes char and short arguments, expect in-branch clones for x86. PR middle-end/112877 * gcc.dg/vect/vect-simd-clone-16c.c: Expect in-branch clones for x86. * gcc.dg/vect/vect-simd-clone-16d.c: Likewise. * gcc.dg/vect/vect-si

[PATCH stage1 5/6] scev-cast.c: Enable for all targets and adjust scan matches

2025-03-14 Thread H.J. Lu
Since the C frontend no longer promotes char argument, enable scev-cast.c for all targets and adjust scan matches. PR middle-end/112877 * gcc.dg/tree-ssa/scev-cast.c: Enable for all targets and adjust scan match. Signed-off-by: H.J. Lu --- gcc/testsuite/gcc.dg/tree-ssa/s

[PATCH stage1 3/6] i386: Adjust apx-ndd.c for frontend promotion removal

2025-03-14 Thread H.J. Lu
Since the C frontend no longer promotes integer argument smaller than int, the apx-ndd.c codgen is slightly different: apx-ndd.s (original)2024-11-10 06:07:09.894876973 +0800 apx-ndd.s (updated) 2024-11-10 06:06:59.371860565 +0800 @@ -17,7 +17,7 @@ foo_add_char: foo1_add_char: .LFB1:

[PATCH stage1 0/3] x86: Add a pass to fold tail call

2025-03-14 Thread H.J. Lu
Conditional and unconditional branch targets can be either a label or a symbol. For conditional jump: (jump_insn 7 6 14 2 (set (pc) (if_then_else (eq (reg:CCZ 17 flags) (const_int 0 [0])) (label_ref:DI 23) (pc))) "x.c":8:5 1458 {jcc} (expr_list

[PATCH stage1 3/3] x86: Fold sibcall targets into jump table

2025-03-14 Thread H.J. Lu
Enhance fold sibcall pass to fold sibcall targets into jump table by turning: foo: .cfi_startproc cmpl$4, %edi ja .L1 movl%edi, %edi jmp *.L4(,%rdi,8) .section.rodata .L4: .quad .L8 .quad .L7 .quad

[PATCH stage1 1/3] Support symbol reference in jump label and jump table

2025-03-14 Thread H.J. Lu
Conditional and unconditional branch targets can be either a label or a symbol. For conditional jump: (jump_insn 7 6 14 2 (set (pc) (if_then_else (eq (reg:CCZ 17 flags) (const_int 0 [0])) (label_ref:DI 23) (pc))) "x.c":8:5 1458 {jcc} (expr_list

Re: [PATCH 0/2] RISC-V: Support RISC-V Profiles.

2025-03-14 Thread Vineet Gupta
Hi, On 12/3/24 03:02, Jiawei wrote: > This patch series introduces support for RISC-V Profiles RV20, RV22[1], > and RV23[2][3].The updates enhance compatibility and streamline the process > of leveraging RISC-V Profiles through the -march option. These additions > are in line with the RISC-V stand

Re: [PATCH] libstdc++: Add P1206R7 from_range members to ordered maps [PR111055]

2025-03-14 Thread Patrick Palka
On Fri, 14 Mar 2025, Tomasz Kamiński wrote: > This is another piece of P1206R7, adding new members to std::map > and std::multimap. There's a couple of instances of stray 8 spaces instead of tabs in the deduction guide hunks, besides that LGTM > > PR libstdc++/111055 > > libstdc++-v3/Cha

Re: [PATCH] COBOL: Prevent use of ASM_EXPR for optimized COBOL compilations [PR119214]

2025-03-14 Thread Richard Biener
On Fri, Mar 14, 2025 at 2:22 AM Robert Dubner wrote: > > Based on the PR119214 discussion about "-O -ftracer" causing the assembler > to fail, I offer the following patch. > > Okay for trunk? (Gives me shivers to say that the first time!) OK, but see below > Author: Robert Dubner > Date: Thu

Re: [RFC] [C]New syntax for the argument of counted_by attribute for C language

2025-03-14 Thread John McCall
On 14 Mar 2025, at 14:13, Martin Uecker wrote: > Am Freitag, dem 14.03.2025 um 10:11 -0700 schrieb David Tarditi: >> Hi Martin, >> >> The C design of VLAs misunderstood dependent typing. > > They probably did not care about theory, but the design is > not inconsistent with theory. This is almost

Re: [PATCH] libstdc++: Missing 'constexpr' in vector's from_range ctor [PR119282]

2025-03-14 Thread Jonathan Wakely
On Fri, 14 Mar 2025 at 17:16, Patrick Palka wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? We could > use a direct constexpr test for this from_range vector ctor code path, > but that'll be easier once we make the __gnu_test range/iterators > constexpr-friendly. For now I

Re: [RFC] [C]New syntax for the argument of counted_by attribute for C language

2025-03-14 Thread Martin Uecker
Am Freitag, dem 14.03.2025 um 10:11 -0700 schrieb David Tarditi: > Hi Martin, > > The C design of VLAs misunderstood dependent typing. They probably did not care about theory, but the design is not inconsistent with theory. > > For a program to be validly typed when there are dependent types, >

[PATCH] c++: poor diag w/ non-constexpr dtor called from constexpr ctor

2025-03-14 Thread Patrick Palka
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for stage 1? -- >8 -- When diagnosing a non-constexpr constructor call during constexpr evaluation, explain_invalid_constexpr_fn was passing the genericized body to require_potential_constant_expression rather than the saved non

Re: [PATCH] libstdc++: Add P1206R7 from_range members to ordered maps [PR111055]

2025-03-14 Thread Tomasz Kaminski
On Fri, Mar 14, 2025 at 5:24 PM Tomasz Kamiński wrote: > This is another piece of P1206R7, adding new members to std::map > and std::multimap. > > PR libstdc++/111055 > > libstdc++-v3/ChangeLog: > > * include/bits/ranges_base.h (__detail::__range_to_alloc_type): > Define.

[PATCH v4] libcpp: Fix incorrect line numbers in large files [PR108900]

2025-03-14 Thread Yash . Shinde
From: Jeremy Bettis This patch addresses an issue in the C preprocessor where incorrect line number information is generated when processing files with a large number of lines. The problem arises from improper handling of location intervals in the line map, particularly when locations exceed LINE

[PATCH] cobol: Don't run cobol tests with -m32 or -mx32 [PR119290]

2025-03-14 Thread Jakub Jelinek
Hi! The following patch adds cobol effective target and uses it to guard main loop in cobol.dg/dg.exp, so that we don't run the tests on unsupported multilibs. Tested on x86_64-linux with make check-cobol RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg.exp' which previously had all FAILs in the

[PATCH] ipa: Do not modify cgraph edges from thunk clones during inlining (PR116572)

2025-03-14 Thread Martin Jambor
Hi, In PR 116572 we hit an assert that a thunk which does not have a body looks like it has one. It does not, but the call_stmt of its outgoing edge points to a statement, which should not. In fact it has several outgoing call graph edges, which cannot be. The problem is that the code updating

[Patch] Fortran: Store OpenMP's 'declare variant' in module file [PR115271]

2025-03-14 Thread Tobias Burnus
Attached is a long overdue bug fix, given that OpenMP's declare variant is supported in gfortran sincer12-4409-g724ee5a0093da4 (Oct 2021). (and in C/C++ since r10-3744-g94e7f906ca5c73, Oct 2019). While 'omp declare simd' was already handled in the .mod file, 'declare variant' was not. It is eas

Re: [PATCH] analyzer: Fix ICE in cmp_csts_same_type on RAW_DATA_CST [PR119278]

2025-03-14 Thread David Malcolm
On Fri, 2025-03-14 at 15:22 +0100, Jakub Jelinek wrote: > Hi! > > The following testcase ICEs in cmp_csts_same_type because > RAW_DATA_CST > isn't handled there.  As TREE_TYPE (cst1) in that case is > INTEGER_TYPE, > e.g. char/signed char/unsigned char, the type itself doesn't imply > the size, so

[PATCH] analyzer: Fix ICE in cmp_csts_same_type on RAW_DATA_CST [PR119278]

2025-03-14 Thread Jakub Jelinek
Hi! The following testcase ICEs in cmp_csts_same_type because RAW_DATA_CST isn't handled there. As TREE_TYPE (cst1) in that case is INTEGER_TYPE, e.g. char/signed char/unsigned char, the type itself doesn't imply the size, so the length is compared first, followed by comparing the data. While at

Re: [RFC] [C]New syntax for the argument of counted_by attribute for C language

2025-03-14 Thread Martin Uecker
Maybe one additional point about scoping rules. The whole point of scoping is to shield nested code from outside changes. This is  what this proposal would break (and the proposed warnings would only mitigate the damage). One scenario where I find this is problematic are macros. Macros are ins

Re: [PATCH][v2] add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producer

2025-03-14 Thread Florian Weimer
th the GCJ compiler driver, where >> -D_FORTIFY_SOURCE=2 meant something completely different. And now we >> are stuck with those variants because some scrits use sed to remove >> those flags, assuming the presence -Wp, prefix. > > I've tested that it works with -Wp as

Revert "GCN, nvptx: Basic '__cxa_guard_{acquire,abort,release}' for C++ static local variables support" (was: OpenMP offloading vs. C++ static local variables)

2025-03-14 Thread Thomas Schwinge
Hi! On 2023-12-23T10:17:57+0100, I wrote: > On 2023-12-21T13:58:23+0100, Jakub Jelinek wrote: >> On Thu, Dec 21, 2023 at 01:31:19PM +0100, Thomas Schwinge wrote: >>> OK to push, for a start, the attached >>> "GCN, nvptx: Basic '__cxa_guard_{acquire,abort,release}' for C++ static >>> local variab

Re: [PATCH] cobol/119281 - make sure $(gcc_version) is set for libgcobol install

2025-03-14 Thread Jakub Jelinek
On Fri, Mar 14, 2025 at 01:23:03PM +0100, Richard Biener wrote: > When using --enable-version-specific-runtime-libs at least it's > required that $(gcc_version) is set to be able to expand > toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' > > The following fixes this by adjusting conf

[PUSHED] GCN, nvptx: Don't default-disable libstdc++ build

2025-03-14 Thread Thomas Schwinge
From: Thomas Schwinge In addition to making libstdc++ itself available, this, via enabling 'build-gcc/*/libstdc++-v3/scripts/testsuite_flags', in particular also makes the standard C++ headers available to 'make check-gcc-c++'. With that, there are a lot of FAIL/UNRESOLVED -> PASS progressions,

[PATCH] cobol/119281 - make sure $(gcc_version) is set for libgcobol install

2025-03-14 Thread Richard Biener
When using --enable-version-specific-runtime-libs at least it's required that $(gcc_version) is set to be able to expand toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' The following fixes this by adjusting configure.ac to call GCC_BASE_VER and Makefile.am to include a definition for

Re: GCN, nvptx: Allow for "hosted" libstdc++ build

2025-03-14 Thread Jonathan Wakely
On 14/03/25 11:39 +0100, Thomas Schwinge wrote: Hi! As the first of a few patches to enable libstdc++ for GCN, nvptx targets, and eventually for OpenACC, OpenMP offloading use, I intend to push the attached 'GCN, nvptx: Allow for "hosted" libstdc++ build'. Any objections? It's not exactly pret

Re: [PATCH] libstdc++: Add P1206R7 from_range members to ordered sets [PR111055]

2025-03-14 Thread Tomasz Kaminski
I have fixed missing headers locally. And also added include to multiset. On Fri, Mar 14, 2025 at 8:54 AM Tomasz Kamiński wrote: > This is another piece of P1206R7, adding new members to std::set > and std::multiset. > > PR libstdc++/111055 > > libstdc++-v3/ChangeLog: > > * inc

[pushed] libstdc++: Include missing algorithm header in priority_queue tests.

2025-03-14 Thread Tomasz Kamiński
This fixes ARM CI failing that do not user PCH. libstdc++-v3/ChangeLog: * testsuite/23_containers/priority_queue/cons_from_range.cc: Add `#include . * testsuite/23_containers/priority_queue/members/push_range.cc: Add `#include . --- Tested on x86_64-linux. Preappr

Re: [PATCH] Fix a pasto in ao_compare::compare_ao_refs

2025-03-14 Thread Martin Jambor
On Thu, Mar 13 2025, Richard Biener wrote: > On Mon, Mar 10, 2025 at 11:59 PM Martin Jambor wrote: >> >> Hi, >> >> when reading the function ao_compare::compare_ao_refs I came accross >> what I believe to ba a copy-and-paste error which this patch fixes. >> >> Bootstrapped, LTO-bootstrapped and te

Re: [pushed] libstdc++: Add P1206R7 from_range members to container adaptors [PR111055]

2025-03-14 Thread Jonathan Wakely
On 13/03/25 16:41 +0100, tkami...@redhat.com wrote: From: Tomasz Kamiński This is another piece of P1206R7, adding new members to std::stack, std::queue, and std::priority_queue. PR libstdc++/111055 libstdc++-v3/ChangeLog: * include/bits/stl_queue.h (queue(from_range_t, _Rg&&

Re: [PATCH][v2] add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producer

2025-03-14 Thread Richard Biener
now we > are stuck with those variants because some scrits use sed to remove > those flags, assuming the presence -Wp, prefix. I've tested that it works with -Wp as well without any special further handling: > ./xgcc -B. -g t.c -c -Wp,-D_FORTIFY_SOURCE=2 > readelf -w t.o | grep DW_AT_producer DW_AT_producer: (indirect string, offset: 0): GNU C23 15.0.1 20250314 (experimental) -D_FORTIFY_SOURCE=2 -mtune=generic -march=x86-64 -g Richard.

Re: [PATCH] aarch64: remove SVE2 requirement from SME and diagnose it as unsupported

2025-03-14 Thread Andre Vieira (lists)
On 14/03/2025 09:59, Richard Sandiford wrote: "Andre Vieira (lists)" writes: diff --git a/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-3.c b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-3.c new file mode 100644 index ..7a873fa2396a4129225ba

[PATCH] tree-optimization/119274 - improve VN optimistic dominance query

2025-03-14 Thread Richard Biener
The following improves how VN performs its dominance queries to determine availability, exploiting edges considered unreachable. The function already contains code to handle the leader block forking the CFG, but that looks like a situation that won't help the dominance query ever. The following ad

Re: [PATCH v2] libstdc++: Fix views::zip_transform constraints for empty range pack [PR111138]

2025-03-14 Thread Jonathan Wakely
On 07/03/25 17:44 +0100, Tomasz Kamiński wrote: Add missing move_constructible && regular_invocable constrains on functor type, and is_object on functor result type for invocations of views::zip_transform without range arguments. PR libstdc++/38 libstdc++-v3/ChangeLog: * i

Re: GCN, nvptx: Allow for "hosted" libstdc++ build

2025-03-14 Thread Andrew Stubbs
On 14/03/2025 10:39, Thomas Schwinge wrote: Hi! As the first of a few patches to enable libstdc++ for GCN, nvptx targets, and eventually for OpenACC, OpenMP offloading use, I intend to push the attached 'GCN, nvptx: Allow for "hosted" libstdc++ build'. Any objections? It's not exactly pretty,

Re: [PATCH] vect: Fix aarch64/pr99873_2.c ld4/st4 failure

2025-03-14 Thread Richard Sandiford
Richard Biener writes: > On Thu, 13 Mar 2025, Richard Sandiford wrote: >> vect_slp_prefer_store_lanes_p allows an SLP tree to be split even >> if the tree could use store-lanes, provided that one of the new >> groups would operate on full vectors for each scalar iteration. >> That heuristic is no

Re: [PATCH] libstdc++: Work around C++20 tuple> constraint recursion [PR116440]

2025-03-14 Thread Ville Voutilainen
On Thu, 13 Mar 2025 at 23:03, Patrick Palka wrote: > + // Defined as a template to work around PR libstdc++/116440. > + template > + constexpr explicit(!__convertible()) > + tuple(const _Elements&... __elements) I don't understand how a constructor template declared like thi

Re: [PATCH] libstdc++: fix compile error when converting std::weak_ptr

2025-03-14 Thread Giuseppe D'Angelo
Hello, On 12/03/2025 18:13, Jonathan Wakely wrote: The newer version of this patch at https://forge.sourceware.org/gcc/gcc-TEST/pulls/35 is OK for trunk, thanks. Thank you for the review. This has now been pushed as r15-8048-gdf0e6509bf7442 , patch attached. -- Giuseppe D'Angelo From df0e650

Re: [PATCH][_Hashtable] Fix hash code cache usage

2025-03-14 Thread Jonathan Wakely
On Fri, 14 Mar 2025 at 08:55, Florian Weimer wrote: > > * Jonathan Wakely: > > >> I still think this is more confusing than necessary. If there isn't > >> some general rule that empty objects can be considered stateless, that > >> should be added somewhere, too. 8-) > > > > Could you submit an is

Re: [PATCH] aarch64: remove SVE2 requirement from SME and diagnose it as unsupported

2025-03-14 Thread Richard Sandiford
"Andre Vieira (lists)" writes: > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index > 4fbb4cda101ebd14891a3ad80aa5b1bc069b45c6..3754e468a05b3ae554b71adb4cf60068d5249507 > 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -22068,7 +22068,8 @@ Enable the Pointer Authe

Re: [PATCH][v2] add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producer

2025-03-14 Thread Jakub Jelinek
On Fri, Mar 14, 2025 at 10:54:33AM +0100, Richard Biener wrote: > The following makes sure to record -D_FORTIFY_SOURCE=n and > -U_FORTIFY_SOURCE in the DW_AT_producer debuginfo attribute when > present on the compiler command line. > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. I'

[PATCH][v2] add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producer

2025-03-14 Thread Richard Biener
The following makes sure to record -D_FORTIFY_SOURCE=n and -U_FORTIFY_SOURCE in the DW_AT_producer debuginfo attribute when present on the compiler command line. Bootstrap and regtest running on x86_64-unknown-linux-gnu. I've checked that -Wp,-[DU]... is also handled correctly. OK? Thanks, Rich

[PATCH] doc: Clarify REG_EH_REGION note usage

2025-03-14 Thread Konstantinos Eleftheriou
The documentation for the REG_EH_REGION could easily be read (especially by non-native speakers) to indicate that it should be attached to insn at the destination of an excpetion edge. Despite the original text saying that the note "specifies the destination," it is actually always attached to the

Re: [PATCH][_Hashtable] Fix hash code cache usage

2025-03-14 Thread Florian Weimer
* Jonathan Wakely: >> I still think this is more confusing than necessary. If there isn't >> some general rule that empty objects can be considered stateless, that >> should be added somewhere, too. 8-) > > Could you submit an issue (or two)? > https://cplusplus.github.io/LWG/lwg-active.html#subm

[PATCH] vect: Fix aarch64/pr99873_2.c ld4/st4 failure

2025-03-14 Thread Richard Sandiford
[Reposting to CC the RISC-V CI] vect_slp_prefer_store_lanes_p allows an SLP tree to be split even if the tree could use store-lanes, provided that one of the new groups would operate on full vectors for each scalar iteration. That heuristic is no longer firing for gcc.target/aarch64/pr99873_2.c.

[PATCH] c, c++, v3: Support musttail attribute even using __attribute__ form [PR116545]

2025-03-14 Thread Jakub Jelinek
On Thu, Mar 13, 2025 at 09:10:05PM +0100, Jakub Jelinek wrote: > Here is adjusted patch which just moves the __attribute__((musttail)) return > handling to cp_parser_statement. So far tested on dg.exp=musttail* > > Moving the GNU attribute assume/fallthrough handling on empty statement > handlin

[PATCH] libstdc++: Add P1206R7 from_range members to ordered sets [PR111055]

2025-03-14 Thread Tomasz Kamiński
This is another piece of P1206R7, adding new members to std::set and std::multiset. PR libstdc++/111055 libstdc++-v3/ChangeLog: * include/bits/stl_multiset.h: (inser_range) (multiset(from_range_t, _Rg&&, const _Compare&, const _Alloc&)) (multiset(from_range_t, _Rg

Re: [PATCH] vect: Fix aarch64/pr99873_2.c ld4/st4 failure

2025-03-14 Thread Richard Biener
On Thu, 13 Mar 2025, Richard Sandiford wrote: > vect_slp_prefer_store_lanes_p allows an SLP tree to be split even > if the tree could use store-lanes, provided that one of the new > groups would operate on full vectors for each scalar iteration. > That heuristic is no longer firing for gcc.target/

[PATCH 2/2] arm: Add ACLE sqrt intrinsic using NEON vsqrt builtins

2025-03-14 Thread Ayan Shafqat
Add inline implementations of the ACLE __sqrt() and __sqrtf() functions in arm_acle.h. These functions, defined when __ARM_FP is available[1], forward the square-root operation to the corresponding NEON builtins: * __sqrt() calls __builtin_neon_vsqrtdf for double precision. * __sqrtf() calls __bui