[Bug tree-optimization/111906] New: ICE: segfault during GIMPLE pass: dom in gsi_prev() testsuite torture/bitint-39.c with -O1 (expensive tests)

2023-10-21 Thread rimvydas.jas at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111906

Bug ID: 111906
   Summary: ICE: segfault during GIMPLE pass: dom in gsi_prev()
testsuite torture/bitint-39.c with -O1 (expensive
tests)
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rimvydas.jas at gmail dot com
  Target Milestone: ---

Strange ICE does not happen with -O{0,2,3,s,g} or with "-O1 -save-temps",
testcase does not reduce.

$ GCC_TEST_RUN_EXPENSIVE=yes make -k check-gcc-c
RUNTESTFLAGS="dg-torture.exp=bitint-39.c"
Running /data/gcc_trunk/gcc/testsuite/gcc.dg/torture/dg-torture.exp ...
FAIL: gcc.dg/torture/bitint-39.c   -O1  (internal compiler error: Segmentation
fault)
FAIL: gcc.dg/torture/bitint-39.c   -O1  (test for excess errors)

=== gcc Summary ===

# of expected passes12
# of unexpected failures2
# of unresolved testcases   1
/tmp/build/gcc/xgcc  version 14.0.0 20231021 (experimental) [master
r14-4812-g66c26e5cfdf] (GCC)

$ valgrind --track-origins=yes ./gcc/cc1
/data/gcc_trunk/gcc/testsuite/gcc.dg/torture/bitint-39.c
-fdiagnostics-plain-output -O1
 bar t115_1add t115_2add t115_3add t115_4add t115_5add t115add t116_1add
t116_2add t116_3add t116_4add t116_5add t116add t117_1add t117_2add t117_3add
t117_4add t117_5add t117add t118_1add t118_2add t118_3add t118_4add t118_5add
t118add t119_1add t119_2add t119_3add t119_4add t119_5add t119add t120_1add
t120_2add t120_3add t120_4add t120_5add t120add t121_1add t121_2add t121_3add
t121_4add t121_5add t121add t122_1add t122_2add t122_3add t122_4add t122_5add
t122add t123_1add t123_2add t123_3add t123_4add t123_5add t123add t124_1add
t124_2add t124_3add t124_4add t124_5add t124add t100_1add t100_2add t100_3add
t100_4add t100_5add t100add t101_1add t101_2add t101_3add t101_4add t101_5add
t101add t102_1sub t102_2sub t102_3sub t102_4sub t102_5sub t102sub t103_1sub
t103_2sub t103_3sub t103_4sub t103_5sub t103sub t104_1mul t104_2mul t104_3mul
t104_4mul t104_5mul t104mul t105_1mul t105_2mul t105_3mul t105_4mul t105_5mul
t105mul t106_1mul t106_2mul t106_3mul t106_4mul t106_5mul t106mul t107_1add
t107_2add t107_3add t107_4add t107_5add t107add t108_1add t108_2add t108_3add
t108_4add t108_5add t108add t109_1add t109_2add t109_3add t109_4add t109_5add
t109add t110_1sub t110_2sub t110_3sub t110_4sub t110_5sub t110sub t111_1add
t111_2add t111_3add t111_4add t111_5add t111add t112_1add t112_2add t112_3add
t112_4add t112_5add t112add t113_1add t113_2add t113_3add t113_4add t113_5add
t113add t114_1add t114_2add t114_3add t114_4add t114_5add t114add main
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> {heap 0 }  {heap 0 }  {heap 0
}  {heap 0 }  {heap 0 }  {heap 0
}  {heap 0 }Streaming LTO
  {heap 0 }  {heap 0 }  {heap 0 }
 {heap 0 }  {heap 0 }  {heap 0 } 
{heap 0 }  {heap 0 }  {heap 0 }  {heap 0
}Assembling functions:
  {heap 0 } bar t115_1add t115_2add t115_3add t115_4add t115_5add
