[Bug ipa/98222] [11 Regression] ICE at -O3 on x86_64-pc-linux-gnu: verify_cgraph_node failed since r11-4267-g0e590b68fa374365

2021-01-13 Thread jamborm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98222

Martin Jambor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Jambor  ---
I'll have a look

[Bug c++/98641] Feature request: implement pointer alignment builtins

2021-01-13 Thread Alexander.Richardson at cl dot cam.ac.uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Alex Richardson  changed:

   What|Removed |Added

 CC||Alexander.Richardson at cl dot 
cam
   ||.ac.uk

--- Comment #5 from Alex Richardson  
---
In clang __builtin_assume_aligned will not be used by the constant expression
evaluator, but it will be used for code generation: for example,

_Bool check(void* x) {
return __builtin_is_aligned(__builtin_assume_aligned(x, 16), 16);
}

is folded to "return true", but something like

extern int i;
_Static_assert(__builtin_is_aligned(__builtin_assume_aligned(&i, 16), 8), "");
generates an "alignment of the base pointee object (4 bytes) is less than the
asserted 16 byte" error when evaluating __builtin_assume_aligned().

https://godbolt.org/z/96h6j1

[Bug tree-optimization/92645] Hand written vector code is 450 times slower when compiled with GCC compared to Clang

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92645

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

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

commit r11-6644-g3ddc18251a821fe69d6229abbf83d77284d2340a
Author: Richard Biener 
Date:   Wed Jan 13 12:40:01 2021 +0100

tree-optimization/92645 - improve SLP with existing vectors

This improves SLP discovery in the face of existing vectors allowing
punning of the vector shape (or even punning from an integer type).
For punning from integer types this does not yet handle lane zero
extraction being represented as conversion rather than BIT_FIELD_REF.

2021-01-13  Richard Biener  

PR tree-optimization/92645
* tree-vect-slp.c (vect_build_slp_tree_1): Relax supported
BIT_FIELD_REF argument.
(vect_build_slp_tree_2): Record the desired vector type
on the external vector def.
(vectorizable_slp_permutation): Handle required punning
of existing vector defs.

* gcc.target/i386/pr92645-6.c: New testcase.

[Bug c++/98626] UBSAN: vec.h:591:30: runtime error: member access within null pointer of type 'struct vec'

2021-01-13 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98626

Nathan Sidwell  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #1 from Nathan Sidwell  ---
magic configure: --with-build-config=bootstrap-ubsan

[Bug fortran/89204] -floop-interchange has no effect on Fortran code

2021-01-13 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89204

Dominique d'Humieres  changed:

   What|Removed |Added

 Resolution|WORKSFORME  |---
 Status|RESOLVED|WAITING

--- Comment #4 from Dominique d'Humieres  ---
> Works for me

What is working for you?

With the original fortran test I get

% gfc pr89204.f90 -O2 -floop-interchange
% time ./a.out
35.970u 0.081s 0:36.76 98.0%0+0k 0+0io 0pf+0w

If I move the 'i' do loop inside the nested loops I get

% gfc pr89204_db.f90 -O2
% time ./a.out
8.124u 0.025s 0:08.76 92.9% 0+0k 0+0io 0pf+0w

[Bug debug/98656] [9/10/11 Regression] switchlower_O0 drops line number of switch

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98656

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-01-13
 Ever confirmed|0   |1

