[Bug c/119877] New: [12/13/14/15/16 Regression] Honor __attribute__((unused)) and don't issue a warning -Wunused-function

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119877

Bug ID: 119877
   Summary: [12/13/14/15/16 Regression] Honor
__attribute__((unused)) and don't issue a warning
-Wunused-function
   Product: gcc
   Version: 15.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mcccs at gmx dot com
  Target Milestone: ---

When compiling:

static __attribute__((unused)) int a();
int main() {}

GCC 12+ fail to compile with -Werror=unused-function

[Bug c/119842] [15/16 Regression] ICE: in c_type_tag, at c/c-typeck.cc:606

2025-04-20 Thread uecker at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119842

uecker at gcc dot gnu.org changed:

   What|Removed |Added

 CC||uecker at gcc dot gnu.org

--- Comment #5 from uecker at gcc dot gnu.org ---


Certainly related to my patch here:
https://gcc.gnu.org/cgit/gcc/commit/?id=a3382d9d675f42db96a51d902afc49a0a4cfadee

[Bug c/119877] [12/13/14/15/16 Regression] Honor __attribute__((unused)) and don't issue a warning -Wunused-function

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119877

--- Comment #1 from Andrew Pinski  ---
This is by design IIRC.

[Bug c++/60551] __attribute__((unused)) is ignored for 'static' declarations

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60551

Andrew Pinski  changed:

   What|Removed |Added

 CC||mcccs at gmx dot com

--- Comment #4 from Andrew Pinski  ---
*** Bug 119877 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/119876] suboptimal code for avx512 conditinal move

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119876

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2025-04-20
 CC||pinskia at gcc dot gnu.org
 Ever confirmed|0   |1
   Keywords||missed-optimization
  Component|target  |tree-optimization
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED

--- Comment #1 from Andrew Pinski  ---
I am 99% sure it is due to missing factoring out the additional out of the phi.

So mine. Will take a while though due to regressions with the patch.

[Bug tree-optimization/119872] [15/16 regression] wrong code at -O{1,2,s}

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119872

mcccs at gmx dot com changed:

   What|Removed |Added

  Attachment #61163|0   |1
is obsolete||

--- Comment #4 from mcccs at gmx dot com ---
Created attachment 61164
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61164&action=edit
cleanup2

a little more cleanup. fails with any optimization level except Og at trunk

[Bug target/119879] New: [r16-39 Regression] FAIL: gcc.target/i386/avx512fp16-trunc-extendvnhf.c

2025-04-20 Thread liuhongt at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119879

Bug ID: 119879
   Summary: [r16-39 Regression] FAIL:
gcc.target/i386/avx512fp16-trunc-extendvnhf.c
   Product: gcc
   Version: 16.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

[r16-39 Regression] FAIL: gcc.target/i386/avx512fp16-trunc-extendvnhf.c 

On Linux/x86_64,

f6859fb621179ec9bf5631eb8902619ab8d4467b is the first bad commit
commit f6859fb621179ec9bf5631eb8902619ab8d4467b
Author: Jan Hubicka 
Date:   Sat Apr 19 18:51:27 2025 +0200

Add tables for SSE fp conversion costs

caused