t115add t116_1add t116_2add t116_3add t116_4add t116_5add t116add t117_1add {GC
released 1080k} {GC 5369k -> 3189k} t117_2add t117_3add t117_4add t117_5add
t117add t118_1add t118_2add t118_3add t118_4add t118_5add t118add t119_1add
t119_2add t119_3add t119_4add t119_5add t119add t120_1add t120_2add {GC
released 1932k madv_dontneed 64k} {GC 5354k -> 3100k} t120_3add t120_4add
t120_5add t120add t121_1add t121_2add t121_3add t121_4add t121_5add t121add
t122_1add t122_2add t122_3add t122_4add t122_5add t122add t123_1add t123_2add
{GC released 2044k} {GC 5347k -> 2993k} t123_3add t123_4add t123_5add t123add
t124_1add t124_2add t124_3add t124_4add t124_5add t124add t100_1add t100_2add
t100_3add t100_4add t100_5add t100add t101_1add t101_2add t101_3add t101_4add
t101_5add t101add t102_1sub t102_2sub t102_3sub t102_4sub t102_5sub t102sub
t103_1sub t103_2sub t103_3sub t103_4sub t103_5sub t103sub t104_1mul t104_2mul
t104_3mul t104_4mul t104_5mul {GC released 1988k} {GC 5325k -> 2670k}==82656==
Invalid read of size 8
==82656==at 0x11568B4: gsi_prev (gimple-iterator.h:202)
==82656==by 0x11568B4:
dom_opt_dom_walker::before_dom_children(basic_block_def*)
(tree-ssa-dom.cc:1764)
==82656==by 0x1E2B86E: dom_walker::walk(basic_block_def*) (domwalk.cc:311)
==82656==by 0x1157278: (anonymous
namespace)::pass_dominator::execute(function*) (tree-ssa-dom.cc:939)
==82656==by 0xEF2628: execute_one_pass(opt_pass*) (passes.cc:2641)
==82656==by 0xEF2EAF: execute_pass_list_1(opt_pass*) (passes.cc:2750)
==82656==by 0xEF2EC1: execute_pass_list_1(opt_pass*) (passes.cc:2751)
==82656==by 0xEF2EE8: execute_pass_list(function*, opt_pass*)
(passes.cc:2761)
==82656==by 0xB1F345: expand (cgraphunit.cc:1841)
==82656==by 0xB1F345: cgraph_node::expand() (cgraph

[Bug target/111907] New: ICE: in curr_insn_transform, at lra-constraints.cc:4294 unable to generate reloads for: {*andnottf3} with -mavx512f -mno-evex512 -mbionic

2023-10-21 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111907

Bug ID: 111907
   Summary: ICE: in curr_insn_transform, at
lra-constraints.cc:4294 unable to generate reloads
for: {*andnottf3} with -mavx512f -mno-evex512 -mbionic
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu

Created attachment 56165
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56165&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -mavx512f -mno-evex512 -mbionic testcase.c 
testcase.c: In function 'foo':
testcase.c:5:1: error: unable to generate reloads for:
5 | }
  | ^
(insn 14 13 15 2 (set (reg:TF 104)
(and:TF (not:TF (reg:TF 103))
(reg:TF 99 [ _2 ]))) "testcase.c":4:10 3138 {*andnottf3}
 (expr_list:REG_DEAD (reg:TF 99 [ _2 ])
(nil)))
during RTL pass: reload
testcase.c:5:1: internal compiler error: in curr_insn_transform, at
lra-constraints.cc:4294
0x7eee43 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/repo/gcc-trunk/gcc/rtl-error.cc:108
0x7a8d79 curr_insn_transform
/repo/gcc-trunk/gcc/lra-constraints.cc:4294
0x12cea56 lra_constraints(bool)
/repo/gcc-trunk/gcc/lra-constraints.cc:5497
0x12b7ae4 lra(_IO_FILE*)
/repo/gcc-trunk/gcc/lra.cc:2419
0x1266d99 do_reload
/repo/gcc-trunk/gcc/ira.cc:5973
0x1266d99 execute
/repo/gcc-trunk/gcc/ira.cc:6161
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-4813-20231021102502-g57cbb1d3344-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-4813-20231021102502-g57cbb1d3344-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231021 (experimental) (GCC)

[Bug target/111905] -O3 vectorization terribly pessimizes the code for an already unrolled loop

2023-10-21 Thread kamkaz at windowslive dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111905

--- Comment #3 from Kamil Kaznowski  ---
Created attachment 56166
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56166&action=edit
a smaller example

A smaller example.
Compilation flags:
-O2 -march=x86-64-v3 -std=c++23
vs
-O3 -march=x86-64-v3 -std=c++23

[Bug target/111905] -O3 vectorization terribly pessimizes the code for an already unrolled loop

2023-10-21 Thread kamkaz at windowslive dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111905