--- Comment #2 from Martin Liška  ---
(In reply to Tom de Vries from comment #1)
> Created attachment 49959 [details]
> Tentative patch
> 
> Using this tentative patch, I get back the .loc for line number 5:
> ...
> foo:
> .LFB0:
> .file 1 "small.c"
> .loc 1 4 1
> .cfi_startproc
> pushq   %rbp
> .cfi_def_cfa_offset 16
> .cfi_offset 6, -16
> movq%rsp, %rbp
> .cfi_def_cfa_register 6
> movl%edi, -20(%rbp)
> movl%esi, -24(%rbp)
> .loc 1 5 3
> cmpl$4, -20(%rbp)
> ja  .L13
> ...

I support the patch Tom.
Thanks for looking into it.

[Bug fortran/94464] [F08] coarrays shoud be enabled by default.

2021-01-13 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94464

Dominique d'Humieres  changed:

   What|Removed |Added

 Resolution|WORKSFORME  |---
 Status|RESOLVED|WAITING

--- Comment #5 from Dominique d'Humieres  ---
> Works for me

What is working for you?

[Bug tree-optimization/98597] [11 Regression] ICE in print_mem_ref since r11-6508-gabb1b6058c09a7c0

2021-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98597

--- Comment #7 from Jakub Jelinek  ---
Example where the new code gets it all wrong
struct S { char a; int b; char c; unsigned d; };
struct T { char t; struct S u; int v; };
typedef short U[2][2];
void baz (U *);

static inline int
bar (char *p)
{
  return *(int *) p;
}

void
foo (int *q)
{
  struct T t;
  t.t = 1;
  t.u.c = 2;
  char *p = (char *) &t;
  q[0] = bar (p + __builtin_offsetof (struct T, u.b));
  q[1] = bar (p + __builtin_offsetof (struct T, u.d));
  q[2] = bar (p + __builtin_offsetof (struct T, v));
  int s[3];
  s[0] = 1;
  char *r = (char *) s;
  q[3] = bar (r + sizeof (int));
  U u[2], v[2];
  u[0][0][0] = 1;
  __builtin_memcpy (&v[1], &u[1], sizeof (U));
  baz (&v[1]);
}

It is true that old MEM_REF printing wasn't correct either:
test.c:19:8: warning: ‘*((void *)&t+8)’ is used uninitialized in this function
[-Wuninitialized]
test.c:20:8: warning: ‘*((void *)&t+16)’ is used uninitialized in this function
[-Wuninitialized]
test.c:21:8: warning: ‘*((void *)&t+20)’ is used uninitialized in this function
[-Wuninitialized]
test.c:25:8: warning: ‘*((void *)&s+4)’ is used uninitialized in this function
[-Wuninitialized]
test.c:28:3: warning: ‘*((void *)&u+8)’ is used uninitialized in this function
[-Wuninitialized]
- it would have been ugly but correct if it used char * instead of void * and
then added another cast to the MEM_REF type.
The new code prints:
test.c:19:8: warning: ‘((int*)t) + 2’ is used uninitialized [-Wuninitialized]
test.c:20:8: warning: ‘((int*)t) + 4’ is used uninitialized [-Wuninitialized]
test.c:21:8: warning: ‘((int*)t) + 5’ is used uninitialized [-Wuninitialized]
test.c:25:8: warning: ‘s + 1’ is used uninitialized [-Wuninitialized]
test.c:28:3: warning: ‘((long unsigned int*)u) + 1’ is used uninitialized
[-Wuninitialized]
Huh!  (int*)t is invalid C (in C++ perhaps there could be an operator for it),
and the result is a pointer anyway.  s + 1 is valid, but again s + 1 is not
uninitialized, it is s[1].  Similarly for u.

[Bug target/98657] SVE: ICE (unrecognizable insn) wtih shift at -O3 -msve-vector-bits=256

2021-01-13 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98657

--- Comment #1 from Alex Coplan  ---
Slightly cleaner testcase:

extern char a[];
void b(_Bool c[][18]) {
  int d;
  for (int e = 0; e < 23; e++)
a[e] = 6 >> c[1][d];
}

[Bug target/98657] SVE: ICE (unrecognizable insn) wtih shift at -O3 -msve-vector-bits=256

2021-01-13 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98657

Alex Coplan  changed:

   What|Removed |Added

  Known to fail||11.0
 Target||aarch64
   Keywords||ice-on-valid-code
   Target Milestone|--- |11.0
 CC||rsandifo at gcc dot gnu.org

[Bug target/98657] New: SVE: ICE (unrecognizable insn) wtih shift at -O3 -msve-vector-bits=256

2021-01-13 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98657

Bug ID: 98657
   Summary: SVE: ICE (unrecognizable insn) wtih shift at -O3
-msve-vector-bits=256
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat test.c
extern char a[];
void b(_Bool c[][18]) {
  for (int d;;)
for (int e = 0; e < 23; e += 1)
  a[e] = 6 >> c[1][d];
}
$ aarch64-elf-gcc -c test.c -O3 -march=armv8.2-a+sve -msve-vector-bits=256
test.c: In function 'b':
test.c:6:1: error: unrecognizable insn:
6 | }
  | ^
(insn 34 33 35 5 (set (reg:VNx16QI 132)
(unspec:VNx16QI [
(reg:VNx16BI 133)
(vec_duplicate:VNx16QI (mem:QI (plus:DI (reg/f:DI 128)
(reg:DI 129)) [1 MEM[(_Bool[18] *)c_9(D) +
18B][d_10(D)]+0 S1 A8]))
(const_vector:VNx16QI [
(const_int 0 [0]) repeated x32
])
] UNSPEC_SEL)) "test.c":5:16 -1
 (nil))
