[PATCH] libgcc: Fix up _BitInt division [PR113604]

2024-01-27 Thread Jakub Jelinek
Hi! The following testcase ends up with SIGFPE in __divmodbitint4. The problem is a thinko in my attempt to implement Knuth's algorithm. The algorithm does (where b is 65536, i.e. one larger than what fits in their unsigned short word): // Compute estimate qhat of q[j]. qhat = (un

[PATCH] lower-bitint: Add debugging dump of SSA_NAME -> decl mappings

2024-01-27 Thread Jakub Jelinek
Hi! While the SSA coalescing performed by lower bitint prints some information if -fdump-tree-bitintlower-details, it is really hard to read and doesn't contain the most important information which one looks for when debugging bitint lowering issues, namely what VAR_DECLs (or PARM_DECLs/RESULT_DEC

[PATCH] lower-bitint: Fix up VIEW_CONVERT_EXPR handling in lower_mergeable_stmt [PR113568]

2024-01-27 Thread Jakub Jelinek
Hi! We generally allow merging mergeable stmts with some final cast (but not further casts or mergeable operations after the cast). As some casts are handled conditionally, if (idx < cst) handle_operand (idx); else if idx == cst) handle_operand (cst); else ..., we must sure that e.g. the mergeabl

[PATCH] lower-bitint: Avoid sign-extending cast to unsigned types feeding div/mod/float [PR113614]

2024-01-27 Thread Jakub Jelinek
Hi! The following testcase is miscompiled, because some narrower value is sign-extended to wider unsigned _BitInt used as division operand. handle_operand_addr for that case returns the narrower value and precision -prec_of_narrower_value. That works fine for multiplication (at least, normal mult

Re: [PATCH v4 0/4] When cmodel=extreme, add macro support and only support macros.

2024-01-27 Thread Xi Ruoyao
On Sat, 2024-01-27 at 11:15 +0800, chenglulu wrote: > > 在 2024/1/26 下午6:57, Xi Ruoyao 写道: > > On Fri, 2024-01-26 at 16:59 +0800, chenglulu wrote: > > > 在 2024/1/26 下午4:49, Xi Ruoyao 写道: > > > > On Fri, 2024-01-26 at 15:37 +0800, Lulu Cheng wrote: > > > > > v3 -> v4: > > > > >     1. Add macro supp

Re: [PATCH v4 0/4] When cmodel=extreme, add macro support and only support macros.

2024-01-27 Thread Xi Ruoyao
On Sat, 2024-01-27 at 18:02 +0800, Xi Ruoyao wrote: > On Sat, 2024-01-27 at 11:15 +0800, chenglulu wrote: > > > > 在 2024/1/26 下午6:57, Xi Ruoyao 写道: > > > On Fri, 2024-01-26 at 16:59 +0800, chenglulu wrote: > > > > 在 2024/1/26 下午4:49, Xi Ruoyao 写道: > > > > > On Fri, 2024-01-26 at 15:37 +0800, Lulu

Re: [PATCH v3 0/2] x86: Don't save callee-saved registers if not needed

2024-01-27 Thread H.J. Lu
On Wed, Jan 24, 2024 at 7:36 PM Hongtao Liu wrote: > > On Tue, Jan 23, 2024 at 11:00 PM H.J. Lu wrote: > > > > Changes in v3: > > > > 1. Rebase against commit 02e68389494 > > 2. Don't add call_no_callee_saved_registers to machine_function since > > all callee-saved registers are properly clobbere

Re: [PATCH] lower-bitint: Avoid sign-extending cast to unsigned types feeding div/mod/float [PR113614]

2024-01-27 Thread Richard Biener
> Am 27.01.2024 um 09:18 schrieb Jakub Jelinek : > > Hi! > > The following testcase is miscompiled, because some narrower value > is sign-extended to wider unsigned _BitInt used as division operand. > handle_operand_addr for that case returns the narrower value and > precision -prec_of_narrow

Re: [PATCH] lower-bitint: Add debugging dump of SSA_NAME -> decl mappings

2024-01-27 Thread Richard Biener
> Am 27.01.2024 um 09:15 schrieb Jakub Jelinek : > > Hi! > > While the SSA coalescing performed by lower bitint prints some information > if -fdump-tree-bitintlower-details, it is really hard to read and doesn't > contain the most important information which one looks for when debugging > bit

Re: [PATCH] lower-bitint: Fix up VIEW_CONVERT_EXPR handling in lower_mergeable_stmt [PR113568]

2024-01-27 Thread Richard Biener
> Am 27.01.2024 um 09:16 schrieb Jakub Jelinek : > > Hi! > > We generally allow merging mergeable stmts with some final cast (but not > further casts or mergeable operations after the cast). As some casts > are handled conditionally, if (idx < cst) handle_operand (idx); else if > idx == cst)

[aarch64] PR112950: gcc.target/aarch64/sve/acle/general/dupq_5.c fails on aarch64_be-linux-gnu

2024-01-27 Thread Prathamesh Kulkarni
Hi, The test passes -mlittle-endian option but doesn't have target check for aarch64_little_endian and thus fails to compile on aarch64_be-linux-gnu. The patch adds the missing aarch64_little_endian target check, which makes it unsupported on the target. OK to commit ? Thanks, Prathamesh PR112950:

[PATCH] x86: Save callee-saved registers in noreturn functions for -O0/-Og

2024-01-27 Thread H.J. Lu
Save callee-saved registers in noreturn functions for -O0/-Og so that debugger can restore callee-saved registers in caller's frame. gcc/ PR target/38534 * config/i386/i386-options.cc (ix86_set_func_type): Save callee-saved registers in noreturn functions for -O0/-Og. gcc

