[Bug preprocessor/101168] gnu++14 complains about altivec types defined with using keyword in the same file with preprocessor macros

2022-03-17 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101168

Jiu Fu Guo  changed:

   What|Removed |Added

 CC||guojiufu at gcc dot gnu.org

--- Comment #1 from Jiu Fu Guo  ---
This issue seems can also be reproduced at at10.0(gcc6.4.1).

[Bug tree-optimization/104975] New: ICE in execute, at gimple-harden-conditionals.cc:577

2022-03-17 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104975

Bug ID: 104975
   Summary: ICE in execute, at gimple-harden-conditionals.cc:577
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 12.0.1 20220313 snapshot (g:7e28750395889d16a9cba49cd5935ced7dc00ce8) ICEs
when compiling the following testcase w/ -O1 -fharden-compares -fno-inline
-fno-ipa-pure-const:

__attribute__ ((pure, returns_twice)) int
bar (int);

int
quux (void)
{
  return 0;
}

int
foo (short int x)
{
  x = !x;
  bar (quux ());

  return x;
}

% gcc-12.0.1 -O1 -fharden-compares -fno-inline -fno-ipa-pure-const -c
pjkdqdif.c
during GIMPLE pass: hardcmp
pjkdqdif.c: In function 'foo':
pjkdqdif.c:11:1: internal compiler error: in execute, at
gimple-harden-conditionals.cc:577
   11 | foo (short int x)
  | ^~~
0x81cbba execute
   
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220313/work/gcc-12-20220313/gcc/gimple-harden-conditionals.cc:577

[Bug go/104973] GCC 11.2.1 build failure with Go support (mv: cannot stat 'cpugen.o': No such file or directory)

2022-03-17 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104973

--- Comment #2 from Ian Lance Taylor  ---
Your build log shows a line like this:

libtool: compile: 
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/gccgo
-B/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/
-B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem
/usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include
-minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=internal/cpu
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu.go
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu_amd64.go
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu_x86.go
cpugen.go 

My build log shows a line like this:

libtool: compile:  /home/iant/gcc/gcc-11-objdir/./gcc/gccgo
-B/home/iant/gcc/gcc-11-objdir/./gcc/
-B/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/bin/
-B/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/lib/ -isystem
/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/include -isystem
/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/sys-include -fchecking=1
-minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=internal/cpu
../../../gcc-11-branch/libgo/go/internal/cpu/cpu.go
../../../gcc-11-branch/libgo/go/internal/cpu/cpu_amd64.go
../../../gcc-11-branch/libgo/go/internal/cpu/cpu_x86.go cpugen.go  -fPIC -o
internal/.libs/cpu.o

Note that my line has a -o ption at the end but yours does not.

I think that is the root of the problem.

Earlier your log has this:

/usr/sbin/mkdir -p internal; files=`echo
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu.go
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu_amd64.go
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/gcc-11-20211127/libgo/go/internal/cpu/cpu_x86.go
cpugen.go | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; /bin/bash ./libtool
--tag GO --mode=compile
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/gccgo
-B/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/
-B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem
/usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include 
   -minline-all-stringops  -O2 -g -I . -c -fgo-pkgpath=`echo internal/cpu.lo |
sed -e 's/.lo$//'`  -o internal/cpu.lo $files

My log has this:

/bin/mkdir -p internal; files=`echo
../../../gcc-11-branch/libgo/go/internal/cpu/cpu.go
../../../gcc-11-branch/libgo/go/internal/cpu/cpu_amd64.go
../../../gcc-11-branch/libgo/go/internal/cpu/cpu_x86.go cpugen.go | sed -e
's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; /bin/sh ./libtool --tag GO
--mode=compile /home/iant/gcc/gcc-11-objdir/./gcc/gccgo
-B/home/iant/gcc/gcc-11-objdir/./gcc/
-B/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/bin/
-B/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/lib/ -isystem
/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/include -isystem
/home/iant/gcc/gcc-11-install/x86_64-pc-linux-gnu/sys-include   -fchecking=1 
-minline-all-stringops  -O2 -g -I . -c -fgo-pkgpath=`echo internal/cpu.lo | sed
-e 's/.lo$//'`  -o internal/cpu.lo $files

Here the -o option is present in both cases.

So why does the -o option disappear?  Could this be somehow due to the patches
being applied at the start of your build log?

[Bug target/104974] [avx512fp16] Error: operand type mismatch for `vmovw'

2022-03-17 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104974

Hongtao.liu  changed:

   What|Removed |Added

 Target||x86_64-*-* i?86-*-*
   Keywords||wrong-code

--- Comment #1 from Hongtao.liu  ---
I'm testing

--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2658,7 +2658,7 @@ (define_insn "*movhi_internal"
(const_string "TI"))
(eq_attr "alternative" "12")
  (cond [(match_test "TARGET_AVX512FP16")
-  (const_string "HI")
+  (const_string "HF")
 (match_test "TARGET_AVX")
   (const_string "TI")
 (ior (not (match_test "TARGET_SSE2"))

[Bug target/104974] New: [avx512fp16] Error: operand type mismatch for `vmovw'

2022-03-17 Thread crazylht at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104974

