[Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"

2023-09-17 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111437

Andreas Schwab  changed:

   What|Removed |Added

 Resolution|FIXED   |INVALID

[Bug c++/111440] New: wrong-code for ternary with reference-compatible arguments

2023-09-17 Thread leni536 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111440

Bug ID: 111440
   Summary: wrong-code for ternary with reference-compatible
arguments
   Product: gcc
   Version: 13.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: leni536 at gmail dot com
  Target Milestone: ---

version: g++ 13.2.0
flags: -std=c++20 -O2 -pedantic-errors

Consider the following code:

```
template 
void foo();,

bool bar() {
int * ptr = nullptr;
const int * const cptr = nullptr;
decltype(auto) res = true ? ptr : cptr;
foo(); // calls void();
return &res == &ptr; // returns false
}
```

https://godbolt.org/z/cW5bxch5K

The observed behavior is described in the code comments.

The expected behavior is that the ternary expression is an lvalue of type
`const int * const` and the result refers to `ptr`.

https://timsong-cpp.github.io/cppwp/n4868/expr.cond#4.1 applies. The target
type is `const int * const&`, E1 is an lvalue of type `int *`.

`int *` is reference-compatible with `const int * const`, as `int**` is
convertible to `const int * const *`.

https://timsong-cpp.github.io/cppwp/n4868/dcl.init.ref#5.1.1 applies, a
reference of type `const int * const&` can be initialized by an lvalue of type
`int*`, and the reference binds directly.

The wording for "reference-compatible" was changed in the resolution of
https://cplusplus.github.io/CWG/issues/2352.html, so earlier standard modes are
probably similarly affected.

[Bug c++/111440] wrong-code for ternary with reference-compatible arguments

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111440

--- Comment #1 from Andrew Pinski  ---
Note clang changed between version 9 and 10 for the defect report it seems ...

[Bug c++/111440] wrong-code for ternary with reference-compatible arguments

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111440

--- Comment #2 from Andrew Pinski  ---
clang change:
https://github.com/llvm/llvm-project/commit/f041e9ad706aee7987c5299427c33424fcabbd0d

[Bug target/105670] [x86] suboptimal code for branch over two bools

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105670

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Andrew Pinski  ---
Dup of bug 79045.

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

[Bug middle-end/79045] bool&bool expanded as 2 jumps

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79045

Andrew Pinski  changed:

   What|Removed |Added

 CC||fent at in dot tum.de

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

[Bug analyzer/111441] New: internal compiler error: in fold_binary_loc, at fold-const.cc:11580

2023-09-17 Thread dale.mengli.ming at proton dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111441

Bug ID: 111441
   Summary: internal compiler error: in fold_binary_loc, at
fold-const.cc:11580
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: dale.mengli.ming at proton dot me
  Target Milestone: ---

Thanks for taking the time to look into this case.

See it live: https://godbolt.org/z/Errh1v5rr.

When the line `__analyzer_describe(0, a[c]);` is commented out, the internal
compiler error disappears. Additionally, under the optimization levels `-O1` to
`-O3`, this error does not occur.

[Bug tree-optimization/111217] variant of cond-bool-2.c fails

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217

--- Comment #2 from Andrew Pinski  ---
This works on the trunk at -O2 now (after r14-3982-g9ea74d235c7e78). But it
still fails at -O1.

[Bug tree-optimization/111442] New: ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

Bug ID: 111442
   Summary: ICE on valid code at -O{s,2,3}: Segmentation fault
signal terminated program cc1
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

This appears to be a recent regression.

Compiler Explorer: https://godbolt.org/z/TY6sWMvcv

[542] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230917 (experimental) (GCC) 
[543] % 
[543] % gcctk -Os small.c
small.c: In function ‘main’:
small.c:5:15: warning: division by zero [-Wdiv-by-zero]
5 | e = a ? 0 % 0 : 0;
  |   ^
gcctk: internal compiler error: Segmentation fault signal terminated program
cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
[544] % 
[544] % cat small.c
int *a, b;
int main() {
  int d = 1, e;
  if (d)
e = a ? 0 % 0 : 0;
  if (d)
a = &d;
  d = -1;
  b = d & e;
  b = 2 * e ^ 1;
  return 0;
}

[Bug c++/111440] wrong-code for ternary with reference-compatible arguments due to C++ defect report 2352

2023-09-17 Thread leni536 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111440

--- Comment #3 from Lénárd Szolnoki  ---
Note that GCC seems to implement CWG2352 outside of ternary operators.

https://godbolt.org/z/rnMcPqE7b

```
template 
void foo();

bool bar() {
int * ptr = nullptr;
const int * const &ref = ptr;
return &ref == &ptr; // returns true
}
```

from GCC 10 `bar` returns true.

[Bug tree-optimization/111217] variant of cond-bool-2.c fails

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111217

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> This works on the trunk at -O2 now (after r14-3982-g9ea74d235c7e78). But it
> still fails at -O1.

Actually it works at -O1 was looking at GCC 13 code generation ..

So fixed.

[Bug c++/111440] wrong-code for ternary with reference-compatible arguments due to C++ defect report 2352

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111440

--- Comment #4 from Andrew Pinski  ---
(In reply to Lénárd Szolnoki from comment #3)
> Note that GCC seems to implement CWG2352 outside of ternary operators.

Yes that was done in GCC 10 (see PR 91844).

[Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Dup of bug 111435.

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

[Bug tree-optimization/111435] [14 Regression] gimple_zero_one_valued_p() infinite recursion

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111435

Andrew Pinski  changed:

   What|Removed |Added

 CC||zhendong.su at inf dot ethz.ch

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

[Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Resolution|DUPLICATE   |---
   Last reconfirmed||2023-09-17
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
   Keywords||ice-on-valid-code
 Status|RESOLVED|ASSIGNED

--- Comment #2 from Andrew Pinski  ---
So it is the same issue but and has the same issue ...

[Bug tree-optimization/111442] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

--- Comment #3 from Andrew Pinski  ---
What I meant was the match for bit_and case has the same issue as convert.
Though I can't don't understand exactly how though but basically any match
can't be recusive after all.

[Bug analyzer/111441] internal compiler error: in fold_binary_loc, at fold-const.cc:11580

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111441

--- Comment #1 from Andrew Pinski  ---
Created attachment 55916
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55916&action=edit
testcase

Please next time attach or place the testcase inline instead of just linking to
godbolt .

[Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

Andrew Pinski  changed:

   What|Removed |Added

Summary|ICE on valid code at|[14 Regression] ICE on
   |-O{s,2,3}: Segmentation |valid code at -O{s,2,3}:
   |fault signal terminated |Segmentation fault signal
   |program cc1 |terminated program cc1
   Target Milestone|--- |14.0

[Bug analyzer/111441] internal compiler error: in fold_binary_loc, at fold-const.cc:11580

2023-09-17 Thread dale.mengli.ming at proton dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111441

--- Comment #2 from mengli ming  ---
(In reply to Andrew Pinski from comment #1)
> Created attachment 55916 [details]
> testcase
> 
> Please next time attach or place the testcase inline instead of just linking
> to godbolt .

Thanks for the reminder, I'll make sure to do so next time.

[Bug analyzer/111441] internal compiler error: in fold_binary_loc, at fold-const.cc:11580

2023-09-17 Thread dale.mengli.ming at proton dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111441

--- Comment #3 from mengli ming  ---
Um..regarding the warning about "stack-based buffer over-read", it's a FP.

[Bug tree-optimization/111435] [14 Regression] gimple_zero_one_valued_p() infinite recursion

2023-09-17 Thread slyfox at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111435

--- Comment #10 from Sergei Trofimovich  ---
The proposed patch fixes my modified i686-linux gcc bootstrap as well. Thank
you!

[Bug c/111443] New: ICE : Segmentation fault signal terminated program since r14-4038-gb975c0dc3be

2023-09-17 Thread shaohua.li at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111443

Bug ID: 111443
   Summary: ICE : Segmentation fault signal terminated program
since r14-4038-gb975c0dc3be
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shaohua.li at inf dot ethz.ch
CC: pinskia at gcc dot gnu.org
  Target Milestone: ---

gcc crashes at -O2.

Bisected to r14-4038-gb975c0dc3be

Compiler explorer: https://godbolt.org/z/zd6WfK5xT


$ cat a.c
int a, c, d;
char b;
void e() {
  char f;
  int g[] = {3};
  char *h;
  if (g[0])
for (; f; f--)
  ;
  c = 0;
  for (;;) {
*h = 0;
b = f - *h;
d = f * a;
  }
}
int main() {}
$
$ gcc -O2 a.c
gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See  for instructions.
$

[Bug tree-optimization/111444] New: Wrong code at -O2/3/s on x86_64-gnu since r14-3226-gd073e2d75d9

2023-09-17 Thread shaohua.li at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111444

Bug ID: 111444
   Summary: Wrong code at -O2/3/s on x86_64-gnu since
r14-3226-gd073e2d75d9
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shaohua.li at inf dot ethz.ch
CC: mjambor at suse dot cz
  Target Milestone: ---

gcc at -O2/3/s produced the wrong code.

Bisected to r14-3226-gd073e2d75d9

Compiler explorer: https://godbolt.org/z/xWj9z8foe

$ cat a.c
int printf(const char *, ...);
int a = 3, d, e;
int *b = &a;
char c;
short f;
const int **g;
static long h(int **i, int **j) {
  const int *k[46];
  const int **l = &k[5];
  *j = &e;
  g = l;
  for (; d; d = d + 1)
;
  **i = 0;
  return f;
}
int main() {
  int *m = &a;
  h(&m, &m);
  c = *b;
  printf("%d\n", c);
}
$
$ gcc -O0 a.c && ./a.out
3
$ gcc -O2 a.c && ./a.out
0
$

[Bug tree-optimization/111445] New: Wrong code at -Os on x86_64-linux-gnu since r12-1077-g57bf3751511

2023-09-17 Thread shaohua.li at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111445

Bug ID: 111445
   Summary: Wrong code at -Os on x86_64-linux-gnu since
r12-1077-g57bf3751511
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shaohua.li at inf dot ethz.ch
CC: aldyh at redhat dot com
  Target Milestone: ---

gcc at -Os produced the wrong code

Bisected to r12-1077-g57bf3751511

Compiler explorer: https://godbolt.org/z/1Ej5jxYPa

$ cat a.c
int printf(const char *, ...);
short a, b;
unsigned char c = 255;
int main() {
  int d;
  unsigned char e;
  d = 0;
  for (; a >= 0; a--) {
int *f = &d;
*f = c;
  }
  e = 0;
  for (; (unsigned char)(d - 255) + e <= 1; e++)
printf("%d\n", b);
}
$
$ gcc -O0 a.c && ./a.out
0
0
$ gcc -Os a.c && ./a.out
$

[Bug driver/86030] specs file processing does not create response files for input directories

2023-09-17 Thread john.soo+gcc-bugzilla at arista dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030

--- Comment #19 from John Soo  ---
I verified the proposed patch sent argv through @file, but COLLECT_GCC_OPTIONS
still caused E2BIG. In the failing execve, COLLECT_GCC_OPTIONS was 134227
characters long.

[Bug c/111443] ICE : Segmentation fault signal terminated program since r14-4038-gb975c0dc3be

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111443

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This will be fixed by the patch which fixes PR 111435 .

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

[Bug tree-optimization/111435] [14 Regression] gimple_zero_one_valued_p() infinite recursion

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111435

Andrew Pinski  changed:

   What|Removed |Added

 CC||shaohua.li at inf dot ethz.ch

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

[Bug tree-optimization/111445] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-1077-g57bf3751511

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111445

Andrew Pinski  changed:

   What|Removed |Added

Summary|Wrong code at -Os on|[12/13/14 Regression] Wrong
   |x86_64-linux-gnu since  |code at -Os on
   |r12-1077-g57bf3751511   |x86_64-linux-gnu since
   ||r12-1077-g57bf3751511
 Ever confirmed|0   |1
   Last reconfirmed||2023-09-17
   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Target Milestone|--- |12.4

--- Comment #1 from Andrew Pinski  ---
Confirmed. Though I think r12-1077-g57bf3751511 just exposed the issue.
-fno-ivopts causes the bug to go away. So does -fwrapv . So I suspect IV-OPTS
is introducing some signed integer overflow for this ...

[Bug tree-optimization/111444] [14 Regression] Wrong code at -O2/3/s on x86_64-gnu since r14-3226-gd073e2d75d9

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111444

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Keywords||alias, wrong-code
Summary|Wrong code at -O2/3/s on|[14 Regression] Wrong code
   |x86_64-gnu since|at -O2/3/s on x86_64-gnu
   |r14-3226-gd073e2d75d9   |since r14-3226-gd073e2d75d9
   Last reconfirmed||2023-09-17
 Ever confirmed|0   |1
   Target Milestone|--- |14.0

--- Comment #1 from Andrew Pinski  ---
Confirmed.

The code must not take into account that *i and *j could alias ???

[Bug tree-optimization/94920] Failure to optimize abs pattern from arithmetic with selected operands based on comparisons with 0

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94920

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |13.0

--- Comment #11 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #8)
> Oh I see the issue. it is not related at all to logical-op-non-short-circuit
> but rather than the testcase should be split into two, one for the scalar
> and one for the vector case. And then the vector case should match not at
> optimized but right before vector lowering happens, maybe in forwprop1 or 2.

That was fixed in r13-6927-gad32fcb8e91ba85cb4676c62 So all fixed in GCC 13.

[Bug middle-end/19987] [meta-bug] fold missing optimizations in general

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19987
Bug 19987 depends on bug 94920, which changed state.

Bug 94920 Summary: Failure to optimize abs pattern from arithmetic with 
selected operands based on comparisons with 0
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94920

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/111043] [14 regression] ICE in adjust_loop_info_after_peeling, at tree-ssa-loop-ivcanon.cc:1068

2023-09-17 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111043

--- Comment #7 from David Binderman  ---
A third reproducer, with -O3 required:

long g_18;
int g_170, g_759, g_1114;
extern void safe_lshift_func_uint64_t_u_u();
void func_35() {
  int __trans_tmp_1;
  for (; g_759 >= 0; g_759 = g_759 - (long)7) {
g_170 = 0;
if (__trans_tmp_1)
  return;
if (g_1114)
  safe_lshift_func_uint64_t_u_u();
  }
}
void func_20() {
  int __trans_tmp_2;
  g_18 = 7;
  for (; g_18 >= 0; g_18 -= 1)
__attribute__(()) int right = g_18;
  __trans_tmp_2 = right < 0 || right >= 2 ?: right;
  if (__trans_tmp_2)
for (;;)
  ;
  func_35();
}

[Bug middle-end/111446] New: genmatch should warn/error out on recusive match patterns

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111446

Bug ID: 111446
   Summary: genmatch should warn/error out on recusive match
patterns
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: internal-improvement
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: pinskia at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

After PR 111442 and PR 111435, I figure we should warn (or error out) about the
case where a match recusively uses itself as that will cause issues with VN and
almost always generate an infinite loop.

[Bug middle-end/111446] genmatch should warn/error out on recusive match patterns

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111446

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-09-17
 Status|UNCONFIRMED |ASSIGNED

[Bug modula2/108143] LONGREAL and powerpc64le-linux

2023-09-17 Thread gaius at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108143

--- Comment #10 from Gaius Mulley  ---
Created attachment 55917
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55917&action=edit
Work in progress fix

Here is a patch set (which needs some tidying up).  It introduces a configure
for LONGREAL as float128 when targetting ppc64le (or hosting on ppc64le).  So
far with this patch I've seen zero regression failures on gcc120 (ppc64le
gnu-linux), (aarch64 gnu-linux) and (x86_64 gnu-linux)  albeit I had to choose
a git master from a few weeks back for aarch64 and x86_64 (still trying to
understand why).  Nevertheless I'm posting the patch here as a work in
progress.

[Bug ada/81114] GNAT mishandles filenames with UTF8 chars on case-insensitive filesystems

2023-09-17 Thread simon at pushface dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81114

--- Comment #6 from simon at pushface dot org ---
(In reply to simon from comment #1)
> Further:
> 
> $ GNAT_FILE_NAME_CASE_SENSITIVE=1 gnatmake -c p*.ads
> gcc -c páck3.ads
> páck3.ads:1:10: warning: file name does not match unit name, should be
> "páck3.ads"
> 
> The reason for this apparently-bizarre message is[1] that macOS takes 
> the composed form (lowercase a acute) and converts it under the hood 
> to what HFS+ insists on, the fully decomposed form (lowercase a, combining 
> acute); thus the names are actually different even though they _look_ 
> the same.

This behaviour (I think it was an error) was fixed by darwin 19. Opening by a
name with the composed form now correctly finds the file named with the fully
decomposed form.

[Bug c++/111447] New: Program crashes when an include is present in global module fragment

2023-09-17 Thread adamstepniak41 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111447

Bug ID: 111447
   Summary: Program crashes when an include is present in global
module fragment
   Product: gcc
   Version: 13.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adamstepniak41 at gmail dot com
  Target Milestone: ---

animal.cpp
---
module;
#include 
export module animal;
export import :sound;
--

animal_sound.cpp
--
module;
#include  // Comment this to get rid of crash
export module animal:sound;

export std::string makeSound() {
 return "Wroooarrh";
}
--

main.cpp
--
#include 

import animal;

int main() {
 auto s = makeSound();
 printf("%s", s.c_str());
 return 0;
}
--

Program crashes when compiled with:
--
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal_sound.cpp -c -o animal_sound.o
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal.cpp -c -o animal.o
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal.o animal_sound.o main.cpp -o main.exe
--

Call stack:
Program received signal SIGSEGV, Segmentation fault.
0x667c in std::__cxx11::basic_string,
std::allocator >::_M_data (this=0x8fa71c45df267600) at
/usr/include/c++/13/bits/basic_string.h:223
223   { return _M_dataplus._M_p; }
(gdb) bt
#0  0x667c in std::__cxx11::basic_string, std::allocator >::_M_data (this=0x0) at
/usr/include/c++/13/bits/basic_string.h:223
#1  0x6ef4 in std::__cxx11::basic_string, std::allocator >::c_str (this=0x7fffda60) at
/usr/include/c++/13/bits/basic_string.h:2584
#2  0x6e60 in main () at main.cpp:7

Compiler version:
g++ --version
g++ (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0

[Bug c++/111447] Program crashes when an include is present in global module fragment

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111447

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Dup of bug 99569.

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

[Bug c++/99569] segfault when running a module

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99569

Andrew Pinski  changed:

   What|Removed |Added

 CC||adamstepniak41 at gmail dot com

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

[Bug c++/103524] [meta-bug] modules issue

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
Bug 103524 depends on bug 111447, which changed state.

Bug 111447 Summary: Program crashes when an include is present in global module 
fragment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111447

   What|Removed |Added

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

[Bug middle-end/111427] [14 regression] gfortran.dg/vect/pr60510.f fails after r14-3999-g3c834d85f2ec42

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111427

Andrew Pinski  changed:

   What|Removed |Added

  Component|other   |middle-end
   Keywords||ra, wrong-code
   Target Milestone|--- |14.0

[Bug sanitizer/111382] Sanitizer says that the right address calculated in parentheses is misaligned.

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111382

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2023-09-17

--- Comment #1 from Andrew Pinski  ---
Confirmed.

  .UBSAN_NULL (test_addr_6, 0B, 8);
  .UBSAN_PTR (test_addr_6, 4);
  i64_9 = MEM[(int64_t *)test_addr_6 + 4B];

It is UBSAN_NULL which I think is expanding to test against 8 byte alignment
...

[Bug tree-optimization/111365] [13/14 Regression] Wrong code at -O3 since r13-1268-g8c99e307b20

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111365

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |14.0
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111445,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111383
Summary|Wrong code at -O3 since |[13/14 Regression] Wrong
   |r13-1268-g8c99e307b20   |code at -O3 since
   ||r13-1268-g8c99e307b20

[Bug tree-optimization/111365] [13/14 Regression] Wrong code at -O3 since r13-1268-g8c99e307b20

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111365

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|14.0|13.3

[Bug tree-optimization/111383] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu since r12-5138-ge82c382971

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111383

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||110233

--- Comment #5 from Andrew Pinski  ---
PR 110233 is almost likely a dup, where IV-OPTS is doing reassociation
incorrectly.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110233
[Bug 110233] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu

[Bug c++/111436] Wrong code when bit-casting struct through pointer

2023-09-17 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111436

--- Comment #2 from Jonathan Wakely  ---
Please re-read the notice that was shown before you created this bug:

"Before reporting a bug, please read the bug writing guidelines, please look at
the list of most frequently reported bugs, and please search for the bug."

"Before reporting that GCC compiles your code incorrectly, compile it with gcc
-Wall -Wextra and see whether this shows anything wrong with your code.
Similarly, if compiling with -fno-strict-aliasing -fwrapv makes a difference,
your code probably is not correct."


Your code produces the expected results with -fno-strict-aliasing and as it
says, that means your code is probably not correct. In this case, it's
definitely not correct.

The reason std::bit_cast doesn't allow more general types is because C++
doesn't support doing it. You can't just reinterpret_cast and expect it to
work.

[Bug libstdc++/111172] Dead code in std::get for variant?

2023-09-17 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72

Jonathan Wakely  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
   Target Milestone|--- |14.0

--- Comment #2 from Jonathan Wakely  ---
Fixed for GCC 14. Thanks for the report.

[Bug tree-optimization/111442] [14 Regression] ICE on valid code at -O{s,2,3}: Segmentation fault signal terminated program cc1

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111442

Andrew Pinski  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2023-Septemb
   ||er/630695.html
   Keywords||patch

--- Comment #4 from Andrew Pinski  ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630695.html

[Bug c++/111448] New: g++ ICE Segmentation fault in qemu-riscv64-static emulator

2023-09-17 Thread rsworktech at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111448

Bug ID: 111448
   Summary: g++ ICE Segmentation fault in qemu-riscv64-static
emulator
   Product: gcc
   Version: 13.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rsworktech at outlook dot com
  Target Milestone: ---

Created attachment 55918
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55918&action=edit
reduced ICE source file

Maybe this is technically not a gcc bug. But I very much appreciate any
suggestions and pointers you might give to me.

gcc doesn't fail on real riscv64 boards so looks more like a qemu bug to me. I
also reported it to qemu: https://gitlab.com/qemu-project/qemu/-/issues/1895

In a qemu-user Arch Linux riscv64
container(https://github.com/felixonmars/archriscv-packages/wiki/Setup-Arch-Linux-RISC-V-Development-Environment),
the attached source file(which has been reduced to less than 5kb by cvise)
caused an ICE, segmentation fault.

Command: g++ -S testcase.i -w -fpreprocessed -o /dev/null

Output: 

g++: internal compiler error: Segmentation fault signal terminated program
cc1plus
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See  for instructions.

g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-unknown-linux-gnu/13.2.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-multilib --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230801 (GCC)

[Bug c++/111448] g++ ICE Segmentation fault in qemu-riscv64-static emulator

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111448

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=110315

--- Comment #1 from Andrew Pinski  ---
I suspect this is a dup of bug 110315.  It works on the trunk but fails on
13.2.0 even on x86_64-linux-gnu.

[Bug tree-optimization/110386] [11/12/13/14 Regression] ICE with ABSU in backprop

2023-09-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110386

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
 Status|NEW |ASSIGNED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111285

--- Comment #6 from Andrew Pinski  ---
I am going to fix this.

[Bug c++/111448] g++ ICE Segmentation fault in qemu-riscv64-static emulator

2023-09-17 Thread rsworktech at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111448

--- Comment #2 from Levi Zim  ---
(In reply to Andrew Pinski from comment #1)
> I suspect this is a dup of bug 110315.  It works on the trunk but fails on
> 13.2.0 even on x86_64-linux-gnu.

I tested it with gcc 13.1.1 and gcc 12.3.0.

gcc 13.1.1 also triggers the ICE.

gcc 12.3.0 doesn't trigger the ICE.

[Bug tree-optimization/111303] [14 Regression] ICE: in type, at value-range.h:869

2023-09-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111303

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jiu Fu Guo :

https://gcc.gnu.org/g:55b22a6f630e76a0be913ced8bf1b017eaffd89b

commit r14-4082-g55b22a6f630e76a0be913ced8bf1b017eaffd89b
Author: Jiufu Guo 
Date:   Wed Sep 13 16:12:05 2023 +0800

use local range for one more pattern in match.pd

For "get_global_range_query" SSA_NAME_RANGE_INFO can be queried.
For "get_range_query", it could get more context-aware range info.
And look at the implementation of "get_range_query",  it returns
global range if no local fun info.

ATTRIBUTE_RETURNS_NONNULL inline range_query *
get_range_query (const struct function *fun)
{
  return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges;
}

So, using "get_range_query" would cover more case.
For example, the test case of "pr111303.c".

PR middle-end/111303

gcc/ChangeLog:

* match.pd ((t * 2) / 2): Update pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr111303.c: New test.

[Bug middle-end/111324] More optimization about "(X * Y) / Y"

2023-09-17 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111324

Jiu Fu Guo  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jiu Fu Guo  ---
This can be handled by r14-3913-g8d8bc560b6ab7f3153db23ffb37157528e5b2c9a.

[Bug tree-optimization/111303] [14 Regression] ICE: in type, at value-range.h:869

2023-09-17 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111303

Jiu Fu Guo  changed:

   What|Removed |Added

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

--- Comment #8 from Jiu Fu Guo  ---
Fix is committed via r14-3913-g8d8bc560b6ab7f3153db23ffb37157528e5b2c9a.

[Bug middle-end/111324] More optimization about "(X * Y) / Y"

2023-09-17 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111324

--- Comment #7 from Jiu Fu Guo  ---
A comment https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111303#c7 
should be attached here.

[Bug target/111449] New: memcmp (p,q,16) == 0 can be optimized better on ppc64 with vector comparison instructions

2023-09-17 Thread guihaoc at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111449

Bug ID: 111449
   Summary: memcmp (p,q,16) == 0 can be optimized better on ppc64
with vector comparison instructions
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: guihaoc at gcc dot gnu.org
  Target Milestone: ---

int compare (const char* s1, const char* s2)
{
  return __builtin_memcmp (s1, s2, 16) == 0;
}


trunk outputs
ld 10,0(3)
ld 9,0(4)
cmpd 0,10,9
beq 0,.L6
.L2:
li 3,1
cntlzw 3,3
srwi 3,3,5
blr
.p2align 4,,15
.L6:
ld 10,8(3)
ld 9,8(4)
li 3,0
cmpd 0,10,9
bne 0,.L2
cntlzw 3,3
srwi 3,3,5
blr

Expect to use vector comparison to eliminate branches.
lxv 32,0(3)
lxv 33,0(4)
vcmpequb. 0,0,1
mfcr 3,2
rlwinm 3,3,25,1
blr

[Bug tree-optimization/111303] [14 Regression] ICE: in type, at value-range.h:869

2023-09-17 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111303

--- Comment #9 from Jiu Fu Guo  ---
(In reply to CVS Commits from comment #7) this comment should be linked to
PR111324.

[Bug target/111367] Error: operand out of range (0x1391c is not between 0xffffffffffff8000 and 0x7fff)

2023-09-17 Thread linkw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111367

--- Comment #6 from Kewen Lin  ---
Created attachment 55919
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55919&action=edit
tested patch

[Bug target/111367] Error: operand out of range (0x1391c is not between 0xffffffffffff8000 and 0x7fff)

2023-09-17 Thread linkw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111367

Kewen Lin  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||bergner at gcc dot gnu.org,
   ||g...@the-meissners.org,
   ||segher at gcc dot gnu.org

--- Comment #7 from Kewen Lin  ---
#c6 is the tested patch.

Hi Mike, I noticed that you committed r10-4547-gce6a6c007e5a98 for DImode, I
wonder if not updating SImode (32bit) is intentional at that time?

[Bug target/111424] LoongArch: Enable vect test suite

2023-09-17 Thread panchenghui at loongson dot cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111424

--- Comment #1 from Chenghui Pan  ---
I also addressed some failed testcases with -mlsx/-mlasx enabled and try to
resolve them by adding dg-options and etc. or editing target-supports.exp to
append loongarch directives. (May submit to maillist later). 
Bug 111403's problem is a little complicated and still under investigation...

[Bug c/111450] New: RISC-V: Missed optimized for strided load/store with stride = element width

2023-09-17 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111450

Bug ID: 111450
   Summary: RISC-V: Missed optimized for strided load/store with
stride = element width
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: juzhe.zhong at rivai dot ai
  Target Milestone: ---

Consider this following cases:

https://godbolt.org/z/3MPoz5q6x

#include "riscv_vector.h"

void foo (int8_t *in, int8_t *out, int n)
{
vint8m1_t v = __riscv_vlse8_v_i8m1 (in, 1, n);
__riscv_vsse8_v_i8m1 (out, 1, v, n);
}

void foo1 (int16_t *in, int16_t *out, int n)
{
vint16m1_t v = __riscv_vlse16_v_i16m1 (in, 2, n);
__riscv_vsse16_v_i16m1 (out, 2, v, n);
}

void foo3 (int32_t *in, int32_t *out, int n)
{
vint32m1_t v = __riscv_vlse32_v_i32m1 (in, 4, n);
__riscv_vsse32_v_i32m1 (out, 4, v, n);
}

void foo4 (int64_t *in, int64_t *out, int n)
{
vint64m1_t v = __riscv_vlse64_v_i64m1 (in, 8, n);
__riscv_vsse64_v_i64m1 (out, 8, v, n);
}

ASM:

foo:
li  a5,1
vsetvli zero,a2,e8,m1,ta,ma
vlse8.v v1,0(a0),a5
vsse8.v v1,0(a1),a5
ret
foo1:
li  a5,2
vsetvli zero,a2,e16,m1,ta,ma
vlse16.vv1,0(a0),a5
vsse16.vv1,0(a1),a5
ret
foo3:
li  a5,4
vsetvli zero,a2,e32,m1,ta,ma
vlse32.vv1,0(a0),a5
vsse32.vv1,0(a1),a5
ret
foo4:
li  a5,8
vsetvli zero,a2,e64,m1,ta,ma
vlse64.vv1,0(a0),a5
vsse64.vv1,0(a1),a5
ret


When stride = element width, vlse should be optimized into vle.
vsse should be optimized into vse.v.

So we can save a constant move instruction.

[Bug c/111451] New: RISC-V: Missed optimization of vrgather.vv into vrgatherei16.vv

2023-09-17 Thread juzhe.zhong at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111451

Bug ID: 111451
   Summary: RISC-V: Missed optimization of vrgather.vv into
vrgatherei16.vv
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: juzhe.zhong at rivai dot ai
  Target Milestone: ---

Consider this following case:

#include 
typedef int32_t vnx32si __attribute__ ((vector_size (128)));

#define MASK_2(X, Y) (Y) - 1 - (X), (Y) - 2 - (X)
#define MASK_4(X, Y) MASK_2 (X, Y), MASK_2 (X + 2, Y)
#define MASK_8(X, Y) MASK_4 (X, Y), MASK_4 (X + 4, Y)
#define MASK_16(X, Y) MASK_8 (X, Y), MASK_8 (X + 8, Y)
#define MASK_32(X, Y) MASK_16 (X, Y), MASK_16 (X + 16, Y)
#define MASK_64(X, Y) MASK_32 (X, Y), MASK_32 (X + 32, Y)
#define MASK_128(X, Y) MASK_64 (X, Y), MASK_64 (X + 64, Y)

#define PERMUTE(TYPE, NUNITS) 
\
  __attribute__ ((noipa)) void permute_##TYPE (TYPE values1, TYPE values2,
\
   TYPE *out) 
\
  {   
\
TYPE v
\
  = __builtin_shufflevector (values1, values2, MASK_##NUNITS (0, NUNITS));
\
*(TYPE *) out = v;
\
  }

#define TEST_ALL(T)   
\
  T (vnx32si, 32) 
\

TEST_ALL (PERMUTE)

ASM:

permute_vnx32si:
li  a5,32
li  a4,31
vsetvli zero,a5,e32,m8,ta,ma
vid.v   v8
vle32.v v24,0(a0)
vrsub.vxv8,v8,a4
vrgather.vv v16,v24,v8
vse32.v v16,0(a2)
ret

https://godbolt.org/z/Mh77YY91r

Here we use:

vsetvli zero,a5,e32,m8,ta,ma
...
vrgather.vv v16,v24,v8

The index vector register "v8" occupies 8 registers.
We should optimize it into vrgatherei16.vv which is using int16 as the index 
elements.

Then with vrgatherei16.vv, the v8 will occupy 4 registers instead of 8.
Lower the register consuming and register pressure.

[Bug middle-end/110983] -fpatchable-function-entry is missing in Option Summary page

2023-09-17 Thread sray at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110983

--- Comment #6 from Mao  ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Mao from comment #3)
> > Created attachment 55810 [details]
> > invoke-doc-patch
> > 
> > I think this can help fix the issue.
> > I am not sure how to build the HTML web pages. But I also checked the man
> > page. The fpatchable-function-entry is also missing in the manpage in the
> > option summary section. And my fix can solve this issue.
> 
> `make html` is the way to build the HTML web pages ...

Hi Andrew, 

I have sent a patch here:
https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628656.html

But I have not got any response. Can you help take it a look, or do you have
any suggestion what should I do now?

[Bug tree-optimization/96487] cddce1 optimizer depends on order of basic blocks

2023-09-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96487

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Richard Biener  ---
Yes, I think so (verified the testcase).

[Bug c++/111452] New: ICE on concept with undeclared identifier and unpermitted keyword

2023-09-17 Thread stevenxia990430 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111452

Bug ID: 111452
   Summary: ICE on concept with undeclared identifier and
unpermitted keyword
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following invalid program reports an internal compiler error: Segmentation
fault. Failed on gcc-trunk. 

To quickly reproduce: https://gcc.godbolt.org/z/c791Wfhr4
```
#include 

template
concept bool IsAnyOf  = IsAnyOf;

struct a{};
int main()
{
constexpr bool bbb = IsAnyOf;
}
```

Note after removing the bool keyword, gcc no longer ICE, additionally use
another name apart from IsAnyOf in the right hand of the concept also no longer
ICE.

[Bug c++/111453] New: ICE on concept with incorrectly ordered template parameter pack

2023-09-17 Thread stevenxia990430 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111453

Bug ID: 111453
   Summary: ICE on concept with incorrectly ordered template
parameter pack
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following invalid program reports an internal compiler error. Failed on
gcc-trunk. 

To quickly reproduce: https://gcc.godbolt.org/z/PcEreesPo
```
#include 

template // incorrectly ordered template parameters
concept IsIn = (... || std::same_as);

template
concept IsNotIn = !IsIn(T);
```

Note after changing from `template` ->
`template`, gcc no longer ICE.