FAIL: gcc.target/i386/avx512fp16-trunc-extendvnhf.c scan-assembler-times
vcvtpd2phx[ \\t]+[^{\n]*[^\n\r]*%xmm[0-9]+(?:\n|[ \\t]+#) 1

with GCC configured with

../../gcc/configure
--prefix=/export/users/haochenj/src/gcc-bisect/master/master/r16-39/usr
--enable-clocale=gnu --with-system-zlib --with-demangler-in-ld
--with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl
--enable-libmpx x86_64-linux --disable-bootstrap

To reproduce:

$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="i386.exp=gcc.target/i386/avx512fp16-trunc-extendvnhf.c
--target_board='unix{-m32}'"
$ cd {build_dir}/gcc && make check
RUNTESTFLAGS="i386.exp=gcc.target/i386/avx512fp16-trunc-extendvnhf.c
--target_board='unix{-m64}'"

(Please do not reply to this email, for question about this report, contact me
at haochen dot jiang at intel.com.)
(If you met problems with cascadelake related, disabling AVX512F in command
line might save that.)
(However, please make sure that there is no potential problems with AVX512.)

[Bug libstdc++/119880] New: fwide must be called before and after std::wcout to change wide orientation to allow std::cout works

2025-04-20 Thread nickhuang99 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119880

Bug ID: 119880
   Summary: fwide must be called before and after std::wcout to
change wide orientation to allow std::cout works
   Product: gcc
   Version: 16.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nickhuang99 at hotmail dot com
  Target Milestone: ---

See following program which requires the first "fwide" so as to allow
"std::cout" to work after "std::wcout" calls. This behavior is only with GCC
library and MSVC latest can comment the first "fwide" out. This indicates a bug
in implementation of GCC stdlib.

#include 
#include 
#include 
#include 
int main() {
//std::fwide(stdout, -1); // you cannot comment out this line for GCC!!!
std::wcout << L"This is a wide line from local wcout." << std::endl;   
std::fwide(stdout, -1);
std::cout << "This is a narrow line after wide output." << std::endl;  
return 0;
}



In GCC family, only "std::wcout" prints while "std::cout" fails to print
because stdout is still wide oriented. This can be confirmed by a test
"fwide(stdout, 0) > 0" after "std::wcout" prints. 



See www.godbolt.org at https://www.godbolt.org/z/63Gh3xGMh

[Bug tree-optimization/119881] New: support alias analysis for large number of pointers

2025-04-20 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119881

Bug ID: 119881
   Summary: support alias analysis for large number of pointers
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tnfchris at gcc dot gnu.org
Blocks: 53947, 115130
  Target Milestone: ---

Consider the following example:

void foo (int *a1,
  int *a2,
  int *a3,
  int *a4,
  int *a5,
  int *a6,
  int *a7,
  int *a8,
  int *a9,
  int *a10,
  int *a11,
  int *a12,
  int *a13,
  int *a14,
  int *a15,
  int *a16,
  int *a17,
  int *a18,
  int *a19,
  int *a20,
  int n, int c)
{
for (int i = 0; i < n; i++)
  {
a1[i] += c;
a2[i] += c;
a3[i] += c;
a4[i] += c;
a5[i] += c;
a6[i] += c;
a7[i] += c;
a8[i] += c;
a9[i] += c;
#if 1
a10[i] += c;
a11[i] += c;
a12[i] += c;
a13[i] += c;
a14[i] += c;
a15[i] += c;
a16[i] += c;
a17[i] += c;
a18[i] += c;
a19[i] += c;
a20[i] += c;
#endif
  }
}

Both GCC and Clang fail to vectorize giving up on the quadratic alias analysis.
The Intel compiler however does vectorize and does something smart
https://godbolt.org/z/3Wq7ax7o6

The pointers are dumped into a local array and the loop is guarded by a call to
__intel_rtdd_indep.

Disassembling this shows that what they do is dump the pointers as a pair
{start_ptr, end_ptr} then do a quicksort based on start_ptr and do a linear
scan over the result checking that r[i].end_ptr >= r[i].start_ptr.

This enables them to vectorize larger programs to a greater degree.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115130
[Bug 115130] [meta-bug] early break vectorization

[Bug target/119876] New: suboptimal code for avx512 conditinal move

2025-04-20 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119876

Bug ID: 119876
   Summary: suboptimal code for avx512 conditinal move
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

int a[1000];
int b[1000];
int c[1000];
int d[1000];
void test()
{
for (int i = 0; i < 1000; i++)
a[i] = b[i] > 0 ? c[i] + 1 : c[i] + 2;
}

is copmpiled with -O3 -march=znver5 as:

test:
.LFB0:
.cfi_startproc
movl$2, %edx
vpxor   %xmm2, %xmm2, %xmm2
xorl%eax, %eax
vpbroadcastd%edx, %zmm3
vpternlogd  $0xFF, %zmm2, %zmm2, %zmm2
vpxor   %xmm4, %xmm4, %xmm4
vpsrld  $31, %zmm2, %zmm2
.p2align 6
.p2align 4
.p2align 3
.L2:
vmovdqa32   b(%rax), %zmm0
vmovdqa32   c(%rax), %zmm1
addq$64, %rax
vpcmpd  $6, %zmm4, %zmm0, %k1
vpaddd  %zmm3, %zmm1, %zmm0
vpaddd  %zmm2, %zmm1, %zmm0{%k1}
vmovdqa32   %zmm0, a-64(%rax)
cmpq$3968, %rax
jne .L2

While clang does (with -fno-unroll-loops)

   vpbroadcastd.LCPI0_0(%rip), %zmm0   # zmm0 =
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
leaqb(%rip), %rax
leaqc(%rip), %rcx
leaqa(%rip), %rdx
xorl%esi, %esi
.p2align4, 0x90
.LBB0_1:# =>This Inner Loop Header: Depth=1
vpcmpgtd(%rsi,%rax), %zmm0, %k1
vpblendmd   .LCPI0_1(%rip){1to16}, %zmm0, %zmm1 {%k1}
vpaddd  (%rsi,%rcx), %zmm1, %zmm1
vmovdqu64   %zmm1, (%rsi,%rdx)
addq$64, %rsi
cmpq$3968, %rsi # imm = 0xF80
jne .LBB0_1

[Bug c++/107616] c++tools: select not found breaks build

2025-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107616

--- Comment #5 from GCC Commits  ---
The releases/gcc-12 branch has been updated by John David Anglin
:

https://gcc.gnu.org/g:3ea4b96173db521366cd5d62c125d4cb6c8f6065

commit r12-11062-g3ea4b96173db521366cd5d62c125d4cb6c8f6065
Author: John David Anglin 
Date:   Mon Jan 9 15:41:51 2023 +

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  

c++tools/ChangeLog:

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

[Bug tree-optimization/119872] [15/16 regression] wrong code at -O{1,2,s}

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119872

--- Comment #3 from mcccs at gmx dot com ---
Created attachment 61163
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61163&action=edit
cleaned up

I cleaned up the testcase, without changing the arithmetic, so it passes with
14.2 -O3 and trunk -O0, while failing with trunk -Os. It turns out my cleanup
revealed another latent bug - it now aborts with trunk -O3 as well

[Bug rtl-optimization/116479] [15/16 Regression] wrong code with -O -funroll-loops -finline-stringops -fmodulo-sched --param=max-iterations-computation-cost=637924876 on aarch64

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116479

mcccs at gmx dot com changed:

   What|Removed |Added

 CC||mcccs at gmx dot com

--- Comment #2 from mcccs at gmx dot com ---
bisection bad commit: 5d0c1b4e0d33c2d1077264636d0a65ce206d0d96

[Bug rtl-optimization/116479] [15/16 Regression] wrong code with -O -funroll-loops -finline-stringops -fmodulo-sched --param=max-iterations-computation-cost=637924876 on aarch64 since r15-1447-g5d0c1b

2025-04-20 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116479

Sam James  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||andre.simoesdiasvieira@arm.
   ||com
Summary|[15/16 Regression] wrong|[15/16 Regression] wrong
   |code with -O -funroll-loops |code with -O -funroll-loops
   |-finline-stringops  |-finline-stringops
   |-fmodulo-sched  |-fmodulo-sched
   |--param=max-iterations-comp |--param=max-iterations-comp
   |utation-cost=637924876 on   |utation-cost=637924876 on
   |aarch64 |aarch64 since
   ||r15-1447-g5d0c1b4e0d33c2

--- Comment #3 from Sam James  ---
(In reply to mcccs from comment #2)
> bisection bad commit: 5d0c1b4e0d33c2d1077264636d0a65ce206d0d96

You can make these pretty by using `contrib/git-descr.sh HASH` btw.

-> r15-1447-g5d0c1b4e0d33c2

[Bug tree-optimization/119872] [15/16 regression] wrong code at -O{1,2,s} since r15-1809-g735edbf1e2479f

2025-04-20 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119872

Sam James  changed:

   What|Removed |Added

 CC||tnfchris at gcc dot gnu.org
Summary|[15/16 regression] wrong|[15/16 regression] wrong
   |code at -O{1,2,s}   |code at -O{1,2,s} since
   ||r15-1809-g735edbf1e2479f
   Keywords|needs-bisection |

--- Comment #5 from Sam James  ---
(In reply to mcccs from comment #2)
> Bisect points at
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;
> h=735edbf1e2479fa2323a2b4a9714fae1a0925f74

-> r15-1809-g735edbf1e2479f

[Bug tree-optimization/119592] [12/13/14/15/16 Regression] false positive array bounds warning with set> since r12-1992-g6feb628a706e86

2025-04-20 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119592

Sam James  changed:

   What|Removed |Added

   Keywords|needs-bisection |
Summary|[12/13/14/15/16 Regression] |[12/13/14/15/16 Regression]
   |false positive  array   |false positive  array
   |bounds warning with |bounds warning with
   |set>   |set> since
   ||r12-1992-g6feb628a706e86

--- Comment #5 from Sam James  ---
r12-1992-g6feb628a706e86

(If you fancy reduction, just to state it explicitly: the reduction here will
mean removing includes (either by preprocessing or manually mangling
before/after)).

[Bug c/119878] New: __builtin_has_attribute(VAR, nonstring) does not work on multidimensional arrays marked with nonstring

2025-04-20 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119878

Bug ID: 119878
   Summary: __builtin_has_attribute(VAR, nonstring) does not work
on multidimensional arrays marked with nonstring
   Product: gcc
   Version: 15.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kees at outflux dot net
  Target Milestone: ---

After fixing bug 118095, I discovered that `__builtin_has_attibute` needs to be
updated similarly to how `-Wunterminated-string-initialization` was fixed in
commit afb46540d392 ("c: Don't emit -Wunterminated-string-initialization
warning for multi-dimensional nonstring array initializers [PR117178]").

This can be seen by updating the testsuite:

diff --git a/gcc/testsuite/gcc.dg/attr-nonstring.c
b/gcc/testsuite/gcc.dg/attr-nonstring.c
index d93e93ca6766..c40762d41e11 100644
--- a/gcc/testsuite/gcc.dg/attr-nonstring.c
+++ b/gcc/testsuite/gcc.dg/attr-nonstring.c
@@ -121,3 +121,10 @@ int sprintf_nonstring_2 (char *d, NONSTRING const char *s)
 {
   return sprintf (d, s);  /* { dg-regexp "\[^\n\r\]+: warning: .sprintf.
argument 2 declared attribute .nonstring. \\\[-Wstringop-overread\[^\n\r\]*"
"sprintf" } */
 }
+
+static const char single[] = "ohai";
+_Static_assert (__builtin_has_attribute ((single, nonstring));
+static const char multi2[][4] = "hola";
+_Static_assert (__builtin_has_attribute ((multi2, nonstring));
+static const char multi3[][16][5] = "hello";
+_Static_assert (__builtin_has_attribute ((multi3, nonstring));

[Bug tree-optimization/119875] loop with floating point conditional move not vectorized without -ffast-math

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119875

--- Comment #1 from Andrew Pinski  ---
Try with just -fno-trapping-math .

And try clang with -ftrapping-math.

Since gcc and clang have opposite settings here.

[Bug c/54192] -fno-trapping-math by default?

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54192

Andrew Pinski  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org

--- Comment #12 from Andrew Pinski  ---
*** Bug 119875 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/119875] loop with floating point conditional move not vectorized without -ffast-math

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119875

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #3 from Andrew Pinski  ---
Dup.

*** This bug has been marked as a duplicate of bug 54192 ***

[Bug target/101197] __builtin_memmove (64) does not expand inline for AVX2

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101197

Andrew Pinski  changed:

   What|Removed |Added

Summary|__builtin_memmove does not  |__builtin_memmove (64) does
   |perform constant|not expand inline for AVX2
   |optimizations   |
  Component|middle-end  |target
   Host|x86_64-linux-gnu,   |x86_64-linux-gnu
   |aarch64-linux-gnu   |
  Build|x86_64-linux-gnu,   |x86_64-linux-gnu
   |aarch64-linux-gnu   |
 Target|x86_64-linux-gnu,   |x86_64-linux-gnu
   |aarch64-linux-gnu   |

--- Comment #19 from Andrew Pinski  ---
aarch64 was done in GCC 13.
x86_64 is handled for 32byte in GCC 15.
For 64bytes, x86_64 still needs to be handled but that is a target issue now.

[Bug c/119877] [12/13/14/15/16 Regression] Honor __attribute__((unused)) and don't issue a warning -Wunused-function

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119877

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Andrew Pinski  ---
Dup. And it is older than GCC 12.

*** This bug has been marked as a duplicate of bug 60551 ***

[Bug tree-optimization/119875] New: loop with floating point conditional move not vectorized without -ffast-math

2025-04-20 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119875

Bug ID: 119875
   Summary: loop with floating point conditional move not
vectorized without -ffast-math
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

double a[1000];
double b[1000];
double c[1000];
double d[1000];
void test()
{
for (int i = 0; i < 1000; i++)
a[i] = b[i] > 0 ? c[i] + 1 : c[i] + 2;
}

is vectorized only with -ffast-math, while clang does it w/o:

.LBB0_1:# =>This Inner Loop Header: Depth=1
xorpd   %xmm2, %xmm2
cmpltpd -16(%rcx,%rax,8), %xmm2
xorpd   %xmm3, %xmm3
cmpltpd (%rcx,%rax,8), %xmm3
movapd  %xmm1, %xmm4
andpd   %xmm2, %xmm4
andnpd  %xmm0, %xmm2
orpd%xmm4, %xmm2
movapd  %xmm1, %xmm4
andpd   %xmm3, %xmm4
andnpd  %xmm0, %xmm3
orpd%xmm4, %xmm3
addpd   -16(%rdx,%rax,8), %xmm2
addpd   (%rdx,%rax,8), %xmm3
movapd  %xmm2, -16(%rsi,%rax,8)
movapd  %xmm3, (%rsi,%rax,8)
addq$4, %rax

[Bug tree-optimization/119875] loop with floating point conditional move not vectorized without -ffast-math

2025-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119875

--- Comment #2 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #1)
> Try with just -fno-trapping-math .
> 
> And try clang with -ftrapping-math.
> 
> Since gcc and clang have opposite settings here.

Yes it is trapping math, let me find the dup on that.

[Bug c++/119866] constexpr with __builtin_strlen does not always work

2025-04-20 Thread barry.revzin at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119866

--- Comment #9 from Barry Revzin  ---
> I think it was never intentionally supported in constexpr (it just happened 
> to work) and so such code was never correct.

Can it just be made to work in constexpr? Is there a reason not to? It already
mostly does.

[Bug target/117863] Missing pcmpeq splitters

2025-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117863

--- Comment #1 from GCC Commits  ---
The master branch has been updated by H.J. Lu :

https://gcc.gnu.org/g:a9fc1b9dec92842b3a978183388c1833918776fd

commit r16-44-ga9fc1b9dec92842b3a978183388c1833918776fd
Author: H.J. Lu 
Date:   Sun Apr 20 15:09:00 2025 +0800

x86: Add tests for PR target/117863

commit 546f28f83ceba74dc8bf84b0435c0159ffca971a
Author: Richard Sandiford 
Date:   Mon Apr 7 08:03:46 2025 +0100

simplify-rtx: Fix shortcut for vector eq/ne

fixed

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

PR target/117863
* gcc.dg/rtl/i386/vector_eq-2.c: New test.
* gcc.dg/rtl/i386/vector_eq-3.c: Likewise.

Signed-off-by: H.J. Lu 

[Bug target/117863] Missing pcmpeq splitters

2025-04-20 Thread hjl.tools at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117863

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|--- |15.0
 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from H.J. Lu  ---
Fixed for GCC 15.

[Bug d/119826] [13/14/15/16 regression] ICE: verify_type failed: type variant differs by TYPE_MAX_VALUE with -g

2025-04-20 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119826

Iain Buclaw  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Iain Buclaw  ---
Committed and backported.

[Bug tree-optimization/114932] IVopts inefficient handling of signed IV used for addressing.

2025-04-20 Thread tnfchris at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114932

--- Comment #27 from Tamar Christina  ---
(In reply to Tianyang Chou from comment #26)
> (In reply to Tamar Christina from comment #0)
> 
> Hi Tamar,
> After reading the whole discussion, I still confused about how does the
> immediate offset mode generated, can you help me understanding the logic
> chain of the optimization?
> What am I understand is: before optimized, gcc generate an register
> offset mode, your patch allows CHREC multiply to be folded in IVOPT pass,
> that means the addressing calculation process get simplified, but what's the
> relation between this simplification and generated immediate offset mode?
> How does this CHREC multiply folding optimization causes the generation of
> immediate offset ldr step by step?
> Hope you can provide me the basic train of thought from your
> optimization to the generation of immediate offset load/store instructions.
> Many thanks!

Hi Tianyang,

Sorry I forgot to respond here.

The basic gist of it is that with the original IV

  Base: (integer(kind=4) *) &block + ((sizetype) ((integer(kind=8))
l0_19(D) * 81) + 9) * 4

The more complicated expression makes it hard for IV opts to compare IVs.
Lets say you have another IV

  Base: (integer(kind=4) *) &block + ((sizetype) ((integer(kind=8))
l0_19(D) * 81) + 9) * 4
  Base: (integer(kind=4) *) &block + ((sizetype) ((integer(kind=8))
l0_19(D) * 81) + 10) * 4

This leaves IV opts with only the choice that the common base can be

  ptr = &block + ((sizetype) ((integer(kind=8)) l0_19(D) * 81)

and so the two IVs become (ptr + 9) * 4 and (ptr + 10) * 4 so you'll need a
more complicated addressing mode.
by being able to fold the expressions to something simpler they become: 

  Base: (integer(kind=4) *) &block + ((sizetype) ((unsigned long) l0_19(D)
* 324) + 36)
  Base: (integer(kind=4) *) &block + ((sizetype) ((unsigned long) l0_19(D)
* 324) + 40)

By comparing the operations structurally IV opts realizes the base expression
this time can be

 ptr = &block + ((sizetype) ((unsigned long) l0_19(D) * 324) + 36)

and so the two IVs become ptr and ptr + 4, hence the immediate offset
addressing.

Basically the outer multiply prevents the IVs from being expressible as a
simple offset from each other.

[Bug tree-optimization/119592] [12/13/14/15/16 Regression] false positive array bounds warning with set>

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119592

mcccs at gmx dot com changed:

   What|Removed |Added

 CC||mcccs at gmx dot com

--- Comment #4 from mcccs at gmx dot com ---
Bisect points at
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6feb628a706e86eb3f303aff388c74bdb29e7381

[Bug target/116030] [15 regression] ICE "could not split insn" in final_scan_insn_1, at final.cc on power pc since r15-1576-g6274f10318d053

2025-04-20 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116030

--- Comment #11 from Jiu Fu Guo  ---
(In reply to Peter Bergner from comment #10)
> Testing was clean with the patch updated with Kewen and Sam's suggestions,
> so I pushed the commit given Kewen's approval in the patch thread.

Hi Peter, thanks!

[Bug c++/119864] [15/16 Regression][modules] ICE with -fmodules and omp reduction of UDT

2025-04-20 Thread pilarlatiesa at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119864

--- Comment #3 from Pilar Latiesa  ---
The original testcase also ICEs with G++ 14. However, simpler omp constructs
(such as #pragma opm parallel for) work with G++-14 + -fmodules-ts.

G++-15 fails to compile anything if the combo -fmodules -fopenmp is used, even
without using any omp pragma.

[Bug c++/119863] [15/16 Regression][modules] Bogus conflicting friend template declaration

2025-04-20 Thread pilarlatiesa at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119863

--- Comment #4 from Pilar Latiesa  ---
Thanks Nathaniel.

I could workaround this issue in my usecase by simply granting friendship to
the particular instantiation that needed it.

[Bug d/119817] d: internal compiler error: in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676

2025-04-20 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119817

--- Comment #5 from GCC Commits  ---
The releases/gcc-12 branch has been updated by Iain Buclaw
:

https://gcc.gnu.org/g:0701c8d32507d9014c5b425157a034632d01e45f

commit r12-11061-g0701c8d32507d9014c5b425157a034632d01e45f
Author: Iain Buclaw 
Date:   Tue Apr 15 14:49:34 2025 +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)

[Bug d/119817] d: internal compiler error: in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676

2025-04-20 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119817

Iain Buclaw  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Iain Buclaw  ---
Fixed and backported.

[Bug middle-end/118939] [14/15/16 Regression] ada: executable segfaults on arm-linux-gnueabi when assigning an access to controlled type since r14-2653-g2971ff7b1d564a

2025-04-20 Thread nicolas at debian dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118939

--- Comment #21 from Nicolas Boulenguez  ---
Created attachment 61162
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61162&action=edit
assembly file with 8 combinations of options

Hello.
Probably too late, but just in case… Here are the assembly code and exit status
for all combinations of -g/-O1/-fstack-check.

[Bug tree-optimization/119872] [15/16 regression] wrong code at -O{1,2,s}

2025-04-20 Thread mcccs at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119872

mcccs at gmx dot com changed:

   What|Removed |Added

 CC||mcccs at gmx dot com

--- Comment #2 from mcccs at gmx dot com ---
Bisect points at
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=735edbf1e2479fa2323a2b4a9714fae1a0925f74