Bug ID: 104974
   Summary: [avx512fp16]  Error: operand type mismatch for `vmovw'
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: crazylht at gmail dot com
  Target Milestone: ---

cat test.c

short
foo (short a)
{
  register short b __asm ("%xmm1") = a;
  asm volatile ("": "+v" (b));
  register short c __asm ("%xmm2") = b;
  asm volatile ("": "+v" (c));
  return a;
}

foo(short):
mov eax, edi
vmovw   xmm1, edi
vmovw   xmm2, xmm1 
ret

To move HImode from sse reg to sse reg under avx512fp16, vmovsh should be used
instead of vmovw.

[Bug go/104973] GCC 11.2.1 build failure with Go support (mv: cannot stat 'cpugen.o': No such file or directory)

2022-03-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104973

--- Comment #1 from Andrew Pinski  ---
Can you attach what is inside cpugen.go?

[Bug go/104973] New: GCC 11.2.1 build failure with Go support (mv: cannot stat 'cpugen.o': No such file or directory)

2022-03-17 Thread sam at gentoo dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104973

Bug ID: 104973
   Summary: GCC 11.2.1 build failure with Go support (mv: cannot
stat 'cpugen.o': No such file or directory)
   Product: gcc
   Version: 11.2.1
   URL: https://bugs.gentoo.org/828439
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: go
  Assignee: ian at airs dot com
  Reporter: sam at gentoo dot org
CC: cmang at google dot com
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
 Build: x86_64-pc-linux-gnu

Created attachment 52648
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52648=edit
build.log.xz

Initially reported downstream in Gentoo at https://bugs.gentoo.org/828439.

```
/bin/bash ../libtool  --tag=CXX   --mode=compile
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/xgcc
-shared-libgcc
-B/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc -nostdinc++
-L/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gnu/32/libstdc++-v3/src
-L/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127>
libtool: compile: mv -f "cpugen.o" "internal/.libs/cpu.o"
mv: cannot stat 'cpugen.o': No such file or directory
make[4]: *** [Makefile:3001: internal/cpu.lo] Error 1
make[4]: Leaving directory
'/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gnu/libgo'
make[3]: *** [Makefile:2327: all-recursive] Error 1
libtool: compile: 
/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc/xgcc
-shared-libgcc
-B/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/./gcc -nostdinc++
-L/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gnu/32/libstdc++-v3/src
-L/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gn>
make[3]: Leaving directory
'/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gnu/libgo'
make[2]: *** [Makefile:1198: all] Error 2
make[2]: Leaving directory
'/var/tmp/portage/sys-devel/gcc-11.2.1_p20211127/work/build/x86_64-pc-linux-gnu/libgo'
make[1]: *** [Makefile:21736: all-target-libgo] Error 2
make[1]: *** Waiting for unfinished jobs
```

Reported for both the 11.2.1 snapshots from 20211127 and 20220115. I don't see
any relevant changes in git since those.

I've attached the full (compressed) build.log which Dennis uploaded in the
original Gentoo bug.

[Bug middle-end/104965] [11/12 Regression] Yet another -Warray-bounds false positive

2022-03-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104965

--- Comment #4 from Andrew Pinski  ---
I think the missed optimization is recorded as either PR 79349 or PR 103827.

[Bug tree-optimization/101895] [11 Regression] SLP Vectorizer change pushes VEC_PERM_EXPR into bad location spoiling further optimization opportunities

2022-03-17 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101895

--- Comment #10 from Jeffrey A. Law  ---
And just an FYI.  As expected this resolves the regression on our internal
target.  Thanks Roger!

[Bug fortran/104908] [11/12 Regression] incorrect Fortran out-of-bound runtime error.

2022-03-17 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104908

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||albandil at atlas dot cz

--- Comment #2 from anlauf at gcc dot gnu.org ---
*** Bug 104972 has been marked as a duplicate of this bug. ***

[Bug fortran/104972] Class dummy argument for array of custom types stuck on -fcheck=bounds

2022-03-17 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104972

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
Exact duplicate.

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

[Bug tree-optimization/40635] [12 Regression] bogus name and location in 'may be used uninitialized' warning

2022-03-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40635

--- Comment #22 from Andrew Pinski  ---
(In reply to Martin Sebor from comment #21)
> Deferring to Andrew per comment #19.

That part was fixed already by r12-6061-gd957d250942b13.

[Bug target/86722] ifcvt produces x&0 that is never cleaned up

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86722

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Roger Sayle :

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

commit r12-7693-gc482c28ba4c549006deb70dead90fe8ab34dcbcf
Author: Roger Sayle 
Date:   Thu Mar 17 21:56:32 2022 +

PR 90356: Use xor to load const_double 0.0 on SSE (always)

Implementations of the x87 floating point instruction set have always
had some pretty strange characteristics.  For example on the original
Intel Pentium the FLDPI instruction (to load 3.14159... into a register)
took 5 cycles, and the FLDZ instruction (to load 0.0) took 2 cycles,
when a regular FLD (load from memory) took just 1 cycle!?  Given that
back then memory latencies were much lower (relatively) than they are
today, these instructions were all but useless except when optimizing
for size (impressively FLDZ/FLDPI require only two bytes).

Such was the world back in 2006 when Uros Bizjak first added support for
fldz https://gcc.gnu.org/pipermail/gcc-patches/2006-November/202589.html
and then shortly after sensibly disabled them for !optimize_size with
https://gcc.gnu.org/pipermail/gcc-patches/2006-November/204405.html

Alas this vestigial logic still persists in the compiler today,
so for example on x86_64 for the following function:

double foo(double x) { return x + 0.0; }

generates with -O2

foo:addsd   .LC0(%rip), %xmm0
ret
.LC0:   .long   0
.long   0

preferring to read the constant 0.0 from memory [the constant pool],
except when optimizing for size.  With -Os we get:

foo:xorps   %xmm1, %xmm1
addsd   %xmm1, %xmm0
ret

Which is not only smaller (the two instructions require seven bytes vs.
eight for the original addsd from mem, even without considering the
constant pool) but is also faster on modern hardware.  The latter code
sequence is generated by both clang and msvc with -O2.  Indeed Agner
Fogg documents the set of floating point/SSE constants that it's
cheaper to materialize than to load from memory.

This patch shuffles the conditions on the i386 backend's *movtf_internal,
*movdf_internal and *movsf_internal define_insns to untangle the newer
TARGET_SSE_MATH clauses from the historical standard_80387_constant_p
conditions.  Amongst the benefits of this are that it improves the code
generated for PR tree-optimization/90356 and resolves PR target/86722.

2022-03-17  Roger Sayle  

gcc/ChangeLog
PR target/86722
PR tree-optimization/90356
* config/i386/i386.md (*movtf_internal): Don't guard
standard_sse_constant_p clause by optimize_function_for_size_p.
(*movdf_internal): Likewise.
(*movsf_internal): Likewise.

gcc/testsuite/ChangeLog
PR target/86722
PR tree-optimization/90356
* gcc.target/i386/pr86722.c: New test case.
* gcc.target/i386/pr90356.c: New test case.

[Bug tree-optimization/90356] Missed optimization for variables initialized to 0.0

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90356

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Roger Sayle :

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

commit r12-7693-gc482c28ba4c549006deb70dead90fe8ab34dcbcf
Author: Roger Sayle 
Date:   Thu Mar 17 21:56:32 2022 +

PR 90356: Use xor to load const_double 0.0 on SSE (always)

Implementations of the x87 floating point instruction set have always
had some pretty strange characteristics.  For example on the original
Intel Pentium the FLDPI instruction (to load 3.14159... into a register)
took 5 cycles, and the FLDZ instruction (to load 0.0) took 2 cycles,
when a regular FLD (load from memory) took just 1 cycle!?  Given that
back then memory latencies were much lower (relatively) than they are
today, these instructions were all but useless except when optimizing
for size (impressively FLDZ/FLDPI require only two bytes).

Such was the world back in 2006 when Uros Bizjak first added support for
fldz https://gcc.gnu.org/pipermail/gcc-patches/2006-November/202589.html
and then shortly after sensibly disabled them for !optimize_size with
https://gcc.gnu.org/pipermail/gcc-patches/2006-November/204405.html

Alas this vestigial logic still persists in the compiler today,
so for example on x86_64 for the following function:

double foo(double x) { return x + 0.0; }

generates with -O2

foo:addsd   .LC0(%rip), %xmm0
ret
.LC0:   .long   0
.long   0

preferring to read the constant 0.0 from memory [the constant pool],
except when optimizing for size.  With -Os we get:

foo:xorps   %xmm1, %xmm1
addsd   %xmm1, %xmm0
ret

Which is not only smaller (the two instructions require seven bytes vs.
eight for the original addsd from mem, even without considering the
constant pool) but is also faster on modern hardware.  The latter code
sequence is generated by both clang and msvc with -O2.  Indeed Agner
Fogg documents the set of floating point/SSE constants that it's
cheaper to materialize than to load from memory.

This patch shuffles the conditions on the i386 backend's *movtf_internal,
*movdf_internal and *movsf_internal define_insns to untangle the newer
TARGET_SSE_MATH clauses from the historical standard_80387_constant_p
conditions.  Amongst the benefits of this are that it improves the code
generated for PR tree-optimization/90356 and resolves PR target/86722.

2022-03-17  Roger Sayle  

gcc/ChangeLog
PR target/86722
PR tree-optimization/90356
* config/i386/i386.md (*movtf_internal): Don't guard
standard_sse_constant_p clause by optimize_function_for_size_p.
(*movdf_internal): Likewise.
(*movsf_internal): Likewise.

gcc/testsuite/ChangeLog
PR target/86722
PR tree-optimization/90356
* gcc.target/i386/pr86722.c: New test case.
* gcc.target/i386/pr90356.c: New test case.

[Bug fortran/104972] New: Class dummy argument for array of custom types stuck on -fcheck=bounds

2022-03-17 Thread albandil at atlas dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104972

Bug ID: 104972
   Summary: Class dummy argument for array of custom types stuck
on -fcheck=bounds
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: albandil at atlas dot cz
  Target Milestone: ---

When the following program is compiled with `-fcheck=bounds` using a recent
version of gfortran, it triggers a bogus (?) error:

program test

type vec
integer :: x(3)
end type

type(vec) :: v(2)

call sub(v)

contains

subroutine sub (v)

class(vec), intent(in) :: v(:)

integer :: k, q(3)

q = [ (v(1)%x(k), k = 1, 3) ]   ! <-- fails here

   end subroutine

end program

The error message is

At line 19 of file test.f90
Fortran runtime error: Index '3' of dimension 1 of array 'v%_data%x' above
upper bound of 2

When the lengths of the arrays `x` and `v` in the code are modified, the
message changes as well, but it always appears as if the compiler interchanged
the dimension of `v` and of `x`. I observe this behaviour with the compiler
version on openSUSE Tumbleweeed 20220316

$ gfortran --version
GNU Fortran (SUSE Linux) 11.2.1 20220103 [revision
d4a1d3c4b377f1d4acb34fe1b55b5088a3f293f6]

I also got the same run-time errors when pulling and compiling a recent Git
version of GCC,

$ gfortran --version
GNU Fortran (GCC) 12.0.1 20220310 (experimental)

However, in older versions of the compiler (8, 9 and 10) using the
`-fcheck=bounds` flag with this program works fine. Provided that the code is
syntactically valid as it is, this suggests a compiler regression.

The error goes away also when I replace the keyword `class` with `type`.

[Bug middle-end/104971] [9/10/11/12 Regression] Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

Marek Polacek  changed:

   What|Removed |Added

   Last reconfirmed||2022-03-17
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org

--- Comment #4 from Marek Polacek  ---
Confirmed then.

[Bug target/104968] [nvptx][OpenMP] SIGSEGV / ICE in final_scan_insn_1

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104968

Tom de Vries  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Tom de Vries  ---
This patch fixes the ICE at openmp level:
...
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 139a0de6100..19af384c634 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -13361,6 +13361,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
   g = gimple_build_bind (NULL_TREE, gfor, NULL_TREE);
   g = gimple_build_omp_task (g, task_clauses, NULL_TREE, NULL_TREE,
 NULL_TREE, NULL_TREE, NULL_TREE);
+  gimple_set_location (g, EXPR_LOCATION (*expr_p));
   gimple_omp_task_set_taskloop_p (g, true);
   g = gimple_build_bind (NULL_TREE, g, NULL_TREE);
   gomp_for *gforo
...

[Bug fortran/96983] [11/12 regression] ICE compiling gfortran.dg/pr96711.f90 starting with r11-3042

2022-03-17 Thread meissner at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96983

Michael Meissner  changed:

   What|Removed |Added

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

--- Comment #41 from Michael Meissner  ---
I tried applying the fix to the GCC 10 branch, and it appears that the patch
needs more infrastructure needed.  So, I'm closing the PR.  If we need a GCC 10
backport, we can either reopen the issue or create a new bug report.  It is
fixed on the GCC 11 branch and on the master branch that will become GCC 12.

[Bug middle-end/104971] [9/10/11/12 Regression] Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

--- Comment #3 from Andrew Cooper  ---
So yes - my experimentation did start from investigating the memory ordering
behaviour of these builtins, based on a thread on LKML.

The pushf in readflags and popf in writeflags have wildly different ordering
requirements, depending on which flags are wanted/modified.  AC for example
(and IF for kernels) need to not be reordered with respect to any memory
access.

As you observe, readflags in particular needs to not be reordered with any
instruction that modifies the arithmetic flags (which is most of them).

IMO, it would be safe to omit the pushf from readflags if the result is not not
used, because there are no unexpected side effects for pushf.

The same is not true of popf in writeflags, which has side effects even when
written twice with the same value.

[Bug tree-optimization/102943] [12 Regression] Jump threader compile-time hog with 521.wrf_r

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102943

--- Comment #51 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

https://gcc.gnu.org/g:8db155ddf8cec9e31f0a4b8d80cc67db2c7a26f9

commit r12-7692-g8db155ddf8cec9e31f0a4b8d80cc67db2c7a26f9
Author: Andrew MacLeod 
Date:   Thu Mar 17 10:52:10 2022 -0400

Always use dominators in the cache when available.

This patch adjusts range_from_dom to follow the dominator tree through the
cache until value is found, then apply any outgoing ranges encountered
along the way.  This reduces the amount of cache storage required.

PR tree-optimization/102943
* gimple-range-cache.cc (ranger_cache::range_from_dom): Find range
via
dominators and apply intermediary outgoing edge ranges.

[Bug c++/69517] SEGV on a VLA with excess initializer elements

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69517

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #19 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/71319] unnecessary call to __strcat_chk emitted after buffer reset

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71319

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/85741] [meta-bug] bogus/missing -Wformat-overflow

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85741
Bug 85741 depends on bug 77721, which changed state.

Bug 77721 Summary: -Wformat-truncation not uses arg range for converted vars
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77721

   What|Removed |Added

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

[Bug middle-end/77721] -Wformat-truncation not uses arg range for converted vars

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77721

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Blocks||85741
 Resolution|--- |FIXED

--- Comment #8 from Martin Sebor  ---
This appears fixed in GCC 12 and 11 (and perhaps even earlier).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85741
[Bug 85741] [meta-bug] bogus/missing -Wformat-overflow

[Bug c/79554] Zero length format string passed to fprintf under if statement causes error message

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79554

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/82601] missing uninitialized warning for INTENT(OUT) argument with -O0 / -Og

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82601

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
 CC|msebor at gcc dot gnu.org  |

--- Comment #6 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/82608] missing -Warray-bounds on an out-of-bounds VLA index

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82608

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
I'm no longer working on this.

[Bug lto/102426] [12 regression] Fix for PR 49664 breaks Solaris bootstrap with gld

2022-03-17 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102426

--- Comment #10 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #9 from Jakub Jelinek  ---
> (In reply to r...@cebitec.uni-bielefeld.de from comment #8)
>> > --- Comment #7 from Jakub Jelinek  ---
>> > So, shouldn't we instead of the -export-symbols-regex use a version script?
>> 
>> We certainly could, but IIUC this would lose the functionality on
>> non-ELF targets that do support -export-symbols-regex in a different
>> way.  No idea if this is deemed acceptable...
>
> The world doesn't end if other symbols are exported, it worked that way for
> years.

True ;-)

> Perhaps we could test in configure whether -export-symbols-regex works and 
> only
> use a fallback if it doesn't?  Or decide it based on target triplet,
> do those GNU and SUN version script checks and if neither of them works, fall
> back to -export-symbols-regex ?

I wouldn't check triplets, but instead do the symbol versioning check
and, if that fails, use -export-symbols-regex.

> gld supports version scripts like:
> { global: onload; local: *; };
> which makes onload a non-versioned GLOBAL symbol while everything else LOCAL,
> does Sun ld support that too or similar?

That's exactly the Sun ld syntax.  After all, they came up with that
before gld adopted it...

[Bug c++/83429] Incorrect line number reported by -Wformat-truncation

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83429

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Sebor  ---
GCC 11 and 12 print the following for the test case in comment #0.  I believe
the problem has been resolved (the %G format is gone now from 12).

pr83429.c: In function ‘void test(S*)’:
pr83429.c:12:42: warning: ‘%s’ directive output may be truncated writing up to
9 bytes into a region of size between 5 and 14 [-Wformat-truncation=]
   12 | snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); //
line 12
  |  ^~
pr83429.c:12:13: note: ‘snprintf’ output between 2 and 20 bytes into a
destination of size 15
   12 | snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); //
line 12
  | ^~~

[Bug tree-optimization/84561] -Wstringop-truncation with -O2 depends on strncpy's size type

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84561

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #8 from Martin Sebor  ---
The warning is still present in GCC 12.  I'm no longer working on this.

[Bug tree-optimization/84577] snprintf with null buffer not eliminated when return value is in a known range

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84577

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
  Known to fail||10.2.0, 11.2.0, 12.0
   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org

--- Comment #5 from Martin Sebor  ---
No changed in GCC 12 but I'm no longer working on this.

[Bug ipa/84603] -finline-limit not accepted in attribute and #pragma optimize

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84603

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/85650] Additional warnings when -fsanitize=undefined is used with -Wstringop-truncation

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85650

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/87034] [9/10/11/12 Regression] missing -Wformat-overflow on a sprintf %s with a wide string

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87034

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #12 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/88059] Spurious stringop-overflow warning with strlen, malloc and strncpy

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88059

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/88771] Misleading -Werror=array-bounds error

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #26 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/88780] [9/10/11/12 Regression] bogus -Wstringop-truncation for copying as many bytes from a string as its length

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #11 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/89678] Bogus -Wstringop-truncation on strncat with bound that depends on strlen of source

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89678

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 90752, which changed state.

Bug 90752 Summary: missing -Warray-bounds accessing the result of string 
functions
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90752

   What|Removed |Added

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

[Bug tree-optimization/90752] missing -Warray-bounds accessing the result of string functions

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90752

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #1 from Martin Sebor  ---
GCC 12 warns as expected:

$ gcc -O2 -S -Wall pr90752.c 
pr90752.c: In function ‘f’:
pr90752.c:7:11: warning: array subscript -1 is outside array bounds of
‘char[4]’ [-Warray-bounds]
7 |   return p[-1];   // missing -Warray-bounds
  |  ~^~~~
pr90752.c:2:13: note: at offset -1 into object ‘a’ of size 4
2 | extern char a[4];
  | ^
pr90752.c: In function ‘g’:
pr90752.c:13:11: warning: array subscript [-5, -2] is outside array bounds of
‘char[4]’ [-Warray-bounds]
   13 |   return p[-5];   // missing -Warray-bounds
  |  ~^~~~
pr90752.c:2:13: note: at offset [-5, -2] into object ‘a’ of size 4
2 | extern char a[4];
  | ^
pr90752.c: In function ‘h’:
pr90752.c:19:11: warning: array subscript 4 is outside array bounds of
‘char[4]’ [-Warray-bounds]
   19 |   return p[4];   // missing -Warray-bounds
  |  ~^~~
pr90752.c:2:13: note: at offset 4 into object ‘a’ of size 4
2 | extern char a[4];
  | ^

[Bug middle-end/90904] vec assignment and copying undefined

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90904

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/90959] hash_map can be copied but leads to a double-free after assignment

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90959

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I'm no longer working on this.

[Bug driver/90983] [9 Regression] manual documents `-Wno-stack-usage` flag, but it is unrecognized

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90983

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #11 from Martin Sebor  ---
Fixed, won't backport.

[Bug c++/91076] wrong class-key in mentioned in a diagnostic note

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91076

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #3 from Martin Sebor  ---
Fixed.

[Bug tree-optimization/91147] strlen of conditional plus index in known range not folded

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91147

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #1 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/91490] [9 Regression] bogus argument missing terminating nul warning on strlen of a flexible array member

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #10 from Martin Sebor  ---
I'm no longer planning to backport the fix.

[Bug middle-end/91584] [9 Regression] Bogus warning from -Warray-bounds during string assignment

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91584

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
I'm no longer planning to backport the fix.

[Bug middle-end/91848] missing warning on strcpy past the end of a member of an array with variable index

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91848

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Sebor  ---
I'm no longer working on this.

[Bug ipa/92799] [9 Regression] ICE on a weakref function definition followed by a declaration

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92799

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #11 from Martin Sebor  ---
I'm not planning to backport the fix.

[Bug c/94040] [9 Regression] ICE on a call to an invalid redeclaration of strftime

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94040

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
I'm not planning to backport the fix.

[Bug c++/94346] [9 Regression] ICE due to handle_copy_attribute since r9-3982

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94346

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
I'm no longer planning to backport the fix.

[Bug tree-optimization/94655] [10 Regression] -Wstringop-overflow on implicit string assignment with vectorized char store

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94655

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #18 from Martin Sebor  ---
I'm no longer planning to bakcport the fix.

[Bug c++/94923] False positive -Wclass-memaccess with trivially copyable std::optional

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94923

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
Fixed per comment #6.

[Bug middle-end/95072] [10/11/12 Regression] -Warray-bounds false positive with flexible array bounds (regression from GCC 9)

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95072

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
The warning is still present in GCC 12.  I'm no longer working on it.

[Bug middle-end/95189] [9 Regression] memcmp being wrongly stripped like strcmp

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #32 from Martin Sebor  ---
I'm not planning to backport the patch.

[Bug c/96171] [10 Regression] ICE on invalid VLA argument declaration and attribute access

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96171

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I'm no longer planning to backport the fix.

[Bug tree-optimization/96963] [10 Regression] -Wstringop-overflow false positive on -O3 or -O2 -ftree-vectorize when assigning consecutive char struct members

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96963

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW

--- Comment #14 from Martin Sebor  ---
I'm no longer planning to backport this.

[Bug c/101289] [11 Regression] bogus -Wvla-paramater warning when using const for vla param

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101289
Bug 101289 depends on bug 97548, which changed state.

Bug 97548 Summary: [11 Regression] bogus -Wvla-parameter on a bound expression 
involving a parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97548

   What|Removed |Added

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

[Bug c/101604] [meta-bug] bogus/missing -Wvla-parameter

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101604
Bug 101604 depends on bug 97548, which changed state.

Bug 97548 Summary: [11 Regression] bogus -Wvla-parameter on a bound expression 
involving a parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97548

   What|Removed |Added

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

[Bug c/97548] [11 Regression] bogus -Wvla-parameter on a bound expression involving a parameter

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97548

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
Fixed.

[Bug tree-optimization/97631] [10 Regression] bogus "writing one too many bytes" warning for memcpy with strlen argument

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97631

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Sebor  ---
I'm no longer planning to backport the fix.

[Bug tree-optimization/99121] [9/10/11 Regression] ICE tree check: expected integer_cst, have var_decl in get_len, at tree.h:6037

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99121

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
Fixed in GCC 12.  It could be fixed on release branches but I'm no longer
working on it.

[Bug c/99295] [9 Regression] documentation on __attribute__((malloc)) is wrong

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99295

Martin Sebor  changed:

   What|Removed |Added

   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org
 Status|ASSIGNED|RESOLVED
 CC|msebor at gcc dot gnu.org  |
 Resolution|--- |FIXED

--- Comment #11 from Martin Sebor  ---
Fixed.

[Bug tree-optimization/99475] [10/11 Regression] bogus -Warray-bounds accessing an array element of empty structs

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99475

Martin Sebor  changed:

   What|Removed |Added

   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org
Summary|[10/11/12 Regression] bogus |[10/11 Regression] bogus
   |-Warray-bounds accessing an |-Warray-bounds accessing an
   |array element of empty  |array element of empty
   |structs |structs
  Known to work||12.0
 Status|ASSIGNED|NEW

--- Comment #4 from Martin Sebor  ---
This has been fixed in GCC 12.  I'm not planning to backport it.

[Bug middle-end/104971] [9/10/11/12 Regression] Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

Jakub Jelinek  changed:

   What|Removed |Added

 CC||vmakarov at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Might be useful to drop the builtin on the floor during expansion if it doesn't
have lhs as an optimization (I think it is intentionally not const or pure
because it depends on any code that sets the flags; though it seems rather
poorly defined because we don't have any dependencies on the surrounding code,
but after all, user can't know what arithmetic instruction that modifies flags
we decide to use last before the builtin).
That said, LRA shouldn't optimize away instructions like:
(insn 6 5 0 2 (set (reg:DI 82)
(mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8])) "pr104971.c":3:14 62
{*popdi1}
 (expr_list:REG_UNUSED (reg:DI 82)
(nil)))
just because they are unused, because they have side-effects.

[Bug middle-end/101665] -fno-delete-null-pointer checks ineffective for attribute nonnull parameters

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101665

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/104069] -Werror=use-after-free false positive on elfutils-0.186

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104069

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #22 from Martin Sebor  ---
I'm no longer working on this.

[Bug middle-end/104076] bogus -Wdangling-pointer on a conditional

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104076

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Sebor  ---
I'm no longer working on this.

[Bug tree-optimization/84050] [9/10/11/12 Regression] missing -Warray-bounds accessing a struct array member

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84050

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #12 from Martin Sebor  ---
I'm no longer working on this.

[Bug c++/84318] [9/10/11/12 Regression] attribute deprecated on function templates different than class templates

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84318

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Sebor  ---
I'm no longer working on this.

[Bug c++/83430] missing warning for specifying larger snprintf bound than destination size

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83430

Martin Sebor  changed:

   What|Removed |Added

 CC|msebor at gcc dot gnu.org  |
   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org
 Status|ASSIGNED|NEW
 Blocks||85741

--- Comment #3 from Martin Sebor  ---
I'm no longer working on this.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85741
[Bug 85741] [meta-bug] bogus/missing -Wformat-overflow

[Bug tree-optimization/80420] missing -Wformat-overfow on snprintf with excessive bound

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80420

Martin Sebor  changed:

   What|Removed |Added

 Blocks||85741
 Status|ASSIGNED|NEW

--- Comment #1 from Martin Sebor  ---
I'm no longer working on this.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85741
[Bug 85741] [meta-bug] bogus/missing -Wformat-overflow

[Bug c++/70588] SIGBUS on a VLA larger than SIZE_MAX / 2

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70588

Martin Sebor  changed:

   What|Removed |Added

   Assignee|msebor at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org

--- Comment #14 from Martin Sebor  ---
I'm no longer working on this.

[Bug c++/70076] no exception for excess initializer elements in a multidimensional VLA

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70076

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #8 from Martin Sebor  ---
I'm no longer working on this.

[Bug c/67872] missing -Warray-bounds warning, bogus -Wmaybe-uninitialized

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67872

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Sebor  ---
I'm no longer working on this.

[Bug preprocessor/41540] -dM -E doesn't #define __FILE__

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41540

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Sebor  ---
No longer working on this.

[Bug tree-optimization/40635] [12 Regression] bogus name and location in 'may be used uninitialized' warning

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40635

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #21 from Martin Sebor  ---
Deferring to Andrew per comment #19.

[Bug lto/102426] [12 regression] Fix for PR 49664 breaks Solaris bootstrap with gld

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102426

--- Comment #9 from Jakub Jelinek  ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #8)
> > --- Comment #7 from Jakub Jelinek  ---
> > So, shouldn't we instead of the -export-symbols-regex use a version script?
> 
> We certainly could, but IIUC this would lose the functionality on
> non-ELF targets that do support -export-symbols-regex in a different
> way.  No idea if this is deemed acceptable...

The world doesn't end if other symbols are exported, it worked that way for
years.
Perhaps we could test in configure whether -export-symbols-regex works and only
use a fallback if it doesn't?  Or decide it based on target triplet,
do those GNU and SUN version script checks and if neither of them works, fall
back to -export-symbols-regex ?
gld supports version scripts like:
{ global: onload; local: *; };
which makes onload a non-versioned GLOBAL symbol while everything else LOCAL,
does Sun ld support that too or similar?

[Bug tree-optimization/104969] Likely a false positive of -D_FORTIFY_SOURCE=3

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104969

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor  ---
That's not the intended reading of the POSIX text.  But (outside of extensions
for behavior C leaves undefined) POSIX defers to C, so the authoritative text
is there.  C doesn't impose any requirement on the size argument.

That said, specifying a snprintf size that's bigger than the space in the
provided buffer is certainly asking for trouble, even more so than doing the
same with strncmp.  GCC should be enhanced to warn about that when possible
(pr83430 tracks the request), although I suspect that wouldn't help in this
case.

For the constant subset of instances Clang issues warning: 'snprintf' size
argument is too large; destination buffer has size 4, but size argument is 7
[-Wfortify-source].

[Bug lto/102426] [12 regression] Fix for PR 49664 breaks Solaris bootstrap with gld

2022-03-17 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102426

--- Comment #8 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #7 from Jakub Jelinek  ---
> So, shouldn't we instead of the -export-symbols-regex use a version script?

We certainly could, but IIUC this would lose the functionality on
non-ELF targets that do support -export-symbols-regex in a different
way.  No idea if this is deemed acceptable...

> We have it in multiple lib* directories, so presumably it should work 
> reliably.
> Say the version script in libssp/ is quite simple, small configure.ac hunk,
> small Makefile.am hunk, small version script.

We could even simplify the libssp example: given that we only want to
export one single symbol, we don't need the make_sunver.pl magic, only
the difference between -Wl,--version-script and -Wl,-M.

Just in case you wonder, we still need that script for libssp on
Solaris: mempcpy and thus __mempcpy_chk don't exist on Solaris, thus
that symbol needs to be filtered from ssp.map.

I long meant to unify all those instances of version script handling,
but that turned out to be a terrible can of worms and is certainly not
GCC 12 material.

[Bug middle-end/104971] [9/10/11/12 Regression] Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|--- |9.5
Summary|Optimisation for|[9/10/11/12 Regression]
   |__builtin_ia32_readeflags   |Optimisation for
   |corrupts the stack  |__builtin_ia32_readeflags
   ||corrupts the stack
 CC||jakub at gcc dot gnu.org
   Priority|P3  |P2

--- Comment #1 from Jakub Jelinek  ---
The builtin has been implemented in
r0-127024-g9bbd48d120d203e8eade09e0bb830370b6d69801
and the pop is optimized away with pushf kept since
r5-4951-g4ab74a01477d4089a3474d52479ed372c9b5ae29
so this is a regression from GCC 4.9.

[Bug middle-end/104971] New: Optimisation for __builtin_ia32_readeflags corrupts the stack

2022-03-17 Thread andrew.cooper3 at citrix dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971

Bug ID: 104971
   Summary: Optimisation for __builtin_ia32_readeflags corrupts
the stack
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andrew.cooper3 at citrix dot com
  Target Milestone: ---

Full example: https://godbolt.org/z/xGq3c4Mnc

Given:

int broken(void)
{
int fl = __builtin_ia32_readeflags_u64();
}

gcc -O2 generates:

broken:
pushfq
ret

Which is going explode very quickly.

Code generation appears to be safe without optimisation, but even -O alone is
enough to create problems.

At a guess, the optimiser has concluded that the result is unused, drops the
`pop %reg`, but fails to also drop the `pushf` too.

Looking through history on Godbolt, it appears that GCC 4.9 (which introduced
this builtin) has correct optimised code generation, and it regressed between
4.9 and 5.1.

[Bug libstdc++/92546] Large increase in preprocessed file sizes in C++2a mode

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92546

--- Comment #26 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:00df7ee4474faca91d3460fe78a88e280c6c1126

commit r12-7691-g00df7ee4474faca91d3460fe78a88e280c6c1126
Author: Jonathan Wakely 
Date:   Thu Mar 17 14:36:07 2022 +

libstdc++: Avoid including  in  [PR92546]

This only affects Windows, but reduces the preprocessed size of
 significantly.

libstdc++-v3/ChangeLog:

PR libstdc++/92546
* include/bits/fs_path.h (path::make_preferred): Use
handwritten loop instead of std::replace.

[Bug middle-end/104966] [11/12 Regression] Yet another bogus -Warray-bounds warning in libstdc++ headers

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104966

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:38ce4489635f2d65de965af3ec5d5c4adf7762d9

commit r12-7690-g38ce4489635f2d65de965af3ec5d5c4adf7762d9
Author: Jonathan Wakely 
Date:   Thu Mar 17 13:33:07 2022 +

libstdc++: Rewrite __moneypunct_cache::_M_cache [PR104966]

GCC thinks the following can lead to a buffer overflow when __ns.size()
equals zero:

  const basic_string<_CharT>& __ns = __mp.negative_sign();
  _M_negative_sign_size = __ns.size();
  __negative_sign = new _CharT[_M_negative_sign_size];
  __ns.copy(__negative_sign, _M_negative_sign_size);

This happens because operator new might be replaced with something that
writes to this->_M_negative_sign_size and so the basic_string::copy call
could use a non-zero size to write to a zero-length buffer.

The solution suggested by Richi is to cache the size in a local variable
so that the compiler knows it won't be changed between the allocation
and the copy.

This commit goes further and rewrites the whole function to use RAII and
delay all modifications of *this until after all allocations have
succeeded. The RAII helper type caches the size and copies the string
and owns the memory until told to release it.

libstdc++-v3/ChangeLog:

PR middle-end/104966
* include/bits/locale_facets_nonio.tcc
(__moneypunct_cache::_M_cache): Replace try-catch with RAII and
make all string copies before any stores to *this.

[Bug target/104688] gcc and libatomic can use SSE for 128-bit atomic loads on Intel CPUs with AVX

2022-03-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:1d47c0512a265d4bb3ab9e56259fd1e4f4d42c75

commit r12-7689-g1d47c0512a265d4bb3ab9e56259fd1e4f4d42c75
Author: Jakub Jelinek 
Date:   Thu Mar 17 18:49:00 2022 +0100

libatomic: Improve 16-byte atomics on Intel AVX [PR104688]

As mentioned in the PR, the latest Intel SDM has added:
"Processors that enumerate support for Intel® AVX (by setting the feature
flag CPUID.01H:ECX.AVX[bit 28])
guarantee that the 16-byte memory operations performed by the following
instructions will always be
carried out atomically:
⢠MOVAPD, MOVAPS, and MOVDQA.
⢠VMOVAPD, VMOVAPS, and VMOVDQA when encoded with VEX.128.
⢠VMOVAPD, VMOVAPS, VMOVDQA32, and VMOVDQA64 when encoded with EVEX.128
and k0 (masking disabled).
(Note that these instructions require the linear addresses of their memory
operands to be 16-byte
aligned.)"

The following patch deals with it just on the libatomic library side so
far,
currently (since ~ 2017) we emit all the __atomic_* 16-byte builtins as
library calls since and this is something that we can hopefully backport.

The patch simply introduces yet another ifunc variant that takes priority
over the pure CMPXCHG16B one, one that checks AVX and CMPXCHG16B bits and
on non-Intel clears the AVX bit during detection for now (if AMD comes
with the same guarantee, we could revert the config/x86/init.c hunk),
which implements 16-byte atomic load as vmovdqa and 16-byte atomic store
as vmovdqa followed by mfence.

2022-03-17  Jakub Jelinek  

PR target/104688
* Makefile.am (IFUNC_OPTIONS): Change on x86_64 to -mcx16 -mcx16.
(libatomic_la_LIBADD): Add $(addsuffix _16_2_.lo,$(SIZEOBJS)) for
x86_64.
* Makefile.in: Regenerated.
* config/x86/host-config.h (IFUNC_COND_1): For x86_64 define to
both AVX and CMPXCHG16B bits.
(IFUNC_COND_2): Define.
(IFUNC_NCOND): For x86_64 define to 2 * (N == 16).
(MAYBE_HAVE_ATOMIC_CAS_16, MAYBE_HAVE_ATOMIC_EXCHANGE_16,
MAYBE_HAVE_ATOMIC_LDST_16): Define to IFUNC_COND_2 rather than
IFUNC_COND_1.
(HAVE_ATOMIC_CAS_16): Redefine to 1 whenever IFUNC_ALT != 0.
(HAVE_ATOMIC_LDST_16): Redefine to 1 whenever IFUNC_ALT == 1.
(atomic_compare_exchange_n): Define whenever IFUNC_ALT != 0
on x86_64 for N == 16.
(__atomic_load_n, __atomic_store_n): Redefine whenever IFUNC_ALT ==
1
on x86_64 for N == 16.
(atomic_load_n, atomic_store_n): New functions.
* config/x86/init.c (__libat_feat1_init): On x86_64 clear bit_AVX
if CPU vendor is not Intel.

[Bug tree-optimization/104970] ICE in execute_todo, at passes.cc:2133 since r12-6480-gea19c8f33a3a8d2b

2022-03-17 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970

Siddhesh Poyarekar  changed:

   What|Removed |Added

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

--- Comment #1 from Siddhesh Poyarekar  ---
Looks like a codegen issue with parm_object_size; it's referring to a
non-existent SSA name.  I'll take a look at it first thing on Tuesday.

[Bug tree-optimization/104969] Likely a false positive of -D_FORTIFY_SOURCE=3

2022-03-17 Thread siddhesh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104969

--- Comment #2 from Siddhesh Poyarekar  ---
(In reply to Martin Liška from comment #0)
> The original code is defective a bit as it wrongly assumes that
> (char*)str + (2 * i) is at maximum 'len' big. It's actually len - (2 * i)
> big. But it should be still valid code, am I right?

It doesn't overflow in this case, but specifying a length larger than the
actual buffer size is a standard violation.

"""
The snprintf() function shall be equivalent to sprintf(), with the addition of
the n argument which states the size of the buffer referred to by s. If n is
zero, nothing shall be written and s may be a null pointer. Otherwise, output
bytes beyond the n-1st shall be discarded instead of being written to the
array, and a null byte is written at the end of the bytes actually written into
the array.
"""

https://pubs.opengroup.org/onlinepubs/9699919799/functions/snprintf.html

[Bug fortran/103039] [12 Regression] Segfault with openmp block within a select type block since r12-1016-g0e3b3b77e13cac76

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103039

--- Comment #6 from Jakub Jelinek  ---
unshare_expr doesn't do anything wrong.
The problem is that because of the select we have firstprivate(__tmp_class_a)
clause where __tmp_class_a has type which has struct __class_seltype_A_p *
type.  Before the r12-1016 change, we clearly firstprivatized that var
because gfc_omp_clause_copy_ctor just did:
return build2_v (MODIFY_EXPR, dest, src);
for that case, so emitted:
D.4011 = .omp_data_i->__tmp_class_a;
__tmp_class_a = D.4011;
which essentially means that the __tmp_class_a var (the pointer) was
privatized, but what it points to was shared.
Now, since r12-1016 it copies various elements the pointer points to
from what the source pointer points to to what the destination pointer points
to.
But we don't really initialize what dest points to first.
I bet we want to privatize what the pointer points to, so we need to emit
something like:
  __class_seltype_A_p temp;
  __tmp_class_a = 
  __tmp_class_a->vptr = .omp_data_i->__tmp_class_a->vptr;
etc. (not gimplified form).
I think the way to achieve this would be make sure to return true from the
gfc_omp_privatize_by_reference hook.

Tobias, can you please have a look?

[Bug rtl-optimization/104961] [9/10/11/12 Regression] compilation never (?) finishes at -Og

2022-03-17 Thread vmakarov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104961

--- Comment #2 from Vladimir Makarov  ---
I've reproduced the bug.  The mentioned patch is not the cause but a trigger. 
The origin of the problem is actually a removal of hard reg propagation before
RA which happened about year ago.

I hope the fix will be ready on Friday or Monday.

[Bug middle-end/104965] [11/12 Regression] Yet another -Warray-bounds false positive

2022-03-17 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104965

Martin Sebor  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor  ---
It looks like an escape analysis limitation.  With this simpler test case using
different types to rule out aliasing assumptions:

#include 

int main()
{
  std::basic_string s;
  auto p = new int[s.size ()]{ };
  char c = 0;
  if (s.size())
c = *p;
  delete[] p;
  return c;
}

pr104965.C:9:9: warning: array subscript 0 is outside array bounds of ‘void
[0]’ [-Warray-bounds]
9 | c = *p;
  | ^~
pr104965.C:6:34: note: object of size 0 allocated by ‘operator new []’
6 |   auto p = new short[s.size ()]{ };
  |  ^

One of the stores to the local s escapes its address which is then assumed to
have been clobbered by operator new:

   [local count: 1073741824]:
  s ={v} {CLOBBER};
  MEM[(struct _Alloc_hider *)] ={v} {CLOBBER};
  MEM[(struct _Alloc_hider *)]._M_p = _M_local_buf;
  s._M_string_length = 0;
  MEM[(char_type &) + 16] = 0;
  _5 = operator new [] (0);

   [local count: 1073741824]:
  _10 = s._M_string_length;
  if (_10 != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 536870913]:
  _1 = MEM[(int *)_5];
  c_6 = (char) _1;

[Bug tree-optimization/104970] ICE in execute_todo, at passes.cc:2133 since r12-6480-gea19c8f33a3a8d2b

2022-03-17 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P1
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2022-03-17
   Target Milestone|--- |12.0

[Bug tree-optimization/104970] New: ICE in execute_todo, at passes.cc:2133 since r12-6480-gea19c8f33a3a8d2b

2022-03-17 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970

Bug ID: 104970
   Summary: ICE in execute_todo, at passes.cc:2133 since
r12-6480-gea19c8f33a3a8d2b
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: siddhesh at gcc dot gnu.org
  Target Milestone: ---

The following is reduced from libmsym package:

$ cat linalg.i
__inline void
memset2(void *__dest, int __ch, long __len) {
  long __trans_tmp_1 = __builtin_dynamic_object_size(__dest, 0);
  __builtin___memset_chk(__dest, __ch, __len, __trans_tmp_1);
}

void
mleye(int l, double E[][l]) { memset2(E, 0, sizeof(double)); }

$ gcc linalg.i -c -D_FORTIFY_SOURCE=2 -O
during GIMPLE pass: objsz
linalg.i: In function ‘mleye’:
linalg.i:8:1: internal compiler error: in execute_todo, at passes.cc:2133
8 | mleye(int l, double E[][l]) { memset2(E, 0, sizeof(double)); }
  | ^
0x75edfa execute_todo
/home/marxin/Programming/gcc/gcc/passes.cc:2133
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/98198] [11/12 Regression] internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in decl_or_type_attrs

2022-03-17 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98198

Roger Sayle  changed:

   What|Removed |Added

   Target Milestone|11.3|12.0
 CC||roger at nextmovesoftware dot 
com
 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #8 from Roger Sayle  ---
This has now been fixed on mainline.

[Bug target/102772] [12 regression] g++.dg/torture/pr80334.C FAILs

2022-03-17 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102772

--- Comment #9 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #8 from Jakub Jelinek  ---
> Does libgomp.fortran/pointer2.f90 still FAIL?

It does.

[Bug target/94680] Missed optimization with __builtin_shuffle and zero vector

2022-03-17 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94680

Roger Sayle  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
 Resolution|--- |FIXED
 CC||roger at nextmovesoftware dot 
com
 Status|NEW |RESOLVED

--- Comment #7 from Roger Sayle  ---
This has been fixed since Hongtao's patch last year.  But the single
remaining case has now been fully optimized with:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=732e4a75fe792182f171bba348a665e8b8d21176
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591788.html

[Bug target/104968] [nvptx][OpenMP] SIGSEGV / ICE in final_scan_insn_1

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104968

--- Comment #4 from Tom de Vries  ---
This ( https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591912.html )
proposed patch fixes this ICE, pinged again.

[Bug target/102772] [12 regression] g++.dg/torture/pr80334.C FAILs

2022-03-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102772

--- Comment #8 from Jakub Jelinek  ---
Does libgomp.fortran/pointer2.f90 still FAIL?

[Bug target/104968] [nvptx][OpenMP] SIGSEGV / ICE in final_scan_insn_1

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104968

--- Comment #3 from Tom de Vries  ---
(In reply to Tom de Vries from comment #2)
> (In reply to Tom de Vries from comment #1)
> > Can't reproduce.
> > 
> > It this not fixed by:
> > ...
> > commit 7862f6ccd85a001e4d70abb00bb95d8c7846ba80
> > Author: Tom de Vries 
> > Date:   Wed Feb 23 09:33:33 2022 +0100
> > 
> > [nvptx] Fix dummy location in gen_comment
> > ...
> > ?
> 
> Hmm, wait, of course I have a patch in my stack that's pending for upstream.
> Let me undo that one and retry.

Ack, reproduced.

[Bug target/104968] [nvptx][OpenMP] SIGSEGV / ICE in final_scan_insn_1

2022-03-17 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104968

--- Comment #2 from Tom de Vries  ---
(In reply to Tom de Vries from comment #1)
> Can't reproduce.
> 
> It this not fixed by:
> ...
> commit 7862f6ccd85a001e4d70abb00bb95d8c7846ba80
> Author: Tom de Vries 
> Date:   Wed Feb 23 09:33:33 2022 +0100
> 
> [nvptx] Fix dummy location in gen_comment
> ...
> ?

Hmm, wait, of course I have a patch in my stack that's pending for upstream.
Let me undo that one and retry.

[Bug tree-optimization/104931] [9/10/11 Regression] wrong-code with number_of_iterations_lt_to_ne

2022-03-17 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104931

--- Comment #10 from Richard Biener  ---
The bug also shows in a -flto-partition=max build where the offending function
ends up in ltrans unit 23 (and only this function) which might enable
side-by-side debugging if desired.

  1   2   >