[Bug target/111412] RISC-V:ICE in phase 6 of vsetvl pass

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

--- Comment #1 from CVS Commits  ---
The releases/gcc-13 branch has been updated by Li Xu :

https://gcc.gnu.org/g:10c7edcc65d4bf1d05a9f0791e77e7b953e3e796

commit r13-7822-g10c7edcc65d4bf1d05a9f0791e77e7b953e3e796
Author: xuli 
Date:   Mon Sep 18 04:02:52 2023 +

RISC-V: Remove phase 6 of vsetvl pass in GCC13[PR111412]

vsetvl pass has been refactored in gcc14, and the optimization
is more reasonable than releases/gcc-13. This problem does not
exist in gcc14.

Phase 6 of gcc13 is an optimization patch. Due to lack of consideration,
there will be some hidden bugs, so we decided to remove phase 6.
Although the generated code will be redundant, the program is correct.

PR target/111412

gcc/ChangeLog:

* config/riscv/riscv-vsetvl.cc (vector_infos_manager::release):
Remove.
(pass_vsetvl::refine_vsetvls): Ditto.
(pass_vsetvl::cleanup_vsetvls): Ditto.
(pass_vsetvl::propagate_avl): Ditto.
(pass_vsetvl::lazy_vsetvl): Ditto.
* config/riscv/riscv-vsetvl.h: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/avl_single-79.c: Adjust case.
* gcc.target/riscv/rvv/vsetvl/avl_single-80.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-86.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-87.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-88.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-89.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-90.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-1.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-5.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-6.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-7.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-8.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-2.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-4.c: Ditto.
* gcc.target/riscv/rvv/base/pr111412.c: New test.

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

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

--- Comment #3 from Andreas Schwab  ---
Also seen with sonic-pi

https://build.opensuse.org/package/live_build_log/openSUSE:Factory:RISCV/sonic-pi/standard/riscv64

and psi+

https://build.opensuse.org/package/live_build_log/openSUSE:Factory:RISCV/psi+/standard/riscv64

[Bug target/30484] INT_MIN % -1 is well defined for -fwrapv but traps on x86

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

Richard Biener  changed:

   What|Removed |Added

Summary|INT_MIN % -1 is well|INT_MIN % -1 is well
   |defined for -fwrapv |defined for -fwrapv but
   ||traps on x86
 Ever confirmed|0   |1
   Last reconfirmed||2023-09-18
 Status|UNCONFIRMED |NEW
 Target||x86_64-*-*

--- Comment #20 from Richard Biener  ---
Re-confirmed.

[Bug c/111454] New: ice in get_nonzero_bits

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

Bug ID: 111454
   Summary: ice in get_nonzero_bits
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Given the following partially reduced C code

(safe_div_func_int16_t_s_s)(short si1, short si2) {
  return ((si2 == 0) || 0) ? : (si1 / si2);
}
short(safe_rshift_func_int16_t_s_s)();
g_3202 = 0x5FL;
void func_1() __attribute__((,
 visibility0, optimize("-O2"), aligned0));
void func_1() {
  short __trans_tmp_4;
  int __trans_tmp_3;
  int l_4 __attribute__(()) = 0;
  int l_3120 __attribute__(()) = 0L;
  {
for (0;; ++l_3120) {
  {
g_3202 = 5;
for (g_3202; (g_3202 > 0); g_3202--) {
  (l_4) = ((safe_rshift_func_int16_t_s_s()));
  break;
}
  }
  __trans_tmp_4 = safe_div_func_int16_t_s_s((0 != (4294967292UL)), (l_4));
  __trans_tmp_3 = safe_lshift_func_int16_t_s_s((__trans_tmp_4), 15);
}
  }
}

when compiled by recent gcc and -O1, does this:

$ /home/dcb38/gcc/results/bin/gcc -w -c -O1 ~/cvise/bug958B.c
gcc: internal compiler error: Segmentation fault signal terminated program cc1
Please submit a full bug report, with preprocessed source (by using
-freport-bug).

Stack backtrace seems to be:

#0  0x010e502a in get_nonzero_bits (name=name@entry=0x7fffe9fed1b0)
at ../../trunk.year/gcc/tree-ssanames.cc:494
#1  0x00a452dc in tree_nonzero_bits (t=0x7fffe9fed1b0)
at ../../trunk.year/gcc/fold-const.cc:16792
#2  0x01deb61f in gimple_zero_one_valued_p (t=0x7fffe9fed1b0, 
valueize=valueize@entry=0x1084e10 )
at gimple-match-3.cc:19
#3  0x01deb728 in gimple_zero_one_valued_p (t=0x7fffe9fedf30, 
valueize=valueize@entry=0x1084e10 )
at gimple-match-3.cc:70
#4  0x01deb728 in gimple_zero_one_valued_p (t=0x7fffe9fed1b0, 
valueize=valueize@entry=0x1084e10 )
at gimple-match-3.cc:70

The bug first seems to occur sometime between g:f73d2d61a5926f42
and gb975c0dc3be28565, a range of 130 commits.

[Bug c/111454] ice in get_nonzero_bits

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

--- Comment #1 from Andrew Pinski  ---
This is either a dup of bug 111435 or bug 111442

[Bug c/111454] ice in get_nonzero_bits

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

--- Comment #2 from David Binderman  ---
(In reply to Andrew Pinski from comment #1)
> This is either a dup of bug 111435 or bug 111442

Plausible. I saw the following strange behaviour:

$ ~/gcc/results/bin/gcc -c  -O1  bug958B.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.
$ ~/gcc/results/bin/gcc -c  -O2  bug958B.c
$ 

Reduced code is

int g_3202, func_1_l_4;
int safe_div_func_int16_t_s_s(short si1, short si2) { return si2 || si1 / si2;
}
short(safe_rshift_func_int16_t_s_s)();
void func_1() __attribute__((optimize("-O2")));
void func_1() {
  g_3202 = 5;
  for (; g_3202;) {
func_1_l_4 = safe_rshift_func_int16_t_s_s();
break;
  }
  safe_div_func_int16_t_s_s(0 != 2, func_1_l_4);
}

[Bug target/111412] RISC-V:ICE in phase 6 of vsetvl pass

2023-09-18 Thread kito at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111412

Kito Cheng  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED
 CC||kito at gcc dot gnu.org

--- Comment #2 from Kito Cheng  ---
fixed

[Bug c/111153] RISC-V: Incorrect Vector cost model for reduction

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

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Pan Li :

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

commit r14-4086-gfafd2502c5416fe4f69daf13224ab1efbf256a1c
Author: Juzhe-Zhong 
Date:   Sun Sep 17 10:05:49 2023 +0800

RISC-V: Support VLS modes reduction[PR53]

This patch supports VLS reduction vectorization.

It can optimize the current reduction vectorization codegen with current
COST model.

TYPE __attribute__ ((noinline, noclone))\
reduc_plus_##TYPE (TYPE * __restrict a, int n)  \
{   \
  TYPE r = 0;   \
  for (int i = 0; i < n; ++i)   \
r += a[i];  \
  return r; \
}

  T (int32_t)   \

TEST_PLUS (DEF_REDUC_PLUS)

Before this patch:

vle32.v v2,0(a5)
addia5,a5,16
vadd.vv v1,v1,v2
bne a5,a4,.L4
lui a4,%hi(.LC0)
lui a5,%hi(.LC1)
addia4,a4,%lo(.LC0)
vlm.v   v0,0(a4)
addia5,a5,%lo(.LC1)
andia1,a1,-4
vmv1r.v v2,v3
vlm.v   v4,0(a5)
vcompress.vmv2,v1,v0
vmv1r.v v0,v4
vadd.vv v1,v2,v1
vcompress.vmv3,v1,v0
vadd.vv v3,v3,v1
vmv.x.s a0,v3
sext.w  a0,a0
beq a3,a1,.L12

After this patch:

vle32.v v2,0(a5)
addia5,a5,16
vadd.vv v1,v1,v2
bne a5,a4,.L4
li  a5,0
andia1,a1,-4
vmv.s.x v2,a5
vredsum.vs  v1,v1,v2
vmv.x.s a0,v1
beq a3,a1,.L12

PR target/53

gcc/ChangeLog:

* config/riscv/autovec.md: Add VLS modes.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/def.h: Add VLS mode reduction
case.
* gcc.target/riscv/rvv/autovec/vls/reduc-1.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-10.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-11.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-12.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-13.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-14.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-15.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-16.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-17.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-18.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-19.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-2.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-20.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-21.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-3.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-4.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-5.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-6.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-7.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-8.c: New test.
* gcc.target/riscv/rvv/autovec/vls/reduc-9.c: New test.

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

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #12 from Jakub Jelinek  ---
s/recusive/recursive/

[Bug target/30484] INT_MIN % -1 is well defined for -fwrapv but traps on x86

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

--- Comment #21 from Richard Biener  ---
operation_could_trap_helper_p is also wrong in only checking for integer_zerop
on the divisor though a literal x / -1 could be optimized to x * -1 and thus
safely rewritten to unsigned arithmetic.  Likewise RTLs may_trap_p_1 is wrong
in the same way (that can also look at the first operand though).  We might
also want to have a SDIV_TRAPS_ON_OVERFLOW (mode) target hook which is half
of the work to fix this very bug at RTL expansion time (not sure if we want
to diverge earlier).

[Bug target/30484] INT_MIN % -1 is well defined for -fwrapv but traps on x86

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

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #22 from Richard Biener  ---
Mine.

[Bug tree-optimization/111294] [14 Regression] Missed Dead Code Elimination since r14-573-g69f1a8af45d

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

--- Comment #12 from CVS Commits  ---
The master branch has been updated by Richard Biener :

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

commit r14-4089-gd45ddc2c04e471d0dcee016b6edacc00b8341b16
Author: Richard Biener 
Date:   Thu Sep 14 13:06:51 2023 +0200

tree-optimization/111294 - backwards threader PHI costing

This revives an earlier patch since the problematic code applying
extra costs to PHIs in copied blocks we couldn't make any sense of
prevents a required threading in this case.  Instead of coming up
with an artificial other costing the following simply removes the
bits.

As with all threading changes this requires a plethora of testsuite
adjustments, but only the last three are unfortunate as is the
libgomp team.c adjustment which is required to avoid a bogus -Werror
diagnostic during bootstrap.

PR tree-optimization/111294
gcc/
* tree-ssa-threadbackward.cc (back_threader_profitability::m_name):
Remove
(back_threader::find_paths_to_names): Adjust.
(back_threader::maybe_thread_block): Likewise.
(back_threader_profitability::possibly_profitable_path_p): Remove
code applying extra costs to copies PHIs.

libgomp/
* team.c (gomp_team_start): Assert alloca size to avoid false
positive alloc-size diagnostic.

gcc/testsuite/
* gcc.dg/tree-ssa/pr111294.c: New test.
* gcc.dg/tree-ssa/phi_on_compare-4.c: Adjust.
* gcc.dg/tree-ssa/pr59597.c: Likewise.
* gcc.dg/tree-ssa/pr61839_2.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-18.c: Likewise.
* g++.dg/warn/Wstringop-overflow-4.C: XFAIL subtest on ilp32.
* gcc.dg/uninit-pred-9_b.c: XFAIL subtest everywhere.
* gcc.dg/vect/vect-117.c: Make scan for not Invalid sum
conditional on lp64.

[Bug tree-optimization/111294] [14 Regression] Missed Dead Code Elimination since r14-573-g69f1a8af45d

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

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #13 from Richard Biener  ---
Fixed.

[Bug ipa/111430] IPA read only variable analysis should handle the case where the storing was the same as the initialization

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

Richard Biener  changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2023-09-18

--- Comment #2 from Richard Biener  ---
I think there's a duplicate for this.

[Bug libgomp/111413] libgomp >= 13 segfault on loading if environ is NULL

2023-09-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111413

Jakub Jelinek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
   Last reconfirmed||2023-09-18

--- Comment #1 from Jakub Jelinek  ---
Created attachment 55920
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55920&action=edit
gcc14-pr111413.patch

Untested fix.  Large patch but in the end it is just
--- libgomp/env.c
+++ libgomp/env.c
@@ -2224,6 +2224,7 @@ initialize_env (void)
   none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX);
   initialize_icvs (&none->icvs);