--- Comment #4 from Kamil Kaznowski  ---
(In reply to Andrew Pinski from comment #2)
> Why are you using `-mprefer-vector-width=512` here?
> 
> 512 causes the loop to be needing to be unrolled once more and that is why
> the confusion happening.

I don't think the preferred vector width mattered there? The vector width used
was already 512 (zmm registers).

I created a simpler example, no extra flags affecting preferred vector width,
chunks of 256 bit (8*32bit). Still the same issue appears - a lot of
weirdly-unrolled code, that I presume (hope?) is dead + some extra code at the
start I can't quite figure out.

[Bug tree-optimization/80532] warning on pointer access after free

2023-10-21 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80532

--- Comment #11 from Eric Gallager  ---
(In reply to CVS Commits from comment #9)
> The master branch has been updated by Martin Sebor :
> 
> https://gcc.gnu.org/g:671a283636de75f7ed638ee6b01ed2d44361b8b6
> 
> commit r12-6605-g671a283636de75f7ed638ee6b01ed2d44361b8b6
> Author: Martin Sebor 
> Date:   Sat Jan 15 16:37:54 2022 -0700
> 
[...snip...]
> libiberty/ChangeLog:
> 
> * regex.c: Suppress -Wuse-after-free.

Was this part necessary? I'm wondering if it might be covering up an actual
error that I'm seeing on CheriBSD on cfarm240...

[Bug target/111908] New: Port CheriBSD-specific compiler warnings to GCC

2023-10-21 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111908

Bug ID: 111908
   Summary: Port CheriBSD-specific compiler warnings to GCC
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: build, diagnostic
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: egallager at gcc dot gnu.org
CC: jrtc27 at jrtc27 dot com
Blocks: 44756, 87403
  Target Milestone: ---
Target: CheriBSD

The GCC compile farm has a CheriBSD machine, cfarm240, where the C/C++ memory
rules are stricter than normal. CheriBSD modifications to C/C++ are described
in the CHERI C/C++ Programming Guide:
https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-947.pdf
The document outlines a number of warnings that their compiler has for code
that will break on CheriBSD, specifically:

- -Wcheri-prototypes (kinda like -Wstrict-prototypes)
- -Wcheri-capability-misuse (kinda like -Wint-to-pointer-cast and
-Wpointer-to-int-cast; says something like "warning: cast from provenance-free
integer type to pointer type will give pointer that can not be dereferenced")
- -Wcheri-provenance (says something like "warning: binary expression on
capability types; it is not clear which should be used as the source of
provenance")

Note that some of these warnings will show up in a build of GCC itself, and
will cause the build to fail if configured with --enable-werror
--enable-werror-always.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44756
[Bug 44756] [meta-bug] --enable-werror-always issues
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403
[Bug 87403] [Meta-bug] Issues that suggest a new warning

[Bug fortran/111781] Fortran compiler complains about variable bound in array dummy argument

2023-10-21 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111781

Mikael Morin  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mikael at gcc dot 
gnu.org

--- Comment #2 from Mikael Morin  ---
I'm on it.

[Bug c++/110848] Consider enabling -Wvla by default in non-GNU C++ modes

2023-10-21 Thread aaron at aaronballman dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848

--- Comment #13 from Aaron Ballman  ---
Just to circle back around on this topic, these are changes recently landed in
Clang:
https://github.com/llvm/llvm-project/commit/84a3aadf0f2483dde0acfc4e79f2a075a5f35bd1

It enables the -Wvla-extension diagnostic group in C++ language modes by
default, adds the warning group to -Wall in GNU++ language modes, and the
warning is still opt-in in C language modes.

[Bug ada/111909] New: Filename case sensitivity defaulted wrongly on macOS

2023-10-21 Thread simon at pushface dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111909

Bug ID: 111909
   Summary: Filename case sensitivity defaulted wrongly on macOS
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ada
  Assignee: unassigned at gcc dot gnu.org
  Reporter: simon at pushface dot org
CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 56167
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56167&action=edit
Demo of code to determine case sensitivity

In gcc/ada/adaint.c(__gnat_get_file_names_case_sensitive), the
assumption for __APPLE__ is that file names are case-insensitive
unless __arm__ or __arm64__ are defined, in which case file names are
declared case-sensitive.

The associated comment is
   "By default, we suppose filesystems aren't case sensitive on
   Windows and Darwin (but they are on arm-darwin)."

This change was made in commit b54d1d39d30c (in github gcc-mirror).

This means that on aarch64-apple-darwin, file names are declared
case-sensitive.

I understand that GCC does not currently support iOS/tvOS/watchOS, so
we could assume macOS.

On macOS, the default filesystem is case-insensitive; changing this
function to reflect that would be an improvement. However, it's
possible to create case-sensitive filesystems, and some users do when
dealing with OSS code. It would be good to check the actual filesystem
in use.

[Bug fortran/111781] Fortran compiler complains about variable bound in array dummy argument

2023-10-21 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111781

--- Comment #3 from Mikael Morin  ---
I'm trying to remove the formal_arg_flag global variables, which seem to just
disable all the checks on dummy arguments.

Unfortunately, it regresses a bit, say pr101026.f for example can be simplified
to this:

  SUBROUTINE PASSB4 (CC,CH)
  DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
  END

which gives:

pr101026.f:4:19:

4 |   DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
  |   1
Error: Variable ‘ido’ cannot appear in the expression at (1)
pr101026.f:4:33:

4 |   DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
  | 1
Error: Variable ‘ido’ cannot appear in the expression at (1)
pr101026.f:4:25:

4 |   DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
  | 1
Error: Variable ‘l1’ cannot appear in the expression at (1)
pr101026.f:4:37:

4 |   DIMENSION CC(IDO,4,L1), CH(IDO,L1,*)
  | 1
Error: Variable ‘l1’ cannot appear in the expression at (1)


What I don't see is what makes the IDO and L1 variables acceptable in a
specification expression.  It seems to me the errors above are valid.

[Bug c/111903] [14 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:567 with -mno-sse2 and _Float16

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111903

Andrew Pinski  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/piperma
   ||il/gcc-patches/2023-October
   ||/633840.html
   Keywords||patch

--- Comment #3 from Andrew Pinski  ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633840.html

[Bug fortran/111837] [11/12/13/14 Regression] Out of bounds access with optimization inside io-implied-do-control

2023-10-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111837

--- Comment #5 from CVS Commits  ---
The releases/gcc-13 branch has been updated by Harald Anlauf
:

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

commit r13-7972-gc83907b9fad802a5c38ed4ca75d9415b8f57f619
Author: Harald Anlauf 
Date:   Mon Oct 16 21:02:20 2023 +0200

Fortran: out of bounds access with nested implied-do IO [PR111837]

gcc/fortran/ChangeLog:

PR fortran/111837
* frontend-passes.cc (traverse_io_block): Dependency check of loop
nest shall be triangular, not banded.

gcc/testsuite/ChangeLog:

PR fortran/111837
* gfortran.dg/implied_do_io_8.f90: New test.

(cherry picked from commit 5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2)

[Bug fortran/111837] [11/12/13/14 Regression] Out of bounds access with optimization inside io-implied-do-control

2023-10-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111837

--- Comment #6 from CVS Commits  ---
The releases/gcc-12 branch has been updated by Harald Anlauf
:

https://gcc.gnu.org/g:4d4d191e03d102d5afeb4b091e947560351004c3

commit r12-9934-g4d4d191e03d102d5afeb4b091e947560351004c3
Author: Harald Anlauf 
Date:   Mon Oct 16 21:02:20 2023 +0200

Fortran: out of bounds access with nested implied-do IO [PR111837]

gcc/fortran/ChangeLog:

PR fortran/111837
* frontend-passes.cc (traverse_io_block): Dependency check of loop
nest shall be triangular, not banded.

gcc/testsuite/ChangeLog:

PR fortran/111837
* gfortran.dg/implied_do_io_8.f90: New test.

(cherry picked from commit 5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2)

[Bug fortran/111837] [11/12/13/14 Regression] Out of bounds access with optimization inside io-implied-do-control

2023-10-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111837

--- Comment #7 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Harald Anlauf
:

https://gcc.gnu.org/g:9b569e0a1cf79519eea2e62422232c8d2d483f07

commit r11-11071-g9b569e0a1cf79519eea2e62422232c8d2d483f07
Author: Harald Anlauf 
Date:   Mon Oct 16 21:02:20 2023 +0200

Fortran: out of bounds access with nested implied-do IO [PR111837]

gcc/fortran/ChangeLog:

PR fortran/111837
* frontend-passes.c (traverse_io_block): Dependency check of loop
nest shall be triangular, not banded.

gcc/testsuite/ChangeLog:

PR fortran/111837
* gfortran.dg/implied_do_io_8.f90: New test.

(cherry picked from commit 5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2)

[Bug fortran/111837] [11/12/13/14 Regression] Out of bounds access with optimization inside io-implied-do-control

2023-10-21 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111837

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed.

[Bug tree-optimization/111910] New: `a - b < 0` is not transformed into `a < b` for signed types

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111910

Bug ID: 111910
   Summary: `a - b < 0` is not transformed into `a < b` for signed
types
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: FIXME, missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: pinskia at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

>From match.pd:

/* Transform comparisons of the form X - Y CMP 0 to X CMP Y.
   ??? The transformation is valid for the other operators if overflow
   is undefined for the type, but performing it here badly interacts
   with the transformation in fold_cond_expr_with_comparison which
   attempts to synthetize ABS_EXPR.  */

I am looking into that fix that for either GCC 14 or 15.

[Bug target/111908] Port CheriBSD-specific compiler warnings to GCC

2023-10-21 Thread jrtc27 at jrtc27 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111908

--- Comment #1 from Jessica Clarke  ---
NB: Arm have a vendor branch for Morello (intended to be generic across CHERI
with a Morello-specific backend, rather than overly tied to the Morello
prototype) at refs/vendors/ARM/heads/morello. I have no experience of it, and
it's less mature than our decade-old Clang/LLVM, but it purports to both add
CHERI C diagnostics and introduce Morello code generation. They are tied
together, as they are in our Clang/LLVM, but there's no reason one couldn't
port some of the diagnostics to non-CHERI and warn people that they're doing
things outside of ISO (or even GNU) C, even if they happen to work on those
architectures, though disambiguating intptr_t vs ((un)signed) long (long) (or
even int on ILP32) may not be feasible given that *is* very much OK on
ILP32/LP64/LLP64.

[Bug tree-optimization/25290] PHI-OPT could be rewritten so that is uses match

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25290

--- Comment #32 from Andrew Pinski  ---
https://gcc.gnu.org/pipermail/gcc-patches/2004-June/140297.html for reference
where the original idea came from.

[Bug tree-optimization/111910] `a - b < 0` is not transformed into `a < b` for signed types

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111910

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2023-10-21

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

[Bug tree-optimization/111910] `a - b < 0` is not transformed into `a < b` for signed types

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111910

--- Comment #2 from Andrew Pinski  ---
That is:
```
int f(int a, int b)
{
if (a > b) return a - b; else return b - a;
}
int fa(int a, int b)
{
return (a > b) ? (a - b) : (b - a);
}

int f1(int a, int b)
{
int t = a - b;
if (a > b) return t; else return -t;
}


int f2(int a, int b)
{
int t = a - b;
if (t > 0) return t; else return -t;
}

int f3a(int a, int b)
{
return ((a - b) > 0) ? (a - b) : (b - a);
}

int f3(int a, int b)
{
int t = a - b;
return t > 0 ? t : -t;
}
```

All are detected as ABS<(a-b)> .

Right now only f3a and f3 are detected as such.

[Bug tree-optimization/111910] `a - b < 0` is not transformed into `a < b` for signed types

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111910

--- Comment #3 from Andrew Pinski  ---
Also this:
```
int f(int a, int b)
{
if (a < b) return a - b; else return b - a;
}
int fa(int a, int b)
{
return (a < b) ? (a - b) : (b - a);
}

int f1(int a, int b)
{
int t = a - b;
if (a < b) return t; else return -t;
}


int f2(int a, int b)
{
int t = a - b;
if (t < 0) return t; else return -t;
}

int f3a(int a, int b)
{
return ((a - b) < 0) ? (a - b) : ( b - a);
}

int f3(int a, int b)
{
int t = a - b;
return t < 0 ? t : -t;
}
```

(note clang misses on the above for f and fa [f1 on x86_64]).

[Bug ada/111909] Filename case sensitivity defaulted wrongly on macOS

2023-10-21 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111909

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #1 from Eric Gallager  ---
Cross-referencing against some related issues:
https://github.com/iains/gcc-darwin-arm64/issues/101
Bug 81114

[Bug target/65250] [SH] Improve comparisons followed by a negated cstore

2023-10-21 Thread olegendo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65250

--- Comment #2 from Oleg Endo  ---
Briefly checked this one on GCC-13.  It generates the optimal sequence.

[Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510

2023-10-21 Thread 141242068 at smail dot nju.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

Bug ID: 111911
   Summary: GCC: 14: internal compiler error: internal compiler
error: in gimplify_expr, at gimplify.cc:17510
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this program, GCC crashes:
```
int main(void) {
  if !((_Bool)(__INT_MAX__ + 1))) /
  (!((_Bool)(__INT_MAX__ + 1))
  ;
  return 1;
}
```

Complier Explorer: https://gcc.godbolt.org/z/W59roeYKP

The full stack dump:
```
: In function 'main':
:2:32: warning: integer overflow in expression of type 'int' results in
'-2147483648' [-Woverflow]
2 |   if !((_Bool)(__INT_MAX__ + 1))) /
  |^
:3:34: warning: integer overflow in expression of type 'int' results in
'-2147483648' [-Woverflow]
3 |   (!((_Bool)(__INT_MAX__ + 1))
  |  ^
cc1: warning: division by zero [-Wdiv-by-zero]
:2:10: internal compiler error: in gimplify_expr, at gimplify.cc:17510
2 |   if !((_Bool)(__INT_MAX__ + 1))) /
  |  ^
0x231f49e internal_error(char const*, ...)
???:0
0xa00958 fancy_abort(char const*, int, char const*)
???:0
0xdbb856 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb856 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbbf48 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbcc33 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbcdf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbcc33 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdc0cd3 gimplify_body(tree_node*, bool)
???:0
0xdc112f gimplify_function_tree(tree_node*)
???:0
0xbea6e7 cgraph_node::analyze()
???:0
0xbee231 symbol_table::finalize_compilation_unit()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug c/111912] New: GCC: 14: internal compile error when apply __transaction_atomic on logical or expr

2023-10-21 Thread 141242068 at smail dot nju.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111912

Bug ID: 111912
   Summary: GCC: 14: internal compile error when apply
__transaction_atomic on logical or expr
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this small program:
```
int a;
int f() { return __transaction_atomic (a || 1); }
```

GCC crashes, (verification link: https://gcc.godbolt.org/z/8onMYzqcv)

The full stack dump:
```
: In function 'f':
:2:40: internal compiler error: in gimplify_expr, at gimplify.cc:17510
2 | int f() { return __transaction_atomic (a || 1); }
  |^
0x231f49e internal_error(char const*, ...)
???:0
0xa00958 fancy_abort(char const*, int, char const*)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbbf48 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbcc33 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbf48 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbf48 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb78d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbcdf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbdddb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb78d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbc9b7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbcdf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||10.1.0, 11.1.0, 8.4.0,
   ||9.3.0, 9.4.0
   Target Milestone|--- |11.5
   Keywords||ice-on-valid-code
  Known to work||7.1.0, 8.3.0, 9.1.0, 9.2.0
Summary|GCC: 14: internal compiler  |[11/12/13/14 Regression]
   |error: internal compiler|ICE with integer overflow
   |error: in gimplify_expr, at |converting to _Bool
   |gimplify.cc:17510   |

[Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-10-22
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1

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

[Bug c/111913] New: GCC: 14: -O1 compile __builtin_popcount fails while -O0 succeeds

2023-10-21 Thread 141242068 at smail dot nju.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111913

Bug ID: 111913
   Summary: GCC: 14: -O1 compile __builtin_popcount fails while
-O0 succeeds
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this program with `-O1`, gcc crashes:
```
int f(unsigned int x, unsigned int y)
{
  return __builtin_popcount (x&y) + __builtin_popcount (y|x--);
}
```

If change the optimization level to `-O0`, then nothing happens.

Compiler Explorer: https://gcc.godbolt.org/z/naoebKMor

The stack dump:
```
: In function 'f':
:4:1: error: invalid conversion in gimple call
4 | }
  | ^
unsigned int

int

_3 = __builtin_popcount (x_6(D));
:4:1: error: invalid conversion in gimple call
unsigned int

int

_11 = __builtin_popcount (y_7(D));
:4:1: error: type mismatch in binary expression
int

unsigned int

unsigned int

_9 = _3 + _11;
during GIMPLE pass: forwprop
:4:1: internal compiler error: verify_gimple failed
0x231f49e internal_error(char const*, ...)
???:0
0x1164659 verify_gimple_in_cfg(function*, bool, bool)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

--- Comment #2 from Andrew Pinski  ---
A c_maybe_const_expr is there still for this.

[Bug c/111914] New: GCC: 14: ICE when function pointer array as arguments

2023-10-21 Thread 141242068 at smail dot nju.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111914

Bug ID: 111914
   Summary: GCC: 14: ICE when function pointer array as arguments
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/Yn354q5zP

When compile this program with `-O0`, gcc crashes:
```
 __attribute__((always_inline))
void f(int n, int (*a())[n]) {
}

void g(void)
{
  int (*a())[1];
  f(1, a);
}

```

Interestingly, `-O1` or above do not trigger the crash.

The full stack dump:
```
:2:6: warning: 'always_inline' function might not be inlinable
[-Wattributes]
2 | void f(int n, int (*a())[n]) {
  |  ^
: In function 'g':
:9:1: error: type mismatch between an SSA_NAME and its symbol
9 | }
  | ^
:9:1: error: type mismatch between an SSA_NAME and its symbol
while verifying SSA_NAME a_4 in statement
a_4 = a;
during GIMPLE pass: einline
:9:1: internal compiler error: verify_ssa failed
0x231f49e internal_error(char const*, ...)
???:0
0x139c15e verify_ssa(bool, bool)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||needs-bisection
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=93348,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=93241

--- Comment #3 from Andrew Pinski  ---
I suspect it started with PR 93241 (and is very similar to PR 93348).

[Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911

--- Comment #4 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #3)
> I suspect it started with PR 93241 (and is very similar to PR 93348).

(_Bool) <<< Unknown tree: c_maybe_const_expr

  1 >>> == 0)


So maybe remove_c_maybe_const_expr needs to be called always instead of just on
"argument with integer operands".

[Bug c/111914] ICE with function pointer array as argument with non-constant size

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111914

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||7.1.0
   Keywords||ice-checking,
   ||ice-on-valid-code
Summary|GCC: 14: ICE when function  |ICE with function pointer
   |pointer array as argument   |array as argument with
   ||non-constant size

--- Comment #1 from Andrew Pinski  ---
Confirmed, goes back to before GCC 7, maybe before (-fchecking only exist in
GCC 7+).

Slightly better testcase:
```

 __attribute__((always_inline))
static inline void f(int n, int (*a())[n]) {
}

void g(void)
{
  int (*a())[1];
  f(1, a);
}

```

[Bug tree-optimization/111913] [14 Regression] ICE with __builtin_popcount(X) + __builtin_popcount(Y) simplification

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111913

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code,
   ||needs-bisection
 Status|UNCONFIRMED |NEW
   Target Milestone|--- |14.0
 Ever confirmed|0   |1
Summary|GCC: 14: -O1 compile|[14 Regression] ICE with
   |__builtin_popcount fails|__builtin_popcount(X) +
   |while -O0 succeeds  |__builtin_popcount(Y)
   ||simplification
   Last reconfirmed||2023-10-22

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

So the simplification was being done in GCC 13 but the type was correct there.

[Bug c/111912] GCC: 14: internal compile error when apply __transaction_atomic on logical or expr

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111912

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
  Known to fail||4.7.1
   Keywords||ice-on-valid-code
   Last reconfirmed||2023-10-22
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed. Not a regression.

[Bug c/111915] New: GCC: ICEs on a program with __restrict and option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`

2023-10-21 Thread 141242068 at smail dot nju.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111915

Bug ID: 111915
   Summary: GCC: ICEs on a program with __restrict and option `-O2
-fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

When compile this program, GCC crashes:
```
void 
foo (int * __restrict a, int * __restrict b, int * __restrict w)
{
  for (int i = 0; i < 16; ++i)
{
  *a += w[2*i+0];
  *b += w[2*i&1];
}
}

int main()
{
  int w[32];
  int a = 0, b = 0;
  foo (&a, b, w);
  return 0;
}
```

Compiler Explorer: https://gcc.godbolt.org/z/8oYjE3e9j

The crash seems to be triggered solely under specific conditions: when the
-fno-tree-vrp, -fno-tree-dominator-opts, and -fno-tree-ccp options are enabled,
in conjunction with an optimization level of -O2 or higher. However, I'm
uncertain whether this combination of settings violates on any internal
conventions or requirements tied to these options.

The full stack dump:
```
: In function 'main':
:15:12: warning: passing argument 2 of 'foo' makes pointer from integer
without a cast [-Wint-conversion]
   15 |   foo (&a, b, w);
  |^
  ||
  |int
:2:43: note: expected 'int * restrict' but argument is of type 'int'
2 | foo (int * __restrict a, int * __restrict b, int * __restrict w)
  |  ~^
: In function 'foo':
:2:1: error: definition in block 3 follows the use
2 | foo (int * __restrict a, int * __restrict b, int * __restrict w)
  | ^~~
for SSA_NAME: _12 in statement:
vect_cst__35 = {_12, _12, _12, _12};
during GIMPLE pass: vect
:2:1: internal compiler error: verify_ssa failed
0x231f49e internal_error(char const*, ...)
???:0
0x139c15e verify_ssa(bool, bool)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
```

[Bug target/65250] [SH] Improve comparisons followed by a negated cstore

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65250

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
Fixed for GCC by r8-2701-g9dc3d6a96167b4c84824be5e472fba4956297033 .

Basically the gimple level is able to optimize that directly to:
  _1 = (unsigned int) value_3(D);
  _5 = _1 <= 2;

No reason to try to have combine optimize it any more.

[Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111915

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-10-22
   Target Milestone|--- |14.0
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Keywords||needs-bisection
Summary|GCC: ICEs on a program with |[14 Regression] ICE in vect
   |__restrict and option `-O2  |with option `-O2
   |-fno-tree-vrp   |-fno-tree-vrp
   |-fno-tree-dominator-opts|-fno-tree-dominator-opts
   |-fno-tree-ccp`  |-fno-tree-ccp`

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

[Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111915

--- Comment #2 from Andrew Pinski  ---
Maybe one of richi's recent SLP related patches:

GCC 13:
/app/example.cpp:5:21: missed:   Build SLP failed: not grouped load _12 = *_11;
/app/example.cpp:5:21: note:   SLP discovery for node 0x4cdbb68 failed
/app/example.cpp:5:21: note:   SLP discovery for node 0x4cdbae8 failed
/app/example.cpp:5:21: note:   SLP discovery failed

But GCC 14:
/app/example.cpp:5:21: note:   Build SLP for _6 = *_5;
/app/example.cpp:5:21: note:   precomputed vectype: vector(4) int
/app/example.cpp:5:21: note:   nunits = 4
/app/example.cpp:5:21: note:   SLP discovery for node 0x4802428 succeeded

[Bug tree-optimization/111915] [14 Regression] ICE in vect with option `-O2 -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp`

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111915

--- Comment #3 from Andrew Pinski  ---
Note the reasoning for the extra options is still get:

  _2 = i_26 * 2;

  _23 = _2 & 1;
  _9 = (long unsigned int) _23;

In the IR.

Otherwise _23 would be 0.

[Bug tree-optimization/111910] `a - b < 0` is not transformed into `a < b` for signed types

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111910

Andrew Pinski  changed:

   What|Removed |Added

 Blocks||50856

--- Comment #4 from Andrew Pinski  ---
Actually the `a < b ? (a - b) : (b - a)` is the first example in PR 50856.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50856
[Bug 50856] ARM: suboptimal code for absolute difference calculation

[Bug c++/110848] Consider enabling -Wvla by default in non-GNU C++ modes

2023-10-21 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848

--- Comment #14 from Eric Gallager  ---
Oh right, if we're considering changing things for plain-C here, too, then
maybe have it enabled by -Wc++-compat there?

[Bug c++/110848] Consider enabling -Wvla by default in non-GNU C++ modes

2023-10-21 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110848

--- Comment #15 from Eric Gallager  ---
(In reply to Eric Gallager from comment #14)
> Oh right, if we're considering changing things for plain-C here, too, then
> maybe have it enabled by -Wc++-compat there?

Or rather, for plain-C modes, where "XY" is 99 or newer:

-std=cXY: enabled by -Wc++-compat
-std=gnuXY: still completely opt-in; -Wvla must be enabled explicitly

(and then for the pre-c99 modes, well, I guess they'd just keep their current
behavior)

[Bug tree-optimization/111916] New: wrong code at -O1 and above on x86_64-linux-gnu (the generated code hangs)

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

Bug ID: 111916
   Summary: wrong code at -O1 and above on x86_64-linux-gnu (the
generated code hangs)
   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/aEEKbdY6E

[563] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/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 20231022 (experimental) (GCC) 
[564] % 
[564] % gcctk -O0 small.c; ./a.out
[565] % 
[565] % gcctk -O1 small.c
[566] % timeout -s 9 5 ./a.out
Killed
[567] % 
[567] % cat small.c
#pragma pack(1)
struct A {
  int b : 4;
  int c : 11;
  int d : 2;
  int e : 5;
} f;
int main() {
  struct A g = {1, 1, 1, 1};
  while (!g.b)
f = g;
  return 0;
}