Re: [PATCH v4 0/4] When cmodel=extreme, add macro support and only support macros.

2024-01-27 Thread chenglulu
在 2024/1/27 下午7:11, Xi Ruoyao 写道: On Sat, 2024-01-27 at 18:02 +0800, Xi Ruoyao wrote: On Sat, 2024-01-27 at 11:15 +0800, chenglulu wrote: 在 2024/1/26 下午6:57, Xi Ruoyao 写道: On Fri, 2024-01-26 at 16:59 +0800, chenglulu wrote: 在 2024/1/26 下午4:49, Xi Ruoyao 写道: On Fri, 2024-01-26 at 15:37 +080

Re: [PATCH] x86: Save callee-saved registers in noreturn functions for -O0/-Og

2024-01-27 Thread Jakub Jelinek
On Sat, Jan 27, 2024 at 05:52:34AM -0800, H.J. Lu wrote: > @@ -3391,7 +3392,9 @@ ix86_set_func_type (tree fndecl) > function is marked as noreturn in the IR output, which leads the > incompatible attribute error in LTO1. */ >bool has_no_callee_saved_registers > -= (((TREE_NOTHR

Re: [PATCH] x86: Save callee-saved registers in noreturn functions for -O0/-Og

2024-01-27 Thread H.J. Lu
On Sat, Jan 27, 2024 at 6:09 AM Jakub Jelinek wrote: > > On Sat, Jan 27, 2024 at 05:52:34AM -0800, H.J. Lu wrote: > > @@ -3391,7 +3392,9 @@ ix86_set_func_type (tree fndecl) > > function is marked as noreturn in the IR output, which leads the > > incompatible attribute error in LTO1. *

[PATCH v2] x86: Save callee-saved registers in noreturn functions for -O0/-Og

2024-01-27 Thread H.J. Lu
Changes in v2: 1. Lookup noreturn attribute first. 2. Use __attribute__((noreturn, optimize("-Og"))) in pr38534-6.c. Save callee-saved registers in noreturn functions for -O0/-Og so that debugger can restore callee-saved registers in caller's frame. gcc/ PR target/38534 * c

[PATCH] Handle function symbol reference in readonly data section

2024-01-27 Thread H.J. Lu
For function symbol reference in readonly data section, instead of putting it in .data.rel.ro or .rodata.cst section, call function_rodata_section to get the read-only or relocated read-only data section associated with the function DECL so that the COMDAT section will be used for a COMDAT function

[PATCH] vect: Tighten vect_determine_precisions_from_range [PR113281]

2024-01-27 Thread Richard Sandiford
This was another PR caused by the way that vect_determine_precisions_from_range handle shifts. We tried to narrow 32768 >> x to a 16-bit shift based on range information for the inputs and outputs, with vect_recog_over_widening_pattern (after PR110828) adjusting the shift amount. But this doesn't

Re: [aarch64] PR112950: gcc.target/aarch64/sve/acle/general/dupq_5.c fails on aarch64_be-linux-gnu

2024-01-27 Thread Richard Sandiford
Prathamesh Kulkarni writes: > Hi, > The test passes -mlittle-endian option but doesn't have target check > for aarch64_little_endian and thus fails to compile on > aarch64_be-linux-gnu. The patch adds the missing aarch64_little_endian > target check, which makes it unsupported on the target. > OK

Fix ICE with -g and -std=c23 when forming composite types [PR113438]

2024-01-27 Thread Martin Uecker
Debug output ICEs when we do not set TYPE_STUB_DECL, fix this. Fix ICE with -g and -std=c23 when forming composite types [PR113438] Set TYPE_STUB_DECL to an artificial decl when creating a new structure as a composite type. PR c/113438 gcc/c/

[PATCH, committed] Fortran: fix bounds-checking errors for CLASS array dummies [PR104908]

2024-01-27 Thread Harald Anlauf
Dear all, commit r11-1235 for pr95331 addressed array bounds issues with unlimited polymorphic array dummies, but caused regressions for CLASS array dummies that lead to either wrong code with bounds-checking, or an ICE. The solution is simple: add a check whether the dummy is unlimited polymorph

[COMMITTED] bpf: add constant pointer to helper-skb-ancestor-cgroup-id.c test

2024-01-27 Thread Jose E. Marchesi
The purpose of this test is to make sure that constant propagation is achieved with the proper optimization level, so a BPF call instruction to a kernel helper is generated. This patch updates the patch so it also covers kernel helpers defined with constant static pointers. The motivation for thi

[PATCH] x86: Generate .cfi_undefined for unsaved callee-saved registers

2024-01-27 Thread H.J. Lu
When assembler directives for DWARF frame unwind is enabled, generate the .cfi_undefined directive for unsaved callee-saved registers which have been used in the function. gcc/ PR target/38534 * config/i386/i386.cc (ix86_post_cfi_startproc): New. (TARGET_ASM_POST_CFI_START

[PATCH] c++/modules: Handle error header names in modules [PR107594]

2024-01-27 Thread Nathaniel Shead
I don't provide a new test because this error only happens when there are no include paths at all, and I haven't worked out a way to get this to happen within DejaGNU (as it adds a number of `-B` and `-I` flags). Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? -- >8 -- When ther

Re: [PATCH 0/6] v2 of libdiagnostics

2024-01-27 Thread Simon Sobisch
Hi David - and thanks for posting an outline for libdiagnostics at https://gcc.gnu.org/wiki/libdiagnostics Currently this shows both libdiagnosts and libdiagnostics-sarif-dump integrated into GCC. Is this the plan or would those be available as a top-level project (the program as an example for