+  if (environ)
 for (env = environ; *env != 0; env++)
   {
if (!startswith (*env, "OMP_"))
plus reindentation.

[Bug target/111425] ia64: ICE in net/ipv4/fib_semantics.c:1621:1: internal compiler error: Segmentation fault

2023-09-18 Thread frank.scheiner at web dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111425

--- Comment #5 from Frank Scheiner  ---
(In reply to Richard Biener from comment #2)
> Confirmed on trunk - we ICE in cselib during var-tracking, so
> -fno-var-tracking would be a workaround (or -g0).

Also confirming that both - i.e. using `-fno-var-tracking` or `-g0` - indeed
workaround the problem for me (this time with v6.6-rc2 which without those
options still shows the original problem):

```
# ia64-linux-gcc -fno-var-tracking -Wp,-MMD,net/ipv4/.fib_semantics.o.d
-nostdinc -I./arch/ia64/include -I./arch/ia64/include/generated  -I./include
-I./arch/ia64/include/uapi -I./arch/ia64/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include
./include/linux/compiler_types.h -D__KERNEL__ -DHAVE_WORKING_TEXT_ALIGN
-DHAVE_MODEL_SMALL_ATTRIBUTE -DHAVE_SERIALIZE_DIRECTIVE -fmacro-prefix-map=./=
-std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE
-fno-strict-aliasing -pipe -ffixed-r13 -mfixed-range=f12-f15,f32-f127
-frename-registers -fno-optimize-sibling-calls -fno-delete-null-pointer-checks
-O2 -fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer
-ftrivial-auto-var-init=zero -fno-stack-clash-protection -falign-functions=32
-fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack
-Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int
-Werror=return-type -Werror=strict-prototypes -Wno-format-security
-Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member
-Wframe-larger-than=2048 -Wno-main -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-dangling-pointer -Wvla -Wno-pointer-sign
-Wcast-function-type -Wno-array-bounds -Wno-alloc-size-larger-than
-Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wenum-conversion -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-restrict -Wno-packed-not-aligned
-Wno-format-overflow -Wno-format-truncation -Wno-stringop-overflow
-Wno-stringop-truncation -Wno-missing-field-initializers -Wno-type-limits
-Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -g 
-mconstant-gp  -DKBUILD_MODFILE='"net/ipv4/fib_semantics"'
-DKBUILD_BASENAME='"fib_semantics"' -DKBUILD_MODNAME='"fib_semantics"'
-D__KBUILD_MODNAME=kmod_fib_semantics -c -o net/ipv4/fib_semantics.o
net/ipv4/fib_semantics.c

# echo $?
0

# rm net/ipv4/fib_semantics.o

# ia64-linux-gcc -Wp,-MMD,net/ipv4/.fib_semantics.o.d -nostdinc
-I./arch/ia64/include -I./arch/ia64/include/generated  -I./include
-I./arch/ia64/include/uapi -I./arch/ia64/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include
./include/linux/compiler_types.h -D__KERNEL__ -DHAVE_WORKING_TEXT_ALIGN
-DHAVE_MODEL_SMALL_ATTRIBUTE -DHAVE_SERIALIZE_DIRECTIVE -fmacro-prefix-map=./=
-std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE
-fno-strict-aliasing -pipe -ffixed-r13 -mfixed-range=f12-f15,f32-f127
-frename-registers -fno-optimize-sibling-calls -fno-delete-null-pointer-checks
-O2 -fno-allow-store-data-races -fno-stack-protector -fomit-frame-pointer
-ftrivial-auto-var-init=zero -fno-stack-clash-protection -falign-functions=32
-fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack
-Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int
-Werror=return-type -Werror=strict-prototypes -Wno-format-security
-Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member
-Wframe-larger-than=2048 -Wno-main -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-dangling-pointer -Wvla -Wno-pointer-sign
-Wcast-function-type -Wno-array-bounds -Wno-alloc-size-larger-than
-Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wenum-conversion -Wno-unused-but-set-variable
-Wno-unused-const-variable -Wno-restrict -Wno-packed-not-aligned
-Wno-format-overflow -Wno-format-truncation -Wno-stringop-overflow
-Wno-stringop-truncation -Wno-missing-field-initializers -Wno-type-limits
-Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -g0 
-mconstant-gp  -DKBUILD_MODFILE='"net/ipv4/fib_semantics"'
-DKBUILD_BASENAME='"fib_semantics"' -DKBUILD_MODNAME='"fib_semantics"'
-D__KBUILD_MODNAME=kmod_fib_semantics -c -o net/ipv4/fib_semantics.o
net/ipv4/fib_semantics.c

# echo $?
0
```

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

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

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org
   Priority|P3  |P1

--- Comment #2 from Richard Biener  ---
Hmm, so we look for a *(int **) here, reach the toplevel vop, skipping *j = &e?
That should have conflicted.

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

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

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener  ---
Maybe related to PR110243.

[Bug tree-optimization/104475] [12/13/14 Regression] Wstringop-overflow + atomics incorrect warning on dynamic object

2023-09-18 Thread aph at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104475

Andrew Haley  changed:

   What|Removed |Added

 CC||aph at gcc dot gnu.org

--- Comment #27 from Andrew Haley  ---
Is this one still alive? It's still causing problems in the wild.

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

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

--- Comment #1 from Richard Biener  ---
Note originally I intended to have (match (...)) inlined in the match IL
itself,
so any such checking should not only check for direct recursion but indirect
as well - all SCCs are unsupported.

(match (one @0)
 (negate @0))

(match (zero @0)
 (negate (one @0)))

(match (one @0)
 (negate (zero @0)))

[Bug c++/111455] New: [14 Regression] Using incorrect cast operator on integer_pack

2023-09-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111455

Bug ID: 111455
   Summary: [14 Regression] Using incorrect cast operator on
integer_pack
   Product: gcc
   Version: 13.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

As I wrote in
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630095.html
I'm not sure casting the argument to integer_type_node is the right thing.

Consider:
#include 

template
void foo (std::integer_sequence)
{}

template
struct U
{
  static constexpr long value = 1;
  constexpr operator int() = delete;
  constexpr operator long() { return value; }
};
template
struct R
{
  using S = std::make_integer_sequence {}>;
  R () noexcept(noexcept(foo (S ( {}
};

int
main()
{
  R();
}

is accepted when using clang++, but rejected on the trunk with
: In instantiation of 'R::R() [with T = long int]':
:24:11:   required from here
:18:31: error: use of deleted function 'constexpr U::operator int()
[with T = {long int}]'
   18 |   R () noexcept(noexcept(foo (S ( {}
  |   ^~~~
:11:13: note: declared here
   11 |   constexpr operator int() = delete;
  | ^~~~
(previously it has been rejected due to PR111357, but e.g. g++ 6.4 accepted
it).
Two template arguments std::make_integer_sequence is declared as
template
using make_integer_sequence = integer_sequence;
so I believe it should cast U {} to long first before casting it further
to whatever it needs under the hood.

[Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack

2023-09-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111455

Jakub Jelinek  changed:

   What|Removed |Added

Version|13.2.1  |14.0
   Target Milestone|--- |14.0
 CC||jason at gcc dot gnu.org,
   ||redi at gcc dot gnu.org

[Bug c++/111455] [14 Regression] Using incorrect cast operator on integer_pack

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

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2023-09-18
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=111357
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
Isn't this just PR 111357? Or at least, its root cause.

I said in the libstdc++ backports that the compiler bug had been fixed on
trunk, but that's not quite true, it has been mitigated for now. The actual bug
is still present though: the argument *should* be an integer already by the
time it gets to __integer_pack.

Do we need two PRs for it though?

[Bug tree-optimization/111456] New: [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

2023-09-18 Thread theodort at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111456

Bug ID: 111456
   Summary: [14 Regression] Dead Code Elimination Regression since
r14-3719-gb34f3736356
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: theodort at inf dot ethz.ch
  Target Milestone: ---

https://godbolt.org/z/jqqP5baY8

Given the following code:

void foo(void);
static int i;
static int *j = &i;
static char l;
static void(a)(char) {}
static short(b)(short c, short d) { return c - d; }
static short(e)(short f, int g) {
return f < 0 || g < 0 || g >= 32 ? f : f >> g;
}
static short(h)(short f, int g) { return g >= 2 ?: f >> g; }
static char k(char m, short n) {
short o;
int *p = &i;
if (!(((m) >= 1) && ((m) <= 1))) {
__builtin_unreachable();
}
o = e(i, i);
if (h(1, o))
;
else {
m = 0;
for (; m >= -20; m = b(m, 9))
if (a(i), n) {
if (*p)
;
else
foo();
;
} else
return l;
}
return i;
}
int main() { k(0 <= 0 > *j, i); }

gcc-trunk -O2 does not eliminate the call to foo:

main:
movli(%rip), %eax
testw   %ax, %ax
js  .L6
testl   %eax, %eax
jne .L6
.L9:
xorl%eax, %eax
ret
.p2align 4,,10
.p2align 3
.L6:
movswl  %ax, %edx
cmpw$1, %ax
jg  .L9
testl   %edx, %edx
je  .L9
pushq   %rbx
movl$3, %ebx
.L5:
cmpl$0, i(%rip)
je  .L13
.L4:
subb$1, %bl
jne .L5
xorl%eax, %eax
popq%rbx
ret
.L13:
callfoo
jmp .L4

gcc-13.2.0 -O2 eliminates the call to foo:

main:
xorl%eax, %eax
ret

Bisects to r14-3719-gb34f3736356

[Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2

2023-09-18 Thread theodort at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111457

Bug ID: 111457
   Summary: [14 Regression] Dead Code Elimination Regression since
r14-3407-g936a12331a2
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: theodort at inf dot ethz.ch
  Target Milestone: ---

https://godbolt.org/z/j4M8z8MzK

Given the following code:

void foo(void);
static int a, b, c, d, h;
static short i;
static void e(int f) {
int g = -16;
for (; g != -6; g = g + 5) {
b = 6;
if (!(((f) >= 1) && ((f) <= 26))) {
__builtin_unreachable();
}
f = 0;
for (; f < 26; ++f)
if (a) {
foo();
break;
}
d = 0;
}
}
int main() {
a = 0;
e(0 == i);
h = d;
c = b;
}

gcc-trunk -O2 does not eliminate the call to foo:

main:
movl$0, a(%rip)
pushq   %rbx
movl$2, %ebx
.L3:
movl$6, b(%rip)
movla(%rip), %eax
testl   %eax, %eax
je  .L2
callfoo
.L2:
movl$0, d(%rip)
cmpl$1, %ebx
jne .L4
xorl%eax, %eax
popq%rbx
ret
.p2align 4,,10
.p2align 3
.L4:
movl$1, %ebx
jmp .L3

gcc-13.2.0 -O2 eliminates the call to foo:

main:
movl$0, a(%rip)
xorl%eax, %eax
movl$6, b(%rip)
movl$0, d(%rip)
ret

Bisects to r14-3407-g936a12331a2

[Bug tree-optimization/104475] [12/13/14 Regression] Wstringop-overflow + atomics incorrect warning on dynamic object

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

--- Comment #28 from Richard Biener  ---
I don't think anybody is working on this currently.

[Bug tree-optimization/111457] [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2

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

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |14.0

[Bug tree-optimization/111456] [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

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

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |14.0

[Bug target/111255] RISC-V: Miss combine two vsetvl insns

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

--- Comment #1 from CVS Commits  ---
The trunk branch has been updated by Lehua Ding :

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

commit r14-4094-g4ab744ace2478c4b986ec4ac27c0e3467b7a6419
Author: Lehua Ding 
Date:   Mon Sep 18 20:04:07 2023 +0800

RISC-V: Add fixed PR111255 testcase by other patch

This patch add the missed PR111255 testcase which is fixed by this
committed patch
(https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628922.html).

PR target/111255

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/vsetvl/pr111255.c: New test.

[Bug target/111255] RISC-V: Miss combine two vsetvl insns

2023-09-18 Thread lehua.ding at rivai dot ai via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111255

Lehua Ding  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Lehua Ding  ---
Confirmed fix.

[Bug target/105928] [AArch64] 64-bit constants with same high/low halves can use ADD lsl 32 (-Os at least)

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

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Wilco Dijkstra :

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

commit r14-4096-gfc7070025d1a6668ff6cb4391f84771a7662def7
Author: Wilco Dijkstra 
Date:   Wed Sep 13 13:21:50 2023 +0100

AArch64: Improve immediate expansion [PR105928]

Support immediate expansion of immediates which can be created from 2 MOVKs
and a shifted ORR or BIC instruction.  Change
aarch64_split_dimode_const_store
to apply if we save one instruction.

This reduces the number of 4-instruction immediates in SPECINT/FP by 5%.

gcc/ChangeLog:
PR target/105928
* config/aarch64/aarch64.cc (aarch64_internal_mov_immediate)
Add support for immediates using shifted ORR/BIC.
(aarch64_split_dimode_const_store): Apply if we save one
instruction.
* config/aarch64/aarch64.md (_3):
Make pattern global.

gcc/testsuite:
PR target/105928
* gcc.target/aarch64/pr105928.c: Add new test.
* gcc.target/aarch64/vect-cse-codegen.c: Fix test.

[Bug target/105928] [AArch64] 64-bit constants with same high/low halves can use ADD lsl 32 (-Os at least)

2023-09-18 Thread wilco at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105928

Wilco  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 Target|arm64-*-*   |aarch64
   Target Milestone|--- |14.0

--- Comment #5 from Wilco  ---
Fixed

[Bug tree-optimization/111456] [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-09-18
 Status|UNCONFIRMED |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #1 from Andrew Pinski  ---
I noticed a few missed optimizations:
   [local count: 1073741824]:
  i.0_1 = i;
  _2 = (short int) i.0_1;
  _14 = _2 >= 0;
  _15 = i.0_1 == 0;
  _16 = _14 & _15;
  if (_16 != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 805306368]:
  _21 = (int) _2;
  _20 = _21 == 0;
  _29 = _21 > 1;
  _30 = _20 | _29;
  if (_30 != 0)
goto ; [72.67%]
  else
goto ; [27.33%]

Here this should have been just 
  if (i.0_1 == 0)
goto ; [50.00%]
  else
goto ; [50.00%]

And that would fix the rest.

I suspect if we extend:
/* Convert (X == CST1) && (X OP2 CST2) to a known value
   based on CST1 OP2 CST2.  Similarly for (X != CST1).  */
/* Convert (X == Y) && (X OP2 Y) to a known value if X is an integral type.
   Similarly for (X != Y).  */

to handle a cast for the second part. This will be fixed ...
Will handle that this weekend or earlier.

[Bug c/111458] New: ICE in in dfs_enumerate_from, at cfganal.c:1560

2023-09-18 Thread 19373742 at buaa dot edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111458

Bug ID: 111458
   Summary: ICE in in dfs_enumerate_from, at cfganal.c:1560
   Product: gcc
   Version: 11.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: 19373742 at buaa dot edu.cn
  Target Milestone: ---

Created attachment 55921
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55921&action=edit
The preprocessed file

***
OS and Platform:
CentOS Linux release 7.9.2009 (Core), x86_64 GNU/Linux
***
gcc version:

# gcc -v
Using built-in specs.
COLLECT_GCC=/home/gcc-releases/gcc-11-0914/bin/gcc
COLLECT_LTO_WRAPPER=/home/gcc-releases/gcc-11-0914/libexec/gcc/x86_64-pc-linux-gnu/11.4.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/gcc-releases/gcc-11-0914/
--disable-multilib --enable-language=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.1 20230914 (GCC) 

***
Command Lines:
# /home/gcc-releases/gcc-11-0914/bin/gcc -I /home/csmith/include/csmith-2.3.0/
-O3 -fno-expensive-optimizations -fno-inline-small-functions -fno-ipa-sra
-fno-tree-ccp -fno-tree-dse -fno-tree-fre -fno-tree-loop-ivcanon a.c

a.c: In function ‘func_18’:
a.c:311:38: warning: conversion from ‘long unsigned int’ to ‘uint32_t’ {aka
‘unsigned int’} changes value from ‘18446744073709551607’ to ‘4294967287’
[-Woverflow]
  311 | uint32_t l_489 = 18446744073709551607UL;
  |  ^~
during GIMPLE pass: vrp
a.c: In function ‘func_1’:
a.c:42:17: internal compiler error: in dfs_enumerate_from, at cfganal.c:1560
   42 | static int16_t  func_1(void)
  | ^~
0x6402fd dfs_enumerate_from(basic_block_def*, int, bool (*)(basic_block_def
const*, void const*), basic_block_def**, int, void const*)
../.././gcc/cfganal.c:1560
0xd635c9 determine_bb_domination_status(loop*, basic_block_def*)
../.././gcc/tree-ssa-threadupdate.c:1594
0xd635c9 determine_bb_domination_status(loop*, basic_block_def*)
../.././gcc/tree-ssa-threadupdate.c:1559
0xd659e2 thread_through_loop_header
../.././gcc/tree-ssa-threadupdate.c:1741
0xd659e2 thread_through_all_blocks(bool)
../.././gcc/tree-ssa-threadupdate.c:2667
0xe04ef4 execute_vrp
../.././gcc/tree-vrp.c:4580
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/111458] ICE in in dfs_enumerate_from, at cfganal.c:1560

2023-09-18 Thread 19373742 at buaa dot edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111458

--- Comment #1 from CTC <19373742 at buaa dot edu.cn> ---
Created attachment 55922
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55922&action=edit
The compiler output

[Bug tree-optimization/111459] New: DSE after deleting trivial dead statements sometimes should do a cfgcleanup

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

Bug ID: 111459
   Summary: DSE after deleting trivial dead statements sometimes
should do a cfgcleanup
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Keywords: internal-improvement
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: pinskia at gcc dot gnu.org
  Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take at -O1:
```
void foo(void);
static int i;
static int *j = &i;
static char l;
static void(a)(char) {}
static short(b)(short c, short d) { return c - d; }
static short(e)(short f, int g) {
return f < 0 || g < 0 || g >= 32 ? f : f >> g;
}
static short(h)(short f, int g) { return g >= 2 ?: f >> g; }
static char k(char m, short n) {
short o;
int *p = &i;
if (!(((m) >= 1) && ((m) <= 1))) {
__builtin_unreachable();
}
o = e(i, i);
if (h(1, o))
;
else {
m = 0;
for (; m >= -20; m = b(m, 9))
if (a(i), n) {
if (*p)
;
else
foo();
;
} else
return l;
}
return i;
}
int main() { k(0 <= 0 > *j, i); }
```

In dse5 we delete trivial dead statements for _30 and _31 below:
  _16 = (int) _2;
  if (_16 > 1)
goto ; [78.67%]
  else
goto ; [21.33%]

   [local count: 536870912]:
  _30 = 1 >> _16;
  iftmp.7_31 = (short int) _30;

   [local count: 1073741829]:

But we should recongize that the bb 6 becomes empty and we should add
TODO_cleanup_cfg to the todos like dse already does for removing trivial dead
phis:
  if (removed_phi && gimple_seq_empty_p (phi_nodes (bb)))
todo |= TODO_cleanup_cfg;

I am filing this to record what I found so I can work on it later this week.

[Bug tree-optimization/111459] DSE after deleting trivial dead statements sometimes should do a cfgcleanup

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

Andrew Pinski  changed:

   What|Removed |Added

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

[Bug tree-optimization/111459] DSE after deleting trivial dead statements sometimes should do a cfgcleanup

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Note I found this while looking into PR 111456.
sink2 (or fab1) ends up doing the cfgcleanup though.

[Bug tree-optimization/111458] [11 Regression] ICE in in dfs_enumerate_from, at cfganal.c:1560

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

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||11.1.0, 11.4.0
   Keywords||ice-on-valid-code
  Known to work||10.1.0, 12.0
Summary|ICE in in   |[11 Regression] ICE in in
   |dfs_enumerate_from, at  |dfs_enumerate_from, at
   |cfganal.c:1560  |cfganal.c:1560
   Target Milestone|--- |11.5

--- Comment #2 from Andrew Pinski  ---
Someone will need to check to see if this went latent in GCC 12.
THere has been many changes in GCC 12 dealing with VRP and jump threading that
this might have been fixed ...

[Bug tree-optimization/111431] a & (a == 0) is not optimized to 0

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

--- Comment #7 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:0fb828af75732d39c644fd145c29d41ca14b8cb1

commit r14-4105-g0fb828af75732d39c644fd145c29d41ca14b8cb1
Author: Andrew Pinski 
Date:   Sat Sep 16 03:27:26 2023 +

MATCH: Add simplifications of `(a == CST) & a`

`(a == CST) & a` can be either simplified to simplying `a == CST`
or 0 depending on the first bit of the CST.
This is an extension of the already pattern of `X & !X` and allows
us to remove the 2 xfails on gcc.dg/binop-notand1a.c and
gcc.dg/binop-notand4a.c.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/111431

gcc/ChangeLog:

* match.pd (`(a == CST) & a`): New pattern.

gcc/testsuite/ChangeLog:

* gcc.dg/binop-notand1a.c: Remove xfail.
* gcc.dg/binop-notand4a.c: Likewise.
* gcc.c-torture/execute/pr111431-1.c: New test.
* gcc.dg/binop-andeq1.c: New test.
* gcc.dg/binop-andeq2.c: New test.
* gcc.dg/binop-notand7.c: New test.
* gcc.dg/binop-notand7a.c: New test.

[Bug tree-optimization/111431] a & (a == 0) is not optimized to 0

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #8 from Andrew Pinski  ---
Fixed.

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

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

--- Comment #4 from Levi Zim  ---
I tested it on gcc's latest commit(5b4acfa306d53c8473883552f1db7278b7065b18).
It doesn't trigger the ICE.

However, I do have another source file that still triggers the ICE with gcc's
latest commit. It is a quite large file(3.8MB) and I can't attach it here so I
put it on gist: https://gist.github.com/kxxt/72b553ae855697d6fcd8300994e7e137

I am reducing this file using cvise and will upload it later.

[Bug other/111460] New: -fdiagnostics-generate-patch=/out.diff to specify patch output destination file

2023-09-18 Thread aldot at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111460

Bug ID: 111460
   Summary: -fdiagnostics-generate-patch=/out.diff to specify
patch output destination file
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aldot at gcc dot gnu.org
CC: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

It would be handy if one could specify a file where the patch(es) generated by
-fdiagnostics-generate-patch could be written/appended to.

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

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

Peter Bergner  changed:

   What|Removed |Added

 CC|g...@the-meissners.org   |meissner at gcc dot gnu.org

--- Comment #8 from Peter Bergner  ---
(In reply to Kewen Lin from comment #7)
> #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?

Mike will know better than I, but I like the idea of the patch!

[Bug libstdc++/111055] [C++23] Implement P1206R7, Conversions from ranges to containers

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

Jonathan Wakely  changed:

   What|Removed |Added

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

--- Comment #1 from Jonathan Wakely  ---
I am working on the ranges::to part of this (but not yet working on the new
container members).

[Bug target/111461] New: [14.0 Regression] RISC-V rv32gc bootstrap ICEs with --enable-checking=rtl

2023-09-18 Thread patrick at rivosinc dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111461

Bug ID: 111461
   Summary: [14.0 Regression] RISC-V rv32gc bootstrap ICEs with
--enable-checking=rtl
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Created attachment 55923
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55923&action=edit
Backtrace

Bootstrap fails with an ICE.

during RTL pass: expand
offtime.c: In function '__offtime':
offtime.c:79:6: internal compiler error: RTL check: expected elt 0 type 'e' or
'u', have 'w' (rtx const_int) in riscv_legitimize_const_move, at
config/riscv/riscv.cc:2176
   79 |   ip = __mon_yday[__isleap(y)];
  |   ~~~^

Caused by: r14-3548-gd16af3ebea8

[Bug tree-optimization/111462] New: [14 regression] gcc.dg/tree-ssa/ssa-sink-18.c fails after r14-4089-gd45ddc2c04e471

2023-09-18 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111462

Bug ID: 111462
   Summary: [14 regression] gcc.dg/tree-ssa/ssa-sink-18.c fails
after r14-4089-gd45ddc2c04e471
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:d45ddc2c04e471d0dcee016b6edacc00b8341b16, r14-4089-gd45ddc2c04e471
make  -k check-gcc RUNTESTFLAGS="tree-ssa.exp=gcc.dg/tree-ssa/ssa-sink-18.c"
FAIL: gcc.dg/tree-ssa/ssa-sink-18.c scan-tree-dump-times sink2 "Sunk
statements: 5" 1
# of expected passes1
# of unexpected failures1

commit d45ddc2c04e471d0dcee016b6edacc00b8341b16 (HEAD)
Author: Richard Biener 
Date:   Thu Sep 14 13:06:51 2023 +0200

tree-optimization/111294 - backwards threader PHI costing

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

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

--- Comment #9 from Segher Boessenkool  ---
I don't like that "wzd" attribute at all.  Please just put an "if" for the mode
around this -- everywhere else (including in a large part of this patch!) we
deal with SImode and DImode separately already.  Or perhaps you can use the
"ptrload" attribute,
which includes the "l"?

There really should be a comment why one alternative needs the %U{n} and the
other can
ignore it, btw.  Nothing new there, but a head-scratcher :-)

[Bug testsuite/111462] [14 regression] gcc.dg/tree-ssa/ssa-sink-18.c fails after r14-4089-gd45ddc2c04e471

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|tree-optimization   |testsuite
   Keywords||testsuite-fail

--- Comment #1 from Andrew Pinski  ---
I wonder if the rule for the xfail/target should change here due to the IV-OPTS
difference like the riscv64-*-* case (note that should really be riscv*-*-*).

[Bug testsuite/111462] [14 regression] gcc.dg/tree-ssa/ssa-sink-18.c fails after r14-4089-gd45ddc2c04e471

2023-09-18 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111462

--- Comment #2 from seurer at gcc dot gnu.org ---
Also this one:

make  -k check-gcc RUNTESTFLAGS="vect.exp=gcc.dg/vect/vect-117.c"
FAIL: gcc.dg/vect/vect-117.c scan-tree-dump-not optimized "Invalid sum"
FAIL: gcc.dg/vect/vect-117.c -flto -ffat-lto-objects  scan-tree-dump-not
optimized "Invalid sum"

[Bug c++/111463] New: Access error in instantiation of template class, incorrectly using inherited constructor of wrong type

2023-09-18 Thread bckempa at iastate dot edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111463

Bug ID: 111463
   Summary: Access error in instantiation of template class,
incorrectly using inherited constructor of wrong type
   Product: gcc
   Version: 11.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bckempa at iastate dot edu
  Target Milestone: ---

Version: 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) [replicated in 11.2 - Trunk]
System: x86_64-linux-gnu Ubuntu 22.04
Flags: -std=c++14


Given the case of a derived class inheriting from a base where both inherent a
templated manager class with different template arguments:

```
class EventA {};

class EventB {};

template  class Manager {};

class Base : Manager {};

template  class Derived : Base, Manager {
using Foo = Manager;
};

int main() {
Derived foo;
}
```


GCC 11.2 and above gives the following error:
```
test.cpp: In instantiation of ‘class Derived’:
test.cpp:14:21:   required from here
test.cpp:10:17: error: ‘class Manager Manager::Manager’ is
private within this context
   10 | using Foo = Manager;
  | ^~
test.cpp:7:7: note: declared private here
7 | class Base : private Manager {};
  |   ^~~~
```

It appears that gcc is attempting to use the constructor from the base class's
inherited Manager, which doesn't match the specified Manager,
rather than the derived class's templated Manager parent.
This can be worked around by adding a scope resolution operator like this:
`using Foo = ::Manager;`


This was initially observed on 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) and I've
confirmed the behavior appeared in gcc 11.2 and persists though all versions to
trunk, while gcc 4.9.0 (the first to recognize the `-std=c++14` flag) up though
gcc 11.1 all select the correct constructor and compile.

Adding the `-fno-new-ttp-matching` flag, changing the order of the inheritance
list, and replacing `Manager` with an explicit `Manager` in the
using statement all had no effect.
Replacing the template argument with an explicit `Manager` in the
inheritance list of the derived class does fix the behavior, but then the
derived class is no longer templated defeating the purpose.

[Bug c++/111463] Access error in instantiation of template class, incorrectly using inherited constructor of wrong type

2023-09-18 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111463

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org

--- Comment #1 from Marek Polacek  ---
Changed in r12-1263 but clang++ rejects the test too.

commit 6cb35b606c39d5f21f3298c77bfbcaaef3fbc872
Author: Patrick Palka 
Date:   Mon Jun 7 12:02:08 2021 -0400

c++: access of dtor named by qualified template-id [PR100918]

[Bug target/111464] New: Using DW_EH_PE_udata4 for amd64 non-pic breaks linking in some situations

2023-09-18 Thread john at feith dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111464

Bug ID: 111464
   Summary: Using DW_EH_PE_udata4 for amd64 non-pic breaks linking
in some situations
   Product: gcc
   Version: 9.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: john at feith dot com
  Target Milestone: ---

Created attachment 55924
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55924&action=edit
Patch for amd64 R_X86_64_32 relocation issue

While the following was observed using gcc 9.5.0 configured to use gas / ld
from binutils 2.39 the code in question seems to be unchanged in this respect
for the current gcc 13.2.0 release.

I bootstrapped gcc 9.5.0 on FreeBSD 13.2 (amd64) and used it to build various
other programs without issue.  However building gdb 11.2 results in:

  ada-exp.o: relocation R_X86_64_32 against symbol
`__gxx_personality_v0@@CXXABI_1.3' can not be used when making a PDE object;

Looking at the 64 bit assembly language generate from ada-exp.c shows:

  .Lframe1:
.long   .LECIE1-.LSCIE1 # Length of Common Information Entry
  .LSCIE1:
...
.byte   0x3 # Personality (udata4)
.long   __gxx_personality_v0

gas generates a R_X86_64_32 relocation for __gxx_personality_v0 and then ld
throws the error when attempting to link the various object along with the
shared libraries into the executable fails.  The ld error comes from bfd
elf64-x86-64.c:

  case R_X86_64_32:
if (!ABI_64_P (abfd))
  goto pointer;
/* Fall through.  */
...
/* Check relocation overflow as these relocs may lead to
   run-time relocation overflow.  Don't error out for
   sections we don't care about, such as debug sections or
   when relocation overflow check is disabled.  */

Note also the FreeBSD rtld-elf also doesn't support R_X86_64_32 so it's just
as well that the binutils ld throw the error.

In gcc i386.c asm_preferred_eh_data_format has:

  ...
  if (ix86_cmodel == CM_SMALL
  || (ix86_cmodel == CM_MEDIUM && code))
return DW_EH_PE_udata4;
  return DW_EH_PE_absptr;

The intent is that for 64 bit small and (in the code case) medium model to
save some space by encoding the address using 4 bytes instead of the full
8 byte pointer.  That may be fine in some cases (i.e. full static linking),
however break certain other mixes (i.e. the forementioned non-PIE gdb build
using a shared C++ library).

The attached change simply changes the non-PIC case to always encode the
full pointer.  Note this should be an essentially no-op change for 32 bits.

The resulting 64 bit assembly language generate from ada-exp.c shows:

  .Lframe1:
.long   .LECIE1-.LSCIE1 # Length of Common Information Entry
  .LSCIE1:
...
.byte   0   # Personality (absolute)
.quad   __gxx_personality_v0

and allows the gdb build to produce a working executable.

This doesn't seem to be a FreeBSD platform specific issue per-say as the
binutils code that checks for R_X86_64_32 isn't platform specific.

ChangeLog:

Fri Sep 15 01:50:44 EDT 2023  John Wehle  (j...@feith.com)

* i386.c (asm_preferred_eh_data_format): Always use DW_EH_PE_absptr
when non-pic.

-- John Wehle

[Bug c++/84075] [11/12/13/14 Regression] Template parameter not resolved: invalid application of ‘sizeof’ to incomplete type ‘boost::serialization::U’

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

--- Comment #14 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:155178ccb5f5bc89dcc8261ae1b64bc2fbfdbd45

commit r14-4109-g155178ccb5f5bc89dcc8261ae1b64bc2fbfdbd45
Author: Patrick Palka 
Date:   Mon Sep 18 14:41:05 2023 -0400

c++: always check arity before deduction

This simple patch extends the r12-3271-gf1e73199569287 optimization
to happen for deduction without explicit template arguments as well.
The motivation for this is to accept testcases such as conv20.C and
ttp40.C below, which don't use explicit template arguments but for
which unnecessary template instantiation during deduction could be
avoided if we uniformly pruned overloads according to arity early.
This incidentally causes us to accept one reduced testcase from
PR c++/84075, but the underlying issue there remains at large.

As a nice side effect, this change causes the "candidate expects N
argument(s)" note during overload resolution failure to point to the
template candidate instead of the call site, which seems like an
improvement along the lines of r14-309-g14e881eb030509.

gcc/cp/ChangeLog:

* call.cc (add_template_candidate_real): Check arity even
when there are no explicit template arguments.  Combine the
two adjacent '!obj' tests into one.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/vt-57397-1.C: Expect "candidate expects ... N
argument(s)" at the declaration site instead of the call site.
* g++.dg/cpp0x/vt-57397-2.C: Likewise.
* g++.dg/overload/template5.C: Likewise.
* g++.dg/template/local6.C: Likewise.
* g++.dg/template/conv20.C: New test.
* g++.dg/template/ttp40.C: New test.

[Bug c++/108347] Incorrect error: ambiguous template instantiation

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

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

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

commit r14-4110-ga6ac1fc64c3caed19da65c2e6b12f8ddaf551231
Author: Patrick Palka 
Date:   Mon Sep 18 14:41:07 2023 -0400

c++: unifying identical tmpls from current inst [PR108347]

Here more_specialized_partial_spec wrongly considers the two partial
specializations to be unordered ultimately because unify for identical
parm=arg=A::C returns failure due to C being dependent.

This patch fixes this by relaxing unify's early-exit identity test to
also accept dependent decls; we can't deduce anything further from them
anyway.  In passing this patch removes the CONST_DECL case of unify:
we should never see the CONST_DECL version of a template parameter here,
and for other CONST_DECLs (such as enumerators) it seems we can rely on
them to already have been folded to their DECL_INITIAL.

PR c++/108347

gcc/cp/ChangeLog:

* pt.cc (unify): Return unify_success for identical dependent
DECL_P 'arg' and 'parm'.
: Remove handling.

gcc/testsuite/ChangeLog:

* g++.dg/template/ttp41.C: New test.

[Bug c++/108347] Incorrect error: ambiguous template instantiation

2023-09-18 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108347

Patrick Palka  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
   Target Milestone|--- |14.0
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Resolution|--- |FIXED
 CC||ppalka at gcc dot gnu.org

--- Comment #5 from Patrick Palka  ---
Fixed for GCC 14, thanks for the bug report.

[Bug c++/18474] Unary plus/minus lvalueness not diagnosed in templates

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

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:6e92a6a2a72d3b7a5e1b29042d8a6a43fe1085aa

commit r14-4111-g6e92a6a2a72d3b7a5e1b29042d8a6a43fe1085aa
Author: Patrick Palka 
Date:   Mon Sep 18 14:47:52 2023 -0400

c++: non-dependent assignment checking [PR63198, PR18474]

This patch makes us recognize and check non-dependent simple assigments
ahead of time, like we already do for compound assignments.  This means
the templated representation of such assignments will now usually have
an implicit INDIRECT_REF (due to the reference return type), which the
-Wparentheses code needs to handle.  As a drive-by improvement, this
patch also makes maybe_convert_cond issue -Wparentheses warnings ahead
of time, and removes a seemingly unnecessary suppress_warning call in
build_x_modify_expr.

On the libstdc++ side, some tests were attempting to modify a data
member from a uninstantiated const member function, which this patch
minimally fixes by making the data member mutable.

PR c++/63198
PR c++/18474

gcc/cp/ChangeLog:

* semantics.cc (maybe_convert_cond): Look through implicit
INDIRECT_REF when deciding whether to issue a -Wparentheses
warning, and consider templated assignment expressions as well.
(finish_parenthesized_expr): Look through implicit INDIRECT_REF
when suppressing -Wparentheses warning.
* typeck.cc (build_x_modify_expr): Check simple assignments
ahead time too, not just compound assignments.  Give the second
operand of MODOP_EXPR a non-null type so that it's not considered
always instantiation-dependent.  Don't call suppress_warning.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/static_assert15.C: Expect diagnostic for
non-constant static_assert condition.
* g++.dg/expr/unary2.C: Remove xfails.
* g++.dg/template/init7.C: Make initializer type-dependent to
preserve intent of test.
* g++.dg/template/recurse3.C: Likewise for the erroneous
statement.
* g++.dg/template/non-dependent26.C: New test.
* g++.dg/warn/Wparentheses-32.C: New test.

libstdc++-v3/ChangeLog:

*
testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
Make data member seed_seq::called mutable.
*
testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.

[Bug c++/63198] decltype in template function declaration yields spurious error

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

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:6e92a6a2a72d3b7a5e1b29042d8a6a43fe1085aa

commit r14-4111-g6e92a6a2a72d3b7a5e1b29042d8a6a43fe1085aa
Author: Patrick Palka 
Date:   Mon Sep 18 14:47:52 2023 -0400

c++: non-dependent assignment checking [PR63198, PR18474]

This patch makes us recognize and check non-dependent simple assigments
ahead of time, like we already do for compound assignments.  This means
the templated representation of such assignments will now usually have
an implicit INDIRECT_REF (due to the reference return type), which the
-Wparentheses code needs to handle.  As a drive-by improvement, this
patch also makes maybe_convert_cond issue -Wparentheses warnings ahead
of time, and removes a seemingly unnecessary suppress_warning call in
build_x_modify_expr.

On the libstdc++ side, some tests were attempting to modify a data
member from a uninstantiated const member function, which this patch
minimally fixes by making the data member mutable.

PR c++/63198
PR c++/18474

gcc/cp/ChangeLog:

* semantics.cc (maybe_convert_cond): Look through implicit
INDIRECT_REF when deciding whether to issue a -Wparentheses
warning, and consider templated assignment expressions as well.
(finish_parenthesized_expr): Look through implicit INDIRECT_REF
when suppressing -Wparentheses warning.
* typeck.cc (build_x_modify_expr): Check simple assignments
ahead time too, not just compound assignments.  Give the second
operand of MODOP_EXPR a non-null type so that it's not considered
always instantiation-dependent.  Don't call suppress_warning.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/static_assert15.C: Expect diagnostic for
non-constant static_assert condition.
* g++.dg/expr/unary2.C: Remove xfails.
* g++.dg/template/init7.C: Make initializer type-dependent to
preserve intent of test.
* g++.dg/template/recurse3.C: Likewise for the erroneous
statement.
* g++.dg/template/non-dependent26.C: New test.
* g++.dg/warn/Wparentheses-32.C: New test.

libstdc++-v3/ChangeLog:

*
testsuite/26_numerics/random/discard_block_engine/cons/seed_seq2.cc:
Make data member seed_seq::called mutable.
*
testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/linear_congruential_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed_seq2.cc:
Likewise.
*
testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq2.cc:
Likewise.

[Bug c++/89231] Bogus "ambiguous template instantiation" error for variadic nested class

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

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:80968d5f4683ffb50dbe8051d10f754d5fd00dfb

commit r14-4112-g80968d5f4683ffb50dbe8051d10f754d5fd00dfb
Author: Patrick Palka 
Date:   Mon Sep 18 14:54:45 2023 -0400

c++: optimize unifying nested templated classes [PR89231]

Since the LHS of a qualified-id is a non-deduced context, it effectively
means we can't deduce from outer template arguments of a class template
specialization.  And checking for equality between the TI_TEMPLATE of a
class specialization parm/arg already implies that the outer template
arguments are the same.  Hence recursing into outer template arguments
during unification of class specializations is redundant, so this patch
makes unify recurse only into innermost arguments.

This incidentally fixes the testcase from PR89231 because there
more_specialized_partial_inst wrongly considers the two partial
specializations to be unordered ultimately because unify for identical
parm=arg=A::Collect gets confused when it recurses into
parm=arg={Ps...} since Ps is outside the (innermost) level of tparms
that we're actually deducing.

PR c++/89231

gcc/cp/ChangeLog:

* pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
test by not calling most_general_template.  Only unify the
innermost levels of template arguments.
(unify) : Only unify the innermost levels of
template arguments, and only if the template is primary.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/variadic-partial3.C: New test.

[Bug c++/111399] Bogus -Wreturn-type diagnostic

2023-09-18 Thread david at westcontrol dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111399

--- Comment #2 from David Brown  ---
Would it be possible to have the "-Wreturn-type" warning pass not issue a
warning immediately, but inject a warning into the code that could then be
removed later by optimisation?

What I mean, is to have something roughly like this :

void __attribute__((warning("Reached return in non-void function")))
__ReturnNonVoid(void);

int sign(int x) {
if (x < 0) return -1;
if (x == 0) return 0;
if (x > 0) return 1;
__ReturnNonVoid();
}


Instead of issuing a warning straight away, if the compiler had added a call to
a non-existent "__ReturnNonVoid" function (just like the sanitizer adds a call
to "__ubsan_handle_missing_return"), this would be optimised away in functions
like this sample and the false positive warning would not be issued.  (Ideally,
of course, it would be suitable GIMPLE, or appropriate internal representation
for that pass, rather than a call to a non-existent function.)

[Bug c++/89231] Bogus "ambiguous template instantiation" error for variadic nested class

2023-09-18 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89231

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ppalka at gcc dot gnu.org
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
   Target Milestone|--- |14.0

--- Comment #3 from Patrick Palka  ---
Fixed for GCC 14, thanks for the bug report.

[Bug c++/18474] Unary plus/minus lvalueness not diagnosed in templates

2023-09-18 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18474

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org
 Status|NEW |RESOLVED
   Target Milestone|--- |14.0
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

--- Comment #4 from Patrick Palka  ---
Fixed for GCC 14.

[Bug c++/63198] decltype in template function declaration yields spurious error

2023-09-18 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63198

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
 CC||ppalka at gcc dot gnu.org
   Target Milestone|--- |14.0
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

--- Comment #8 from Patrick Palka  ---
Fixed for GCC 14.

[Bug fortran/70231] Runtime error: Different CHARACTER lengths in array constructor with allocatable array and -O0

2023-09-18 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70231

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Created attachment 55925
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55925&action=edit
Patch

The issue here is that the "bounds check" does not properly initialize the
string length temporary that is used for checking.  The attached patch
uses what we have after calling get_array_ctor_strlen.

[Bug bootstrap/111465] New: [14 regression] stage 3 ICE kills bootstrap

2023-09-18 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111465

Bug ID: 111465
   Summary: [14 regression] stage 3 ICE kills bootstrap
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

/home/seurer/gcc/git/build/gcc-trunk-bootstrap/./prev-gcc/xg++
-B/home/seurer/gcc/git/build/gcc-trunk-bootstrap/./prev-gcc/
-B/home/seurer/gcc/git/install/gcc-trunk-bootstrap/powerpc64le-unknown-linux-gnu/bin/
-nostdinc++
-B/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs

-I/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/include/powerpc64le-unknown-linux-gnu

-I/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/include
 -I/home/seurer/gcc/git/gcc-trunk-bootstrap/libstdc++-v3/libsupc++
-L/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/home/seurer/gcc/git/build/gcc-trunk-bootstrap/prev-powerpc64le-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
 -I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp -I.
-I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/../include
-I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/include  -g -O2 -fchecking=1
-W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic
-Wno-long-long -Werror -fno-exceptions -fno-rtti
-I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp -I.
-I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/../include
-I/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/include-c -o line-map.o
-MT line-map.o -MMD -MP -MF .deps/line-map.Tpo
/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/line-map.cc
/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/line-map.cc: In function 'int
linemap_compare_locations(line_maps*, location_t, location_t)':
/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/line-map.cc:1434:1: error:
statement uses released SSA name
 1434 | linemap_compare_locations (line_maps *set,
  | ^
_219 = _216;
The use of _216 should have been replaced
during GIMPLE pass: dom
/home/seurer/gcc/git/gcc-trunk-bootstrap/libcpp/line-map.cc:1434:1: internal
compiler error: cannot update SSA form

I am tracking down exactly where this started but it was just earlier today.

[Bug fortran/70231] Runtime error: Different CHARACTER lengths in array constructor with allocatable array and -O0

2023-09-18 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70231

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-September/059762.html

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

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

--- Comment #13 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:951d3c191d01440ad54415f683437770b0c957e4

commit r14-4113-g951d3c191d01440ad54415f683437770b0c957e4
Author: Andrew Pinski 
Date:   Sat Sep 16 15:19:58 2023 -0700

MATCH: Avoid recursive zero_one_valued_p for conversions

So when VN finds a name which has a nop conversion, it says
both names are equivalent to each other and the valuaization
function for one will return the other. This normally does not
cause any issues as there is no recursive matches. But after
r14-4038-gb975c0dc3be285, there was one added. So we would
do an infinite recursion on the match and never finish.
This fixes the issue (and adds a comment in match.pd) by
for converts just handle one level instead of being recursive
always.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note the testcase was reduced from tree-ssa-loop-niter.cc and then
changed slightly into C rather than C++ but it still needs exceptions
turned on get the IR that VN would produce this equivalence relationship
going on. Also had to turn off early inline to force put to be inlined
later.

PR tree-optimization/111435

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Don't do recursion
on converts.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111435-1.c: New test.

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

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

--- Comment #5 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:7ea501d3ea698e1c845fb61e3487f4cd949e6253

commit r14-4114-g7ea501d3ea698e1c845fb61e3487f4cd949e6253
Author: Andrew Pinski 
Date:   Sun Sep 17 11:20:36 2023 -0700

MATCH: Make zero_one_valued_p non-recursive fully

So it turns out VN can't handle any kind of recursion for match. In this
case we have `b = a & -1` and we try to match a as being zero_one_valued_p
and VN returns b as being the value and we just go into an infinite loop at
this point.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note genmatch should warn (or error out) if this gets detected so I filed
PR 111446
which I will be looking into next week or the week after so we don't run
into
this issue again.

PR tree-optimization/111442

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Have the bit_and match not be
recursive.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111442-1.c: New test.

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

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

--- Comment #2 from CVS Commits  ---
The trunk branch has been updated by Andrew Pinski :

https://gcc.gnu.org/g:7ea501d3ea698e1c845fb61e3487f4cd949e6253

commit r14-4114-g7ea501d3ea698e1c845fb61e3487f4cd949e6253
Author: Andrew Pinski 
Date:   Sun Sep 17 11:20:36 2023 -0700

MATCH: Make zero_one_valued_p non-recursive fully

So it turns out VN can't handle any kind of recursion for match. In this
case we have `b = a & -1` and we try to match a as being zero_one_valued_p
and VN returns b as being the value and we just go into an infinite loop at
this point.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note genmatch should warn (or error out) if this gets detected so I filed
PR 111446
which I will be looking into next week or the week after so we don't run
into
this issue again.

PR tree-optimization/111442

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Have the bit_and match not be
recursive.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111442-1.c: New test.

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

2023-09-18 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|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Andrew Pinski  ---
Fixed.

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

2023-09-18 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

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

--- Comment #14 from Andrew Pinski  ---
(In reply to Jakub Jelinek from comment #12)
> s/recusive/recursive/

Thanks I committed it with the spelling fix applied.

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap

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

Andrew Pinski  changed:

   What|Removed |Added

  Component|bootstrap   |tree-optimization
   Target Milestone|--- |14.0
   Keywords||build, ice-checking,
   ||ice-on-valid-code

--- Comment #1 from Andrew Pinski  ---
I suspect this was caused by/exposed by r14-4089-gd45ddc2c04e471d0dcee01 .

Do you have the preprocessed source which you could attach?

[Bug target/111464] Using DW_EH_PE_udata4 for amd64 non-pic breaks linking in some situations

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

--- Comment #1 from Andrew Pinski  ---
Also see
https://inbox.sourceware.org/gcc-patches/20230201073859.3920910-1-mask...@google.com/

The original patch which uses DW_EH_PE_udata4 :
https://inbox.sourceware.org/gcc-patches/20050801093315.gc14...@kam.mff.cuni.cz/

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

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

--- Comment #3 from Andrew Pinski  ---
(In reply to Richard Biener from comment #1)
> Note originally I intended to have (match (...)) inlined in the match IL
> itself,
> so any such checking should not only check for direct recursion but indirect
> as well - all SCCs are unsupported.
> 
> (match (one @0)
>  (negate @0))
> 
> (match (zero @0)
>  (negate (one @0)))
> 
> (match (one @0)
>  (negate (zero @0)))

Yes I guess the easiest/best way to implement this is to walk the predicate
definitions to make sure they don't loop back.

[Bug fortran/58146] Array slice bounds checking

2023-09-18 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58146

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |WAITING

--- Comment #10 from anlauf at gcc dot gnu.org ---
All testcases in this PR are covered.

There are other open PRs on bounds-checking.  Can we close this one?

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap

2023-09-18 Thread seurer at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111465

--- Comment #2 from seurer at gcc dot gnu.org ---
Created attachment 55926
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55926&action=edit
preprocessed .ii file

Yup, that looks like the culprit.

Preprocessed file attached.

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap

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

--- Comment #3 from Andrew Pinski  ---
Reproduced, reducing ...

[Bug target/111466] New: RISC-V: redundant sign extensions despite ABI guarantees

2023-09-18 Thread vineetg at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111466

Bug ID: 111466
   Summary: RISC-V: redundant sign extensions despite ABI
guarantees
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: vineetg at gcc dot gnu.org
  Reporter: vineetg at gcc dot gnu.org
CC: aagarwa at gcc dot gnu.org, jeffreyalaw at gmail dot com,
jivanhakobyan9 at gmail dot com, kito at gcc dot gnu.org,
palmer at gcc dot gnu.org
  Target Milestone: ---

Consider the test below:

int foo(int unused, int n, unsigned y, unsigned delta){
  int s = 0;
  unsigned int x = 0;// if int, sext elided
  for (;xhttps://gcc.gnu.org/pipermail/gcc-patches/2023-September/630811.html

[Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s)

2023-09-18 Thread vineetg at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111467

Bug ID: 111467
   Summary: REE failing to eliminate redundant extension due to
multiple reaching def(s)
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: vineetg at gcc dot gnu.org
  Reporter: vineetg at gcc dot gnu.org
CC: jeffreyalaw at gmail dot com, jivanhakobyan9 at gmail dot 
com,
kito at gcc dot gnu.org, palmer at gcc dot gnu.org
  Target Milestone: ---

For the trivial test case below (credit goes to Palmer for mentioning this
almost 2 years ago).

int
foo6(int a, int b)
{
  return a > b ? a : b;
}

-O2 -march=rv64gc

foo6:
mv  a5,a1
bge a1,a0,.L5
mv  a5,a0
.L5:
sext.w  a0,a5
ret

REE fails to eliminate the sign extension due to multiple reaching definitions
constraint.

I don't know how involved or runtime cost relaxing the constraint is, so
opening this PR to investigate.

FWIW a zba build generates a max insn, eliminating the sext.w, but the vanilla
case shows where things can possibly be improved.

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap from r14-4089-gd45ddc2c04e471d0dcee01

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

--- Comment #4 from Andrew Pinski  ---
Created attachment 55927
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55927&action=edit
reduced somewhat

Compile with `-O2 -fno-exceptions`.

[Bug sanitizer/109882] sanitizer/common_interface_defs.h bogusly defines __has_feature

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

--- Comment #9 from Jonathan Wakely  ---
Resubmitted now that LLVM uses github pull requests:
https://github.com/llvm/llvm-project/pull/66628

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap from r14-4089-gd45ddc2c04e471d0dcee01

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

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-09-18
 Target|powerpc64le-linux-gnu   |
  Build|powerpc64le-linux-gnu   |
   Host|powerpc64le-linux-gnu   |
 Status|UNCONFIRMED |NEW

--- Comment #5 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #4)
> Created attachment 55927 [details]
> reduced somewhat
> 
> Compile with `-O2 -fno-exceptions`.

This reduced testcase fails on x86_64-linux-gnu with `-O2 -fno-exceptions
--param=logical-op-non-short-circuit=0`

Confirmed.

[Bug rtl-optimization/111467] REE failing to eliminate redundant extension due to multiple reaching def(s)

2023-09-18 Thread vineetg at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111467

--- Comment #1 from Vineet Gupta  ---
(insn 8 4 11 2 (set (reg:SI 15 a5 [orig:137 b ] [137])  <--- DEF #1
(reg:SI 11 a1 [orig:136 b ] [136])) "max.c":12:20 207 {*movsi_internal}
 (nil))

(jump_insn 11 8 22 2 (set (pc)
(if_then_else (ge (reg/v:DI 11 a1 [orig:136 b ] [136])
(reg/v:DI 10 a0 [orig:135 a ] [135]))
(label_ref 13)
(pc))) "max.c":12:20 273 {*branchdi}
 (int_list:REG_BR_PROB 536870916 (nil))
 -> 13)

(insn 12 22 13 3 (set (reg:SI 15 a5 [orig:137 b ] [137])<--- DEF #2
(reg:SI 10 a0 [orig:135 a ] [135])) "max.c":12:20 207 {*movsi_internal}
 (nil))

(code_label 13 12 23 4 2 (nil) [1 uses])

(insn 19 14 20 4 (set (reg/i:DI 10 a0)  <-- USE: Multiple reaching DEFs
(sign_extend:DI (reg:SI 15 a5 [orig:137 b ] [137]))) "max.c":13:1 122
{extendsidi2}
 (nil))

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap from r14-4089-gd45ddc2c04e471d0dcee01

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

--- Comment #6 from Andrew Pinski  ---
Created attachment 55928
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55928&action=edit
Reduced even further

Still requires `-O2 -fno-exceptions --param=logical-op-non-short-circuit=0` to
reproduce.

[Bug tree-optimization/111465] [14 regression] stage 3 ICE kills bootstrap from r14-4089-gd45ddc2c04e471d0dcee01

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

--- Comment #7 from Andrew Pinski  ---
```
Optimizing block #15

1>>> STMT 1 = prephitmp_58 le_expr location_138
1>>> STMT 1 = prephitmp_58 ge_expr location_138
1>>> STMT 1 = prephitmp_58 eq_expr location_138
1>>> STMT 0 = prephitmp_58 ne_expr location_138
Optimizing statement if (iftmp.2_137 <= location_138)
  Replaced 'iftmp.2_137' with constant '2147483648'
Applying pattern match.pd:6895, gimple-match-8.cc:2512
Applying pattern match.pd:5745, gimple-match-4.cc:2113
gimple_simplified to _192 = (signed int) location_138;
if (_192 < 0)
  Folded to: if (_192 < 0)
 Registering value_relation (_192 pe32 location_138) (bb15) at _192 = (signed
int) location_138;
Folding predicate _192 < 0 to 0
Optimizing statement _192 = (signed int) location_138;
LKUP STMT _192 = nop_expr location_138
2>>> STMT _192 = nop_expr location_138



Optimizing block #16

Optimizing statement _16 = (signed int) prephitmp_15;
  Replaced 'prephitmp_15' with variable 'location_138'
LKUP STMT _16 = nop_expr location_138
FIND: _192
  Replaced redundant expr '(signed int) location_138' with '_192'
 ASGN _16 = _192
Optimizing statement if (_16 < 0)
  Replaced '_16' with variable '_192'
Folding predicate _192 < 0 to 0
Marking all outgoing edges of unreachable BB 17 as not executable
 STMT _192 = nop_expr location_138
 STMT 0 = prephitmp_58 ne_expr location_138
 STMT 1 = prephitmp_58 eq_expr location_138
 STMT 1 = prephitmp_58 ge_expr location_138
 STMT 1 = prephitmp_58 le_expr location_138
 COPY prephitmp_15 = location_138

```
But _16 is no longer used ...

[Bug tree-optimization/111456] [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

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

--- Comment #2 from Andrew Pinski  ---
Reduced testcase for the missed optimization before and after the patch:
```
_Bool f(int a)
{
_Bool t = a == 0;
short t1 = a;
_Bool t2 = t1 >= 0;
return t & t2;
}
```

This really should just reduce to `return a == 0;`

[Bug tree-optimization/110992] [13/14 Regression] missed VRP optimization due to transformation of `a & -zero_one_valued_p` into `a * zero_one_valued_p`

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

Andrew Pinski  changed:

   What|Removed |Added

URL|https://gcc.gnu.org/piperma |
   |il/gcc-patches/2023-Septemb |
   |er/630651.html  |
 Status|ASSIGNED|NEW
   Keywords|patch   |
   Assignee|pinskia at gcc dot gnu.org |unassigned at gcc dot 
gnu.org

--- Comment #12 from Andrew Pinski  ---
Not working on this. a Ranger/VRP person should fix this instead ...

[Bug middle-end/111454] ice in get_nonzero_bits

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

Andrew Pinski  changed:

   What|Removed |Added

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

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


(In reply to David Binderman from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > This is either a dup of bug 111435 or bug 111442
> 
> Plausible. I saw the following strange behaviour:
> 
> $ ~/gcc/results/bin/gcc -c  -O1  bug958B.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.
> $ ~/gcc/results/bin/gcc -c  -O2  bug958B.c
> $ 

That seems like a different issue which should be filed seperately.
But that comes down to somehow the attribute optimize is not setting optimize
correctly.

Fre pass does:
  /* At -O[1g] use the cheap non-iterating mode.  */
  bool iterate_p = may_iterate && (optimize > 1);

*** 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-18 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||dcb314 at hotmail dot com

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

[Bug tree-optimization/106164] (a > b) & (a >= b) does not get optimized until reassoc1

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

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #19 from Andrew Pinski  ---
Another integer testcase which is missed here:
```
_Bool f(int a)
{
_Bool t = a == 0;
unsigned t1 = a;
_Bool t2 = t1 >= 3;
return t & t2;
}
```

[Bug tree-optimization/111456] [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

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

--- Comment #3 from Andrew Pinski  ---
here is another missed optimization:
```
_Bool f2(int a, int b)
{
_Bool t = a == b;
unsigned t1 = a;
unsigned t2 = b;
_Bool b2 = t1 >= t2;
return t & b2;
}
```
This should just be optimized to `return a == b;`.

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

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

--- Comment #20 from John Soo  ---
I think that in order to really rid gcc of the E2BIG problem on linux,
COLLECT_*_OPTIONS will have to be deprecated and removed. This is particularly
a problem when executing spec files, it seems.

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

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

--- Comment #10 from Kewen Lin  ---
Thanks for both of your comments!

(In reply to Peter Bergner from comment #8)
> Mike will know better than I, but I like the idea of the patch!

Looking forward to Mike's reply. :)

(In reply to Segher Boessenkool from comment #9)
> I don't like that "wzd" attribute at all.  Please just put an "if" for the
> mode
> around this -- everywhere else (including in a large part of this patch!) we
> deal with SImode and DImode separately already.  Or perhaps you can use the
> "ptrload" attribute,
> which includes the "l"?

Ok, nice tips!  I will use "ptrload" instead.

> 
> There really should be a comment why one alternative needs the %U{n} and the
> other can
> ignore it, btw.  Nothing new there, but a head-scratcher :-)

OK, something like: "prefixed load/store insns only have D-form but no update
and X-form"?

[Bug tree-optimization/111456] [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356

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

--- Comment #4 from Andrew Pinski  ---
Created attachment 55929
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55929&action=edit
Patch which I am testing

I still need to add testcases.

[Bug tree-optimization/106164] (a > b) & (a >= b) does not get optimized until reassoc1

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

--- Comment #20 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #19)
> Another integer testcase which is missed here:
> ```
> _Bool f(int a)
> {
> _Bool t = a == 0;
> unsigned t1 = a;
> _Bool t2 = t1 >= 3;
> return t & t2;
> }
> ```

See PR 111456 for the patch for that.

[Bug rtl-optimization/111467] REE failing to eliminate redundant extension due to multiple reaching def(s)

2023-09-18 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111467

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at gcc dot gnu.org

--- Comment #2 from Jeffrey A. Law  ---
I thought REE handled multiple reaching definition. So this is a bit of a
surprise.

[Bug middle-end/111468] New: cannot express unordered equal in gimple FE

2023-09-18 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111468

Bug ID: 111468
   Summary: cannot express unordered equal in gimple FE
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aldyh at gcc dot gnu.org
  Target Milestone: ---

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

It looks like you can't express an UNEQ_EXPR in the GIMPLE FE.

Am I missing something?  The snippet below compiles fine with:

  if (x_1 == a_5(D))

but not with:

  if (x_1 u== a_5(D))

And at least tree-pretty-print.cc has:

case UNEQ_EXPR:
  return "u==";

I'm trying to come up with a threading test for some unordered stuff, and I'm
getting:

$ ./cc1 c.c -O2 -fgimple -quiet
c.c: In function ‘foo’:
c.c:19:10: error: expected ‘)’ before ‘u’
   19 |   if (x_1 u== a_5(D))
  |  ^~
  |  )

[snip snip]

Is there a blessed way of expressing unordered comparisons in the GIMPLE FE?

[Bug middle-end/111468] cannot express unordered equal in gimple FE

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

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Severity|normal  |enhancement
   Last reconfirmed||2023-09-19
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
I was going to suggest to use __builtin_islessgreater but it does not exactly
work the same way.

That is:
```
void stuff();

void __GIMPLE (ssa,startwith("threadfull1"))
foo (float a, float b, int cond)
{
  float x;
  int _7;

 __BB(2):
  if (cond_3(D) != 0)
goto __BB4;
  else
goto __BB3;

 __BB(3):
  goto __BB4;

 __BB(4):
  x_1 = __PHI (__BB2: a_5(D), __BB3: b_4(D));
  _7 = __builtin_islessgreater (x_1 , a_5(D));
  if (_7 != 0)
goto __BB5;
  else
goto __BB6;

 __BB(5):
  stuff ();
  goto __BB6;

 __BB(6):
  return;

}
```

But we don't get UNEQ_EXPR right away, instead we have to wait until vrp1 to
get the UNEQ_EXPR ...

[Bug c++/110785] [c++14+] Incorrect return type deduction for const auto with no return statement

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

Amatul Adeeba  changed:

   What|Removed |Added

 CC||amatuladeeba at gmail dot com

--- Comment #2 from Amatul Adeeba  ---
Here the function f is declared with unspecified return type by using auto
whereas fp is a function pointer declared as returning void, but its assigned
to a function with an unknown return type.

[Bug c/71219] Warn about (struct S*)malloc(n) where n < sizeof(struct S)

2023-09-18 Thread muecker at gwdg dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71219

Martin Uecker  changed:

   What|Removed |Added

 CC||muecker at gwdg dot de

--- Comment #5 from Martin Uecker  ---
PATCH: https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630817.html

  1   2   >