during RTL pass: vregs
test.c:6:1: internal compiler error: in extract_insn, at recog.c:2769
0xd621cd _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/home/alecop01/toolchain/src/gcc/gcc/rtl-error.c:108
0xd621ec _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
/home/alecop01/toolchain/src/gcc/gcc/rtl-error.c:116
0xd3217f extract_insn(rtx_insn*)
/home/alecop01/toolchain/src/gcc/gcc/recog.c:2769
0xa540b1 instantiate_virtual_regs_in_insn
/home/alecop01/toolchain/src/gcc/gcc/function.c:1609
0xa540b1 instantiate_virtual_regs
/home/alecop01/toolchain/src/gcc/gcc/function.c:1983
0xa540b1 execute
/home/alecop01/toolchain/src/gcc/gcc/function.c:2032
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug other/86656] [meta-bug] Issues found with -fsanitize=address

2021-01-13 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86656
Bug 86656 depends on bug 78746, which changed state.

Bug 78746 Summary: charlen_03, charlen_10 ICE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78746

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

[Bug fortran/89891] [meta-bug] Accessing memory in rejected statements or expressions

2021-01-13 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89891
Bug 89891 depends on bug 78746, which changed state.

Bug 78746 Summary: charlen_03, charlen_10 ICE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78746

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

[Bug fortran/78746] charlen_03, charlen_10 ICE

2021-01-13 Thread dominiq at lps dot ens.fr via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78746

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #27 from Dominique d'Humieres  ---
At revision r11-6550 my instrumented compiler gives:

pr78746.f90:5:40:

5 |   character(:), allocatable :: x(n) ! { dg-error "must have a
deferred shape" }
  |1
Error: Allocatable component of structure at (1) must have a deferred shape
=
==33829==ERROR: AddressSanitizer: heap-use-after-free on address 0x60400ee8
at pc 0x000100423feb bp 0x7ffeefbfe3b0 sp 0x7ffeefbfe3a8
READ of size 8 at 0x60400ee8 thread T0
...

[Bug debug/98656] [9/10/11 Regression] switchlower_O0 drops line number of switch

2021-01-13 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98656

--- Comment #1 from Tom de Vries  ---
Created attachment 49959
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49959&action=edit
Tentative patch

Using this tentative patch, I get back the .loc for line number 5:
...
foo:
.LFB0:
.file 1 "small.c"
.loc 1 4 1
.cfi_startproc
pushq   %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq%rsp, %rbp
.cfi_def_cfa_register 6
movl%edi, -20(%rbp)
movl%esi, -24(%rbp)
.loc 1 5 3
cmpl$4, -20(%rbp)
ja  .L13
...

[Bug tree-optimization/98655] ICE: verify_gimple failed (error: integral result type precision does not match field size of 'bit_field_ref')

2021-01-13 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98655

--- Comment #2 from Arseny Solokha  ---
My configuration is 32-bit BE.

[Bug tree-optimization/92645] Hand written vector code is 450 times slower when compiled with GCC compared to Clang

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92645

--- Comment #24 from Richard Biener  ---
Created attachment 49958
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49958&action=edit
unincluded GCC source

The GCC source no longer compiles due to missing changes in the x86 intrinsic
includes in the preprocessed source:

...
/aux/hubicka/trunk-install2/lib/gcc/x86_64-pc-linux-gnu/10.0.0/include/avx512vlbwintrin.h:
In function 'void _mm_mask_cvtsepi16_storeu_epi8(void*, __mmask8, __m128i)':
/aux/hubicka/trunk-install2/lib/gcc/x86_64-pc-linux-gnu/10.0.0/include/avx512vlbwintrin.h:258:38:
error: cannot convert '__v8qi*' to 'long long unsigned int*'
: note:   initializing argument 1 of 'void
__builtin_ia32_pmovswb128mem_mask(long long unsigned int*, __vector(8) short
int, unsigned char)'
In file included from
/aux/hubicka/trunk-install2/lib/gcc/x86_64-pc-linux-gnu/10.0.0/include/immintrin.h:69,
 from
/aux/hubicka/firefox-2019-2/gfx/skia/skia/src/opts/SkOpts_
...

attached unincluded source that can be compiled with trunk and GCC 10
when using -march=haswell

[Bug target/95905] Failure to optimize _mm_unpacklo_epi8 with 0 as right operand to _mm_cvtepu8_epi16

2021-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95905

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #4 from Jakub Jelinek  ---
Fixed.

[Bug target/95905] Failure to optimize _mm_unpacklo_epi8 with 0 as right operand to _mm_cvtepu8_epi16

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95905

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

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

commit r11-6636-gb1d1e2b54c6b9cf13f021176ba37d24cc4dc2fe1
Author: Jakub Jelinek 
Date:   Wed Jan 13 11:28:48 2021 +0100

i386, expand: Optimize also 256-bit and 512-bit permutatations as vpmovzx
if possible [PR95905]

The following patch implements what I've talked about, i.e. to no longer
force operands of vec_perm_const into registers in the generic code, but
let
each of the (currently 8) targets force it into registers individually,
giving the targets better control on if it does that and when and allowing
them to do something special with some particular operands.
And then defines the define_insn_and_split for the 256-bit and 512-bit
permutations into vpmovzx* (only the bw, wd and dq cases, in theory we
could
add define_insn_and_split patterns also for the bd, bq and wq).

2021-01-13  Jakub Jelinek  

PR target/95905
* optabs.c (expand_vec_perm_const): Don't force v0 and v1 into
registers before calling targetm.vectorize.vec_perm_const, only
after
that.
* config/i386/i386-expand.c (ix86_vectorize_vec_perm_const): Handle
two argument permutation when one operand is zero vector and only
after that force operands into registers.
* config/i386/sse.md (*avx2_zero_extendv16qiv16hi2_1): New
define_insn_and_split pattern.
(*avx512bw_zero_extendv32qiv32hi2_1): Likewise.
(*avx512f_zero_extendv16hiv16si2_1): Likewise.
(*avx2_zero_extendv8hiv8si2_1): Likewise.
(*avx512f_zero_extendv8siv8di2_1): Likewise.
(*avx2_zero_extendv4siv4di2_1): Likewise.
* config/mips/mips.c (mips_vectorize_vec_perm_const): Force
operands
into registers.
* config/arm/arm.c (arm_vectorize_vec_perm_const): Likewise.
* config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Likewise.
* config/ia64/ia64.c (ia64_vectorize_vec_perm_const): Likewise.
* config/aarch64/aarch64.c (aarch64_vectorize_vec_perm_const):
Likewise.
* config/rs6000/rs6000.c (rs6000_vectorize_vec_perm_const):
Likewise.
* config/gcn/gcn.c (gcn_vectorize_vec_perm_const): Likewise.  Use
std::swap.

* gcc.target/i386/pr95905-2.c: Use scan-assembler-times instead of
scan-assembler.  Add tests with zero vector as first
__builtin_shuffle
operand.
* gcc.target/i386/pr95905-3.c: New test.
* gcc.target/i386/pr95905-4.c: New test.

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Liška  ---
Fixed.

[Bug tree-optimization/98455] [11 Regression] ICE: verify_gimple failed (error: invalid 'PHI' argument; error: incompatible types in 'PHI' argument 2) since r11-5642-gc961e94901eb793b

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98455

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Martin Liska :

https://gcc.gnu.org/g:7875e8dc831f30eec7203e090a209efe4c01a27d

commit r11-6635-g7875e8dc831f30eec7203e090a209efe4c01a27d
Author: Martin Liska 
Date:   Tue Jan 12 13:40:44 2021 +0100

if-to-switch: fix also virtual phis

gcc/ChangeLog:

PR tree-optimization/98455
* gimple-if-to-switch.cc (condition_info::record_phi_mapping):
Record also virtual PHIs.
(pass_if_to_switch::execute): Return TODO_cleanup_cfg only
conditionally.

gcc/testsuite/ChangeLog:

PR tree-optimization/98455
* gcc.dg/tree-ssa/pr98455.c: New test.

[Bug analyzer/98599] fatal error: Cgraph edge statement index out of range with -Os -flto -fanalyzer

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98599

--- Comment #7 from Martin Liška  ---
(In reply to David Malcolm from comment #4)
> I set them so that each stmt has a unique id, unique across all functions. 
> I was assuming from the comments I quoted above in gimple.h that this is
> safe to do, but it sounds like from your comment that WPA makes assumptions
> that the uids don't change.  If that's the case, then I need to rethink
> things, and the gimple.h comments probably need updating (or WPA needs to
> allow for uids to change, but maybe that's hard to do?)

So looking into the code, in WPA when we stream out cgraph_edge, we record to
which GIMPLE statement an edge points to:

gcc/lto-cgraph.c:264-265

and the info is later used in LTRANS where you see the fatal_error.

So I would recommend using a separate table where you will assign a unique ID
to statements. And please update the comment in gimple.h.

[Bug c++/98641] Feature request: implement pointer alignment builtins

2021-01-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

--- Comment #4 from Jonathan Wakely  ---
(In reply to Jakub Jelinek from comment #3)
> assume_aligned is something different, I guess __builtin_is_aligned expands
> to an actual runtime check (perhaps optimized away if the pointer can't be
> misaligned).

But we could do this:

--- a/libstdc++-v3/include/bits/align.h
+++ b/libstdc++-v3/include/bits/align.h
@@ -98,7 +98,7 @@ align(size_t __align, size_t __size, void*& __ptr, size_t&
__space) noexcept
{
  // This function is expected to be used in hot code, where
  // __glibcxx_assert would add unwanted overhead.
- _GLIBCXX_DEBUG_ASSERT((uintptr_t)__ptr % _Align == 0);
+ _GLIBCXX_DEBUG_ASSERT(__builtin_is_aligned(__ptr, _Align));
  return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align));
}
 }

[Bug c++/98641] Feature request: implement pointer alignment builtins

2021-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
assume_aligned is something different, I guess __builtin_is_aligned expands to
an actual runtime check (perhaps optimized away if the pointer can't be
misaligned).
So I guess __builtin_is_aligned (__builtin_assume_aligned (ptr, 32), 16) should
optimize to true...

I guess I have big questions on what exactly will it do during constexpr
evaluation - if it is on a pointer to object with certain alignment, for
smaller alignment arguments guess it is just like pointer arithmetics then, but
if it asks for larger alignment, shall it make it non-constant expression?

[Bug tree-optimization/98640] [10/11 Regression] GCC produces incorrect code with -O1 and higher since r10-2711-g3ed01d5408045d80

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98640

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

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

commit r11-6632-gffd28c265e6d611983cd27e9332dc799039a3f04
Author: Richard Biener 
Date:   Wed Jan 13 09:43:52 2021 +0100

tree-optimization/98640 - fix bogus sign-extension with VN

VN tried to express a sign extension from int to long of
a trucated quantity with a plain conversion but that loses the
truncation.  Since there's no single operand doing truncate plus
sign extend (there was a proposed SEXT_EXPR to do that at some
point mapping to RTL sign_extract) don't bother to appropriately
model this with two ops (which the VN insert machinery doesn't
handle and which is unlikely to CSE fully).

2021-01-13  Richard Biener  

PR tree-optimization/98640
* tree-ssa-sccvn.c (visit_nary_op): Do not try to
handle plus or minus from a truncated operand to be
sign-extended.

* gcc.dg/torture/pr98640.c: New testcase.

[Bug libstdc++/98471] libstdc++ fails to build with clang on windows because of filesystem bug

2021-01-13 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98471

--- Comment #3 from cqwrteur  ---
(In reply to Jonathan Wakely from comment #2)
> The bug is already assigned to me so I get emailed about all updates to the
> bug, so stop CCing my other email addresses.
> 
> Being annoying does not persuade me to fix things any faster. Quite the
> opposite in fact.
> 
> I have not applied your patch because I have a better solution, and because
> I've been on holiday. I'm not on holiday now, but I'm still going to wait
> because you're annoying.

okay. sorry.

[Bug c++/98641] Feature request: implement pointer alignment builtins

2021-01-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

--- Comment #2 from Jonathan Wakely  ---
We could make immediate use of these in libstdc++. We have std::align and
std::assume_aligned in include/bits/align.h, and aligned_ceil in
src/c++17/memory_resource.cc, and a couple of places in libsupc++/new_opa.cc
and maybe other places too.

[Bug debug/98656] [9/10/11 Regression] switchlower_O0 drops line number of switch

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98656

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |9.4
   Priority|P3  |P2
Summary|switchlower_O0 drops line   |[9/10/11 Regression]
   |number of switch|switchlower_O0 drops line
   ||number of switch

[Bug debug/98656] New: switchlower_O0 drops line number of switch

2021-01-13 Thread vries at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98656

Bug ID: 98656
   Summary: switchlower_O0 drops line number of switch
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Originally filed as gdb PR at
https://sourceware.org/bugzilla/show_bug.cgi?id=27179 ]

Consider test-case small.c.
...
$ cat -n small.c
 1  #include 
 2
 3  void foo (int x, int y)
 4  {
 5switch (x) {
 6  case 0: break;
 7  case 1: break;
 8  case 2: break;
 9  case 3:
10for (int z = 0; z < ({ if (y) break; 5; }); z++)
11break;
12  case 4: break;
13  default: break;
14}
15  }
16
17  int main ()
18  {
19foo (1, 1);  // L1
20foo (2, 1);  // L2
21printf("hello world!");  // L3
22return 0;
23  }
...

With gcc-8, we have a .loc with line number 5 representing the switch
statement:
...
$ gcc-8 -O0 -g small.c -save-temps
$ cat small.s
foo:
.LFB0:
.file 1 "small.c"
.loc 1 4 1
.cfi_startproc
pushq   %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq%rsp, %rbp
.cfi_def_cfa_register 6
movl%edi, -20(%rbp)
movl%esi, -24(%rbp)
.loc 1 5 3
cmpl$4, -20(%rbp)
ja  .L13
...

With gcc-9 that .loc disappeared:
...
foo:
.LFB0:
.file 1 "small.c"
.loc 1 4 1
.cfi_startproc
pushq   %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq%rsp, %rbp
.cfi_def_cfa_register 6
movl%edi, -20(%rbp)
movl%esi, -24(%rbp)
cmpl$4, -20(%rbp)
ja  .L13
...
and that's still the case with gcc-11.

Culprit is switchlower_O0.

With this compilation:
...
$ rm -f *.c.*; gcc-11 -O0 -g small.c -fdump-tree-all-lineno -save-temps
...
we have at a-small.c.234t.cplxlower0:
...
   :
  [small.c:5:3] switch (x_1(D)) <[small.c:13:2] default:  [INV],
[small.c:6:5] case 0:  [INV], [small.c:7:5] case 1:  [INV],
[small.c:8:5] case 2:  [INV], [small.c:9:5] case 3:  [INV],
[small.c:12:5] case 4:  [INV]>
...
and at a-small.c.236t.switchlower_O0:
...
   :
  switch (x_1(D)) <[small.c:13:2] default:  [0.00%], [small.c:6:5] case 0:
 [20.00%], [small.c:7:5] case 1:  [20.00%], [small.c:8:5] case 2: 
[20.00%], [small.c:9:5] case 3:  [20.00%], [small.c:12:5] case 4: 
[20.00%]>
...

Note the dropped "[small.c:5:3]" in front of "switch".

[Bug libstdc++/57585] New --enable-clocale model using POSIX 2008

2021-01-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57585

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-01-13

--- Comment #1 from Jonathan Wakely  ---
See the thread at
https://gcc.gnu.org/pipermail/libstdc++/2021-January/051843.html

[Bug libstdc++/98471] libstdc++ fails to build with clang on windows because of filesystem bug

2021-01-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98471

--- Comment #2 from Jonathan Wakely  ---
The bug is already assigned to me so I get emailed about all updates to the
bug, so stop CCing my other email addresses.

Being annoying does not persuade me to fix things any faster. Quite the
opposite in fact.

I have not applied your patch because I have a better solution, and because
I've been on holiday. I'm not on holiday now, but I'm still going to wait
because you're annoying.

[Bug tree-optimization/96938] Failure to optimize bit-setting pattern when not using temporary

2021-01-13 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96938

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #6 from Jakub Jelinek  ---
Fixed.

[Bug tree-optimization/96938] Failure to optimize bit-setting pattern when not using temporary

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96938

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

https://gcc.gnu.org/g:5d057bfeff70e5b8d00e521844c476f62d51e22c

commit r11-6631-g5d057bfeff70e5b8d00e521844c476f62d51e22c
Author: Jakub Jelinek 
Date:   Wed Jan 13 10:15:13 2021 +0100

i386: Add define_insn_and_split patterns for btrl [PR96938]

In the following testcase we only optimize f2 and f7 to btrl, although we
should optimize that way all of the functions.  The problem is the type
demotion/narrowing (which is performed solely during the generic folding
and
not later), without it we see the AND performed in SImode and match it as
btrl, but with it while the shifts are still performed in SImode, the
AND is already done in QImode or HImode low part of the shift.

2021-01-13  Jakub Jelinek  

PR target/96938
* config/i386/i386.md (*btr_1, *btr_2): New
define_insn_and_split patterns.
(splitter after *btr_2): New splitter.

* gcc.target/i386/pr96938.c: New test.

[Bug demangler/88783] integer overflow in libiberty, heap overflow will be triggered in nm

2021-01-13 Thread prajwapa at in dot ibm.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88783

--- Comment #8 from prajwapa at in dot ibm.com ---
(In reply to prajwapa from comment #7)
> Kindly let me know, if this bug is going to be fixed in binutils and in
> which version?

could someone please provide an update as this is urgent.

[Bug ipa/98652] unused code found in function analyze_functions:1194

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98652

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Liška  ---
Fixed.

[Bug ipa/98652] unused code found in function analyze_functions:1194

2021-01-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98652

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Martin Liska :

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

commit r11-6630-g6b70fa678b1a5ecf3ee87e2be87c3dc9dd08cc92
Author: Martin Liska 
Date:   Wed Jan 13 09:25:31 2021 +0100

ipa: remove a dead code

gcc/ChangeLog:

PR ipa/98652
* cgraphunit.c (analyze_functions): Remove dead code.

[Bug ipa/98652] unused code found in function analyze_functions:1194

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98652

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2021-01-13
 Status|UNCONFIRMED |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Martin Liška  ---
Confirmed, let me fix it.

[Bug tree-optimization/98655] ICE: verify_gimple failed (error: integral result type precision does not match field size of 'bit_field_ref')

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98655

--- Comment #1 from Richard Biener  ---
can't reproduce with a cross to ppc64le.

[Bug tree-optimization/98640] [10/11 Regression] GCC produces incorrect code with -O1 and higher since r10-2711-g3ed01d5408045d80

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98640

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
I will have a look.

[Bug c++/98611] [concepts][10/11 Regression] ICE in get_underlying_template, at cp/pt.c:6494 since r10-3735-gcb57504a55015891

2021-01-13 Thread bjornsundin02 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98611

--- Comment #6 from Björn Sundin  ---
(In reply to CVS Commits from comment #5)
> The master branch has been updated by Patrick Palka :
> 
> https://gcc.gnu.org/g:e0bec6ceac47752616dd9fe0801344ed45db2fd3
> 
> commit r11-6614-ge0bec6ceac47752616dd9fe0801344ed45db2fd3
> Author: Patrick Palka 
> Date:   Tue Jan 12 09:34:41 2021 -0500
> 
> c++: Fix ICE with CTAD in concept [PR98611]
> 
> This patch teaches cp_walk_subtrees to visit the template represented
> by a CTAD placeholder, which would otherwise be not visited during
> find_template_parameters.  The template may be a template template
> parameter (as in the first testcase), or it may implicitly use the
> template parameters of an enclosing class template (as in the second
> testcase), and in either case we need to visit this tree to record the
> template parameters used therein for later satisfaction.
> 
> gcc/cp/ChangeLog:
> 
> PR c++/98611
> * tree.c (cp_walk_subtrees) : Visit
> the template of a CTAD placeholder.
> 
> gcc/testsuite/ChangeLog:
> 
> PR c++/98611
> * g++.dg/cpp2a/concepts-ctad1.C: New test.
> * g++.dg/cpp2a/concepts-ctad2.C: New test.

Brilliant! Appreciate you :). IsInstantiationOf is a very useful generic
concept that I'd love to be able to use in my project, so I'm happy this was
fixed.

[Bug target/97348] [nvptx] Make -misa=sm_35 the default

2021-01-13 Thread tschwinge at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97348

Thomas Schwinge  changed:

   What|Removed |Added

 CC||tschwinge at gcc dot gnu.org

--- Comment #7 from Thomas Schwinge  ---
Documentation later updated in commit 91e4e16b550540723cca824b9674c7d8c43f4849
"nvptx - invoke.texi: Update default of -misa".

[Bug demangler/98650] Issue within gdb with debugging symbols of telegram-desktop under Debian 10 GNU/Linux amd64

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98650

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška  ---
Apparently, the current c++filt demangler work for me:

c++filt
_ZNSt11_Tuple_implILm0EJN3rpl8producerIN4base5flagsIN11MTPDchannel4FlagEEENS0_8no_errorEZNS0_7details10map_helperIZN4Data18FlagsValueWithMaskINSA_5FlagsIS6_Lj2147486693EE6ChangeES7_ZNS8_11then_helperISE_S7_ZNKS0_12event_streamISE_E6eventsEvEUlRKT_E_EclISE_S7_ZNS0_6singleISE_EEDaOSI_EUlSK_E_SE_S7_EEDaONS1_ISI_T0_T1_EEEUlSK_E_EEDaSU_NSI_4TypeEEUlRKSE_E0_EclISE_S7_ZNS8_13filter_helperIZNSB_ISE_S7_SV_EEDaSU_SW_EUlSY_E_EclISE_S7_SV_vEEDaSU_EUlSK_E_S6_EEDaSU_EUlSK_E_EENS1_IbS7_ZNS9_IZNSA_15SingleFlagValueINSC_INS3_IN19MTPDchatAdminRights4FlagEEELj4294967295EE6ChangeES7_ZNSF_IS1E_S7_ZNKSG_IS1E_E6eventsEvEUlSK_E_EclIS1E_S7_ZNSO_IS1E_EEDaSP_EUlSK_E_S1E_S7_EEDaSU_EUlSK_E_EEDaSU_NSI_4EnumEEUlS1C_E_EclIS1C_S7_ZNS9_IZNSB_IS1E_S7_S1K_EEDaSU_SW_EUlRKS1E_E0_EclIS1E_S7_ZNS12_IZNSB_IS1E_S7_S1K_EEDaSU_SW_EUlS1Q_E_EclIS1E_S7_S1K_vEEDaSU_EUlSK_E_S1C_EEDaSU_EUlSK_E_bEEDaSU_EUlSK_E_EENS1_IbS7_ZNS9_IZNS19_INSC_INS3_IN20MTPDchatBannedRights4FlagEEELj4294967295EE6ChangeES7_ZNSF_IS25_S7_ZNKSG_IS25_E6eventsEvEUlSK_E_EclIS25_S7_ZNSO_IS25_EEDaSP_EUlSK_E_S25_S7_EEDaSU_EUlSK_E_EEDaSU_S1L_EUlS23_E_EclIS23_S7_ZNS9_IZNSB_IS25_S7_S2B_EEDaSU_SW_EUlRKS25_E0_EclIS25_S7_ZNS12_IZNSB_IS25_S7_S2B_EEDaSU_SW_EUlS2G_E_EclIS25_S7_S2B_vEEDaSU_EUlSK_E_S23_EEDaSU_EUlSK_E_bEEDaSU_EUlSK_E_EES2Q_EED1Ev
_ZNSt11_Tuple_implILm0EJN3rpl8producerIN4base5flagsIN11MTPDchannel4FlagEEENS0_8no_errorEZNS0_7details10map_helperIZN4Data18FlagsValueWithMaskINSA_5FlagsIS6_Lj2147486693EE6ChangeES7_ZNS8_11then_helperISE_S7_ZNKS0_12event_streamISE_E6eventsEvEUlRKT_E_EclISE_S7_ZNS0_6singleISE_EEDaOSI_EUlSK_E_SE_S7_EEDaONS1_ISI_T0_T1_EEEUlSK_E_EEDaSU_NSI_4TypeEEUlRKSE_E0_EclISE_S7_ZNS8_13filter_helperIZNSB_ISE_S7_SV_EEDaSU_SW_EUlSY_E_EclISE_S7_SV_vEEDaSU_EUlSK_E_S6_EEDaSU_EUlSK_E_EENS1_IbS7_ZNS9_IZNSA_15SingleFlagValueINSC_INS3_IN19MTPDchatAdminRights4FlagEEELj4294967295EE6ChangeES7_ZNSF_IS1E_S7_ZNKSG_IS1E_E6eventsEvEUlSK_E_EclIS1E_S7_ZNSO_IS1E_EEDaSP_EUlSK_E_S1E_S7_EEDaSU_EUlSK_E_EEDaSU_NSI_4EnumEEUlS1C_E_EclIS1C_S7_ZNS9_IZNSB_IS1E_S7_S1K_EEDaSU_SW_EUlRKS1E_E0_EclIS1E_S7_ZNS12_IZNSB_IS1E_S7_S1K_EEDaSU_SW_EUlS1Q_E_EclIS1E_S7_S1K_vEEDaSU_EUlSK_E_S1C_EEDaSU_EUlSK_E_bEEDaSU_EUlSK_E_EENS1_IbS7_ZNS9_IZNS19_INSC_INS3_IN20MTPDchatBannedRights4FlagEEELj4294967295EE6ChangeES7_ZNSF_IS25_S7_ZNKSG_IS25_E6eventsEvEUlSK_E_EclIS25_S7_ZNSO_IS25_EEDaSP_EUlSK_E_S25_S7_EEDaSU_EUlSK_E_EEDaSU_S1L_EUlS23_E_EclIS23_S7_ZNS9_IZNSB_IS25_S7_S2B_EEDaSU_SW_EUlRKS25_E0_EclIS25_S7_ZNS12_IZNSB_IS25_S7_S2B_EEDaSU_SW_EUlS2G_E_EclIS25_S7_S2B_vEEDaSU_EUlSK_E_S23_EEDaSU_EUlSK_E_bEEDaSU_EUlSK_E_EES2Q_EED1Ev

But apparently, it does not demangle to a meaningful symbol name.

[Bug c++/98646] [11 Regression] A static_cast confuses -Wnonnull, causing false positives

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98646

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |11.0

[Bug testsuite/98643] [11 regression] r11-6615 causes failure in gcc.target/powerpc/fold-vec-extract- char.p7.c

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98643

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |11.0

[Bug c++/98641] Feature request: implement pointer alignment builtins

2021-01-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Richard Biener  changed:

   What|Removed |Added

   Severity|normal  |enhancement
Version|unknown |11.0

[Bug middle-end/98649] Trivial jump table not eliminated

2021-01-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98649

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
Yes, that's the case. Switch lowering pass sees:

   [local count: 1073741809]:
  _1 = v_14(D)->index_;
  switch (_1)  [0.00%], case 0:  [20.00%], case 1: 
[20.00%], case 2:  [20.00%], case 3:  [20.00%], case 4: 
[20.00%]>

   [local count: 214748365]:
:
  _15 = &v_14(D)->D.2444.t0_;
  _2 = MEM[(struct T0 *)v_14(D) + 8B].D.2369._vptr.Base;
  _3 = *_2;
  OBJ_TYPE_REF(_3;(struct T0)_15->0) (_15, f_16(D));
  goto ; [100.00%]

   [local count: 214748365]:
:
  _18 = &v_14(D)->D.2444.t1_;
  _4 = MEM[(struct T1 *)v_14(D) + 8B].D.2383._vptr.Base;
  _5 = *_4;
  OBJ_TYPE_REF(_5;(struct T1)_18->0) (_18, f_16(D));
  goto ; [100.00%]

...

<    1   2